/* ============================================================
   navigation.css — fixed nav, progress rail, mobile menu
   ============================================================ */

/* Fully transparent nav: the cinematic stage behind it runs edge to
   edge, so the header must not paint its own bar. Legibility over
   arbitrary video luminance comes from text halos + a short top
   scrim that fades out well before the content starts. */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
}

.site-nav::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 140px;
  background: linear-gradient(180deg, rgba(2, 5, 12, 0.62) 0%, rgba(2, 5, 12, 0.28) 45%, transparent 100%);
  pointer-events: none;
}

.site-nav.is-scrolled {
  background: transparent;
  border-bottom-color: transparent;
}

/* Keep the dropdown readable once it opens (class set by the nav
   controller; :has() avoided for older-engine support). */
.site-nav.menu-open {
  background: rgba(4, 7, 14, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.site-nav.menu-open::before { display: none; }

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin-right: auto;
}

/* Real brand logo. The PNG is already transparent and its colours
   (magenta #FE00F8, steel #88ACC5) are high-contrast on the dark
   stage, so it needs no backing plate — just generous size. */
.brand-logo {
  display: block;
  height: 42px;
  width: auto;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: inline-block;
  box-shadow: 0 0 18px rgba(94, 234, 212, 0.45);
}

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  position: relative;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 12px 10px;
  border-radius: 8px;
  text-shadow: 0 1px 8px rgba(2, 5, 12, 0.95), 0 0 2px rgba(2, 5, 12, 0.9);
  transition: color 0.2s ease;
}

/* Animated thin underline: grows from the centre for both hover and
   the current section. transform-only so it stays compositor-cheap. */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.nav-links a:hover,
.nav-links a:focus-visible { color: var(--ink); }

.nav-links a:hover::after,
.nav-links a.is-current::after { transform: scaleX(1); }

.nav-links a.is-current {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}

/* Reduced motion: no growth animation, line still indicates position. */
@media (prefers-reduced-motion: reduce) {
  .nav-links a::after { transition: none; }
}

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* Story progress rail */
.progress-rail {
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}
.progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* Mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: rgba(4, 7, 14, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.mobile-menu {
  display: grid;
  padding: 8px 16px 16px;
}

/* Critical: author display:grid overrides the UA [hidden] rule
   (display:none), which previously made the menu impossible to hide.
   The attribute must always win. */
.mobile-menu[hidden] {
  display: none;
}

/* The dropdown is a mobile-only pattern: never render it on desktop,
   even if it was left open before a resize/orientation change. */
@media (min-width: 901px) {
  .mobile-menu {
    display: none;
  }
}
.mobile-menu a {
  color: var(--ink);
  text-decoration: none;
  padding: 12px 8px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}
