/* ==========================================================================
   Cartage — Base: reset, typography, utilities
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;             /* Lenis handles smoothing */
  background: var(--bg);
  transition: background-color var(--t-theme) var(--ease-soft);
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: color var(--t-theme) var(--ease-soft), background-color var(--t-theme) var(--ease-soft);
}

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

img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, dl, dd, figure, blockquote { margin: 0; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* Thin scrollbar that respects the theme */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid var(--bg); }

/* ---- Typography ---------------------------------------------------------- */

.display, h1, h2, h3, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 340;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
  letter-spacing: -0.022em;
  line-height: .98;
}
h1 em, h2 em, h3 em, .h2 em, .h3 em, .display em {
  font-style: italic;
  font-weight: 300;
  font-variation-settings: "opsz" 144, "SOFT" 70, "WONK" 1;
  letter-spacing: -0.01em;
}
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-feature-settings: "tnum", "zero";
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: clamp(20px, 2.6vw, 36px);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 1.5px;
  flex: none;
}

.lede {
  font-size: var(--fs-lede);
  line-height: 1.5;
  color: var(--fg-2);
  max-width: 34em;
  text-wrap: pretty;
}

/* ---- Split-text word masks (js/ui.js) ------------------------------------ */
.w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding: .06em .04em .12em 0;
  margin: -.06em -.04em -.12em 0;
}
.w__i { display: inline-block; will-change: transform; }

/* Scroll-scrubbed words (manifesto) */
[data-scrub-words] .sw { opacity: .16; transition: none; }

/* ---- Grain --------------------------------------------------------------- */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 70;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  mix-blend-mode: multiply;
  animation: grain 7s steps(8) infinite;
}
html.is-dark .grain { mix-blend-mode: screen; opacity: .07; }
@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -4%); }
  75%  { transform: translate(-4%, -1%); }
  100% { transform: translate(3%, 3%); }
}

/* ---- Helpers ------------------------------------------------------------- */
.section__head { margin-bottom: clamp(48px, 7vw, 96px); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  [data-scrub-words] .sw { opacity: 1; }
  .grain { animation: none; }
}
