/* Base: reset, type, layout primitives, header, footer, buttons. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@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(--step-0);
  line-height: 1.6;
  font-weight: 380;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* A whisper of paper grain, so flat surfaces feel made rather than rendered. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain-opacity);
  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='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, canvas { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

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

em { font-style: italic; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -3rem; z-index: 200;
  background: var(--text); color: var(--bg); padding: 0.5rem 0.9rem; border-radius: var(--radius-sm);
  text-decoration: none; transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.mono { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: -0.01em; color: var(--text-muted); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.site-header[data-scrolled] {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom-color: var(--line);
}
.site-header__inner {
  max-width: var(--max); margin: 0 auto; padding: 0.75rem var(--gutter);
  display: flex; align-items: center; gap: var(--space-5);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-weight: 520; letter-spacing: -0.02em; }
.brand__name { font-size: 1.0625rem; }
.brand__name span { color: var(--text-faint); font-weight: 420; }
.site-nav { display: flex; gap: var(--space-5); margin-left: auto; font-size: 0.9rem; }
.site-nav a { color: var(--text-muted); text-decoration: none; transition: color var(--dur-micro) ease; }
.site-nav a:hover, .site-nav a[aria-current="true"] { color: var(--text); }
.site-header__actions { display: flex; align-items: center; gap: var(--space-2); }
@media (max-width: 860px) {
  .site-nav { display: none; }
  .site-header__actions { margin-left: auto; }
}

.icon-button {
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border-radius: var(--radius-pill); border: 1px solid var(--line); background: transparent; color: var(--text-muted);
  transition: color var(--dur-micro) ease, border-color var(--dur-micro) ease, transform var(--dur-micro) ease;
}
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }
.icon-button:active { transform: scale(0.94); }
.icon-button svg { width: 1.05rem; height: 1.05rem; display: none; }
.icon-button[data-mode="system"] .i-system,
.icon-button[data-mode="light"] .i-light,
.icon-button[data-mode="dark"] .i-dark { display: block; }

/* ── Buttons ────────────────────────────────────────────── */
.button {
  --b-bg: var(--text); --b-fg: var(--bg); --b-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 1.15rem; border-radius: var(--radius-pill);
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-line);
  font-size: 0.9375rem; font-weight: 500; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) ease, border-color var(--dur-micro) ease, box-shadow var(--dur) ease;
}
.button:hover { box-shadow: var(--shadow); }
.button:active { transform: scale(0.975); transition-timing-function: var(--ease-spring); }
.button svg { width: 1.05rem; height: 1.05rem; }
.button .gh { stroke: none; }
.button--quiet { --b-bg: transparent; --b-fg: var(--text); --b-line: var(--line-strong); }
.button--quiet:hover { --b-line: var(--text-faint); box-shadow: none; }
.button--small { min-height: 2.25rem; padding: 0 0.85rem; font-size: 0.875rem; }
.button--pill { min-height: 3rem; padding: 0 1.5rem; }
.button--primary { --b-bg: var(--text); --b-fg: var(--bg); }
.text-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; transition: text-decoration-color var(--dur-micro) ease; }
.text-link:hover { text-decoration-color: currentColor; }

/* ── Sections ───────────────────────────────────────────── */
.section { max-width: var(--max); margin: 0 auto; padding: var(--section-pad) var(--gutter) 0; }
.section__head { max-width: 46rem; margin-bottom: clamp(2.5rem, 2rem + 3vw, 4.5rem); }
.section__head .eyebrow { margin-bottom: var(--space-4); }
.section__title {
  font-family: var(--font-display); font-weight: 400; font-size: var(--step-3);
  line-height: 1.02; letter-spacing: -0.02em; text-wrap: balance;
}
.section__title em { color: var(--text-muted); }
.section__lede { margin-top: var(--space-5); font-size: var(--step-1); line-height: 1.55; color: var(--text-muted); max-width: 38rem; text-wrap: pretty; }
.fineprint { margin-top: var(--space-6); max-width: 44rem; font-size: var(--step--1); color: var(--text-faint); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.25rem, 1rem + 1.2vw, 2rem); }

.dot { display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--success); flex: none; }
.dot--amber { background: var(--warning); }

/* Scroll reveal: content rises a few pixels into place. Off entirely with reduced motion. */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; } }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); margin-top: var(--space-8); }
.site-footer__inner {
  max-width: var(--max); margin: 0 auto; padding: var(--space-6) var(--gutter) calc(var(--space-6) + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-6);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: 0.875rem; }
.site-footer nav a { color: var(--text-muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }
.site-footer__note { margin-left: auto; font-size: 0.8125rem; color: var(--text-faint); }
@media (max-width: 720px) { .site-footer__note { margin-left: 0; width: 100%; } }
