/* Shared navigation behaviour: loaded last by the public and Admin shells.
   Sticky (not fixed) preserves the existing announcement, page flow and theme. */
html { scroll-padding-top: 92px; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  --sticky-header-height: 78px;
}
.reference-home .site-header { --sticky-header-height: 62px; }

/* The menu remains attached to the header when scrolling on phones/tablets.
   Its own scroll area keeps the last links reachable on short screens. */
@media (max-width: 870px) {
  .site-header .primary-nav,
  .reference-home .site-header .primary-nav {
    top: 100%;
    max-height: calc(100vh - var(--sticky-header-height));
    max-height: calc(100dvh - var(--sticky-header-height) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .site-header.menu-open { z-index: 90; }
}
@media (max-width: 650px) {
  .site-header { --sticky-header-height: 65px; }
}
@media (max-width: 610px) {
  .reference-home .site-header { --sticky-header-height: 60px; }
}

/* Authenticated dashboard pages use a separate topbar and fixed sidebar. */
.admin-topbar { position: sticky; top: 0; z-index: 35; }
