Scroll down, then back up
The navbar hides itself once you leave the very top of the page, stays hidden while you scroll down, and slides back into view the moment you scroll up — a lightweight cue that navigation is always one scroll away.
It tracks direction, not position
A passive scroll listener compares the current scroll position against the last one it saw. Scrolling up shows the pill; scrolling down hides it again, no matter how far down the page you are.
Scroll back up to reveal the navbar
Keep scrolling up from here and watch the pill fade back in near the top of the viewport, exactly like the original.