/* ============================================================
   Reset + base typography
   ============================================================ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Lenis drives scrolling; native smooth-scroll would fight it. */
  scroll-behavior: auto;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
  overflow-x: hidden;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select { font: inherit; color: inherit; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

/* ── Headings ─────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  font-optical-sizing: auto;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 {
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

/* ── Links ────────────────────────────────────────────────── */

a { color: inherit; text-decoration: none; }

a:not([class]) {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color var(--dur-micro) var(--ease);
}

a:not([class]):hover { color: var(--accent); }

/* ── Focus: visible, branded, keyboard-only ───────────────── */

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

:focus:not(:focus-visible) { outline: none; }

/* ── Utilities ────────────────────────────────────────────── */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-3);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  transform: translateY(-200%);
  transition: transform var(--dur-micro) var(--ease);
}

.skip-link:focus { transform: translateY(0); }

/* ── Layout primitives ────────────────────────────────────── */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--page-x) * 2);
  margin-inline: auto;
  padding-inline: var(--page-x);
}

.container--narrow { max-width: calc(var(--container-narrow) + var(--page-x) * 2); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--section-y-tight); }

.measure { max-width: var(--measure); }
.measure--short { max-width: var(--measure-short); }

/* Hairline rule — the primary structural device of this design. */
.rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── The mono label: small caps, tracked, brass tick ──────── */

.label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  font-weight: 400;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-subtle);
  line-height: 1;
}

.label::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: var(--accent);
  flex: none;
}

.label--bare::before { display: none; }

/* Every figure on this site is monospaced. It is the signature move:
   it makes numbers read as audited rather than asserted. */
.figure {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.55;
  color: var(--text-muted);
  letter-spacing: var(--tracking-tight);
}

/* ── Motion: reveal (progressive enhancement) ─────────────── */

/* Only applies once JS confirms it can run. Without JS the content is
   simply visible — never hidden behind an animation that never fires. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  will-change: opacity, transform;
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

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

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
