On a foldable, opening the screen does not reload the page: the viewport goes from 466 to 890 px live. The site receives a resize event and has to switch layouts without losing what the visitor was doing: their position in the page, a half-filled form, a video playing.
Layouts that compute their dimensions only once on load, in JavaScript, stay stuck at the folded width. Prefer media queries or container queries, and check that carousels and grids recompute their columns when the device opens.
Unfolded, the screen is almost square: 890 by 626 px. Full-screen visuals designed for a very tall portrait get heavily cropped, and fixed headers take up a larger share of the visible height.
To detect a touchscreen without relying on the User-Agent, query its capabilities: the (pointer: coarse) media query or navigator.maxTouchPoints. That is what keeps touch targets large enough on the unfolded screen, which its User-Agent passes off as a Mac.