The trick is that the <details> is contained within a wrapper div with identical styling to the <summary> (ie. the 'button') and identical text contents, except the wrapper div is invisible and position:relative, with the <details> being position:absolute and anchored against the wrapper's top left corner.
This means that the wrapper essentially 'reserves' the space for the button, while the <details> element can freely expand without disrupting anything because its absolute positioning takes it out of the content flow
@lily Yeah it took me a good while to figure it out as well, probably a few hours - I made a lot of attempts at 'breaking out' the content element from the details element, which went nowhere, until I eventually realized that all I needed to do was reserve the right amount of space 🙃