/* ==========================================================================
   BASE — typography, layout primitives, section rhythm
   ========================================================================== */

/* overflow-x: clip (not hidden) — `hidden` makes the element a scroll
   container, which silently breaks position: sticky on the header. */
html { overflow-x: clip; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bone);
  overflow-x: clip;
}

/* ---- Headings ----------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); letter-spacing: -0.02em; }
h4 { font-size: var(--fs-h4); line-height: var(--lh-snug); letter-spacing: -0.015em; font-weight: 700; }

p { text-wrap: pretty; }

strong { font-weight: 650; }

/* ---- Layout primitives -------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--wide { max-width: 1560px; }
.wrap--tight { max-width: 940px; }

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

.section--dark {
  background: var(--ink);
  color: var(--bone);
}

.section--soft {
  background: var(--bone-deep);
}

.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--bone); }

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

/* ---- Eyebrow ------------------------------------------------------------ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: var(--sp-4);
}

.section--dark .eyebrow { color: var(--brass); }

.eyebrow::before {
  content: '';
  width: 28px;
  height: 2px;
  background: var(--crest);
  flex: none;
}

/* ---- Oversized section numeral ------------------------------------------ */
.section-index {
  display: block;          /* keeps the eyebrow from colliding with the numeral */
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 0.8;
  letter-spacing: -0.05em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line-strong);
  pointer-events: none;
  user-select: none;
}

/* ---- Section header ----------------------------------------------------- */
.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: var(--sp-6) var(--sp-8);
  align-items: end;
  margin-bottom: var(--sp-8);
}

.sec-head__lede {
  color: var(--slate);
  font-size: var(--fs-lead);
  max-width: 52ch;
}

.section--dark .sec-head__lede { color: var(--mist); }

/* ---- Body copy ---------------------------------------------------------- */
.prose > * + * { margin-top: var(--sp-5); }
.prose p { color: var(--slate); }
.section--dark .prose p { color: var(--mist); }

.prose h3 { margin-top: var(--sp-7); color: var(--ink); }
.section--dark .prose h3 { color: var(--bone); }

.prose ul {
  list-style: none;
  display: grid;
  gap: var(--sp-3);
}

.prose ul li {
  position: relative;
  padding-left: 1.75rem;
  color: var(--slate);
}

.section--dark .prose ul li { color: var(--mist); }

.prose ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 9px;
  height: 9px;
  background: var(--crest);
  transform: rotate(45deg);
}

/* ---- Inline link -------------------------------------------------------- */
.link {
  position: relative;
  color: inherit;
  font-weight: 600;
  background-image: linear-gradient(var(--crest), var(--crest));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size var(--d-base) var(--ease-out);
}

.link:hover, .link:focus-visible { background-size: 100% 2px; }

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: var(--z-toast);
  background: var(--crest);
  color: var(--bone);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  font-weight: 700;
  transition: top var(--d-micro) var(--ease-out);
}

.skip-link:focus { top: var(--sp-4); }

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

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  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='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
