/* =====================================================
   IncMarketry — the public-site header (homepage v8, stage B, 2026-10-09)

   One header, byte-identical on the eight public pages apart from the active link
   (index, services, resources, about, legal, contact, help, blog-press). Built from
   im-primitives.css (tokens, .im-btn, .im-ring), which every page using this file links first.

   Markup (the only thing a page varies is class="active" / aria-current="page" on one link):
     <header class="im-hdr" id="site-header"><div class="im-hdr-bar">
       <a class="im-logo">ring + <span class="wm">…</span></a>
       <nav class="im-nav" id="main-nav">…links…<a class="im-nav-contact">Contact</a></nav>
       <div class="im-hdr-actions">Get Access · Contact (glass) · menu button</div>
     </div></header>

   ONE link list. Above 960px #main-nav is the centred row; at 960px and below the SAME element
   becomes the glass drawer the menu button opens (display:none while closed, so a screen reader
   meets the links exactly once). The drawer's Contact entry replaces the bar's Contact button.

   Three grounds, chosen by the BODY, never by header markup:
     - default (inner pages): an opaque sand bar at rest;
     - body.has-overlay-header (the homepage): transparent at rest, floating over the hero;
     - body.im-hdr-on-dark: sand text for a dark hero (stage C's new homepage). Not used yet.
   Past 60px of scroll site-nav.js adds .is-stuck: sand glass, ink text, on every page.

   The bar's paint (background, blur, border, shadow) lives on ::before, not on .im-hdr itself:
   an element with backdrop-filter becomes the backdrop root for its descendants, so the drawer's
   own blur would see only the 72px header and none of the page under it.

   Header buttons are DRAWN at 40px (36px at phone width) — v8's size — and given a 44px tap area
   on touch screens by an invisible ::after (.im-hdr-hit). Every other button stays >= 44px drawn.

   No hex values (verify-brand-colors), no container queries (a container ancestor would capture
   the fixed Get Access modal, chat button and scroll-progress bar), every name im- prefixed.
   ===================================================== */

.im-hdr {
  position: sticky; top: 0; z-index: 100;
  height: 72px; color: var(--im-ink);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.im-hdr::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--im-sand);
  border-bottom: 1px solid var(--im-line);
  transition: background-color .35s, box-shadow .35s, border-color .35s;
}
body.has-overlay-header .im-hdr { position: fixed; left: 0; right: 0; }
/* :not(.is-stuck) is load-bearing: without it this (0,2,2) rule out-specifies .im-hdr.is-stuck::before
   (0,2,1) and the homepage never gets its glass — the suite caught exactly that. */
body.has-overlay-header .im-hdr:not(.is-stuck)::before { background: transparent; border-bottom-color: transparent; }
/* 94% sand, not v8's 72%: terracotta "Inc" is only 3.58:1 on pure sand, so any dark band scrolling
   under 72% glass (blog-press's dark sections, a dark hero's tail) took it to 2.1:1 — measured. 94% keeps
   it >= 3:1 over the darkest ground on the site; over sand content the two look the same. */
.im-hdr.is-stuck::before {
  background: rgba(var(--brand-cream-rgb), .94);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom-color: rgba(var(--brand-navy-rgb), .1);
  box-shadow: 0 10px 30px -24px rgba(var(--brand-plum-deepest-rgb), .35);
}

.im-hdr-bar {
  max-width: var(--im-max); margin: 0 auto; height: 72px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 calc(var(--im-pad) + var(--im-gut));
}

/* ---- ring + wordmark. "Inc" takes its colour from the .wm rule in brand-tokens.css
   (terracotta at this size on a light ground; .wm-dark, set by site-nav.js, on a dark one). ---- */
.im-logo {
  justify-self: start; display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 22px; letter-spacing: -.02em; line-height: 1;
  color: inherit; text-decoration: none; white-space: nowrap;
  min-height: 44px; /* a tap target too: the bar is 72px, so this costs nothing */
}
.im-hdr .im-ring { stroke: var(--im-plum); }

