/* ==========================================================================
   Numbers V2 — shared header (partial: site/partials/header.html)
   Needs /assets/v2.css (which imports /css/tokens.css) before this file.

   The nav is transparent at the top of a page and goes solid with a
   hairline once the page scrolls. Theme comes from JS:
     .site-nav.is-dark   on a black hero
     .site-menu.is-dark  the phone panel follows
   ========================================================================== */

.site-nav {
  --nav-h: 76px;
  --nav-fg: var(--ink);
  --nav-link: var(--ink);          /* Paper 8Z1-1: resting links #0A0C0F */
  --nav-mark: var(--ink);          /* active underline */
  --nav-dot: var(--up);            /* active Work dot, Paper 8N5-1 #12A150 */
  --nav-line: var(--hairline);
  --nav-bg: color-mix(in srgb, var(--white) 94%, transparent);
  --nav-cta-line: var(--button-line);
  --nav-cta-bg: var(--white);
  --nav-toggle-bg: var(--white);

  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: transparent;
  border-bottom: 0;
  color: var(--nav-fg);
  transition: background-color .2s var(--ease-soft), box-shadow .2s var(--ease-soft);
}

/* the design's light nav carries its hairline at rest (Flagship 8Z1-1, Our Story
   8XC-1 / CHH-1); the black one does not, and neither does the Work section
   (Work 8N5-1 / EFE-1 and the case studies), where header.js sets
   data-nav-section="work". The border is always 1 px (transparent when off),
   so the bar never shifts when it turns on at scroll. */
.site-nav:not(.is-dark) { border-bottom: 1px solid var(--hairline); }
.site-nav[data-nav-section="work"]:not(.is-scrolled):not(.is-menu-open) { border-bottom-color: transparent; }

.site-nav.is-dark {
  --nav-fg: var(--white);
  --nav-link: var(--button-line);  /* Paper F4Y-1 / 27A-0: resting links #CDD1D7 */
  --nav-mark: var(--white);
  --nav-dot: var(--electric);
  --focus-ring: var(--electric);
  --nav-line: var(--line);
  --nav-bg: color-mix(in srgb, var(--black) 96%, transparent); /* 90% read grey over white sections */
  --nav-cta-line: var(--btn-line-on-black);
  --nav-cta-bg: transparent;
  --nav-toggle-bg: transparent;
  border-bottom-color: transparent;
}

.site-nav.is-scrolled,
.site-nav.is-menu-open {
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
}

.site-nav.is-scrolled:not(.is-dark) { border-bottom-color: var(--hairline); }

.site-nav.is-dark.is-scrolled,
.site-nav.is-dark.is-menu-open { box-shadow: inset 0 -1px 0 var(--nav-line); }

.site-nav__inner {
  height: 100%;
  max-width: var(--v2-max, 1440px);
  margin-inline: auto;
  padding-inline: var(--v2-gutter, 96px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ---------- logo: four bars + the wordmark ---------- */
.site-nav__brand {
  display: flex;
  align-items: center;
  gap: 6.6px;
  flex: 1 0 0;            /* equal sides keep the links centred (Paper 8Z2-1 / 8ZR-1) */
  color: var(--nav-fg);   /* min-width stays auto: the logo never shrinks under the links */
}
.site-nav__mark { flex: none; width: 31px; height: 28px; }
.site-nav__word {
  font-family: var(--font-ui);
  font-size: 38.5px;
  line-height: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--nav-fg);
  white-space: nowrap;
}

/* ---------- desktop links ---------- */
.site-nav__links {
  display: flex;
  align-items: center;
  gap: 30px;
  flex: none;
  padding-top: 6px; /* keeps the text on the 76 px optical centre, underlined links included */
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--nav-link);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  transition: color .18s var(--ease-soft);
}
.site-nav__link::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background-color .18s var(--ease-soft);
}
.site-nav__link:hover { color: var(--nav-fg); }
.site-nav__link:hover::after { background: color-mix(in srgb, currentColor 32%, transparent); }
.site-nav__link.is-active { color: var(--nav-fg); font-weight: 600; }
.site-nav__link.is-active::after { background: var(--nav-mark); }

