/* Fonts are self-hosted (SIL Open Font License, texts in /fonts/), so nothing loads from other origins. */
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #f3f1ea;
  --surface: #fbfaf5;
  --ink: #0f0f10;
  --muted: #5c5b56;
  --faint: #9a988f;
  --rule: rgba(15, 15, 16, 0.14);
  --blue: #2a3cff;
  --lime: #d8ff3e;
  --orange: #ff6b35;
  --band: #0f0f10;    /* the dark research panel */
  --deep: #2a3cff;    /* filled blue surfaces with white text, the same in both themes */
  --on-ink: var(--lime); /* accents on an ink-coloured background */
  /* names book.js reads for the order book strip */
  --bg: var(--paper);
  --accent: var(--blue);
  --ask: var(--orange);
  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 46rem;
  --wide: 84rem;
  color-scheme: light;
}

/* Dark theme. It follows the system setting unless the visitor picked a theme with the
   switch in the navigation, which theme.js restores from localStorage. */
:root[data-theme="dark"] {
  --paper: #0e0f12; --surface: #17181c; --ink: #efede6; --muted: #a6a49b; --faint: #6f6d67;
  --rule: rgba(239, 237, 230, 0.14); --blue: #5f70ff; --orange: #ff7a45; --band: #1a1b21; --on-ink: #2a3cff;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e0f12; --surface: #17181c; --ink: #efede6; --muted: #a6a49b; --faint: #6f6d67;
    --rule: rgba(239, 237, 230, 0.14); --blue: #5f70ff; --orange: #ff7a45; --band: #1a1b21; --on-ink: #2a3cff;
    color-scheme: dark;
  }
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; font-size: 93.75%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

.wrap { max-width: var(--measure); margin-inline: auto; padding-inline: 1.5rem; }
.wide { max-width: var(--wide); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }

a { color: inherit; text-decoration-color: var(--blue); text-underline-offset: 0.22em; text-decoration-thickness: 2px; }
a:hover { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--lime); color: #0f0f10; }

.skip { position: absolute; left: -999px; top: 0.5rem; z-index: 10; background: var(--lime); color: #0f0f10; padding: 0.4rem 0.7rem; }
.skip:focus { left: 0.5rem; }

.mono, time, .nav, .label, .btn, .when, .tags { font-family: var(--mono); }

/* ---------- Navigation */
.nav {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-block: 1.25rem;
  font-size: 0.8125rem;
}
.mark {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(.2,.9,.3,1.4);
}
.mark:hover { color: var(--on-ink); transform: rotate(-12deg) scale(1.08); }
.nav ul { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.nav ul a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav ul a:hover, .nav ul a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.theme-toggle:hover { background: var(--ink); color: var(--paper); }
/* a half-filled circle: the filled half is the current theme's ink */
.theme-toggle span { width: 0.95rem; height: 0.95rem; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

/* ---------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(.2,.9,.3,1.4), background 0.15s, color 0.15s, box-shadow 0.2s;
}
.btn:hover { color: var(--ink); background: var(--lime); transform: translateY(-2px); }
.btn.solid { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn.solid:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btns { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }

/* ---------- Home hero */
.hero { position: relative; padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem); }
.hero-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 0 0 clamp(1.5rem, 4vw, 2.5rem);
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.live { display: inline-flex; align-items: center; gap: 0.6rem; }
.live::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--blue);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(42, 60, 255, 0.55); }
  70%, 100% { box-shadow: 0 0 0 0.75rem rgba(42, 60, 255, 0); }
}

.giant {
  position: relative;
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.5rem, 10vw, 9rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}
/* clip only below each line, so the letters rise into view without cutting their tops */
.giant .line { display: block; padding-bottom: 0.1em; margin-bottom: -0.1em; clip-path: inset(-0.6em -0.3em 0 -0.3em); }
.giant .line > span { display: inline-block; animation: rise 0.9s cubic-bezier(.2,.8,.2,1) both; }
.giant .line + .line > span { animation-delay: 0.12s; }
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }

.hero-photo {
  position: absolute;
  right: clamp(1.25rem, 4vw, 3rem);
  top: clamp(4rem, 8vw, 6rem);
  width: clamp(8rem, 15vw, 12.5rem);
  animation: drop 0.9s 0.2s ease-out both;
}
.hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 0.75rem;
  filter: grayscale(1) contrast(1.08);
}
@keyframes drop { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }


.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 54rem) auto;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 2rem; margin: 0; padding-top: 1.1rem; border-top: 1.5px solid var(--ink); }
.facts dt { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--blue); }
.facts dd { margin: 0.35rem 0 0; font-size: 1.0625rem; line-height: 1.4; font-weight: 500; }
@media (max-width: 48rem) { .facts { grid-template-columns: 1fr; } }
.lede { margin: 0; font-size: clamp(1.2rem, 2.1vw, 1.6rem); line-height: 1.35; font-weight: 450; }

@media (max-width: 48rem) {
  .hero-photo { position: relative; right: auto; top: auto; width: 10rem; margin: 0 0 1.5rem auto; }
  .hero-foot { grid-template-columns: 1fr; }
}

/* ---------- Crossing tapes */
.tapes { position: relative; margin-block: 0.5rem 0; overflow: hidden; }
.marquee {
  position: relative;
  padding-block: 0.8rem;
  overflow: hidden;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.marquee.one { background: var(--ink); color: var(--paper); }
.track { display: inline-flex; animation: slide 60s linear infinite; }
.track span { padding-inline: 1.1rem; }
.track span::after { content: "✶"; padding-left: 2.2rem; font-family: var(--sans); font-weight: 400; color: var(--on-ink); }
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- Section heads */
.section { padding-block: clamp(3rem, 6vw, 4.5rem); }
.kicker {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 clamp(1.75rem, 4vw, 3rem);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.kicker .n { font-family: var(--mono); font-size: 0.875rem; font-weight: 500; letter-spacing: 0; color: var(--blue); transform: translateY(-1.4em); }

/* ---------- Numbers */
.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.numbers li {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 13rem;
  padding: 1.5rem;
  border: 1.5px solid var(--rule);
  border-radius: 1.25rem;
  background: var(--surface);
  transition: transform 0.35s cubic-bezier(.2,.9,.3,1.4);
}
.numbers li:nth-child(1) { background: var(--deep); border-color: var(--deep); color: #fff; }
.numbers li:hover { transform: translateY(-4px); }
.numbers strong {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  line-height: 0.9;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.numbers span { font-size: 0.9375rem; line-height: 1.4; }
@media (max-width: 64rem) { .numbers { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 30rem) { .numbers { grid-template-columns: 1fr; } .numbers li { min-height: 12rem; } }

/* ---------- Animated illustrations (viz.js) */
.viz-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.viz-card { margin: 0; padding: 1.25rem; border: 1.5px solid var(--rule); border-radius: 1.25rem; background: var(--surface); }
.viz-card canvas { display: block; width: 100%; height: 12rem; }
.viz-card h4 { margin: 1rem 0 0.3rem; font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.viz-card p { margin: 0; color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }
@media (max-width: 60rem) { .viz-cards { grid-template-columns: 1fr; } }
.stream { margin: 0 0 1.5rem; padding: 1.25rem 1.5rem 1rem; border: 1.5px solid var(--rule); border-radius: 1.25rem; background: var(--surface); }
.stream canvas { display: block; width: 100%; height: 118px; }
.stream figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.stream .key { font-family: var(--mono); font-size: 0.75rem; }
.key .buy::before { background: var(--blue); }
.key .sell::before { background: var(--orange); }
.key .cancel::before { background: var(--faint); }
.key .trade::before { background: var(--ink); }

/* Field boxes: each opens its own panel of graphics. Without JavaScript every panel shows. */
.topics { display: none; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
.js .topics { display: grid; }
.topic {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1.1rem 1.2rem 1.25rem;
  border: 1.5px solid var(--rule);
  border-radius: 1.1rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.15s, border-color 0.15s;
}
.topic:hover { transform: translateY(-2px); border-color: var(--ink); }
.topic[aria-selected="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.topic-n { font-family: var(--mono); font-size: 0.75rem; color: var(--blue); }
.topic[aria-selected="true"] .topic-n { color: var(--lime); }
.topic-name { font-family: var(--display); font-weight: 700; font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.05; letter-spacing: -0.025em; }
@media (max-width: 56rem) { .topics { grid-template-columns: repeat(2, 1fr); } }
.topic-title { margin: 0 0 1rem; font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.025em; }
.topic-panel + .topic-panel { margin-top: 2.5rem; }
.js .topic-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .js .topic-panel:not([hidden]) .viz-card { animation: pop 0.5s cubic-bezier(.2,.8,.2,1) both; }
  .js .topic-panel:not([hidden]) .viz-card:nth-child(2) { animation-delay: 0.07s; }
  .js .topic-panel:not([hidden]) .viz-card:nth-child(3) { animation-delay: 0.14s; }
}
@keyframes pop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- The fraud game (/why-me/) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.game-intro h2 { margin-bottom: 1rem; }
.game-rules { margin: 0 0 1.75rem; padding-left: 1.15rem; }
.game-rules li + li { margin-top: 0.4rem; }
.game-rules li::marker { content: "✶  "; color: var(--blue); font-size: 0.85em; }
.game-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.game-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin: 0; font-family: var(--mono); font-size: 0.875rem; }
.g-mode { padding: 0.3rem 0.75rem; border-radius: 999px; background: var(--ink); color: var(--paper); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1rem; }
#field { display: block; width: 100%; height: min(34rem, 70vh); border: 1.5px solid var(--rule); border-radius: 1.1rem; background: var(--surface); cursor: crosshair; touch-action: manipulation; }
.game-side { display: flex; flex-direction: column; gap: 1rem; }
.game-axes { display: grid; gap: 0.6rem; }
.game-axes label { display: grid; gap: 0.25rem; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.game-axes select { padding: 0.5rem 0.6rem; border: 1.5px solid var(--ink); border-radius: 0.6rem; background: var(--surface); color: var(--ink); font: inherit; font-family: var(--sans); font-size: 0.9375rem; }
.game-details { padding: 1rem; border: 1.5px solid var(--rule); border-radius: 1.1rem; background: var(--surface); font-size: 0.875rem; }
.game-details dl { margin: 0.5rem 0 0; }
.game-details dl div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0; border-top: 1px solid var(--rule); }
.game-details dt { color: var(--muted); }
.game-details dd { margin: 0; font-family: var(--mono); font-size: 0.8125rem; text-align: right; }
.game-details .g-score dd { color: var(--blue); }
.g-help { margin: 0; color: var(--muted); }
.g-pay { margin: 0; font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; }
.game-last { margin: 1rem 0 0; }
.game-end { margin-top: 2rem; padding: clamp(1.25rem, 3vw, 2rem); border-radius: 1.25rem; background: var(--deep); color: #fff; }
.game-end:focus { outline: none; }
.game-end p { max-width: 46rem; margin: 0 0 1rem; }
.g-big { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.1; letter-spacing: -0.025em; }
.game-end .btns { margin-top: 1.5rem; }
.game-end .btn { border-color: #fff; color: #fff; }
.game-end .btn:hover { color: #0f0f10; }
.game-end .btn.solid { background: var(--lime); border-color: var(--lime); color: #0f0f10; }
.g-compare { display: grid; gap: 0.6rem; max-width: 40rem; margin: 0 0 1.25rem; }
.g-cmp { display: grid; grid-template-columns: 8.5rem 1fr 3.5rem; gap: 0.75rem; align-items: center; font-family: var(--mono); font-size: 0.8125rem; }
.g-cmp strong { text-align: right; font-weight: 500; }
.g-cmp-track { height: 0.8rem; border-radius: 999px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.g-cmp-bar { display: block; height: 100%; background: var(--lime); }
@media (max-width: 56rem) { .game-layout { grid-template-columns: 1fr; } #field { height: 24rem; } }

/* ---------- Patent */
.patent { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.patent-title { margin: 0 0 0.75rem; font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: -0.03em; }
.patent-meta { margin: 0 0 1rem; font-family: var(--mono); font-size: 0.8125rem; color: var(--blue); }
.patent p { max-width: 36rem; }
.patent .btns { margin-top: 1.5rem; }
.patent .viz-card canvas { height: 15rem; }
@media (max-width: 56rem) { .patent { grid-template-columns: 1fr; } }

/* ---------- Work list */
.jobs { margin: 0; padding: 0; list-style: none; border-top: 1.5px solid var(--ink); }
.job { position: relative; border-bottom: 1px solid var(--rule); }
.job > a {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding: clamp(1rem, 2.5vw, 1.75rem) 0.75rem;
  color: var(--ink);
  text-decoration: none;
  isolation: isolate;
}
.job > a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--surface);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.35s cubic-bezier(.7,0,.2,1);
}
.job .idx { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }
.job .co {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  transition: transform 0.35s cubic-bezier(.2,.9,.3,1.2);
}
.job .meta { font-family: var(--mono); font-size: 0.8125rem; text-align: right; }
.job .meta .title { display: block; font-weight: 500; }
.job .desc {
  grid-column: 2 / -1;
  max-width: 40rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 1rem;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
}
.job > a:hover::before, .job > a:focus-visible::before { transform: scaleY(1); }
.job > a:hover .co, .job > a:focus-visible .co, .job > a:hover .idx, .job > a:focus-visible .idx { color: var(--blue); }
.job > a:hover .co, .job > a:focus-visible .co { transform: translateX(0.75rem); }
.job > a:hover .desc, .job > a:focus-visible .desc { max-height: 8rem; opacity: 1; margin-top: 0.5rem; }
@media (hover: none), (max-width: 48rem) {
  .job > a { grid-template-columns: 2.25rem 1fr; }
  .job .meta { grid-column: 2; text-align: left; }
  .job .desc { max-height: none; opacity: 1; margin-top: 0.25rem; color: var(--muted); }
}
.after-list { margin-top: 2rem; }

/* ---------- Dark research band */
.dark {
  --ink: #f3f1ea;
  --muted: #a9a79e;
  --rule: rgba(243, 241, 234, 0.16);
  --bg: var(--band);
  --accent: #6f7dff;
  --ask: var(--orange);
  background: var(--band);
  color: var(--ink);
  border-radius: clamp(1.5rem, 4vw, 3rem);
  margin-inline: clamp(0.5rem, 1.5vw, 1.25rem);
}
.research-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.big-q { margin: 0 0 1.5rem; font-family: var(--display); font-weight: 500; font-size: clamp(1.75rem, 3.4vw, 2.75rem); line-height: 1.1; letter-spacing: -0.03em; }
.dark p { color: var(--muted); }
.dark .btn { border-color: var(--ink); color: var(--ink); }
.dark .btn:hover { color: #0f0f10; }
.dark .btn.solid { background: var(--lime); border-color: var(--lime); color: #0f0f10; }
.dark .btn.solid:hover { background: var(--paper); border-color: var(--paper); }
.tape canvas { display: block; width: 100%; height: clamp(14rem, 28vw, 20rem); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.tape figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding-top: 0.75rem; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.key { display: inline-flex; gap: 1rem; }
.key span::before { content: ""; display: inline-block; width: 0.6rem; height: 0.6rem; margin-right: 0.4rem; border-radius: 2px; vertical-align: -0.05em; }
.key .bid::before { background: var(--accent); }
.key .ask::before { background: var(--ask); }
.key .mid::before { height: 2px; vertical-align: 0.2em; background: var(--ink); }
@media (max-width: 56rem) { .research-grid { grid-template-columns: 1fr; } }

/* ---------- Education cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.cards li {
  position: relative;
  padding: 1.75rem 1.5rem 1.5rem;
  border: 1.5px solid var(--rule);
  border-radius: 1.25rem;
  background: var(--surface);
  transition: transform 0.3s ease;
}
.cards li:hover { transform: translateY(-4px); }
.cards .yrs { font-family: var(--mono); font-size: 0.8125rem; color: var(--blue); }
.cards h3 { margin: 0.75rem 0 0.25rem; font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1.05; letter-spacing: -0.03em; }
.cards .where { margin: 0 0 0.75rem; font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }
.cards p { margin: 0; font-size: 0.9375rem; }
.cards .sticker {
  position: absolute;
  top: -0.9rem;
  right: 1rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--lime);
  color: #0f0f10;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
}
.cards.two { grid-template-columns: repeat(2, 1fr); }
.cards .num { display: block; font-family: var(--display); font-weight: 700; font-size: 3.5rem; line-height: 0.9; letter-spacing: -0.035em; color: var(--blue); }
@media (max-width: 56rem) { .cards, .cards.two { grid-template-columns: 1fr; } }

/* ---------- Contact */
.contact-block { text-align: left; }
.shout {
  margin: 0 0 2rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.75rem, 8vw, 7rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
}
.contact-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem; }
.contact-row p { margin: 0; font-family: var(--mono); font-size: 0.875rem; color: var(--muted); }

/* ---------- Footer */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-block: 2rem 2.5rem;
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.footer p { margin: 0; }

/* ---------- Scroll reveal: only when site.js runs, and never with reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(2.5rem); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2,.8,.2,1); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .stagger > * { opacity: 0; transform: translateY(2rem); transition: opacity 0.6s ease, transform 0.7s cubic-bezier(.2,.9,.3,1.2); }
  .js .stagger.in > * { opacity: 1; transform: none; }
  .js .stagger.in > :nth-child(2) { transition-delay: 0.08s; }
  .js .stagger.in > :nth-child(3) { transition-delay: 0.16s; }
  .js .stagger.in > :nth-child(4) { transition-delay: 0.24s; }
  .js .stagger.in > :nth-child(5) { transition-delay: 0.32s; }
}
@media (prefers-reduced-motion: reduce) {
  .giant .line > span, .hero-photo, .track, .live::before { animation: none; }
  .btn, .numbers li, .cards li, .job .co, .mark { transition: none; }
}

/* ======================================================================
   Inner pages: CV and research
   ====================================================================== */
.page-head {
  position: relative;
  overflow: hidden;
  margin-inline: clamp(0.5rem, 1.5vw, 1.25rem);
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4rem);
  border-radius: clamp(1.5rem, 4vw, 3rem);
  background: var(--deep);
  color: #fff;
}
.page-head .eyebrow { margin: 0 0 1rem; font-family: var(--mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lime); }
.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.5rem, 6.5vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: -0.035em;
}
.page-head .subtitle { max-width: 40rem; margin: 1.5rem 0 0; font-size: clamp(1.1rem, 1.8vw, 1.35rem); line-height: 1.4; }
.page-head .btns { margin-top: 2rem; }
.page-head .btn { border-color: #fff; color: #fff; }
.page-head .btn:hover { color: #0f0f10; }
.page-head .btn.solid { background: var(--lime); border-color: var(--lime); color: #0f0f10; }
.page-head .btn.solid:hover { background: #fff; border-color: #fff; }
.page-head::after {
  content: "";
  position: absolute;
  right: -6rem;
  bottom: -6rem;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  background: var(--lime);
  pointer-events: none;
  display: none;
}
.page-head > .wrap { position: relative; z-index: 1; }
@media (max-width: 48rem) { .page-head::after { width: 8rem; height: 8rem; right: -3rem; bottom: -3rem; } }
@media (max-width: 30rem) {
  .nav ul { gap: 0.3rem; }
  .nav ul a { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
  .mark { width: 2.4rem; height: 2.4rem; font-size: 0.875rem; }
  .hero-photo { margin-top: 1.25rem; }
}

.inner { padding-block: clamp(2.5rem, 6vw, 4.5rem) 0; }
.inner h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
}
.inner h2 .n { font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0; color: var(--blue); align-self: flex-start; }

.prose p { margin: 0 0 1rem; }
.lead { font-size: 1.1875rem; }

.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.figures li { padding: 1.25rem 1.35rem; border: 1.5px solid var(--rule); border-radius: 1rem; background: var(--surface); }
.figures li:nth-child(1) { background: var(--deep); border-color: var(--deep); color: #fff; }
.figures li:nth-child(1) span { color: #dfe2ff; }
.figures strong { display: block; font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.05; letter-spacing: -0.03em; }
.figures span { display: block; margin-top: 0.5rem; color: var(--muted); font-size: 0.9375rem; line-height: 1.45; }
@media (max-width: 34rem) { .figures { grid-template-columns: 1fr; } }

/* Experience timeline: dates | rail with dots | content */
.entry { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0 1.25rem; }
.entry > .when { margin: 0; padding-top: 0.6rem; color: var(--muted); font-size: 0.75rem; line-height: 1.7; }
.entry > .when time { display: block; }
.entry > div { position: relative; padding: 0 0 2.5rem 1.75rem; border-left: 2px solid var(--ink); }
.entry > div::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 0.55rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.entry.current > div::before { background: var(--lime); }
.entry:last-child > div { padding-bottom: 0.5rem; }
.entry > div > * { margin: 0; }
.entry > div > * + * { margin-top: 0.65rem; }
.entry h3 { font-family: var(--display); font-weight: 700; font-size: 1.9rem; line-height: 1.05; letter-spacing: -0.035em; }
.entry .role { font-family: var(--mono); font-size: 0.8125rem; line-height: 1.5; color: var(--blue); }
.entry .context { color: var(--muted); font-size: 0.9375rem; }
.entry ul { padding-left: 1.15rem; }
.entry li + li { margin-top: 0.45rem; }
.entry li::marker { content: "✶  "; color: var(--blue); font-size: 0.85em; }
.entry.plain > div { border-left-color: transparent; padding-bottom: 1.25rem; }
.entry.plain > div::before { display: none; }
.entry.plain > .when { padding-top: 0.25rem; font-size: 0.8125rem; color: var(--ink); }
@media (max-width: 34rem) {
  .entry { grid-template-columns: 1fr; }
  .entry > .when { padding: 0 0 0.3rem 1.75rem; border-left: 2px solid var(--ink); }
  .entry > .when time { display: inline; }
  .entry > .when time + time::before { content: " · "; }
  .entry.plain > .when { padding-left: 0; border: 0; }
  .entry.plain > div { padding-left: 0; }
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.tags li { margin: 0; padding: 0.25rem 0.7rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: 0.75rem; }
.entry .tags { padding-left: 0; }
.entry .tags li + li { margin-top: 0; }
.entry .tags li::marker { content: none; }

/* Research diagram */
.diagram { margin: 2rem 0 0.5rem; padding: 1.5rem 1.5rem 1rem; border: 1.5px solid var(--rule); border-radius: 1rem; background: var(--surface); }
.diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
.diagram figcaption { margin-top: 0.75rem; color: var(--muted); font-size: 0.875rem; }
.d-day { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.d-memory { fill: var(--lime); }
.d-memory-edge { stroke: var(--blue); stroke-width: 2; fill: none; stroke-dasharray: 4 3; }
.d-window { fill: var(--blue); }
.d-now { stroke: var(--ink); stroke-width: 2; }
.d-axis { stroke: var(--ink); stroke-width: 1.5; }
.d-tick { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.d-label { fill: var(--ink); font-family: var(--mono); font-size: 11px; }
.d-label.on-accent { fill: var(--blue); font-weight: 500; }

.inner-foot { margin-top: clamp(3rem, 7vw, 5rem); }

.notfound { padding-block: 4rem 6rem; }
.notfound .shout { color: var(--blue); }
.notfound .btns { margin-top: 2rem; }

.print-only { display: none; }

/* ---------- Print (the CV page): a clean A4 CV */
@page { size: A4; margin: 14mm 16mm 15mm; }
@media print {
  html { font-size: 100%; }
  :root:not([data-print]) { --paper: #fff; --surface: #fff; --ink: #111; --muted: #555; --faint: #999; --rule: #ddd; --blue: #2a3cff; color-scheme: light; }
  body { font-size: 9.5pt; line-height: 1.45; }
  .wrap, .wide { max-width: none; padding: 0; }
  .nav, .skip, .footer, .no-print, .tape, .inner-foot, .stream, .viz-cards { display: none !important; }
  .page-head { margin: 0; padding: 0 0 2mm; border-radius: 0; background: none; color: #111; }
  .page-head::after { display: none; }
  .page-head .eyebrow { display: none; }
  .page-head h1 { font-size: 30pt; }
  .page-head .subtitle.mono { font-size: 8.5pt; }
  .page-head .subtitle { margin-top: 2mm; font-size: 10.5pt; }
  .print-only { display: block !important; }
  .inner { padding-block: 3mm 0; }
  .inner h2 { margin-bottom: 3mm; font-size: 15pt; break-after: avoid; }
  .figures { grid-template-columns: repeat(4, 1fr); gap: 2mm; margin-top: 3mm; }
  .figures li { padding: 2mm 2.5mm; border-width: 1px; border-radius: 2mm; break-inside: avoid; background: #fff !important; color: #111 !important; border-color: #ccc !important; }
  .figures li span { color: #555 !important; }
  .figures strong { font-size: 11pt; }
  .figures span { font-size: 8pt; }
  /* floats instead of grid, so a long entry can continue on the next page */
  .entry { display: flow-root; }
  .entry > .when { float: left; width: 27mm; padding-top: 1mm; font-size: 7.5pt; }
  .entry > .when time { white-space: nowrap; }
  .entry > div { margin-left: 30mm; padding: 0 0 4mm 4mm; border-left-width: 1px; }
  .entry > div::before { width: 2.6mm; height: 2.6mm; left: -1.4mm; top: 1.3mm; border-width: 1px; }
  .entry h3 { font-size: 13pt; break-after: avoid; }
  .entry .role { color: #111; font-size: 8pt; break-after: avoid; }
  .entry .context { font-size: 9pt; }
  .entry li, .entry p { break-inside: avoid; }
  .entry li + li { margin-top: 1mm; }
  .entry > div > * + * { margin-top: 1.2mm; }
  .tags li { font-size: 7.5pt; padding: 0.3mm 2mm; border-width: 1px; background: #fff !important; }
  a { text-decoration: none; }
}
