/* ============================================================
   Reset, page ground, shared typography, reveal behaviour
   ============================================================ */

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

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

/* clear the fixed masthead when jumping to an anchor */
section[id], main[id] { scroll-margin-top: 5rem; }

body { margin: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* ---------- ground ----------
   The pressure gradient: the whole document darkens with depth, so
   scrolling reads as a descent rather than a sequence of panels. */

body {
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.68;
  color: var(--ink);
  background: var(--bg-1);
  background-image: linear-gradient(180deg,
    var(--bg-1) 0%,
    var(--bg-1) 14%,
    var(--bg-2) 46%,
    var(--bg-3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--bg-2); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- shared typography ---------- */

.display {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 0.92;
  text-transform: uppercase;
  text-wrap: balance;
  margin: 0;
}

.label {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: var(--measure);
  text-wrap: pretty;
  margin: 0;
}

p { text-wrap: pretty; }

.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---------- scroll reveal ----------
   Scoped to html.js, which the inline head script adds and removes
   again if the deferred scripts never boot. Without JS the content is
   simply visible — the reveal can never hide the page. */

html.js .rise {
  opacity: 0;
  transform: translateY(22px);
}
html.js .rise.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 760ms cubic-bezier(.2,.8,.2,1) var(--d, 0ms),
              transform 760ms cubic-bezier(.2,.8,.2,1) var(--d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  html.js .rise { opacity: 1; transform: none; }
}
