CSS Scroll-State Queries Make Sticky-Header JavaScript Optional
Sticky headers that react to the scroll used to mean a scroll listener or IntersectionObserver plus a class toggle. Scroll-state container queries, now live in Chrome, Edge, Samsung Internet, and Opera, let the stylesheet answer the question itself.