/* =====================================================================
   BASE — reset, typography, layout primitives, utilities, motion
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
body.is-locked { overflow: hidden; }
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  color: var(--ink);
  font-optical-sizing: auto;
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: -0.025em; }
h2 { font-size: var(--fs-2xl); line-height: 1.12; letter-spacing: -0.02em; }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h1 em, h2 em, h3 em, .hl em { font-style: italic; color: var(--primary-text); font-weight: 450; }
::selection { background: color-mix(in oklab, var(--primary) 25%, transparent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(820px + var(--gutter) * 2); }
.section { padding-block: var(--section); position: relative; }
.section--tight { padding-block: calc(var(--section) * 0.6); }
.section--alt { background: var(--bg-alt); }
.section--surface { background: var(--surface); }
.section:not(.section--alt):not(.section--inverse):not(.section--surface) + .section:not(.section--alt):not(.section--inverse):not(.section--surface) { padding-top: 0; }
.section--inverse {
  background: var(--inverse-bg);
  color: var(--inverse-ink);
  --ink: var(--inverse-ink);
  --muted: var(--inverse-muted);
  --line: var(--inverse-line);
  --primary-text: color-mix(in oklab, var(--primary) 45%, #ffffff);
}
.grid { display: grid; gap: var(--space-5); }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Text helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.65em;
  font-family: var(--font-body);
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--primary-text);
  margin: 0 0 1.1rem;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1.5px; background: currentColor; opacity: 0.7;
}
.eyebrow .idx { font-variant-numeric: tabular-nums; color: var(--muted); }
.lead { font-size: var(--fs-md); color: var(--muted); line-height: 1.6; max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.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: fixed; left: 16px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none; transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------- Section heading ---------- */
.section-head { display: grid; gap: var(--space-4); margin-bottom: clamp(2.2rem, 1.5rem + 2.5vw, 3.75rem); }
.section-head h2 { margin: 0; max-width: 20ch; }
.section-head .lead { margin: 0; }
.section-head--center { justify-items: center; text-align: center; }
.section-head--center h2 { max-width: 22ch; }
@media (min-width: 900px) {
  .section-head--split { grid-template-columns: 1.2fr 1fr; align-items: end; column-gap: var(--space-8); }
  .section-head--split .eyebrow { grid-column: 1 / -1; margin-bottom: -0.25rem; }
  .section-head--split .section-head__aside { display: grid; gap: var(--space-4); justify-items: start; }
}

/* ---------- Media wrapper (loading + error states) ---------- */
.media {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(110deg, var(--bg-alt) 30%, color-mix(in oklab, var(--bg-alt) 60%, var(--surface)) 50%, var(--bg-alt) 70%);
  background-size: 250% 100%;
  animation: shimmer 1.6s linear infinite;
  aspect-ratio: var(--ratio, 4 / 3);
}
.media.is-loaded { animation: none; background: var(--bg-alt); }
.media img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s var(--ease), transform 0.9s var(--ease); }
.media.is-loaded img, .media img.is-loaded { opacity: 1; }
.media.is-broken img { object-fit: contain; padding: 18%; opacity: 0.55; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---------- Reveal on scroll ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: var(--delay, 0s); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }
[data-motion="off"] [data-reveal] { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- Icons ---------- */
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon--fill { fill: currentColor; stroke: none; }

/* ---------- No-JS fallback ---------- */
.nojs { max-width: 640px; margin: 18vh auto; padding: 0 24px; text-align: center; }
