/*
 * base.css - reset, design tokens and typography.
 * All colors live here as custom properties; other files use the tokens.
 */

:root {
  /* Surfaces and ink */
  --bg: #FFFFFF;
  --bg-soft: #F6F7F9;
  --bg-sunken: #EEF0F4;
  --ink: #0B1220;
  --ink-2: #3A4458;
  --ink-3: #5F687B;
  --line: #E3E6EC;
  --line-strong: #0B1220;
  --accent: #2552E8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8EEFF;
  --accent-hover: #1C43C7;
  --success: #12805C;  --success-soft: #E3F5EE;
  --danger:  #C92A2A;  --danger-soft:  #FDECEC;
  --warning: #B7791F;  --warning-soft: #FDF4E3;
  --warning-ink: #7A4F0E;
  --focus: #2552E8;
  --white: #FFFFFF;
  --footer-muted: #B6BDCC;
  --backdrop: rgba(11, 18, 32, .55);
  --overlay: rgba(255, 255, 255, .94);

  /* Stroop stimulus colors (high contrast on white) */
  --c-red: #D62828; --c-blue: #1D4ED8; --c-green: #15803D;
  --c-yellow: #CA8A04; --c-purple: #7E22CE; --c-black: #111111;

  /* Group colors */
  --g-attention: var(--accent);
  --g-speed: var(--c-yellow);
  --g-memory: var(--c-purple);

  /* Typography */
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-display: clamp(40px, 6vw + 12px, 64px);
  --fs-h2: clamp(28px, 2.4vw + 18px, 40px);
  --fs-h3: clamp(20px, .4vw + 18px, 22px);
  --fs-lead: clamp(18px, .3vw + 17px, 20px);
  --fs-body: clamp(16px, .15vw + 15.5px, 17px);
  --fs-small: 14px;
  --fs-micro: 12px;
  --fs-stimulus: clamp(56px, 12vw, 120px);
  --fs-metric: clamp(40px, 8vw, 72px);

  /* Spacing (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;

  /* Layout */
  --container: 1200px;
  --container-narrow: 760px;
  --gutter: 16px;
  --header-h: 64px;

  /* Motion */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-micro: 160ms;
  --t-small: 280ms;

  /* Elevation (hard shadows only) */
  --shadow-hover: 4px 4px 0 var(--ink);
  --shadow-panel: 6px 6px 0 var(--ink);
  --shadow-shell: 8px 8px 0 var(--ink);

  /* Z-index scale */
  --z-header: 50; --z-dropdown: 60; --z-backdrop: 90; --z-modal: 100; --z-toast: 110;

  color-scheme: light;
}

@media (min-width: 768px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
*, *::before, *::after { border-radius: 0 !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
svg.icon { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
main:focus { outline: none; }

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

/* Focus */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-3); border: 2px solid var(--bg); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font); color: var(--ink); }
.display, .hero-title, .page-title {
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.03em;
}
.page-title { font-size: clamp(34px, 4vw + 14px, 56px); }
.section-title, h2.h2 {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.sub-title, .card-title, h3.h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.3;
}
.card-title { font-size: 18px; }
.lead {
  font-size: var(--fs-lead);
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink-2);
}
.small, small { font-size: var(--fs-small); font-weight: 500; line-height: 1.5; }
.eyebrow {
  font-size: var(--fs-micro);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.muted { color: var(--ink-3); }
.num, .tabular { font-variant-numeric: tabular-nums; }

.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;
}

.skip-link {
  position: absolute;
  left: var(--s-4); top: -100px;
  z-index: 200;
  background: var(--ink); color: var(--white);
  padding: var(--s-3) var(--s-4);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--s-4); color: var(--white); }

/* Article prose */
.prose { color: var(--ink-2); max-width: 68ch; }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: clamp(24px, 1.6vw + 16px, 30px); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: var(--s-7); color: var(--ink); }
.prose h3 { font-size: var(--fs-h3); font-weight: 700; margin-top: var(--s-6); color: var(--ink); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul { list-style: square; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: var(--s-2); }
.prose blockquote { border-left: 4px solid var(--accent); padding: var(--s-2) 0 var(--s-2) var(--s-5); color: var(--ink); font-weight: 500; }
.prose code { background: var(--bg-sunken); padding: 1px 6px; font-size: .92em; }
.prose table { font-size: var(--fs-small); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.prose th, .prose td { border: 1px solid var(--line); padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); color: var(--ink); font-weight: 700; }

/* Motion: hidden start states apply only after Motion has loaded (motion.js
   adds .motion-ready) and are lifted by .motion-done after 2.5 s. */
.js.motion-ready:not(.motion-done) [data-reveal]:not(.is-revealed),
.js.motion-ready:not(.motion-done) [data-stagger-item]:not(.is-revealed),
.js.motion-ready:not(.motion-done) [data-hero-item] { opacity: 0; }