/* ---- the link row ---- */
.im-nav { position: relative; display: flex; gap: 2px; justify-self: center; }
.im-nav a {
  position: relative; z-index: 1; padding: 8px 14px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; line-height: 1.2; color: inherit; text-decoration: none;
  white-space: nowrap;
}
.im-nav a:focus-visible, .im-logo:focus-visible, .im-hdr-toggle:focus-visible {
  outline: 2px solid var(--im-terra); outline-offset: 2px;
}
/* No pill (reduced motion, no JS): the active link carries the pill's look, standing still. */
.im-nav:not(.has-pill) a.active { background: rgba(var(--brand-navy-rgb), .085); }
.im-nav .im-nav-contact { display: none; }

/* The liquid pill (site-nav.js): transform and width only, an overshooting curve and a stretch
   derived from the real travel distance — no SVG filters. */
.im-nav-pill {
  position: absolute; top: 50%; left: 0; height: 34px; margin-top: -17px; border-radius: 999px;
  background: rgba(var(--brand-navy-rgb), .085); border: 1px solid rgba(var(--brand-navy-rgb), .08);
  pointer-events: none; z-index: 0; opacity: 0;
  transform: translateX(0) scaleX(1); transform-origin: center;
  transition: transform .42s cubic-bezier(.34, 1.4, .5, 1), width .42s cubic-bezier(.34, 1.4, .5, 1), opacity .25s ease;
}
.im-nav-pill.im-pill-on { opacity: 1; }
.im-nav-pill.im-pill-moving { transform: translateX(var(--pill-x, 0)) scaleX(var(--pill-stretch, 1)); }

/* ---- actions ---- */
.im-hdr-actions { justify-self: end; display: flex; gap: 8px; align-items: center; }
/* Homepage v21 (stage E2): Get Access comes first and the two pills are the same size. */
.im-hdr-actions .im-btn { height: 40px; min-width: 122px; justify-content: center; padding: 0 18px; font-size: 14px; }
.im-hdr-actions [data-magnet] { transition: transform .25s cubic-bezier(.2, .6, .2, 1), background .2s, color .2s, border-color .2s; }
.im-hdr-contact { background: rgba(var(--brand-navy-rgb), .06); border-color: rgba(var(--brand-navy-rgb), .18); color: var(--im-ink); }
.im-hdr-contact:hover { background: rgba(var(--brand-navy-rgb), .12); }
.im-hdr-access { background: var(--im-plum-dd); color: var(--im-sand); }

.im-hdr-toggle {
  display: none; position: relative; box-sizing: border-box; width: 40px; height: 40px; padding: 0; border-radius: 999px;
  border: 1px solid rgba(var(--brand-navy-rgb), .18); background: rgba(var(--brand-navy-rgb), .06);
  color: inherit; align-items: center; justify-content: center; cursor: pointer;
}
.im-hdr-toggle i { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px; position: relative; transition: background .3s; }
.im-hdr-toggle i::before, .im-hdr-toggle i::after {
  content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; border-radius: 1px;
  transition: transform .3s, top .3s;
}
.im-hdr-toggle i::before { top: -6px; }
.im-hdr-toggle i::after { top: 6px; }
.im-hdr-toggle[aria-expanded="true"] i { background: transparent; }
.im-hdr-toggle[aria-expanded="true"] i::before { top: 0; transform: rotate(45deg); }
.im-hdr-toggle[aria-expanded="true"] i::after { top: 0; transform: rotate(-45deg); }

/* ---- 44px tap area on touch screens, invisible, centred on the drawn control. The row links
   (33px drawn) get it too, for a touch tablet wide enough to show the row; drawer links are
   47px already, so max() leaves them alone. ---- */
