/* Shared top-nav-bar component (2026-07-05). See topnav.js for the
   duplication history this converges. Canonical --tp-nav-bg/--tp-nav-border
   values below match the majority usage already found across pages (18/20
   existing definitions agreed on these exact values) — picking the
   already-dominant values means most pages' visual output doesn't change,
   only the definition moves to one place.

   Consuming pages are expected to already define --tp-text-primary /
   --tp-text-secondary / --tp-focus-ring (established per-page token
   convention, out of scope to centralize here) — this file only owns
   nav-specific tokens. */

:root {
  --tp-nav-bg: rgba(2, 4, 8, 0.95);
  --tp-nav-border: rgba(255, 255, 255, 0.06);
  /* B4 / WCAG 2.4.11 Focus Not Obscured: the nav is sticky at the top of the
     document scroll, so a Tab-to-focus (or an in-page anchor) can otherwise
     land the target underneath the 52px bar. Reserving scroll-padding on the
     root scroller keeps the focused element clear of it. Matches the nav
     height + notch inset, plus a small gap. */
  scroll-padding-top: calc(52px + env(safe-area-inset-top, 0px) + 8px);
}
[data-theme="light"] {
  --tp-nav-bg: rgba(235, 243, 240, 0.92);
  --tp-nav-border: rgba(14, 31, 38, 0.08);
}

.tp-nav {
  display: none;
  /* Sticky, not fixed — stays in flow so it reserves its own space and needs
     no content-offset. Requires its mount wrapper NOT to constrain it: a
     nav-height wrapper caps the sticky range to ~0 (the nav scrolls away on
     the first pixel). mountTopNav() sets the wrapper to display:contents so
     the sticky containing block becomes the tall page main column. */
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--tp-nav-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--tp-nav-border);
  height: 52px;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  /* Own compositing layer — Safari's backdrop-filter otherwise creates a
     new containing block for descendant position:fixed elements (the
     mobile drawer backdrop), shrinking them to this bar's own height. */
  transform: translateZ(0);
}
@media (max-width: 767px) {
  .tp-nav { display: flex; align-items: center; }
}

.tp-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tp-nav-left { display: flex; align-items: center; gap: 10px; }
.tp-nav-right { display: flex; align-items: center; gap: 2px; }
.tp-nav-otto { width: 24px; height: 24px; flex-shrink: 0; }

.tp-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--tp-text-primary);
  text-decoration: none;
  letter-spacing: -0.2px;
}

.tp-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--tp-text-secondary);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tp-hamburger:hover { color: var(--tp-text-primary); }
.tp-hamburger:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 2px;
  border-radius: 8px;
}
.tp-hamburger svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* --nav--back : back-link + bare hamburger, no logo/Otto */
.tp-nav--back .tp-nav-inner { justify-content: flex-start; gap: 4px; }
.tp-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--tp-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  min-height: 44px;
}
.tp-back:hover { color: var(--tp-text-primary); }
.tp-back svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --nav--minimal : bare logo + hamburger, no wrapper divs. The shared
   .tp-nav mobile-only display:flex rule above already applies; this
   variant just skips the .tp-nav-inner wrapper so its two children
   (hamburger, logo) are direct flex items. */
.tp-nav--minimal { gap: 10px; }
