/* ==========================================================================
   base.css — reset, fonts, typography, focus, motion defaults
   Depends on tokens.css. Declares no colours of its own.
   ========================================================================== */

/* --- Fonts: self-hosted, variable, latin subset ------------------------- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-var.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-var.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-var.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2212;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;           /* guards the 320px no-h-scroll requirement */
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  text-wrap: balance;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

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

/* Any explicit `display` in a stylesheet beats the user-agent `display:none`
   that the `hidden` attribute relies on, so `el.hidden = true` silently stops
   working on anything styled with display:flex/grid/block. That is exactly
   what happened to the viewer's "Step inside" gate: it was marked hidden and
   stayed on screen. Make the attribute authoritative. */
[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* --- Focus -------------------------------------------------------------
   Gold, always visible, never removed. 2px offset so it reads on both
   --ink and image backdrops.                                             */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* --- Skip link ---------------------------------------------------------- */
.skip {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 999;
  padding: var(--s-3) var(--s-5);
  background: var(--gold);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: var(--step-util);
  letter-spacing: var(--tr-util-lg);
  text-transform: uppercase;
  transition: top var(--d-fast) var(--ease);
}
.skip:focus { top: var(--s-4); }

/* --- Screen-reader only ------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- The mono voice ----------------------------------------------------
   Eyebrows, coordinates, regions, durations. Never body copy.           */
.mono {
  font-family: var(--font-mono);
  font-size: var(--step-util);
  font-weight: 500;
  letter-spacing: var(--tr-util);
  text-transform: uppercase;
  color: var(--bone-dim);
}
.mono--gold { color: var(--gold); }
.mono--tight { letter-spacing: var(--tr-util-lg); }

/* --- Type scale helpers ------------------------------------------------- */
.lede {
  font-size: var(--step-lede);
  line-height: 1.5;
  color: var(--bone-dim);
  max-width: 46ch;
}

/* --- Reveal ------------------------------------------------------------
   One-shot section entry. `is-in` is added by IntersectionObserver and
   never removed, so nothing re-animates on scroll-back.
   NOTE: no-JS safety lives in the <noscript> block in head.php, which
   forces .reveal visible. Do not rely on JS to reveal content.          */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity var(--d-slow) var(--ease),
    transform var(--d-slow) var(--ease);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}
.reveal[data-delay="1"] { transition-delay: 90ms; }
.reveal[data-delay="2"] { transition-delay: 180ms; }
.reveal[data-delay="3"] { transition-delay: 270ms; }

/* --- Reduced motion ----------------------------------------------------
   tokens.css already collapses durations. This block additionally
   neutralises every transform, because a 1ms slide is still a slide,
   and kills the marquee + Ken Burns outright.                           */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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

  .reveal { opacity: 1 !important; transform: none !important; }
  .hero__headline-line > span { transform: none !important; }
  .marquee__track { animation: none !important; transform: none !important; }
  .hero__slide { animation: none !important; }
  .loom__thread { transform: scaleX(1) !important; }
}
