/* ============================================================
   header — brief/header.md (desktop 3441:2366 · mobile 3441:2048 · drawer 3441:1722/1724)
   Mobile-first: base = mobile (<768), 768-1023 = pseudo-tablet (burger + drawer carried up),
   >=1024 = desktop bar (vector logo · 5 links · outline Contact).
   Section-local tokens are scoped to .header (fluid-formulas.md; M / M-min / M-max / M-767).
   ============================================================ */

.header {
  /* mobile bar right padding 12 (D-header-4) */
  --header-pr: clamp(10px, calc(12px + (var(--max-vw) - 375px) * 0.015), 12px);
  /* drawer (3441:1724) */
  --drawer-py: clamp(34px, calc(40px + (var(--max-vw) - 375px) * 0.015), 40px);
  --drawer-item-py: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  /* drawer Contact: 12 / 24 padding (3441:1731) — not the mobile --btn-py 10 */
  --drawer-cta-py: clamp(10px, calc(12px + (var(--max-vw) - 375px) * 0.015), 12px);
  --drawer-cta-px: clamp(20px, calc(24px + (var(--max-vw) - 375px) * 0.015), 24px);

  /* Sticky "on scroll up" (Shopify Dawn behaviour, user request 2026-10-09 — overrides BA-P3):
     js/header.js adds .is-hidden while scrolling down and removes it on any scroll up. */
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  transition: transform 0.25s ease;
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding-block: 0;                         /* Figma padding 30 is inert (D-header-11) */
  padding-inline-end: var(--header-pr);     /* longhand only — .container keeps the start gutter */
  background: var(--color-bg);              /* D-header-1 */
}

.header__inner {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* ---------- Logo ---------- */
.header__logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--color-text);
}

.header__logo-img { display: none; }

/* Mobile text logo "MM": 800 + 300 (D-header-3), wrapper 53.14 x 36 */
.header__logo-text {
  display: flex;
  align-items: center;
  height: calc(var(--text-logo-m) * 1.3125);      /* 36 / 27.43 */
  padding-inline: 0.039em;                         /* 1.07 / 27.43 — text centred in the wrapper */
  font-family: var(--font-display);
  font-size: var(--text-logo-m);
  font-weight: 800;
  line-height: var(--lh-auto);
  letter-spacing: var(--ls-logo-m);
  white-space: nowrap;
}
.header__logo-m--light { font-weight: 300; }

/* ---------- Desktop right group (hidden below 1024) ---------- */
.header__right { display: none; }

.header__nav-list {
  display: flex;
  align-items: flex-start;
}

.header__nav-link {
  display: block;
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-body);
  white-space: nowrap;
  color: var(--color-text);
  text-underline-position: from-font;
  text-decoration-thickness: from-font;
  text-decoration-skip-ink: none;
}
.header__nav-link[aria-current="page"] {
  font-weight: 700;
  text-decoration-line: underline;
}

/* ---------- Burger (below 1024) — fixed 48 hit-area / 24 glyph (D-header-5) ---------- */
.header__burger {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
}
.header__burger-icon {
  width: 24px;
  height: 24px;
}

/* ---------- Drawer (menu-open state, below 1024) ---------- */
.header__drawer {
  position: fixed;
  top: var(--drawer-top, var(--header-h));   /* D-header-6: bar bottom → viewport bottom */
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-drawer);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--drawer-py) var(--gutter);
  background: var(--color-bg);
}
.header__drawer[hidden] { display: none; }

.header__drawer-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.header__drawer-link {
  display: block;
  width: 100%;
  /* 20 top / 19 bottom + 1px rule = the 79 row (Figma INSIDE stroke) */
  padding-block: var(--drawer-item-py) calc(var(--drawer-item-py) - 1px);
  border-bottom: var(--border-width) solid var(--color-rule-light);
  font-size: var(--text-menu);
  font-weight: 400;
  line-height: var(--lh-auto);
  color: var(--color-text);
  text-underline-position: from-font;
  text-decoration-thickness: from-font;
  text-decoration-skip-ink: none;
}
/* D-header-9: no visual current state in the drawer */
.header__drawer-link[aria-current="page"] {
  font-weight: 400;
  text-decoration-line: none;
}

/* Full-width outline Contact. The .btn ring is an OUTER 1px box-shadow, so its top edge
   lands on item 5's rule (y 498) with the box starting at the list bottom (y 499). */
.header__drawer-cta {
  display: flex;
  width: 100%;
  padding: var(--drawer-cta-py) var(--drawer-cta-px);
}

/* ---------- Hover / focus (BA-H4) ---------- */
@media (hover: hover) {
  .header__nav-link:hover,
  .header__drawer-link:hover { text-decoration-line: underline; }
}
.header__logo:focus-visible,
.header__nav-link:focus-visible,
.header__cta:focus-visible,
.header__burger:focus-visible,
.header__drawer-link:focus-visible,
.header__drawer-cta:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 4px;
}
.header__drawer-link:focus-visible { outline-offset: -2px; }

/* ============================================================
   DESKTOP >= 1024 — horizontal bar (3441:2366)
   ============================================================ */
@media (min-width: 1024px) {
  .header {
    --header-logo-h: clamp(19px, calc(27px * (var(--max-vw) / var(--vw-base))), 36px);
    --header-nav-gap: clamp(23px, calc(32px * (var(--max-vw) / var(--vw-base))), 43px);
    --header-group-gap: clamp(17px, calc(24px * (var(--max-vw) / var(--vw-base))), 32px);

    padding-inline-end: var(--gutter);
  }

  .header__logo-text { display: none; }
  .header__logo-img {
    display: block;
    height: var(--header-logo-h);
    width: auto;
  }

  .header__right {
    display: flex;
    align-items: center;
    gap: var(--header-group-gap);
  }
  .header__nav-list { gap: var(--header-nav-gap); }

  .header__burger,
  .header__drawer,
  .header__drawer[hidden] { display: none; }
}

/* ---------- Sticky on scroll up (Dawn) ---------- */
.header.is-hidden {
  transform: translateY(-100%);
}
/* The drawer is position: fixed INSIDE the header; any transform on the header would make the
   header its containing block. While the menu is open the header never moves. */
.header.is-menu-open {
  transform: none;
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  .header { transition: none; }
}

