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

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Prevent horizontal overflow without clipping sticky/position children. */
  overflow-x: clip;
}

body {
  overflow-x: clip;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "calt";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@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;
  }
}

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

/* Inputs must never trigger iOS zoom — keep >= 16px. */
input, textarea, select, button {
  font: inherit;
  font-size: max(1rem, var(--step-0));
  color: inherit;
}

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

/* --- Headings ------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: 1.06;
  letter-spacing: -0.014em;
  text-wrap: balance;
  /* Newsreader large optical size for a confident editorial display cut. */
  font-variation-settings: "opsz" 72;
  font-optical-sizing: auto;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }

/* --- Links ---------------------------------------------------------------- */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--rule-strong);
  transition: text-decoration-color 0.2s var(--reveal-curve);
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong, b { font-weight: 600; }
em, i { font-style: italic; }

/* --- Layout primitives ---------------------------------------------------- */

/* The centered reading column. Width = measure, generous gutter on small. */
.measure {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.measure--wide { max-width: var(--measure-wide); }

/* Full-bleed band: spans viewport width, content re-centered inside. */
.bleed {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.bleed > .bleed__inner {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
}

/* Hairline rule. */
.rule {
  border: 0;
  border-top: var(--rule-hair) solid var(--rule);
  width: 100%;
}

/* Visually hidden but accessible. */
.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. */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6em 1em;
  text-decoration: none;
  border-radius: 2px;
}
.skip-link:focus { top: var(--space-xs); }
