/* =============================================================
   NAV — Phase 3 (.site-header)
   Sticky, always-dark header (a brand bookend in both themes) with a
   flat five-item nav, theme toggle, enrol CTA, and an accessible
   mobile menu. Text/accent tokens come from the dark-zone scope in
   components.css (.site-header → white text).
   ============================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(3, 13, 26, 0.85);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(147, 197, 253, 0.10);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled {
  background: rgba(3, 13, 26, 0.97);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  max-width: 1280px;
  min-height: 72px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* Logo */
.nav__logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.nav__logo-img { height: 40px; width: auto; display: block; object-fit: contain; }

/* Primary links */
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;   /* push links + actions to the right */
  list-style: none;
}
.nav__links a {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: rgba(255, 255, 255, 0.78);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav__links a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav__links a[aria-current="page"] { color: var(--color-sky); }

/* Actions cluster */
.nav__actions { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.nav__login {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav__login:hover { color: #fff; }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.35); }
.theme-toggle .theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-toggle__sun  { display: block; }

/* Burger (mobile only) */
.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  flex-shrink: 0;
}
.nav__burger:hover { background: rgba(255, 255, 255, 0.08); }
.nav__burger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav__burger[aria-expanded="true"] .nav__burger-bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] .nav__burger-bar:nth-child(3) { opacity: 0; }
.nav__burger[aria-expanded="true"] .nav__burger-bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu panel */
.nav__mobile-menu {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  background: rgba(3, 13, 26, 0.98);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(147, 197, 253, 0.12);
  padding: var(--space-6);
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 99;
}
.nav__mobile-menu.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.nav__mobile-links { list-style: none; display: flex; flex-direction: column; gap: var(--space-1); }
.nav__mobile-links a {
  display: block;
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
}
.nav__mobile-links a:hover,
.nav__mobile-links a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.07); }
.nav__mobile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.nav__mobile-actions .btn { justify-content: center; }

/* Focus states (WCAG) */
.nav__links a:focus-visible,
.nav__login:focus-visible,
.theme-toggle:focus-visible,
.nav__burger:focus-visible,
.nav__mobile-links a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Mobile breakpoint ── */
@media (max-width: 900px) {
  .nav__links { display: none; }
  /* Scoped to the desktop cluster. .nav__login is used in the mobile menu
     too, so hiding it unscoped took the Log In link out of the burger
     menu as well — leaving no way to sign in on a phone. .nav__enroll
     and .nav__account appear only in the header, so they need no scope. */
  .nav__actions .nav__login { display: none; }
  .nav__enroll, .nav__account { display: none; }
  .nav__burger { display: flex; }
  .nav__actions { margin-left: auto; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .nav__mobile-menu,
  .nav__burger-bar { transition: none; }
}
