/* ============================================================
   base.css — reset, typography, layout utilities
   ============================================================ */

*, *::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(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Film grain overlay — fixed, low-opacity, no layout impact */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.85  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
img { border-style: none; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
  border-radius: 2px;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--track-tight);
  margin: 0 0 0.5em;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-h3); line-height: 1.25; }
h4 { font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600; letter-spacing: var(--track-cap); text-transform: uppercase; color: var(--accent-ink); line-height: 1.3; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 1em; padding-left: 1.2em; }
li { margin-bottom: 0.35em; }
li:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

small, .small { font-size: var(--fs-sm); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* ---------- Layout utilities ---------- */
.container { width: var(--maxw); margin: 0 auto; }
.page-grid { width: var(--maxw); margin: 0 auto; }
.narrow { width: var(--maxw-narrow); margin: 0 auto; }
.wide { width: var(--maxw-wide); margin: 0 auto; }

.section { padding: var(--s-9) 0; position: relative; z-index: 2; }
.section--tight { padding: var(--s-8) 0; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-cap);
  font-weight: 600;
  letter-spacing: var(--track-cap);
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 var(--s-4);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent-line);
  display: inline-block;
}

.lead {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 0.6vw + 1rem, 1.5rem);
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 var(--s-6);
  max-width: 56ch;
}

.prose { max-width: 64ch; }
.prose p { margin-bottom: 1.1em; }
.prose a { color: var(--accent-ink); }

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: 0 0 var(--r-md) 0;
  font-weight: 600;
  font-size: var(--fs-sm);
}
.skip-link:focus { left: 0; color: var(--on-accent); text-decoration: none; }

/* Reading progress bar */
.progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  z-index: 150;
  pointer-events: none;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: width 80ms linear;
}

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity var(--dur-slow) var(--ease-soft), transform var(--dur-slow) var(--ease-soft); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

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

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