/* ==========================================================================
   BASE — reset, document shell, typography defaults, utilities.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--s-16);
}

body {
  background: var(--c-mist);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }

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 { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--c-indigo);
  outline-offset: 3px;
  border-radius: 2px;
}
.section--ink :focus-visible { outline-color: var(--c-lilac); }

::selection { background: var(--c-lilac); color: var(--c-ink); }


/* --------------------------------------------------------------------------
   Headings — display serif, optical sizing on, tight leading.
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, .u-display {
  font-family: var(--font-display);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

h1 { font-size: var(--t-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); }
h2 { font-size: var(--t-h2);      line-height: 1.02; letter-spacing: var(--ls-display); }
h3 { font-size: var(--t-h3); }
h4 { font-size: var(--t-h4); }

p { text-wrap: pretty; }


/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

/* The white sheet: the whole site is printed on it, framed by mist. */
.sheet {
  max-width: var(--maxw);
  /* The mist frame is the same width on all four sides at every viewport. */
  width: calc(100% - var(--sheet-margin) * 2);
  margin: var(--sheet-margin) auto;
  background: var(--c-paper);
  border-radius: var(--r-sheet);
  overflow: clip;          /* keeps full-bleed children inside the radius */
  position: relative;
  isolation: isolate;      /* contains the hero's blend-mode to the sheet */
}

/* Horizontal rhythm inside the sheet. */
.wrap { padding-inline: var(--gutter); }

/* Vertical rhythm between sections. */
.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * .62); }

/* Sections that paint their own ground bleed to the sheet edges. */
.section--ink   { background: var(--c-ink-900); color: var(--c-text-invert); }
.section--tint  { background: var(--c-panel); }

.section--ink  { --c-rule: var(--c-rule-invert); --c-text-muted: var(--c-text-invert-muted); }


/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.u-measure   { max-width: var(--measure); }
.u-muted     { color: var(--c-text-muted); }
.u-lead      { font-size: var(--t-lead); line-height: var(--lh-snug); color: var(--c-text-muted); }

.u-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Film grain — a whisper of texture that keeps dark panels from going flat. */
.u-grain::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}


/* --------------------------------------------------------------------------
   Browser surfaces — the parts we did not draw still belong to the design.
   -------------------------------------------------------------------------- */

html { caret-color: var(--c-indigo); }

@supports (scrollbar-color: auto) {
  html { scrollbar-color: var(--c-lilac-500) var(--c-mist); scrollbar-width: thin; }
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--c-mist); }
::-webkit-scrollbar-thumb {
  background: var(--c-lilac-500);
  border-radius: var(--r-pill);
  border: 3px solid var(--c-mist);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-indigo); }

a { text-underline-offset: .18em; text-decoration-thickness: from-font; }

/* Figures and sequence marks read as data, so they line up as data. */
.stage__no, .strip__cell span, .film__kind, .terms__list { font-variant-numeric: tabular-nums; }
