/* =====================================================================
   AYIF – shared site header
   Used by every page. Self-contained: it does not depend on the page's
   own :root variables, so it looks identical everywhere.
   Mobile menu breakpoint: 1120px (kept in sync with js/header.js)
   ===================================================================== */

.site-header{
  --hd-h:76px;
  --hd-bg:#0d211a;
  --hd-panel:#12291f;
  --hd-gold:#d4a24c;
  --hd-gold-light:#e8c580;
  --hd-cream:#fbf6ec;
  --hd-text:rgba(251,246,236,.82);
  --hd-line:rgba(212,162,76,.18);
  --hd-ease:cubic-bezier(.22,.8,.3,1);

  position:sticky; top:0; z-index:100;
  border-bottom:1px solid var(--hd-line);
  font-family:'Work Sans','Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  transition:box-shadow .3s ease, border-color .3s ease;
}
.site-header.scrolled{
  box-shadow:0 10px 30px rgba(0,0,0,.28);
  border-bottom-color:rgba(212,162,76,.3);
}
/* frosted background lives on a pseudo-element: backdrop-filter on the header itself
   would make the fixed mobile menu size itself to the header instead of the screen */
.site-header::before{
  content:''; position:absolute; inset:0; z-index:-1;
  background:rgba(13,33,26,.94);
  -webkit-backdrop-filter:saturate(140%) blur(12px);
  backdrop-filter:saturate(140%) blur(12px);
}
html{scroll-padding-top:84px;}
html.nav-open{overflow:hidden;}

.site-header a{text-decoration:none;}
.site-header ul{list-style:none; margin:0; padding:0;}
.site-header :focus-visible{outline:2px solid var(--hd-gold); outline-offset:3px; border-radius:6px;}

/* ---------- layout ---------- */
.nav-inner{
  max-width:1240px; margin:0 auto; padding:0 32px;
  height:var(--hd-h);
  display:flex; align-items:center; justify-content:space-between; gap:24px;
}

/* ---------- brand ---------- */
.brand{display:flex; align-items:center; gap:14px; color:var(--hd-cream); min-width:0;}
.brand-mark{
  flex-shrink:0; height:56px; border-radius:10px; overflow:hidden;
  box-shadow:0 0 0 1px rgba(212,162,76,.35);
}
.brand-mark img{display:block; height:100%; width:auto;}
.brand-word{
  font-family:'Fraunces',Georgia,serif; font-weight:700;
  font-size:1.05rem; line-height:1.2; letter-spacing:.01em;
}
.brand-word span{
  display:block; margin-top:3px;
  font-family:'Space Mono',ui-monospace,monospace; font-weight:400;
  font-size:.62rem; letter-spacing:.12em; text-transform:uppercase;
  color:var(--hd-gold-light);
}

/* ---------- primary navigation (desktop) ---------- */
.nav-list{display:flex; align-items:center; gap:6px;}
.nav-list > li{position:relative;}

.nav-list > li > a,
.dropdown-toggle{
  position:relative; display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px; border:0; border-radius:8px; background:none; cursor:pointer;
  font:inherit; font-size:.98rem; font-weight:500; line-height:1.2;
  color:var(--hd-text);
  transition:color .25s ease, background-color .25s ease;
}
.nav-list > li > a:hover,
.dropdown-toggle:hover,
.has-dropdown.open > .dropdown-toggle{color:var(--hd-cream); background:rgba(251,246,236,.06);}

/* underline marker – grows on hover, stays on the active page */
.nav-list > li > a:not(.give-btn)::after,
.dropdown-toggle::after{
  content:''; position:absolute; left:14px; right:14px; bottom:3px; height:2px;
  background:var(--hd-gold); border-radius:2px;
  transform:scaleX(0); transform-origin:left center;
  transition:transform .35s var(--hd-ease);
}
.nav-list > li > a:not(.give-btn):hover::after,
.dropdown-toggle:hover::after,
.has-dropdown.open > .dropdown-toggle::after,
.nav-list > li > a[aria-current]::after,
.dropdown-toggle[aria-current]::after{transform:scaleX(1);}

.nav-list > li > a[aria-current],
.dropdown-toggle[aria-current]{color:var(--hd-gold-light);}

.caret{font-size:.68rem; transition:transform .3s var(--hd-ease);}
.has-dropdown.open .caret{transform:rotate(180deg);}

