The collision check in positionPopup was reading the popup's measured
rect right after mount, but the popup grows after that runs (the
genre tree fills in asynchronously). The first measurement reported a
height much smaller than the final ~500px / ~700px max-heights from
CSS, so the "would I overflow the bottom?" branch evaluated false even
when the final popup didn't fit. Result: bottom of the popup got clipped
by the window edge (visible in the Discover -> Filter by genre flow on
short windows).
Use the CSS max-heights (530/630 already used for width) as the
collision target instead. If the down-placement still overflows, try
flipping above the trigger; if neither fits (very small window), clamp
to the bottom padding and let the popup's own internal scroll handle
the overflow.
cc