/* ==========================================================================
   Base — reset, type, print textures, the global ink layers
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color .7s var(--ease), color .7s var(--ease);
  cursor: none;
}

/* Fine pointers get the web-shooter reticle; touch keeps its own cursor. */
@media (pointer: coarse) { body { cursor: auto; } }

img, svg, canvas { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: .92;
  letter-spacing: .005em;
  text-transform: uppercase;
  margin: 0;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: fixed; top: -100px; left: 12px; z-index: 999;
  background: var(--yellow); color: #000;
  border: var(--border) solid #000; box-shadow: var(--shadow-hard-sm);
  padding: .6rem 1rem; font-family: var(--f-comic); font-size: 1.1rem;
  letter-spacing: .06em;
}
.skip-link:focus { top: 12px; }

.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;
}

/* --------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */

.wrap {
  width: min(1240px, 100% - (var(--gutter) * 2));
  margin-inline: auto;
}
.wrap--narrow { width: min(820px, 100% - (var(--gutter) * 2)); }
.wrap--wide   { width: min(1520px, 100% - (var(--gutter) * 2)); }

.chapter {
  position: relative;
  z-index: 2;
  padding-block: clamp(5rem, 12vh, 9rem);
}
.chapter--tight { padding-block: clamp(3rem, 7vh, 5rem); }

/* Hook for chapters below the fold. Deliberately NOT content-visibility:
   auto — it interferes with the IntersectionObserver reveals. */
.chapter--deferred { contain: layout style; }

/* --------------------------------------------------------------------------
   The print textures. Three stacked full-viewport layers, all decorative.
   -------------------------------------------------------------------------- */

.tex {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

/* Ben-Day dots + newsprint tooth, in a single layer. These used to be two
   separate mix-blend-mode elements; each one forced the entire page beneath
   it to be re-composited every frame, which is why scrolling stuttered. */
.tex--print {
  z-index: 58;
  opacity: .5;
  background-image:
    radial-gradient(circle at center, rgba(0, 0, 0, .5) 22%, transparent 26%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  background-size: var(--dots) var(--dots), 180px 180px;
  background-blend-mode: overlay;
  transition: background-size .7s var(--ease);
}



/* --------------------------------------------------------------------------
   Chromatic aberration. --split is written by the scroll engine, so the
   ink goes out of register the faster you move. This is the signature.
   -------------------------------------------------------------------------- */

.chroma {
  text-shadow:
    calc(var(--split) * -1px) 0 0 rgba(255, 31, 69, .85),
    calc(var(--split) *  1px) 0 0 rgba(22, 242, 230, .85);
}
.chroma--hard {
  text-shadow:
    calc(var(--split) * -1.6px) calc(var(--split) * -.4px) 0 var(--red),
    calc(var(--split) *  1.6px) calc(var(--split) *  .4px) 0 var(--cyan);
}

/* --------------------------------------------------------------------------
   Reveal — panels don't fade, they LAND.
   -------------------------------------------------------------------------- */

.rise {
  opacity: 0;
  transform: translate3d(0, 28px, 0) scale(.985);
  transition:
    opacity .45s var(--ease),
    transform .55s var(--pop);
}
.rise.is-in { opacity: 1; transform: none; }

.rise--l { transform: translate3d(-34px, 12px, 0) rotate(-1.5deg); }
.rise--r { transform: translate3d(34px, 12px, 0) rotate(1.5deg); }

/* Stagger children without writing a rule per child. */
.stagger > * { transition-delay: calc(var(--i, 0) * 70ms); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tex--print { opacity: .38; }
  .rise { opacity: 1; transform: none; transition: none; }
  .chroma, .chroma--hard { text-shadow: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
