/* ================================
   chanaway5000 — Nav (optimized)
   ================================ */

/* Vars */
:root {
  --ink: #022351;
  --rule: #eaeaea;
  --container: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 64px; /* mobile header becomes 56px below */
}

/* Header shell */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  isolation: isolate; /* for ::before glass layer */
  height: var(--header-h);
}

/* Content row */
.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  font-family: 'Barlow', system-ui, sans-serif;
  position: relative;
  z-index: 1; /* above glass */
}

/* Single unified glass layer */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(14px) saturate(120%) brightness(1.04);
  -webkit-backdrop-filter: blur(14px) saturate(120%) brightness(1.04);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 6px 16px rgba(0,0,0,0.04);
  transition: background .3s ease, backdrop-filter .3s ease;
}
body.scrolled .site-header::before {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px) saturate(140%) brightness(1.04);
  -webkit-backdrop-filter: blur(16px) saturate(140%) brightness(1.04);
}

/* Brand */
.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* Hamburger */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
}
.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
}
.nav-toggle__bar { position: relative; }
.nav-toggle__bar::before { position: absolute; top: -6px; }
.nav-toggle__bar::after  { position: absolute; top:  6px; }
.nav-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Mobile panel — hidden by default */
#primary-nav {
  display: none;               /* closed */
  position: fixed;             /* never clipped by parents */
  left: 0; right: 0; top: 56px;/* matches mobile header height */
  background: rgba(255,255,255,0.95);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
  border-top: 1px solid var(--rule);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  padding: 12px var(--gutter);
  z-index: 9999;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
}

/* Open states — either hook works */
body.nav-open #primary-nav,
.site-header.is-open #primary-nav {
  display: block;
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Menu list */
.primary-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.primary-nav__list a {
  display: block;
  padding: 12px 4px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .02em;
}

/* Remove default underline everywhere, control with bg-image on desktop */
.primary-nav__list a,
.primary-nav__list a:visited {
  text-decoration: none;
}
.primary-nav__list a:hover {
  text-decoration: none; /* prevent browser underline */
}

/* Active/current page */
.primary-nav__list a.active,
.primary-nav__list a[aria-current="page"] {
  font-weight: 700;
  background: rgba(255,255,255,0.10);
  border-radius: 8px;
}

/* Scroll lock when open */
.no-scroll { overflow: hidden; }

/* Desktop: inline menu, hide hamburger */
@media (min-width: 861px) {
  .site-header { height: var(--header-h); }

  #primary-nav {
    display: block !important;
    position: static; left: auto; right: auto; top: auto;
    border: 0; padding: 0; box-shadow: none;
    transform: none; opacity: 1; pointer-events: auto;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .primary-nav__list {
    flex-direction: row;
    align-items: center;
    gap: 22px;
  }

  .primary-nav__list a {
    padding: 8px 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;

    /* Animated underline (single rule, no duplicates) */
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: 0 100%;
    transition: background-size .2s ease, color .2s ease, text-shadow .2s ease;
    border-radius: 6px;
  }

  .primary-nav__list a:hover { background-size: 100% 2px; }
  .nav-toggle { display: none; }
}

/* Mobile height tweak */
@media (max-width: 860px) {
  .site-header { height: 56px; }
  .site-header::before { background: rgba(255,255,255,0.92); } /* firmer contrast */
  .primary-nav__list a { padding: 12px 4px; }
}

/* Motion & transparency accessibility */
@media (prefers-reduced-motion: reduce) {
  #primary-nav, .primary-nav__list a { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .site-header::before {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
  }
}

