/* ==========================================================================
   Base — reset, typography, layout primitives, utilities, accessibility
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 90px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-sans); font-size: var(--fs-base); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "kern"; text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5 { margin: 0; font-family: var(--font-serif); font-weight: 500; line-height: var(--lh-snug); letter-spacing: var(--tracking-title); font-optical-sizing: auto; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
figure { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-8) 0; }
::selection { background: var(--c-mint); color: var(--c-ink); }
[hidden] { display: none !important; }

/* Focus — always visible for keyboard users */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.on-dark :focus-visible, .on-dark:focus-visible { outline-color: #9cc7ff; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 999; background: var(--c-ink); color: #fff;
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 700; transition: top var(--dur-2);
}
.skip-link:focus { top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Layout primitives */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container-wide { width: min(100% - 2 * var(--gutter), var(--container-wide)); margin-inline: auto; }
.container-read { width: min(100% - 2 * var(--gutter), var(--container-read)); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section-tight { padding-block: calc(var(--section-y) * .6); }
.stack > * + * { margin-top: var(--stack, var(--s-4)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--cluster, var(--s-3)); align-items: center; }
.grid { display: grid; gap: var(--grid-gap); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
@media (max-width: 1023px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-12 > [class*="span-"] { grid-column: 1 / -1; }
}
@media (max-width: 719px) {
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
}

/* Typography utilities */
.display { font-family: var(--font-serif); font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: var(--tracking-display); font-weight: 400; }
.h1 { font-size: var(--fs-4xl); line-height: .98; letter-spacing: var(--tracking-display); }
.h2 { font-size: var(--fs-3xl); line-height: 1.02; letter-spacing: -.035em; }
.h3 { font-size: var(--fs-2xl); line-height: 1.06; }
.h4 { font-size: var(--fs-xl); line-height: 1.12; }
.h5 { font-size: var(--fs-lg); line-height: 1.2; }
.serif { font-family: var(--font-serif); }
.italic, .h1 em, .h2 em, .display em { font-style: italic; }
.lead { font-size: var(--fs-md); line-height: 1.55; color: var(--fg-muted); max-width: 62ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-sans);
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--accent);
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; }
.eyebrow.no-rule::before { display: none; }
.kicker { font-family: var(--font-sans); font-size: var(--fs-micro); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.meta { font-size: var(--fs-xs); color: var(--fg-muted); line-height: 1.7; }
.meta > * { display: inline; }
.meta > time { white-space: nowrap; }
.meta > * + *::before { content: "·"; margin: 0 9px; color: var(--c-line-strong); display: inline-block; }
.meta.no-dots > * + *::before { display: none; }
.muted { color: var(--fg-muted); }
.num { font-family: var(--font-serif); font-variant-numeric: lining-nums tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.balance { text-wrap: balance; }
.pretty { text-wrap: pretty; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rule-top { border-top: 1px solid var(--fg); padding-top: var(--s-4); }
.rule { border-top: 1px solid var(--border); }

/* Link affordance used in running text */
.link { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size var(--dur-2) var(--ease); }
.link:hover { background-size: 100% 1px; }
.link-underline { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link-underline:hover { text-decoration-color: var(--c-coral); }

/* Dark surfaces */
.on-dark { color: #eef2ee; }
.on-dark .muted, .on-dark .meta, .on-dark .lead { color: #b8c6be; }
.on-dark .eyebrow { color: var(--c-mint); }

/* Scroll progress */
.progress { position: fixed; inset: 0 auto auto 0; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--c-coral); z-index: calc(var(--z-header) + 5); pointer-events: none; }

/* Page transition */
.view-enter { animation: viewIn var(--dur-3) var(--ease) both; }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } } /* opacity only: a transform would trap position:fixed children */

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* Route changes move focus to the page title for screen readers; it is not an interactive control */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }
