/* Nemesis — site styles. One sans for text, one mono for measured values. */

@font-face {
  font-family: "Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --paper: #f5f6f7;
  --ink: #14181d;
  --quiet: #5a636e;
  --rule: #d8dde2;
  --band: #e6e9ec;
  --fail: #c03a2b;
  --fix: #1d58cc;
  --fix-wash: #1d58cc14;

  --sans: "Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 38rem;
  --wide: 70rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15191e;
    --ink: #e8ebee;
    --quiet: #9aa3ad;
    --rule: #2c333b;
    --band: #222930;
    --fail: #f07462;
    --fix: #84a9f6;
    --fix-wash: #84a9f61f;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.875rem; text-decoration: none; z-index: 10;
}
.skip:focus { top: 0.75rem; }

.wrap { width: 100%; max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header { padding: 1.5rem 0; }
.site-header .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; }
.brand { display: flex; align-items: baseline; gap: 0.875rem; text-decoration: none; }
.brand-name { font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; }
.brand-tag { color: var(--quiet); font-size: 0.9375rem; }
.site-nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; }
.site-nav a { text-decoration: none; color: var(--quiet); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 40rem) { .brand-tag { display: none; } }

/* Type */
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(2.375rem, 5.6vw, 4.5rem); line-height: 1.04; max-width: 17ch; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.625rem); line-height: 1.12; max-width: 22ch; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
.lede { font-size: clamp(1.125rem, 1.6vw, 1.3125rem); line-height: 1.5; color: var(--quiet); max-width: var(--measure); }
.num { font-weight: 500; letter-spacing: -0.035em; font-variant-numeric: tabular-nums lining-nums; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem; }
.button {
  display: inline-block; padding: 0.8125rem 1.25rem;
  background: var(--ink); color: var(--paper);
  font-weight: 500; text-decoration: none; border-radius: 6px;
  transition: background-color 120ms ease;
}
.button:hover { background: var(--fix); color: var(--paper); }
.text-link { font-weight: 500; }

/* Sections */
.section { padding: clamp(4rem, 10vw, 7.5rem) 0; border-top: 1px solid var(--rule); }
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(3.5rem, 8vw, 6rem); }
.hero h1 { margin-bottom: 1.5rem; }
.hero .lede { margin-bottom: 2.25rem; }

/* Hero figure */
.run { margin: clamp(3rem, 7vw, 5rem) 0 0; }
.run svg { width: 100%; height: auto; overflow: visible; }
.run-mobile { display: none; }
@media (max-width: 44rem) {
  .run-desktop { display: none; }
  .run-mobile { display: block; }
}
.run figcaption { margin-top: 1.25rem; color: var(--quiet); font-size: 0.9375rem; max-width: var(--measure); }
.run figcaption strong { color: var(--ink); font-weight: 500; }