/* Work marks the page with a 4 px dot instead of the underline (Paper 8N5-1,
   8WQ-1, 8KH-1, 8NS-1: 4 x 4, radius 2, #12A150, 4 px under the label) */
.site-nav__link--dot::after { width: 4px; height: 4px; border-radius: 2px; margin-bottom: -2px; /* label stays on the shared 28 px line */ }
.site-nav__link--dot:hover::after { background: transparent; }
.site-nav__link--dot.is-active::after { background: var(--nav-dot); }

.site-nav__divider {
  width: 1px;
  height: 16px;
  flex: none;
  background: var(--nav-line);
  margin-bottom: 6px;
}

/* ---------- right: CTA + phone toggle ---------- */
.site-nav__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 0 0;
}

.site-nav__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--nav-cta-line);
  border-radius: 18px;
  background: var(--nav-cta-bg);
  color: var(--nav-fg);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .18s var(--ease-soft), border-color .18s var(--ease-soft);
}
.site-nav__cta:hover { border-color: var(--nav-fg); background: color-mix(in srgb, var(--nav-fg) 8%, transparent); }

.site-nav__toggle {
  display: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px 0 14px;
  border: 1px solid var(--nav-cta-line);
  border-radius: 18px;
  background: var(--nav-toggle-bg);
  color: var(--nav-fg);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.site-nav__toggle:hover { border-color: var(--nav-fg); }
.site-nav__cta:focus-visible,
.site-nav__toggle:focus-visible { outline-offset: 2px; border-radius: 18px; }

.site-nav__icon { width: 16px; height: 16px; flex: none; }
.site-nav__icon--close,
.site-nav__label-close { display: none; }
.site-nav__toggle[aria-expanded="true"] .site-nav__icon--menu,
.site-nav__toggle[aria-expanded="true"] .site-nav__label-open { display: none; }
.site-nav__toggle[aria-expanded="true"] .site-nav__icon--close { display: block; }
.site-nav__toggle[aria-expanded="true"] .site-nav__label-close { display: inline; }

/* ---------- phone menu panel ---------- */
.site-menu {
  position: fixed;
  inset: var(--nav-h, 76px) 0 0 0;
  z-index: 99;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--white);
  color: var(--ink);
  animation: site-menu-in .22s var(--ease-soft) both;
}
.site-menu[hidden] { display: none; }
.site-menu.is-dark { background: var(--black); color: var(--white); }

.site-menu__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 8px var(--v2-gutter, 20px) 40px;
}

.site-menu__links { display: flex; flex-direction: column; }

