/**
 * BASE — resets, @font-face, typography defaults, global a11y primitives.
 */

/* ---- @font-face: real faces ------------------------------------------ */
@font-face {
  font-family: "Haywire Condensed";
  src: url("../fonts/haywire-condensed-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Haywire Sans";
  src: url("../fonts/poppins-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Haywire Sans";
  src: url("../fonts/poppins-medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Haywire Sans";
  src: url("../fonts/poppins-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Haywire Mono";
  src: url("../fonts/mono-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Haywire Mono";
  src: url("../fonts/mono-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- @font-face: metric-matched fallbacks -----------------------------
   Sized from the real webfont metrics (unitsPerEm / hhea ascent+descent /
   measured average advance width) so when the swap happens, nothing
   reflows. Numbers printed and explained in build.mjs's console report. */
@font-face {
  font-family: "Haywire Condensed Fallback";
  src: local("Arial Narrow"), local("Liberation Sans Narrow"), local("Arial");
  size-adjust: 129%;
  ascent-override: 105%;
  descent-override: 35%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Haywire Sans Fallback";
  src: local("Segoe UI"), local("Helvetica Neue"), local("Arial");
  size-adjust: 123%;
  ascent-override: 105%;
  descent-override: 35%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Haywire Mono Fallback";
  src: local("Consolas"), local("Menlo"), local("Courier New");
  size-adjust: 110%;
  ascent-override: 93%;
  descent-override: 24%;
  line-gap-override: 0%;
}

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}
html:focus-within { scroll-behavior: smooth; }
body {
  min-height: 100svh;
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-on-dark);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
p, li, dd { max-width: 66ch; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: -.015em;
  line-height: 0.95;
  font-weight: 700;
}
h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }
h4 { font-size: var(--size-h4); }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
table { border-collapse: collapse; }

/* ---- Selection ----------------------------------------------------------- */
::selection { background: var(--volt); color: var(--void); }

/* ---- Focus -----------------------------------------------------------------
   3px volt ring, 2px offset, everywhere EXCEPT on volt surfaces where it
   flips to void so the ring stays visible against the fill. */
:focus-visible {
  outline: 3px solid var(--volt);
  outline-offset: 2px;
  border-radius: 0;
}
[data-surface="volt"] :focus-visible,
.on-volt :focus-visible {
  outline-color: var(--void);
}
:focus:not(:focus-visible) { outline: none; }

/* ---- Motion ----------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Utility: visually hidden but available to AT ---------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Skip link ------------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--sp-4);
  z-index: var(--z-skiplink);
  background: var(--volt);
  color: var(--void);
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: var(--size-small);
  padding: var(--sp-3) var(--sp-5);
}
.skip-link:focus {
  top: var(--sp-4);
}

/* ---- Progressive-enhancement reveal gate -------------------------------------
   Set by an inline script in <head> before paint: `document.documentElement
   .classList.add('js')`. Everything with [data-reveal] starts hidden ONLY
   when .js is present, so a JS failure never hides content. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
}
.js [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--dur-reveal) var(--ease-mech),
              transform var(--dur-reveal) var(--ease-mech);
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
}
.js [data-reveal].is-visible:nth-child(1) { transition-delay: calc(var(--stagger) * 0); }
.js [data-reveal].is-visible:nth-child(2) { transition-delay: calc(var(--stagger) * 1); }
.js [data-reveal].is-visible:nth-child(3) { transition-delay: calc(var(--stagger) * 2); }
.js [data-reveal].is-visible:nth-child(4) { transition-delay: calc(var(--stagger) * 3); }
.js [data-reveal].is-visible:nth-child(5) { transition-delay: calc(var(--stagger) * 4); }
.js [data-reveal].is-visible:nth-child(6) { transition-delay: calc(var(--stagger) * 5); }

/* ---- Headline wipe (progressive enhancement, same gate as above) ------------ */
.js [data-wipe] {
  clip-path: inset(0 100% 0 0);
}
.js [data-wipe].is-visible {
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--dur-wipe) var(--ease-mech);
}
@media (prefers-reduced-motion: reduce) {
  .js [data-wipe] { clip-path: none; opacity: 0; }
  .js [data-wipe].is-visible { opacity: 1; transition: opacity var(--dur-reveal) linear; }
}
