/* ==========================================================================
   BASE — reset, document defaults, and typography.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

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

/* --- Headings ---------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--text);
}

h1 { font-size: var(--step-5); letter-spacing: -0.025em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); line-height: 1.25; }
h4 { font-size: var(--step-0); line-height: 1.35; font-weight: 600; }

/* --- Prose ------------------------------------------------------------- */

p, li { text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: color var(--dur-fast) var(--ease),
              text-decoration-color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

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

strong { font-weight: 600; color: var(--text); }

em { font-style: italic; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-tint);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-s);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--space-xl) 0;
}

blockquote {
  border-left: 2px solid var(--rule-strong);
  padding-left: var(--space-m);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.45;
}

ul, ol { padding-left: 1.25em; }

/* A reading column: paragraphs and lists get comfortable rhythm. */
.prose > * + * { margin-block-start: var(--space-s); }
.prose > * + h2 { margin-block-start: var(--space-xl); }
.prose > * + h3 { margin-block-start: var(--space-l); }
.prose h2 + *, .prose h3 + * { margin-block-start: var(--space-xs); }
.prose p, .prose li { color: var(--text-muted); }

/* Justified body copy. Hyphenation keeps the word spacing even in a narrow
   column; without it justified text opens up rivers of white space. */
.prose p {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  /* Only hyphenate words of 8+ characters, leaving at least 4 letters on each
     side. Without this the narrow column produces breaks like "mod-el". */
  hyphenate-limit-chars: 8 4 4;
}

/* A phone column is too narrow to justify well: the word gaps go ragged and
   hyphenation fires constantly. Set it flush left instead. */
@media (max-width: 36rem) {
  .prose p {
    text-align: left;
    hyphens: manual;
    -webkit-hyphens: manual;
  }
}
.prose li + li { margin-block-start: var(--space-3xs); }
.prose ul, .prose ol { padding-left: 1.15em; }

/* --- Reusable text roles ----------------------------------------------- */

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.lede {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.4;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.meta {
  font-size: var(--step--1);
  color: var(--text-faint);
}

.text-muted { color: var(--text-muted); }

/* --- Accessibility helpers --------------------------------------------- */

.visually-hidden {
  position: absolute;
  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;
  top: 0; left: var(--space-s);
  transform: translateY(-120%);
  z-index: 100;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2xs) var(--space-s);
  border: 1px solid var(--rule-strong);
  border-radius: 0 0 var(--radius-m) var(--radius-m);
  font-size: var(--step--1);
  text-decoration: none;
  transition: transform var(--dur) var(--ease);
}

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