/* ============================================================
   Base — reset, typography, layout primitives
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--ink);
  background: var(--bg);
  font-kerning: normal;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';   /* Inter stylistic sets */
  overflow-x: hidden;
}

/* Headlines — editorial serif */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: 'opsz' 144, 'SOFT' 25, 'WONK' 0;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  color: var(--ink);
  margin: 0;
}

h1 { font-size: var(--fs-5xl); }
h2 { font-size: var(--fs-3xl); letter-spacing: var(--tracking-snug); }
h3 { font-size: var(--fs-2xl); letter-spacing: var(--tracking-snug); }
h4 { font-size: var(--fs-xl); letter-spacing: var(--tracking-snug); }

/* Body */
p { margin: 0; text-wrap: pretty; }
article p, .prose p { line-height: var(--lh-relaxed); color: var(--ink-soft); }
article p + p, .prose p + p { margin-top: var(--s-4); }

/* Links */
a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration: underline; }

/* Images */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}
img { font-style: italic; background: var(--bg-sunk); }

/* Forms */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }

/* Selection */
::selection { background: var(--sage-soft); color: var(--ink); }

/* Focus — keyboard only. Mouse / touch get no focus ring (no purple flash) */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
  border-radius: var(--r-1);
}

/* Kill the mobile blue/purple tap highlight on every interactive element */
* { -webkit-tap-highlight-color: transparent; }

/* ---------- Utility primitives ---------- */
.container {
  width: 100%;
  max-width: var(--max-w-content);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-prose {
  width: 100%;
  max-width: var(--max-w-prose);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack > * + * { margin-top: var(--stack-gap, var(--s-4)); }
.stack-tight > * + * { margin-top: var(--s-2); }
.stack-loose > * + * { margin-top: var(--s-6); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cluster-gap, var(--s-3));
  align-items: center;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.grid {
  display: grid;
  gap: var(--grid-gap, var(--s-5));
}

.section {
  padding-block: clamp(var(--s-6), 6.5vw, var(--s-8));
}

.section-tight {
  padding-block: clamp(var(--s-5), 4vw, var(--s-7));
}

/* ---------- Eyebrow / label ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--ink-mute);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.eyebrow::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.eyebrow-sage { color: var(--sage-deep); }

/* ---------- Display variants ---------- */
.display-xl {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-6xl);
  line-height: 0.96;
  letter-spacing: -0.028em;
  font-variation-settings: 'opsz' 144, 'SOFT' 25;
}

.display-italic {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}

/* Hairline divider */
.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* Tabular numerics */
.tabular { font-variant-numeric: tabular-nums; }

/* Small caps for credentials */
.small-caps {
  font-variant-caps: all-small-caps;
  letter-spacing: var(--tracking-label);
}

/* Visually hidden but available to a11y */
.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;
}

/* Dark band — inverse surfaces */
.band-deep {
  background: var(--bg-deep);
  color: var(--ink-on-deep);
}
.band-deep h1, .band-deep h2, .band-deep h3, .band-deep h4 { color: var(--ink-on-deep); }
.band-deep p { color: var(--ink-on-deep-soft); }
.band-deep .eyebrow { color: var(--ink-on-deep-soft); }
.band-deep .hr { border-color: oklch(42% 0.030 200); }
