In addition to the new iMac with the 10-core M4 chip being the first-ever Mac with support for up to an 8K external display ...
Meanwhile, the M4 Max MacBook Pro can simultaneously support the built-in display and: Up to four external displays: Up to three external displays with 6K resolution at 60Hz over Thunderbolt and one ...
Closing the lid, or running the MacBook Air in clamshell ... For that, you're probably going to need to look at an M3 Pro MacBook Pro if you want to keep that second external display.