.site-menu__link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px 0 22px;
  border-top: 1px solid var(--hairline);
  color: inherit;
}
.site-menu__link:first-child { border-top: 0; } /* the open nav already draws the line above */
.site-menu__link:last-child { border-bottom: 1px solid var(--hairline); }
.site-menu.is-dark .site-menu__link { border-color: var(--line); }
.site-menu__index {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: .08em;
  color: var(--mute);
  flex: none;
}
.site-menu.is-dark .site-menu__index { color: var(--label-on-black); }
.site-menu__label {
  font-family: var(--font-ui);
  font-size: 40px;
  line-height: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.site-menu__link.is-active .site-menu__label { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

.site-menu__foot {
  margin-top: auto;
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.site-menu__note {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 23px;
  color: var(--mute);
  max-width: 320px;
}
.site-menu.is-dark .site-menu__note { color: var(--body-on-black); }

.site-menu__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 20px;
  font-weight: 500;
  transition: background-color .18s var(--ease-soft), color .18s var(--ease-soft);
}
.site-menu__cta:hover { background: var(--electric); color: var(--ink); }
.site-menu.is-dark .site-menu__cta { background: var(--electric); color: var(--ink); }
.site-menu.is-dark .site-menu__cta:hover { background: var(--white); }

@keyframes site-menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

body.nav-locked { overflow: hidden; }

/* ---------- phone ---------- */
@media (max-width: 960px) {
  .site-nav { --nav-h: 60px; }
  .site-nav__inner { padding-inline: var(--v2-gutter, 20px); gap: 12px; } /* 20 on a phone (Paper EFE-1), 48 on a tablet like the page */
  .site-nav__links { display: none; }
  .site-nav__cta { display: none; }
  .site-nav__toggle { display: inline-flex; }
  .site-nav__brand { flex: none; }
  .site-nav__right { flex: none; }
  .site-nav__word { font-size: 38.5px; }
  .site-menu { --nav-h: 60px; }
  .site-menu__inner { padding-top: 4px; }
}

@media (max-width: 380px) {
  .site-nav__mark { width: 27px; height: 24px; }
  .site-nav__word { font-size: 32px; line-height: 24px; }
  .site-nav__toggle { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-menu { animation: none; }
  .site-nav__link,
  .site-nav__link::after,
  .site-nav__cta,
  .site-menu__cta { transition: none; }
}

/* Phone bar variants. header.js sets data-nav-phone from the path.
   Desktop (min-width 961) does not read these. The word "Menu" stays in
   the button for the menu-pill variant; icon variants hide it. The
   close-icon swap is unchanged. */
@media (max-width: 960px) {
  .site-nav[data-nav-phone="icon"],
  .site-menu[data-nav-phone="icon"],
  .site-nav[data-nav-phone="cta-round"],
  .site-menu[data-nav-phone="cta-round"] { --nav-h: 56px; }

  .site-nav[data-nav-phone="menu-pill"],
  .site-menu[data-nav-phone="menu-pill"] { --nav-h: 60px; }

  .site-nav[data-nav-phone="menu-pill"] .site-nav__inner { padding-inline: 20px; }
  .site-nav[data-nav-phone="menu-pill"] .site-nav__mark { width: 31px; height: 28px; }
  .site-nav[data-nav-phone="menu-pill"] .site-nav__word { font-size: 38.5px; line-height: 28px; }

  /* light: filled, same as the desktop Book a call pill.
     dark: a real pill, not a 1 px hairline on an empty fill. */
  .site-nav[data-nav-phone="menu-pill"] .site-nav__toggle {
    background: var(--white);
    border-color: var(--button-line);
    color: var(--ink);
  }
  .site-nav.is-dark[data-nav-phone="menu-pill"] .site-nav__toggle {
    background: var(--white);
    border-color: var(--white);
    color: var(--ink);
  }

  .site-nav[data-nav-phone="cta-round"] .site-nav__cta,
  .site-nav[data-nav-phone="cta-bare"] .site-nav__cta { display: inline-flex; }

  .site-nav[data-nav-phone="cta-round"] .site-nav__mark { width: 22.3px; height: 20.2px; }
  .site-nav[data-nav-phone="cta-round"] .site-nav__word { font-size: 33px; line-height: 24px; }
  .site-nav[data-nav-phone="cta-round"] .site-nav__toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
    flex: none;
  }
  .site-nav[data-nav-phone="cta-round"] .site-nav__toggle:focus-visible { border-radius: 50%; }

  .site-nav[data-nav-phone="cta-bare"] .site-nav__mark { width: 22px; height: 20px; }
  .site-nav[data-nav-phone="cta-bare"] .site-nav__word { font-size: 27.7px; line-height: 20px; }
  .site-nav[data-nav-phone="cta-bare"] .site-nav__toggle {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    justify-content: center;
    gap: 0;
    flex: none;
  }
  .site-nav[data-nav-phone="cta-bare"] .site-nav__icon { width: 24px; height: 24px; }

  .site-nav[data-nav-phone="icon"] .site-nav__toggle {
    width: auto;
    height: auto;
    padding: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    gap: 0;
    flex: none;
  }

  .site-nav[data-nav-phone="icon"] .site-nav__toggle-label,
  .site-nav[data-nav-phone="cta-round"] .site-nav__toggle-label,
  .site-nav[data-nav-phone="cta-bare"] .site-nav__toggle-label { display: none; }
}
