/* ==========================================================================
   base.css  |  reset, type, shared primitives, smooth-scroll support
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto;          /* smoothing is handled by motion.js */
  scroll-padding-top: var(--nav-h);   /* only matters without smooth scroll */
}

/* Lenis (smooth scroll) hooks */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped, html.is-locked, html.is-locked body { overflow: hidden; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* a whisper of paper grain over everything; below the viewer and envelope */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

img, svg, canvas, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }

/* Display type: one tall serif, set large and tight. It has a single weight,
   so never ask for bold (that would be synthesised). */
.display, h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }

p { max-width: var(--measure); text-wrap: pretty; }
.soft { color: var(--text-soft); }

a { color: var(--accent); text-underline-offset: 0.25em; }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* Text mask: lines rise out of a clip box. Padding gives descenders room. */
.mask {
  display: block;
  overflow: hidden;
  padding-block: 0.12em 0.24em;
  margin-block: -0.12em -0.24em;
}
.mask > * { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
