/* ========================================================================
   base.css - reset, design tokens, layout primitives, typography
   Dark editorial-tech system. Single committed theme.
   ======================================================================== */

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

:root {
  color-scheme: dark;

  /* ---- Color ---- */
  --bg: #0a0a0b;
  --surface: #0f0f11;
  --surface-2: #141417;
  --text: #f4f4f5;
  --text-muted: #9c9ca6;
  /* Raised from #63636d to clear WCAG AA (4.5:1) on --bg for the small
     meta text this token is used for (dates, field hints, table labels). */
  --text-dim: #83838f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #6d7cff;
  --accent-bright: #8b96ff;
  --accent-soft: rgba(109, 124, 255, 0.12);
  --on-accent: #0a0a0b;
  --positive: #4ade80;

  /* ---- Type families ---- */
  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- Type scale ---- */
  /* tuned for the two-column hero (copy column ≈ 52% of the container) */
  --fs-hero: clamp(2.5rem, 1.2rem + 3.4vw, 3.9rem);
  --fs-h2: clamp(2.1rem, 1.2rem + 3.6vw, 3.5rem);
  --fs-h3: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem);
  --fs-lead: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  --fs-body: 1.0625rem;
  --fs-sm: 0.9375rem;
  --fs-meta: 0.8125rem;

  --lh-tight: 1.04;
  --lh-snug: 1.22;
  --lh-body: 1.72;
  --tracking-tight: -0.03em;
  --tracking-meta: 0.14em;

  /* ---- Spacing (8px base) ---- */
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-5: 3rem;
  --sp-6: 4.5rem;
  --sp-7: 7rem;
  --sp-8: 10rem;
  --section-pad: clamp(4.5rem, 3rem + 7vw, 9rem);

  /* ---- Radii ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* ---- Layout ---- */
  --container: 1240px;
  --gutter: clamp(1.25rem, 0.5rem + 4vw, 4rem);
  --col-gap: clamp(1rem, 0.4rem + 1.6vw, 2rem);
  --header-h: 116px;
  --header-h-scrolled: 82px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.4s;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 32px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-wrap: balance;
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); letter-spacing: -0.02em; }

p { color: var(--text-muted); text-wrap: pretty; }
strong, b { color: var(--text); font-weight: 600; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 3px;
}

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

.section {
  padding-block: var(--section-pad);
  position: relative;
}
/* full-bleed hairline between sections - not boxes */
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  height: 1px;
  background: var(--border);
}
.section--flush::before { display: none; }

/* Editorial section header: sticky index + title */
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 3.5fr) minmax(0, 8.5fr);
  gap: var(--sp-3) var(--col-gap);
  align-items: start;
  margin-bottom: clamp(3rem, 6vw, 5.5rem);
}
.section-index {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: var(--tracking-meta);
  color: var(--accent);
  padding-top: 0.55rem;
}
.section-head h2,
.section-head h1.section-h1 { max-width: 16ch; }
/* Archive/taxonomy pages carry the real <h1> but keep the section-title look. */
.section-head h1.section-h1 {
  font-size: var(--fs-h2);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
.section-head .section-lead {
  color: var(--text-muted);
  font-size: var(--fs-lead);
  line-height: 1.55;
  max-width: 46ch;
  margin-top: var(--sp-2);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: var(--tracking-meta);
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent);
}

.skip-link {
  position: absolute;
  left: var(--sp-2);
  top: -120px;
  z-index: 999;
  background: var(--text);
  color: var(--bg);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--sp-2); }

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
