@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600;6..72,700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;

  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f1ee;
  --border: #e1e0d9;
  --border-strong: #c3c2b7;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --shadow: 0 10px 34px rgba(11, 11, 11, 0.10);

  /* validated categorical slots (light) */
  --c1: #2a78d6; /* blue */
  --c2: #eb6834; /* orange */
  --c3: #1baf7a; /* aqua */
  --c4: #eda100; /* yellow */
  --c5: #e87ba4; /* magenta */
  --c6: #008300; /* green */
  --c7: #4a3aa7; /* violet */
  --c8: #e34948; /* red */
  --gold: #b8860b; /* halbach finale accent, deliberately distinct from --c4 */

  --good: #0ca30c;
  --warn: #fab219;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #212120;
    --border: #2c2c2a;
    --border-strong: #383835;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);

    --c1: #3987e5;
    --c2: #d95926;
    --c3: #199e70;
    --c4: #c98500;
    --c5: #d55181;
    --c6: #008300;
    --c7: #9085e9;
    --c8: #e66767;
    --gold: #e0b23d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #212120;
  --border: #2c2c2a; --border-strong: #383835;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --gold: #e0b23d;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
/* Theme toggle swaps CSS custom properties on <html>; surfaces that read
   those properties get a brief cross-fade instead of an instant snap. */
.xnav, .stat, .finale, .pstats .ps, .footnote, .tmonth li a.pill,
.pheader, .pstatus, .milestone {
  transition: background-color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}
a { color: var(--c1); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--c1); color: #fff; }

/* ── Layout shell ───────────────────────────────────────────────────────── */
.page { max-width: 1180px; margin: 0 auto; padding: 0 24px 100px; }
.eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px; display: block;
}