.im-hdr-hit { position: relative; }
/* MOBILE POLISH P1 (lane 2, 2026-11-07): the header buttons' 44px tap area is no longer gated on (pointer: coarse). Some
   phone browsers and every emulated phone report a fine pointer, and the 36px drawn buttons then had no 44px area at
   all (Get Access and Menu measured 100x36 / 36x36). The box is invisible and centred, so nothing changes to the eye;
   the row links keep the coarse-pointer gate (a desktop row link must not grab its neighbour's clicks). */
.im-hdr-hit::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
}
@media (pointer: coarse) {
  .im-nav a::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
  }
}

/* ---- dark hero (stage C): sand text while the bar is transparent over it ---- */
body.im-hdr-on-dark .im-hdr:not(.is-stuck) { color: var(--im-sand); }
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-ring { stroke: var(--im-sand); }
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-hdr-access { background: var(--im-sand); color: var(--im-plum-dd); }
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-hdr-contact,
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-hdr-toggle { background: var(--im-glass-bg); border-color: var(--im-glass-b); color: inherit; }
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-hdr-contact:hover { background: rgba(var(--brand-cream-rgb), .18); }
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-nav-pill { background: rgba(var(--brand-cream-rgb), .14); border-color: rgba(var(--brand-cream-rgb), .18); }
body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-nav:not(.has-pill) a.active { background: rgba(var(--brand-cream-rgb), .14); }

/* ---- 960px and below: the drawer ---- */
@media (max-width: 960px) {
  .im-hdr-bar { grid-template-columns: 1fr auto; }
  .im-hdr-toggle { display: inline-flex; }
  .im-hdr-actions .im-hdr-contact { display: none; }
  .im-nav {
    display: none; position: absolute; left: var(--im-gut); right: var(--im-gut); top: 80px;
    justify-self: stretch; /* a grid child keeps justify-self even when absolute: centre would shrink-wrap it */
    flex-direction: column; gap: 0; padding: 10px; border-radius: 20px;
    background: rgba(var(--brand-plum-deepest-rgb), .86); color: var(--im-sand);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    border: 1px solid var(--im-glass-b); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);
  }
  .im-nav.is-open { display: flex; }
  .im-nav a { padding: 14px 16px; border-radius: 12px; font-size: 16px; }
  .im-nav a.active, .im-nav a:hover,
  body.im-hdr-on-dark .im-hdr:not(.is-stuck) .im-nav:not(.has-pill) a.active,
  .im-nav:not(.has-pill) a.active { background: rgba(var(--brand-cream-rgb), .1); }
  .im-nav .im-nav-contact { display: block; }
  .im-nav-pill { display: none; }
}

/* ---- phone (v8's 640px layout) ---- */
@media (max-width: 640px) {
  .im-hdr-bar { padding: 0 calc(var(--im-pad) + var(--im-gut) - 6px); }
  .im-logo { font-size: 19px; gap: 7px; }
  .im-hdr-actions { gap: 6px; }
  .im-hdr-actions .im-btn { height: 36px; min-width: 0; padding: 0 14px; font-size: 13px; }
  .im-hdr-toggle { width: 36px; height: 36px; }
}
/* Narrowest phones: the bar's own padding gives, nothing else changes size. */
@media (max-width: 359px) {
  .im-hdr-bar { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .im-hdr::before, .im-nav-pill, .im-hdr-actions [data-magnet],
  .im-hdr-toggle i, .im-hdr-toggle i::before, .im-hdr-toggle i::after { transition: none; }
}

/* SAFE AREA (lane 2, 7 Nov 2026): the public header grows by the top inset and keeps its bar below it. env() is 0 unless a
   page is drawn under the status bar, so every current page renders exactly as before. */
.im-hdr { box-sizing: content-box; padding-top: env(safe-area-inset-top, 0px); }
/* the homepage hero runs under the overlay header: it grows by the same inset, so the copy stays clear and the hero's
   own colour fills the status area (theme-color plum-deepest on index.html). */
body.ih-page .ih-hero { padding-top: calc(72px + env(safe-area-inset-top, 0px)); }
