/* =============================================================
   Section: Site Header / Nav
   Maps to: template-parts/header.php  (and a small slice of
   functions.php for nav menu registration)
   ============================================================= */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-nav);
  color: var(--bone);
  border-bottom: 1px solid transparent;
  /* Padding interpolates from 26px → 16px as --scroll-ratio goes 0 → 1 */
  padding-block: calc(26px - var(--scroll-ratio, 0) * 10px);
  /* LOGO_OVERFLOW_MODE = "overlap" — must be visible so the enlarged logo
     can hang below the header bar without being clipped.
     Change to overflow: hidden when switching to CONTAIN mode (see below). */
  overflow: visible;
}

/* Once fully scrolled, clip the logo so it no longer hangs below the bar.
   No background — header stays transparent at all scroll positions. */
.site-header.is-scrolled {
  overflow: hidden;
}

.site-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-6);
  max-width: none;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: currentColor;
}

/* ─── LOGO SIZE & OVERFLOW MODE ──────────────────────────────────────
 *
 *  LOGO_OVERFLOW_MODE = "overlap"
 *
 *  overlap  (current) — Logo is 2× its original width. The header height
 *             stays constant; the logo's lower portion hangs below the nav
 *             bar and floats over the section beneath it.  Works best when
 *             a full-bleed hero image sits directly below the header.
 *             Hang depth is set by translateY() — increase the % to hang
 *             deeper, decrease to hang shallower (0% = no hang / flush).
 *             Also requires  overflow: visible  on .site-header (above).
 *
 *  contain  (alternative) — Logo is 2× size AND the header grows to fully
 *             enclose it.  To switch to contain mode:
 *               1. Change .site-header  overflow: visible → overflow: hidden
 *               2. Remove the  transform: translateY()  lines below
 *               3. Update --header-h and --header-h-scrolled in tokens.css
 *                  to match the new taller header height
 *
 * ──────────────────────────────────────────────────────────────────── */
.site-header__logo {
  width: calc(var(--logo-width, 156px) * 2); /* 2× normal size */
  height: auto;
  /* Logo is black on transparent — invert to white for the dark header */
  filter: invert(1);
  /* Scale from the left edge so the logo stays left-aligned as it shrinks.
     Both translateY (hang depth) and scale interpolate continuously from
     --scroll-ratio 0 (top of page) → 1 (fully scrolled).
     No CSS transition — the scroll position IS the animation. */
  transform-origin: left center;
  transform:
    translateY(calc((1 - var(--scroll-ratio, 0)) * 30%))
    scale(calc(1 - var(--scroll-ratio, 0) * 0.5));
  margin-top:    calc((1 - var(--scroll-ratio, 0)) * 10px);
  margin-bottom: calc((1 - var(--scroll-ratio, 0)) * 10px);
}

.site-header__brand-meta {
  display: none;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 0.58rem + 0.18vw, 0.88rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-dark);
  border-left: 1px solid var(--rule-dark);
  padding-left: 14px;
  line-height: 1.35;
}
@media (min-width: 980px) {
  .site-header__brand-meta { display: inline-block; }
}

.primary-nav {
  display: none;
}

@media (min-width: 900px) {
  .primary-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-6);
  }
  .primary-nav li {
    display: inline-flex;
    align-items: center;
    list-style: none;
  }
}
@media (min-width: 1200px) {
  .primary-nav { gap: var(--s-7); }
}

/* ── HIDE_NAV_WHEN_SCROLLED ──────────────────────────────────────────
 *  enabled (current) — Primary nav text fades + slides up out of the
 *         header continuously in sync with the logo shrink, driven by
 *         the --scroll-ratio custom property that nav.js updates on
 *         every scroll. At ratio 0 (top of page) the nav is fully
 *         visible; at ratio 1 (past SCROLL_RANGE) it is fully hidden.
 *         Returning to the top reverses the animation. Logo, social
 *         icons, and hamburger remain visible the entire time.
 *  disabled (original) — Nav text stays visible at all times.
 *         To revert: delete this rule block (no JS change needed —
 *         --scroll-ratio is also used for the logo shrink).
 * ──────────────────────────────────────────────────────────────────── */
.primary-nav {
  opacity:   calc(1 - var(--scroll-ratio, 0));
  transform: translateY(calc(var(--scroll-ratio, 0) * -100%));
}
.site-header.is-scrolled .primary-nav {
  pointer-events: none;
}

.primary-nav a {
  font-family: var(--font-mono);
  font-size: clamp(0.92rem, 0.75rem + 0.25vw, 1.15rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  position: relative;
  padding-block: 12px;
  transition: color var(--dur-fast) var(--ease-out);
}
/* Bold lines on top + bottom that split apart on hover:
   top slides right, bottom slides left. */
.primary-nav a::before,
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--safety);
  transform: scaleX(0) translateX(0);
  transform-origin: center center;
  transition:
    transform var(--dur-base) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
  opacity: 0;
  pointer-events: none;
}
.primary-nav a::before { top: 0; }
.primary-nav a::after  { bottom: 0; }

.primary-nav a:hover { color: var(--safety); }
.primary-nav a:hover::before {
  opacity: 1;
  transform: scaleX(1) translateX(6px);
}
.primary-nav a:hover::after {
  opacity: 1;
  transform: scaleX(1) translateX(-6px);
}

.site-header__cta {
  display: none;
}
@media (min-width: 720px) {
  .site-header__cta {
    display: inline-flex;
    padding: 12px 22px;
    border: 1px solid var(--bone);
    color: var(--bone);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.84rem, 0.7rem + 0.2vw, 1.05rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  }
  .site-header__cta:hover { background: var(--safety); color: var(--ink); border-color: var(--safety); }
}

/* Social icons in header.
   .site-header__actions is the outer cluster (icons + mobile burger).
   .site-header__socials wraps just the icons so the Customizer's
   selective-refresh partial can swap them in place; it must also be
   flex so the icons keep their gap + vertical centering. */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-header__socials {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}
.site-header__social {
  display: none;
  color: var(--bone);
  font-size: 1.8rem;
  opacity: 0.75;
  transition: opacity var(--dur-fast) var(--ease-out);
  line-height: 1;
}
.site-header__social:hover { opacity: 1; }
@media (min-width: 720px) {
  .site-header__social { display: inline-flex; align-items: center; }
}

/* Mobile burger — sized to a 44px touch target (Apple/Google guideline) */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-dark);
  margin-left: var(--s-4);
}
@media (min-width: 900px) {
  .nav-toggle { display: none; }
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.75px;
  background: var(--bone);
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}

/* ---------- Mobile drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  background: var(--ink);
  color: var(--bone);
  z-index: var(--z-drawer);
  padding: 100px var(--gutter) var(--gutter);
  transform: translateY(-100%);
  transition: transform var(--dur-slow) var(--ease-out);
  overflow-y: auto;
}
.drawer.is-open { transform: translateY(0); }

.drawer__close {
  position: absolute;
  top: 22px; right: var(--gutter);
  width: 44px; height: 44px;
  border: 1px solid var(--rule-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  line-height: 1;
}

.drawer__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-top: var(--s-7);
}

.drawer__list a {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 4rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--bone);
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
}
.drawer__list a span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--safety);
  text-transform: uppercase;
}
.drawer__list a:hover { color: var(--safety); }

.drawer__foot {
  margin-top: var(--s-9);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule-dark);
  display: grid;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dark);
}

body.drawer-open { overflow: hidden; }