.run text { font-family: var(--sans); font-size: 15px; fill: var(--ink); }
.run .t-quiet { fill: var(--quiet); }
.run .t-small { font-size: 13px; }
.run .t-mono { font-family: var(--mono); font-size: 13px; fill: var(--quiet); }
.run .t-fix { fill: var(--fix); font-weight: 600; }
.run .t-fail { fill: var(--fail); font-weight: 600; }
.run .band { fill: var(--band); }
.run .lane { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.run .axis { stroke: var(--rule); stroke-width: 1; }
.run .leader { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 3; }
.run .dot { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.run .dot-fix { fill: var(--fix); stroke: var(--paper); stroke-width: 3; }
.run .crash { fill: var(--fail); stroke: var(--paper); stroke-width: 3; }
.run .fork { stroke: var(--fix); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.run .stop { stroke: var(--fix); stroke-width: 3; stroke-linecap: round; }
.run .d-ok { fill: var(--fix); }
.run .d-late { fill: var(--fail); }

/* The one orchestrated moment: the run plays out, then the fork branches off. */
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.run .lane, .run .fork { stroke-dasharray: 1 1; }
.run .lane { animation: draw 1.7s cubic-bezier(0.45, 0, 0.25, 1) 0.25s both; }
.run .crash, .run .t-fail { animation: appear 0.3s ease-out 1.9s both; }
.run .fork { animation: draw 0.9s cubic-bezier(0.3, 0, 0.2, 1) 2.4s both; }
.run .stop, .run .t-fork { animation: appear 0.3s ease-out 3.2s both; }
@media (prefers-reduced-motion: reduce) {
  .run .lane, .run .fork, .run .crash, .run .t-fail, .run .stop, .run .t-fork { animation: none; }
}

/* Problem */
.problem { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
@media (min-width: 52rem) { .problem { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 4rem; align-items: end; } }
.problem h2 { margin-bottom: 1.5rem; }
.problem p { color: var(--quiet); max-width: var(--measure); }
.stat { border-left: 3px solid var(--fail); padding-left: 1.25rem; }
.stat .num { display: block; font-size: clamp(4.5rem, 11vw, 8.5rem); line-height: 0.88; color: var(--fail); }
.stat span:last-child { display: block; margin-top: 0.875rem; max-width: 18rem; font-size: 0.9375rem; color: var(--quiet); }

/* Three questions */
.questions h2 { margin-bottom: 1rem; }
.mechanism { color: var(--quiet); font-size: 1.125rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.q-list { list-style: none; margin: 0; padding: 0; }
.q {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem 3rem;
  padding: 2rem 0; border-top: 1px solid var(--rule);
}
.q:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 52rem) {
  .q { grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr); padding: 2.5rem 0; }
}
.q p { color: var(--quiet); max-width: 32rem; }
.q-evidence .num { display: block; font-size: clamp(2rem, 3.4vw, 2.625rem); line-height: 1; color: var(--ink); }
.q-evidence span:last-child { display: block; margin-top: 0.5rem; font-size: 0.875rem; line-height: 1.45; color: var(--quiet); }
@media (max-width: 51.99rem) { .q-evidence { margin-top: 0.75rem; } }

/* Method */
.method-body { max-width: var(--measure); }
.method h2 { margin-bottom: 1.5rem; }
.method p + p { margin-top: 1rem; }
.method .quiet { color: var(--quiet); }
.method .text-link { display: inline-block; margin-top: 1.75rem; }

/* Closing call */
.closing h2 { margin-bottom: 1.5rem; }
.closing .lede { margin-bottom: 2.25rem; }
.closing .email { color: var(--quiet); font-size: 0.9375rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.5rem; font-size: 0.875rem; color: var(--quiet); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Research page */
.article { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(4rem, 8vw, 6rem); }
.article header { margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.article h1 { font-size: clamp(2.125rem, 4.4vw, 3.375rem); max-width: 20ch; margin-bottom: 1.25rem; }
.article .meta { color: var(--quiet); font-size: 0.9375rem; margin-top: 1rem; }
.article h2 { font-size: clamp(1.5rem, 2.6vw, 1.875rem); max-width: none; margin: clamp(3rem, 6vw, 4.5rem) 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.article p, .article ul, .article ol { max-width: var(--measure); }
.article p + p, .article p + ul, .article ul + p, .article .table-wrap + p { margin-top: 1rem; }
.article ul, .article ol { padding-left: 1.25rem; margin: 1rem 0 0; }
.article li + li { margin-top: 0.5rem; }
.article .findings { padding: 0; list-style: none; counter-reset: f; }
.article .findings li { counter-increment: f; display: grid; grid-template-columns: 2rem 1fr; }
.article .findings li::before { content: counter(f); font-family: var(--mono); color: var(--quiet); }
.article .note { color: var(--quiet); font-size: 0.9375rem; }
.article code { font-family: var(--mono); font-size: 0.875em; }

.table-wrap { margin: 1.5rem 0 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font-size: 0.9375rem; line-height: 1.4; min-width: 100%; }
caption { text-align: left; color: var(--quiet); font-size: 0.875rem; padding-bottom: 0.625rem; caption-side: top; }
th, td { text-align: left; padding: 0.625rem 1.25rem 0.625rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 500; color: var(--quiet); font-size: 0.8125rem; border-bottom-color: var(--ink); }
td.n, th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.875rem; white-space: nowrap; }
td:last-child, th:last-child { padding-right: 0; }
thead th.n { font-family: var(--sans); font-size: 0.8125rem; white-space: normal; }
tr.emph td { font-weight: 600; }
tr.emph td.n { font-weight: 500; color: var(--ink); }

/* 404 */
.missing { padding: clamp(5rem, 14vw, 10rem) 0; }
.missing h1 { margin-bottom: 1.25rem; }
.missing .lede { margin-bottom: 2rem; }

@media print {
  .site-header nav, .actions, .skip { display: none; }
  body { background: #fff; color: #000; }
}
