/* ══════════════════════════════════════════════════════════════
   BASE — reset, typography primitives, global texture
   ══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 2rem);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-body);
  font-variation-settings: "wdth" 100, "wght" 400;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

body.is-locked { overflow: hidden; }

/* The loader covers the first paint while webfonts settle, so display type
   never flashes a fallback. Without JS there is no loader to lift, so it is
   never shown in the first place. */
html:not(.has-js) .boot { display: none; }

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--flare); color: var(--flare-ink); }

:focus-visible {
  outline: 2px solid var(--flare);
  outline-offset: 3px;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--line-hard); border: 3px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--flare); }

/* ══════════════════════════════════════════════════════════════
   TYPE PRIMITIVES
   ══════════════════════════════════════════════════════════════ */

.mono {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  font-weight: 400;
}

/* Extended heavy display — the Marathon signature. */
.display {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 118, "wght" 800;
  text-transform: uppercase;
  letter-spacing: var(--tr-tight);
  line-height: 0.86;
}

.eyebrow {
  color: var(--flare);
  font-size: var(--t-micro);
  letter-spacing: var(--tr-wider);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.eyebrow::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  background: currentColor;
  flex: none;
}

.dim { color: var(--ink-dim); }
.flare { color: var(--flare); }

/* ── PROSE (writing bodies + prose sections) ───────────────── */
.prose { font-size: var(--t-md); line-height: 1.72; color: var(--ink-dim); max-width: 62ch; }
.prose > * + * { margin-top: 1.1em; }
.prose strong { color: var(--ink); font-variation-settings: "wdth" 100, "wght" 650; }
.prose em { font-style: italic; }
.prose a {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--flare);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.prose a:hover { background: var(--flare); color: var(--flare-ink); box-shadow: none; }
.prose h3 {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 112, "wght" 750;
  text-transform: uppercase;
  letter-spacing: var(--tr-snug);
  font-size: var(--t-lg);
  line-height: 1.05;
  color: var(--ink);
  margin-top: 2.2em;
}
.prose h4 {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  color: var(--flare);
  margin-top: 2em;
}
.prose ul { padding-left: 0; }
.prose li {
  position: relative;
  padding-left: 1.6rem;
  margin-top: 0.5em;
}
.prose li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 0.6rem; height: var(--hair);
  background: var(--flare);
}
.prose blockquote {
  border-left: 2px solid var(--flare);
  padding: var(--s-2) 0 var(--s-2) var(--s-5);
  color: var(--ink);
  font-size: var(--t-lg);
  line-height: 1.35;
  font-variation-settings: "wdth" 100, "wght" 500;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface);
  border: var(--hair) solid var(--line);
  padding: 0.1em 0.4em;
  color: var(--ink);
}
.prose hr { border: 0; height: var(--hair); background: var(--line); margin: 2.4em 0; }

/* ══════════════════════════════════════════════════════════════
   GLOBAL TEXTURE — grain, scanline, registration marks
   ══════════════════════════════════════════════════════════════ */

/* overflow:hidden is load-bearing — the oversized grain layer would
   otherwise widen the document and shove every fixed element off-screen. */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }

.hud__grain {
  position: absolute; inset: -50%;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 6s steps(6) infinite;
  will-change: transform;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -2%); }
  80%  { transform: translate(3%, 1%); }
  100% { transform: translate(0, 0); }
}

.hud__scan {
  position: absolute; inset: 0;
  opacity: var(--scan-op);
  background: repeating-linear-gradient(
    to bottom,
    currentColor 0 1px,
    transparent 1px 3px
  );
  color: var(--ink);
}

/* Corner registration crosshairs */
.hud__reg {
  position: absolute;
  width: 14px; height: 14px;
  border: var(--hair) solid var(--flare);
  opacity: 0.75;
}
.hud__reg--tl { top: 10px;    left: 10px;    border-right: 0; border-bottom: 0; }
.hud__reg--tr { top: 10px;    right: 10px;   border-left: 0;  border-bottom: 0; }
.hud__reg--bl { bottom: 10px; left: 10px;    border-right: 0; border-top: 0; }
.hud__reg--br { bottom: 10px; right: 10px;   border-left: 0;  border-top: 0; }

/* ── UTILITY ───────────────────────────────────────────────── */
.skip {
  position: fixed; left: var(--s-4); top: var(--s-4);
  transform: translateY(-300%);
  background: var(--flare); color: var(--flare-ink);
  padding: var(--s-3) var(--s-5);
  font-family: var(--font-mono); font-size: var(--t-xs);
  letter-spacing: var(--tr-wide); text-transform: uppercase;
  z-index: 200;
}
.skip:focus { transform: none; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ── REVEAL ────────────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
  transition-delay: var(--delay, 0s);
}
[data-reveal].in { opacity: 1; transform: none; }

@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;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .hud__grain { animation: none; }
}
