/* ==========================================================================
   Base — reset, typography, primitives, texture overlays
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

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

img {
  height: auto;
}

/* WebP wrappers must not become a layout box, or every `height: 100%` and
   flex/grid rule written against the <img> would resolve against the wrapper
   instead of the real container. */
picture {
  display: contents;
}

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

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

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

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

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 0;
}

::selection {
  background: var(--orange);
  color: var(--text-invert);
}

/* ---- Focus ------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--orange-hot);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 999;
  padding: var(--s-3) var(--s-5);
  background: var(--orange);
  color: var(--text-invert);
  font-family: var(--font-display);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transform: translateY(-110%);
  transition: transform var(--t-fast) var(--ease-out);
}

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

/* ==========================================================================
   Typography
   ========================================================================== */

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 400;
  text-wrap: balance;
}

.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-mega);
  line-height: 0.96;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.display--xxl {
  font-size: var(--fs-xxl);
  line-height: 0.98;
  letter-spacing: 0.03em;
}

/* Interior-page H1 — smaller than the homepage hero, larger than a section H2 */
.h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xxl);
  line-height: 0.98;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xl);
  line-height: 1.02;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-lg);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-md);
  line-height: 1.3;
}

/* Supporting lines under titles are body copy — same size and weight as prose,
   so a page doesn't grow a second heading style between the title and the text. */
.lede {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-mid);
  max-width: 62ch;
}

.prose {
  max-width: 68ch;
  color: var(--text-mid);
}

.prose p {
  margin: 0 0 var(--s-5);
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Mono / telemetry -------------------------------------------------- */
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.mono--accent {
  color: var(--orange-hot);
}

.mono--bright {
  color: var(--text);
}

.mono-sm {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
}

/* Section eyebrow: index + label + rule */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.eyebrow__idx {
  color: var(--orange-hot);
}

.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

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

.section {
  position: relative;
  padding-block: var(--section-y);
  border-top: 1px solid var(--hairline);
}

.section--flush {
  border-top: 0;
}

.section--field {
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(0, 56, 168, 0.28), transparent 60%),
    linear-gradient(180deg, var(--blue-abyss), var(--bg) 85%);
}

.section--surface {
  background: var(--surface);
}

/* Crosshair markers at section corners */
.section--marked::before,
.section--marked::after {
  content: "+";
  position: absolute;
  top: -0.62em;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1;
  color: var(--text-faint);
  pointer-events: none;
}

.section--marked::before {
  left: var(--gutter);
}

.section--marked::after {
  right: var(--gutter);
}

/* Hazard stripe terminator */
.hazard {
  height: 6px;
  background: repeating-linear-gradient(
    45deg,
    var(--orange) 0 10px,
    transparent 10px 20px
  );
  opacity: 0.65;
}

/* ==========================================================================
   Texture overlays — fixed and pointer-events:none so they never repaint
   during scroll.
   ========================================================================== */

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Scanlines live on photo plates only — see --scanline in tokens.css */

/* ==========================================================================
   Utilities
   ========================================================================== */

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.text-accent {
  color: var(--orange-hot);
}

.text-mid {
  color: var(--text-mid);
}

.nowrap {
  white-space: nowrap;
}

/* ==========================================================================
   Motion base — every animated element is safe with JS disabled.
   `.reveal` elements are visible by default; motion.js opts them in.
   ========================================================================== */

.js-motion .reveal {
  opacity: 0;
  transform: translateY(22px);
}

/* Split-text scaffolding, injected by motion.js. The padding/margin pair
   gives the mask room for descenders that overflow:hidden would otherwise
   shave off. Nothing here renders unless the splitter has run. */
.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

.word__in {
  display: inline-block;
}

.char {
  display: inline-block;
}

/* A split block is revealed by its parts, so the block itself must be opaque
   and unshifted or the two transforms compound. */
.js-motion .reveal.is-split {
  opacity: 1;
  transform: none;
}

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

  .js-motion .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

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