/* Donate call-to-action */
.nav-list > li > .give-btn{
  margin-left:10px; padding:11px 26px; border-radius:8px;
  background:var(--hd-gold); color:var(--hd-bg);
  font-size:.95rem; font-weight:700; letter-spacing:.02em;
  box-shadow:0 6px 16px rgba(212,162,76,.25);
  transition:background-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.nav-list > li > .give-btn:hover{
  background:var(--hd-gold-light); color:var(--hd-bg);
  transform:translateY(-2px); box-shadow:0 10px 22px rgba(212,162,76,.35);
}
.nav-list > li > .give-btn[aria-current]{
  color:var(--hd-bg); background:var(--hd-gold-light);
  box-shadow:0 0 0 2px var(--hd-bg), 0 0 0 4px var(--hd-gold);
}

/* ---------- dropdown (desktop) ---------- */
.dropdown{
  position:absolute; top:100%; left:50%; z-index:110;
  min-width:250px; padding-top:14px;
  opacity:0; visibility:hidden; transform:translate(-50%,8px);
  transition:opacity .25s ease, transform .3s var(--hd-ease), visibility 0s linear .3s;
}
.has-dropdown.open > .dropdown{
  opacity:1; visibility:visible; transform:translate(-50%,0);
  transition-delay:0s;
}
.dropdown-menu{
  position:relative; padding:8px;
  background:var(--hd-panel);
  border:1px solid rgba(212,162,76,.28); border-radius:14px;
  box-shadow:0 22px 48px rgba(0,0,0,.45);
}
.dropdown-menu::before{ /* little pointer notch */
  content:''; position:absolute; top:-6px; left:50%; width:11px; height:11px;
  margin-left:-5px; transform:rotate(45deg);
  background:var(--hd-panel);
  border-top:1px solid rgba(212,162,76,.28); border-left:1px solid rgba(212,162,76,.28);
}
.dropdown-menu a{
  position:relative; display:flex; align-items:center; gap:12px;
  padding:11px 14px; border-radius:10px;
  font-size:.95rem; font-weight:500; white-space:nowrap;
  color:var(--hd-text);
  transition:background-color .2s ease, color .2s ease, transform .25s var(--hd-ease);
}
.dropdown-menu a i{
  flex-shrink:0; width:34px; height:34px; border-radius:9px;
  display:grid; place-items:center; font-size:.9rem;
  background:rgba(212,162,76,.12); color:var(--hd-gold);
  transition:background-color .2s ease, color .2s ease;
}
.dropdown-menu a:hover,
.dropdown-menu a:focus-visible{background:rgba(212,162,76,.12); color:var(--hd-cream); transform:translateX(3px);}
.dropdown-menu a:hover i,
.dropdown-menu a:focus-visible i{background:var(--hd-gold); color:var(--hd-bg);}
.dropdown-menu a[aria-current]{background:rgba(212,162,76,.16); color:var(--hd-gold-light);}
.dropdown-menu a[aria-current]::after{
  content:''; position:absolute; left:0; top:20%; bottom:20%; width:3px;
  border-radius:3px; background:var(--hd-gold);
}

/* ---------- hamburger ---------- */
.menu-toggle{
  display:none; position:relative; flex-shrink:0;
  width:44px; height:44px; padding:0; border:0; border-radius:10px;
  background:rgba(251,246,236,.06); cursor:pointer;
  transition:background-color .25s ease;
}
.menu-toggle:hover{background:rgba(251,246,236,.12);}
.menu-toggle .bar{
  position:absolute; left:12px; width:20px; height:2px; border-radius:2px;
  background:var(--hd-cream);
  transition:transform .35s var(--hd-ease), opacity .2s ease, top .35s var(--hd-ease);
}
.menu-toggle .bar:nth-child(1){top:14px;}
.menu-toggle .bar:nth-child(2){top:21px;}
.menu-toggle .bar:nth-child(3){top:28px;}
.menu-toggle.active .bar:nth-child(1){top:21px; transform:rotate(45deg);}
.menu-toggle.active .bar:nth-child(2){opacity:0; transform:scaleX(.3);}
.menu-toggle.active .bar:nth-child(3){top:21px; transform:rotate(-45deg);}

/* ---------- slightly tighter desktop (small laptops) ---------- */
@media (max-width:1280px) and (min-width:1121px){
  .nav-inner{padding:0 24px; gap:16px;}
  .nav-list{gap:2px;}
  .nav-list > li > a,
  .dropdown-toggle{padding:10px 11px; font-size:.94rem;}
  .nav-list > li > .give-btn{margin-left:6px; padding:10px 20px;}
}

/* ---------- tablet & mobile: slide-down panel ---------- */
@media (max-width:1120px){
  .menu-toggle{display:block;}

  .primary{
    position:fixed; top:var(--hd-h); right:0; bottom:0; left:0;
    padding:8px 24px calc(32px + env(safe-area-inset-bottom));
    background:var(--hd-bg);
    overflow-y:auto; overscroll-behavior:contain;
    opacity:0; visibility:hidden; transform:translateY(-12px);
    transition:opacity .3s ease, transform .35s var(--hd-ease), visibility 0s linear .35s;
  }
  .primary.open{
    opacity:1; visibility:visible; transform:none;
    transition-delay:0s;
  }

  .nav-list{flex-direction:column; align-items:stretch; gap:0; max-width:640px; margin:0 auto;}
  .nav-list > li{
    border-bottom:1px solid rgba(251,246,236,.08);
    opacity:0; transform:translateY(10px);
    transition:opacity .35s ease, transform .4s var(--hd-ease);
  }
  .primary.open .nav-list > li{opacity:1; transform:none;}
  .primary.open .nav-list > li:nth-child(1){transition-delay:.04s;}
  .primary.open .nav-list > li:nth-child(2){transition-delay:.08s;}
  .primary.open .nav-list > li:nth-child(3){transition-delay:.12s;}
  .primary.open .nav-list > li:nth-child(4){transition-delay:.16s;}
  .primary.open .nav-list > li:nth-child(5){transition-delay:.2s;}
  .primary.open .nav-list > li:nth-child(6){transition-delay:.24s;}

  .nav-list > li > a,
  .dropdown-toggle{
    display:flex; width:100%; justify-content:space-between;
    padding:18px 6px; border-radius:0; font-size:1.1rem; background:none;
  }
  .nav-list > li > a:hover,
  .dropdown-toggle:hover,
  .has-dropdown.open > .dropdown-toggle{background:none;}

  /* active page: gold bar on the left instead of the underline */
  .nav-list > li > a:not(.give-btn)::after,
  .dropdown-toggle::after{display:none;}
  .nav-list > li > a[aria-current],
  .dropdown-toggle[aria-current]{box-shadow:inset 3px 0 0 var(--hd-gold); padding-left:16px;}

  .nav-list > li:last-child{border-bottom:0; margin-top:22px;}
  .nav-list > li > .give-btn{
    justify-content:center; margin:0; padding:16px 24px; border-radius:10px; font-size:1.05rem;
  }

  /* dropdown becomes a smooth accordion */
  .dropdown{
    position:static; min-width:0; padding:0; transform:none;
    opacity:1; visibility:visible;
    display:grid; grid-template-rows:0fr;
    transition:grid-template-rows .4s var(--hd-ease);
  }
  .has-dropdown.open > .dropdown{
    transform:none; grid-template-rows:1fr;
  }
  .dropdown-menu{
    min-height:0; overflow:hidden; padding:0 0 0 12px;
    background:none; border:0; border-radius:0; box-shadow:none;
    visibility:hidden; transition:visibility 0s linear .4s;
  }
  .has-dropdown.open .dropdown-menu{visibility:visible; padding-bottom:14px; transition-delay:0s;}
  .dropdown-menu::before{display:none;}
  .dropdown-menu a{padding:12px 10px; font-size:1.02rem;}
  .dropdown-menu a:hover,
  .dropdown-menu a:focus-visible{transform:none;}
}

@media (max-width:560px){
  .site-header{--hd-h:68px;}
  .nav-inner{padding:0 16px; gap:12px;}
  .brand{gap:10px;}
  .brand-mark{height:46px; border-radius:8px;}
  .brand-word{font-size:clamp(.8rem,3.9vw,.95rem);}
  .brand-word span{font-size:.54rem; letter-spacing:.08em;}
  .primary{padding-left:16px; padding-right:16px;}
}

@media (prefers-reduced-motion:reduce){
  .site-header *,
  .site-header{transition-duration:.001ms !important; transition-delay:0s !important;}
}