/* ── Nav ────────────────────────────────────────────────────────────────── */
.xnav {
  position: sticky; top: 0; z-index: 999;
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.xnav .brand {
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  color: var(--ink); white-space: nowrap;
}
.xnav .brand span { color: var(--muted); font-weight: 400; }
.xnav-links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.xnav-links a {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px; text-decoration: none; border: 1px solid transparent;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.xnav-links a:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.themebtn {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform 80ms var(--ease-out);
}
.themebtn:hover { border-color: var(--border-strong); color: var(--ink); }
.themebtn:active { transform: scale(0.94); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { padding: 88px 0 56px; }
.hero h1 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em;
  font-size: clamp(38px, 7vw, 76px); line-height: 1.04; text-wrap: balance;
  margin-bottom: 20px;
}
.hero h1 em {
  font-style: normal; background: linear-gradient(90deg, var(--c1), var(--c7));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 19px; color: var(--ink-2); max-width: 62ch; margin-bottom: 10px; }
.hero .who { font-family: var(--mono); font-size: 13.5px; color: var(--muted); }
.hero .who b { color: var(--ink); font-weight: 600; }
.scrollcue {
  margin-top: 56px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--muted); text-transform: uppercase; display: flex; align-items: center; gap: 8px;
}
.scrollcue::after { content: ''; width: 1px; height: 28px; background: var(--border-strong); animation: pulse-down 1.8s ease-in-out infinite; }
@keyframes pulse-down { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ── Stat strip ─────────────────────────────────────────────────────────── */
.statstrip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; margin: 48px 0 12px;
}
.stat { background: var(--surface); padding: 22px 20px; }
.stat .num {
  font-family: var(--mono); font-weight: 700; font-size: clamp(24px, 3.4vw, 34px);
  color: var(--ink); letter-spacing: -0.01em;
}
.stat .lbl { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
@media (max-width: 720px) { .statstrip { grid-template-columns: repeat(2, 1fr); } }

/* ── Section headers ────────────────────────────────────────────────────── */
.section { padding: 72px 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: none; }
.section-head { max-width: 68ch; margin-bottom: 40px; }
.section-head h2 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -0.01em; margin-bottom: 10px; text-wrap: balance;
}
.section-head p { color: var(--ink-2); font-size: 16px; line-height: 1.65; }

/* ── Timeline ───────────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--border-strong), var(--border));
}
.tmonth { margin-bottom: 40px; position: relative; opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.tmonth.in-view { opacity: 1; transform: translateY(0); }
.timeline .tmonth:nth-child(2) { transition-delay: 60ms; }
.timeline .tmonth:nth-child(3) { transition-delay: 120ms; }
.timeline .tmonth:nth-child(4) { transition-delay: 180ms; }
.timeline .tmonth:nth-child(5) { transition-delay: 240ms; }
.timeline .tmonth:nth-child(6) { transition-delay: 300ms; }
.tmonth::before {
  content: ''; position: absolute; left: -28px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--c1);
}
.tmonth h3 {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--c1); margin-bottom: 10px;
}
.tmonth ul { list-style: none; display: grid; gap: 8px; }
.tmonth li {
  font-size: 15px; color: var(--ink-2); line-height: 1.55; padding-left: 16px; position: relative;
}
.tmonth li::before { content: '—'; position: absolute; left: 0; color: var(--muted); }
.tmonth li b { color: var(--ink); font-weight: 600; }
.tmonth li a.pill {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--ink-2); margin-left: 6px; white-space: nowrap;
  display: inline-block;
}
.tmonth li a.pill:hover { text-decoration: none; border-color: var(--c1); color: var(--c1); }

/* ── Project card grid ──────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
a.card {
  --accent: var(--c1);
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: 14px; padding: 24px; color: inherit; text-decoration: none;
  opacity: 0; transform: translateY(14px);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out),
              opacity .5s var(--ease-out), transform .5s var(--ease-out);
}
a.card.in-view { opacity: 1; transform: translateY(0); }
/* Group entrance: a small stagger reads as intentional rather than all nine
   cards popping in as one flat block when the grid enters the viewport at once. */
.cards a.card:nth-child(1) { transition-delay: 0ms, 0ms, 0ms, 0ms, 0ms, 0ms; }
.cards a.card:nth-child(2) { transition-delay: 0ms, 0ms, 0ms, 0ms, 40ms, 40ms; }
.cards a.card:nth-child(3) { transition-delay: 0ms, 0ms, 0ms, 0ms, 80ms, 80ms; }
.cards a.card:nth-child(4) { transition-delay: 0ms, 0ms, 0ms, 0ms, 120ms, 120ms; }
.cards a.card:nth-child(5) { transition-delay: 0ms, 0ms, 0ms, 0ms, 160ms, 160ms; }
.cards a.card:nth-child(6) { transition-delay: 0ms, 0ms, 0ms, 0ms, 200ms, 200ms; }
.cards a.card:nth-child(7) { transition-delay: 0ms, 0ms, 0ms, 0ms, 240ms, 240ms; }
.cards a.card:nth-child(8) { transition-delay: 0ms, 0ms, 0ms, 0ms, 280ms, 280ms; }
.cards a.card:nth-child(9) { transition-delay: 0ms, 0ms, 0ms, 0ms, 320ms, 320ms; }
/* Hover-lift only where hover is a real, precise pointer gesture — on touch,
   a tap would otherwise leave the card looking "stuck" mid-lift. */
@media (hover: hover) and (pointer: fine) {
  a.card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
}
a.card:active { transform: scale(0.985); transition-duration: 80ms; }
.c-eyebrow { font-family: var(--mono); font-size: 11px; color: var(--accent, var(--c1)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: inline-block; }
.card h3 { font-family: var(--serif); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.card .c-tag { font-size: 14px; color: var(--ink-2); }
.card .c-range { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.card .c-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.card .c-stat { font-family: var(--mono); }
.card .c-stat .v { font-size: 17px; font-weight: 700; color: var(--ink); }
.card .c-stat .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card .c-open { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent); }

/* ── Halbach finale ─────────────────────────────────────────────────────── */
.finale {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 44px 40px; position: relative; overflow: hidden;
}
.finale::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background: radial-gradient(600px 240px at 15% 0%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 70%);
}
.finale .eyebrow { color: var(--gold); }
.finale h2 { font-family: var(--serif); font-size: clamp(28px, 4vw, 40px); font-weight: 600; margin-bottom: 14px; }
.finale .lede { font-size: 17px; color: var(--ink-2); max-width: 62ch; margin-bottom: 28px; }
.finale-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.ffact .l { font-family: var(--mono); font-size: 10.5px; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.ffact .v { font-size: 14.5px; color: var(--ink); line-height: 1.5; }
.finale .milestone {
  font-size: 14.5px; color: var(--ink); background: color-mix(in srgb, var(--gold) 12%, var(--surface));
  border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; padding: 12px 16px; margin-bottom: 16px;
}
.finale .fnote { font-size: 12.5px; color: var(--muted); font-style: italic; }

/* ── Supporting / footer ────────────────────────────────────────────────── */
.footnote {
  font-size: 14px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 22px; margin-top: 8px;
}
footer.site {
  margin-top: 60px; padding-top: 28px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

/* ── Project detail page ────────────────────────────────────────────────── */
.pheader { padding: 48px 0 20px; }
.pheader .back { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-bottom: 22px; display: inline-block; }
.pheader .back:hover { color: var(--ink); text-decoration: none; }
.pheader .c-eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.pheader h1 { font-family: var(--serif); font-size: clamp(34px, 6vw, 56px); font-weight: 600; letter-spacing: -0.02em; margin: 10px 0 8px; }
.pheader .tag { font-size: 18px; color: var(--ink-2); margin-bottom: 6px; }
.pheader .range { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.pheader .who { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 4px; }

.pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 28px 0; }
.pstats .ps { background: var(--surface); padding: 18px; }
.pstats .ps .v { font-family: var(--mono); font-weight: 700; font-size: 22px; }
.pstats .ps .l { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.pbody { display: grid; grid-template-columns: 2fr 1fr; gap: 44px; padding: 20px 0 60px; }
.psummary { font-size: 17px; line-height: 1.7; color: var(--ink-2); max-width: 68ch; margin-bottom: 32px; }
.phighlights h4, .paside h4 {
  font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: 14px;
}
.phighlights ul { list-style: none; display: grid; gap: 12px; }
.phighlights li { padding-left: 20px; position: relative; font-size: 15px; line-height: 1.6; }
.phighlights li::before { content: '▸'; position: absolute; left: 0; color: var(--accent, var(--c1)); }
.pstatus {
  margin-top: 32px; font-size: 14.5px; color: var(--ink); background: var(--surface);
  border-left: 3px solid var(--accent, var(--c1)); border-radius: 0 8px 8px 0; padding: 14px 18px;
}
.paside { display: grid; gap: 28px; align-content: start; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.paside ul { list-style: none; display: grid; gap: 6px; }
.paside li { font-size: 13.5px; color: var(--ink-2); }
.psource { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.pnav { display: flex; justify-content: space-between; padding: 24px 0 60px; border-top: 1px solid var(--border); gap: 16px; flex-wrap: wrap; }
.pnav a { display: block; max-width: 45%; }
.pnav a .d { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.pnav a .t { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.pnav a:hover .t { text-decoration: underline; }
.pnav a.next { text-align: right; margin-left: auto; }

@media (max-width: 800px) {
  .pbody { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 40px; }
}
