/* ============================================================
   Base — reset, typography, shared primitives.
   Loaded by all five sites after tokens.css.
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-normal);
  letter-spacing: var(--tr-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* The scroll-linked atmosphere layer. A fixed wash whose hue and
   opacity are driven by scroll progress, so the page changes mood
   as you descend. Fixed + transform-free = no repaint cost. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      120% 80% at 50% 0%,
      hsl(var(--atmos-h) var(--atmos-s) 50% / var(--atmos-a)) 0%,
      transparent 68%
    ),
    radial-gradient(
      100% 60% at 85% 100%,
      hsl(calc(var(--atmos-h) + 40) var(--atmos-s) 45% / calc(var(--atmos-a) * 0.6)) 0%,
      transparent 70%
    );
}

/* Everything sits above the atmosphere. */
body > * { position: relative; z-index: 1; }

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select { font: inherit; color: inherit; }

p,
h1,
h2,
h3,
h4 { overflow-wrap: break-word; }

/* --- Typography ------------------------------------------- */

h1, h2, h3, h4 {
  font-weight: 400;
  letter-spacing: var(--tr-tight);
  line-height: var(--lh-snug);
  text-wrap: balance;
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--tr-tight);
  line-height: var(--lh-tight);
}

.display em {
  font-style: italic;
  color: var(--accent-text);
}

.t-mega { font-size: var(--t-mega); }
.t-h1   { font-size: var(--t-h1); }
.t-h2   { font-size: var(--t-h2); }
.t-h3   { font-size: var(--t-h3); }
.t-lead {
  font-size: var(--t-lead);
  line-height: var(--lh-loose);
  letter-spacing: var(--tr-snug);
  color: var(--text-muted);
  max-width: var(--measure);
}
.t-small { font-size: var(--t-small); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.eyebrow::before {
  content: "";
  width: var(--s-6);
  height: 1px;
  background: var(--line-strong);
  flex: none;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

/* --- Layout primitives ------------------------------------ */

.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }

.stack > * + * { margin-top: var(--flow, var(--s-5)); }

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
}

/* --- Buttons ---------------------------------------------- */

.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-6);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: var(--tr-normal);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.btn:hover { transform: translateY(-2px); opacity: 0.92; }
.btn:active { transform: translateY(0); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  --btn-bg: var(--tint);
  border-color: var(--paper-300);
  opacity: 1;
}

/* --- Accessibility ---------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 200;
  padding: var(--s-3) var(--s-5);
  background: var(--paper-000);
  color: var(--ink-000);
  border-radius: var(--r-full);
  font-size: var(--t-small);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Mobile navigation -------------------------------------
   Below 900px the header's links move into a disclosure panel anchored to
   the bottom of the header. Previously they were simply hidden, which left
   a phone visitor with no way to reach a section but scrolling.

   Selectors are written as `nav[data-nav-panel]` so they outrank the
   `.nav` / `.d-nav` rules in the later stylesheets without !important. */

.navtoggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  flex: none;
  background: transparent;
  color: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.navtoggle:hover { border-color: var(--text-muted); }

.navtoggle__bars {
  position: relative;
  display: block;
  width: 1.125rem;
  height: 0.6875rem;
}

.navtoggle__bars span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition:
    transform var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
}

.navtoggle__bars span:first-child { top: 0; }
.navtoggle__bars span:last-child { bottom: 0; }

.navtoggle[aria-expanded="true"] .navtoggle__bars span:first-child {
  transform: translateY(4.75px) rotate(45deg);
}
.navtoggle[aria-expanded="true"] .navtoggle__bars span:last-child {
  transform: translateY(-4.75px) rotate(-45deg);
}

@media (max-width: 900px) {
  .navtoggle { display: inline-flex; }

  nav[data-nav-panel] {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0 var(--gutter) var(--s-4);
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lift);
  }

  nav[data-nav-panel].is-open { display: flex; }

  nav[data-nav-panel] a {
    padding-block: var(--s-4);
    border-top: 1px solid var(--line);
    font-size: var(--t-lead);
    color: var(--text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .navtoggle__bars span { transition: none; }
}

/* --- Spam honeypot ----------------------------------------- */
/* Positioned off-screen rather than display:none — many bots skip fields
   that are genuinely hidden, but will happily fill this one. Real users
   never reach it: it is aria-hidden and out of the tab order. */

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Reveal: the shared scroll-in state -------------------- */
/* Elements start offset only when JS is present to bring them back,
   so a JS failure leaves a fully readable page rather than a blank one. */

[data-reveal] { will-change: auto; }

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* --- Line reveals ------------------------------------------ */
/* Headings split on their <br> tags into masked lines that slide up.
   The mask is padded so descenders aren't sheared off by the clip. */

.js [data-lines] { visibility: hidden; }

.js [data-lines].is-split,
.js [data-hero].is-ready [data-lines] { visibility: visible; }

.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}

.line__i { display: block; }

/* Gated on .js: if the fail-safe drops that class, split lines must return
   to their resting position rather than staying hidden forever. */
.js .line__i {
  transform: translateY(110%);
  opacity: 0;
}

/* Resting state is pinned by a class once the animation completes, so the
   final position never depends on Motion leaving inline styles behind. */
.js [data-lines].is-done .line__i {
  transform: none;
  opacity: 1;
}

/* --- Wipe reveals ------------------------------------------- */
/* Used on photography: the frame uncovers the image from the bottom up
   instead of fading it, which reads as film rather than as a web page.

   The clip goes on the <img>, never on [data-wipe] itself. Clipping the
   observed element to zero height makes IntersectionObserver report an
   intersectionRatio of 0 even when it is centred in the viewport, so a
   ratio threshold can never be met — the element would be hidden by a clip
   that stops the observer that would reveal it. Measured: same element,
   ratio 0 clipped vs 1 unclipped. */

.js [data-reveal][data-wipe] {
  opacity: 1;
  transform: none;
}

.js [data-reveal][data-wipe] img {
  clip-path: inset(100% 0 0 0);
}

.js [data-reveal][data-wipe].is-in img {
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* --- Reduced motion --------------------------------------- */
/* Not a courtesy: scroll-linked parallax and drifting backgrounds
   are a genuine vestibular trigger. Everything static, everything
   readable, nothing hidden. */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .btn:hover { transform: none; }

  /* Line and wipe reveals depend on JS adding classes that never arrive
     under reduced motion, so their hidden states must be lifted here. */
  .js [data-lines],
  .js [data-lines].is-split { visibility: visible; }

  .js [data-lines] .line__i {
    transform: none !important;
    opacity: 1 !important;
  }

  .js [data-reveal][data-wipe] img { clip-path: none !important; }

  .js [data-hero-step] { opacity: 1 !important; }
}
