/* ============================================================
   Base — reset, typography, grid shell
   ============================================================ */

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

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

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

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--fg-100);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

::selection { background: var(--plum-cross); color: var(--fg-100); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--paper-100);
  color: var(--ink-900);
}
.skip-link:focus { left: 1rem; top: 1rem; }

.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;
}

/* ---------- Grid shell ---------- */

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

.grid12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}

@media (max-width: 899px) {
  .grid12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- Type primitives ---------- */

.display {
  font-size: var(--t-display);
  line-height: var(--lh-tight);
  font-weight: 800;
  letter-spacing: -0.035em;
  word-break: keep-all;
}

.h1 {
  font-size: var(--t-h1);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
  word-break: keep-all;
}

.h2 {
  font-size: var(--t-h2);
  line-height: var(--lh-snug);
  font-weight: 700;
  letter-spacing: -0.025em;
  word-break: keep-all;
}

.h3 {
  font-size: var(--t-h3);
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.015em;
  word-break: keep-all;
}

.lede {
  font-size: clamp(1.02rem, 1.35vw, 1.32rem);
  line-height: 1.66;
  color: var(--fg-200);
  word-break: keep-all;
}

.body { color: var(--fg-200); word-break: keep-all; }
.muted { color: var(--fg-300); }

.label {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-300);
  font-weight: 500;
}

.index {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  color: var(--purple-lift);
  font-weight: 500;
}

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

/* ---------- Section frame ---------- */

.section {
  position: relative;
  padding-block: var(--s-7);
  border-top: 1px solid var(--ink-500);
}

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

.section--paper {
  background: var(--paper-100);
  color: var(--ink-900);
}
.section--paper .label { color: #6b6558; }
.section--paper .body,
.section--paper .lede { color: #3a372f; }
.section--paper .index { color: var(--purple-deep); }

.section__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.section__head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ink-500);
}
.section--paper .section__head::after { background: var(--paper-300); }

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
