/* ==========================================================================
   PRISM — prism.css
   One stylesheet for the whole site. No framework, no build step.
   Design language carried over from the pitch deck + logo:
   ink on white, three refracted beams (blue / green / orange).
   The beams double as the status-tag system:
     concept = blue · demonstrated = green · vision = orange · history = gray
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --ink: #16181a;
  --ink2: #4d5459;
  --muted: #899096;
  --surface: #ffffff;
  --panel: #f6f8f9;
  --panel2: #eef2f4;
  --line: #e4e8ea;
  --line2: #d5dbde;

  --blue: #48afd6;
  --green: #9dce57;
  --orange: #fea93c;
  --data: #2f88ad;
  --data-deep: #1e6b8c;
  --green-deep: #4d7422;
  --orange-deep: #b3701a;
  --red-deep: #b0483f;

  /* status tags */
  --tag-concept: var(--data-deep);
  --tag-demonstrated: var(--green-deep);
  --tag-vision: var(--orange-deep);
  --tag-history: var(--muted);

  /* row-mark tints (annotation only; models never see marks) */
  --mark-signal-bg: rgba(254, 169, 60, 0.14);
  --mark-signal-edge: #d99a2b;
  --mark-test-bg: rgba(72, 175, 214, 0.16);
  --mark-test-edge: var(--data);
  --mark-early-bg: rgba(157, 206, 87, 0.18);
  --mark-early-edge: var(--green-deep);
  --mark-impact-bg: rgba(254, 169, 60, 0.22);
  --mark-impact-edge: var(--orange-deep);
  --mark-late-bg: rgba(176, 72, 63, 0.12);
  --mark-late-edge: var(--red-deep);

  --logo-ink: #16181a;
  --shadow: 0 1px 2px rgba(22, 24, 26, 0.06), 0 8px 24px rgba(22, 24, 26, 0.07);
  --shadow-lift: 0 2px 4px rgba(22, 24, 26, 0.08), 0 14px 34px rgba(22, 24, 26, 0.12);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Cascadia Mono", "Liberation Mono", monospace;

  --maxw: 72rem;
  --radius: 12px;
  color-scheme: light;
}

[data-theme="dark"] {
  --ink: #e8ecee;
  --ink2: #b6bec3;
  --muted: #7d868c;
  --surface: #0e1112;
  --panel: #16191b;
  --panel2: #1d2124;
  --line: #24292c;
  --line2: #31383c;

  --data: #58a8cc;
  --data-deep: #6fb9d9;
  --green-deep: #a5cf6a;
  --orange-deep: #e0a558;
  --red-deep: #d07f77;

  --tag-concept: var(--data-deep);
  --tag-demonstrated: var(--green-deep);
  --tag-vision: var(--orange-deep);

  --mark-signal-bg: rgba(254, 169, 60, 0.10);
  --mark-signal-edge: #c79340;
  --mark-test-bg: rgba(72, 175, 214, 0.14);
  --mark-test-edge: #58a8cc;
  --mark-early-bg: rgba(157, 206, 87, 0.12);
  --mark-early-edge: #a5cf6a;
  --mark-impact-bg: rgba(254, 169, 60, 0.16);
  --mark-impact-edge: #e0a558;
  --mark-late-bg: rgba(208, 127, 119, 0.12);
  --mark-late-edge: #d07f77;

  --logo-ink: #e8ecee;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.5), 0 14px 34px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--data-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--data); }
:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(72, 175, 214, 0.25); }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 0.5em; font-weight: 750; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.2rem); font-weight: 800; letter-spacing: -0.022em; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.05rem); }
h3 { font-size: 1.22rem; }
p { margin: 0 0 1em; }
strong { font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.35em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--surface); padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.1rem, 4vw, 2rem); }
.section { padding: clamp(2.8rem, 6vw, 4.5rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section--panel { background: var(--panel); }
.prose { max-width: 46rem; }
.prose-wide { max-width: 56rem; }
.lede { font-size: clamp(1.08rem, 1.7vw, 1.3rem); line-height: 1.55; color: var(--ink2); max-width: 48rem; }
.grid { display: grid; gap: 1.1rem; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* ---------- the beam bar (deck accent) ---------- */
.beams { display: flex; height: 4px; width: 100%; }
.beams i { flex: 1; }
.beams i:nth-child(1) { background: var(--logo-ink); }
.beams i:nth-child(2) { background: var(--blue); }
.beams i:nth-child(3) { background: var(--green); }
.beams i:nth-child(4) { background: var(--orange); }
.beams--mini { width: 72px; height: 4px; margin-bottom: 1.1rem; border-radius: 2px; overflow: hidden; }

/* ---------- kicker ---------- */
.kicker {
  font-size: 0.8rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.65rem;
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 1.2rem; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); font-weight: 750; letter-spacing: 0.02em; font-size: 1.05rem; margin-right: auto; }
.brand svg { display: block; }
.nav-links { display: flex; gap: 0.15rem; align-items: center; flex-wrap: wrap; }
.nav-links a {
  color: var(--ink2); text-decoration: none; font-size: 0.93rem; font-weight: 550;
  padding: 0.45rem 0.7rem; border-radius: 8px;
}
.nav-links a:hover { color: var(--ink); background: var(--panel); }
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--panel2); }
.nav-toggle { display: none; }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink2);
  border-radius: 8px; padding: 0.4rem 0.55rem; cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.theme-toggle:hover { color: var(--ink); background: var(--panel); }
@media (max-width: 860px) {
  .nav { flex-wrap: wrap; padding-block: 0.5rem; }
  .nav-toggle {
    display: block; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    border-radius: 8px; padding: 0.4rem 0.65rem; cursor: pointer; font-size: 1rem;
  }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 0.6rem; }
  .nav-links.open { display: flex; }
}

/* ---------- status badges ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.76rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink2); background: var(--surface);
  border: 1px solid var(--line2); border-radius: 999px; padding: 0.18em 0.75em 0.18em 0.6em;
  white-space: nowrap;
}
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.tag-concept::before { background: var(--tag-concept); }
.tag-concept { border-color: color-mix(in srgb, var(--tag-concept) 45%, var(--line)); }
.tag-demonstrated::before { background: var(--tag-demonstrated); }
.tag-demonstrated { border-color: color-mix(in srgb, var(--tag-demonstrated) 45%, var(--line)); }
.tag-vision::before { background: var(--tag-vision); }
.tag-vision { border-color: color-mix(in srgb, var(--tag-vision) 45%, var(--line)); }
.tag-history::before { background: var(--tag-history); }
.tag-row { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.4rem; box-shadow: none;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line2); }
.card h3 { margin-bottom: 0.35rem; }
.card p { color: var(--ink2); font-size: 0.95rem; margin-bottom: 0; }
.card .go { display: inline-block; margin-top: 0.7rem; font-weight: 600; font-size: 0.9rem; color: var(--data-deep); }
.card--edge { border-top: 3px solid var(--line2); }
.card--edge-blue { border-top-color: var(--blue); }
.card--edge-green { border-top-color: var(--green); }
.card--edge-orange { border-top-color: var(--orange); }
.card--edge-ink { border-top-color: var(--logo-ink); }

/* ---------- callouts ---------- */
.callout {
  border-left: 3px solid var(--line2); background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem; margin: 1.4rem 0;
}
.callout .kicker { margin-bottom: 0.3rem; }
.callout p:last-child { margin-bottom: 0; }
.callout--honest { border-left-color: var(--orange); }
.callout--honest .kicker { color: var(--orange-deep); }
.callout--note { border-left-color: var(--blue); }
.callout--note .kicker { color: var(--data-deep); }
.callout--demo { border-left-color: var(--green); }
.callout--demo .kicker { color: var(--green-deep); }

/* ---------- patient timeline table ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.timeline { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 0.78rem; line-height: 1.45; }
.timeline th, .timeline td { padding: 0.5em 0.8em; text-align: left; white-space: nowrap; border-top: 1px solid var(--line); vertical-align: top; }
.timeline thead th {
  border-top: 0; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); background: var(--panel); position: sticky; top: 0;
}
.timeline td.markcell { width: 1%; color: var(--muted); font-family: var(--sans); font-size: 0.68rem; font-weight: 650; letter-spacing: 0.05em; }
.timeline .r-signal { background: var(--mark-signal-bg); box-shadow: inset 3px 0 0 var(--mark-signal-edge); }
.timeline .r-test { background: var(--mark-test-bg); box-shadow: inset 3px 0 0 var(--mark-test-edge); }
.timeline .r-early { background: var(--mark-early-bg); box-shadow: inset 3px 0 0 var(--mark-early-edge); }
.timeline .r-impact { background: var(--mark-impact-bg); box-shadow: inset 3px 0 0 var(--mark-impact-edge); }
.timeline .r-late { background: var(--mark-late-bg); box-shadow: inset 3px 0 0 var(--mark-late-edge); }
.timeline .r-gen td { color: var(--data-deep); font-weight: 600; }
.timeline .r-ellipsis td { color: var(--muted); text-align: left; }
.tablenote { font-size: 0.82rem; color: var(--muted); margin: 0.6rem 0.2rem 0; }

/* ---------- stat tiles ---------- */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; }
.stat .label { font-size: 0.74rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.stat .value { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat .context { font-size: 0.85rem; color: var(--ink2); margin-top: 0.35rem; }
.stat--flag .value { color: var(--green-deep); }

/* ---------- bar charts (plain HTML) ---------- */
.bars { display: grid; gap: 10px; margin: 1.2rem 0; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr; gap: 0.8rem; align-items: center; }
.bar-row .bar-label { font-size: 0.86rem; color: var(--ink2); text-align: right; }
.bar-track { position: relative; background: var(--panel); border-radius: 4px; height: 22px; }
.bar-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0;
  background: var(--data-deep); min-width: 2px;
  display: flex; align-items: center;
}
/* darker than --muted so a white inside-label clears WCAG-AA (~5.5:1) in both themes */
.bar-fill.alt { background: #5f666b; }
.bar-val {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  font-size: 0.84rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap;
}
.bar-val.inside { position: static; transform: none; color: #fff; padding-left: 10px; }
.chart-legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 0.84rem; color: var(--ink2); margin: 0.4rem 0 0.8rem; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 0.45em; }
.chart-legend .swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--data-deep); display: inline-block; }
.chart-legend .swatch.alt { background: var(--muted); }
.chart-title { font-weight: 650; margin-bottom: 0.15rem; }
.chart-sub { font-size: 0.86rem; color: var(--muted); margin-bottom: 0.6rem; }
details.data-table { margin: 0.6rem 0 0; font-size: 0.88rem; }
details.data-table summary { cursor: pointer; color: var(--ink2); font-size: 0.84rem; }
details.data-table table { border-collapse: collapse; margin-top: 0.6rem; }
details.data-table th, details.data-table td { border: 1px solid var(--line); padding: 0.35em 0.8em; text-align: right; }
/* Data tables inside a <details> have no .tablewrap ancestor; let the table itself
   scroll horizontally so a wide one never pans the whole page body on mobile. */
details.data-table table { display: block; overflow-x: auto; max-width: 100%; }
details.data-table th:first-child, details.data-table td:first-child { text-align: left; }

/* ---------- consensus chips ---------- */
.votes { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
.vote {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35em;
  min-width: 74px; padding: 0.45em 0.7em; border-radius: 10px;
  border: 1.5px solid var(--line2); background: var(--surface);
  font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}
.vote.fired { border-color: var(--green-deep); color: var(--green-deep); background: color-mix(in srgb, var(--green) 14%, var(--surface)); font-weight: 700; }
.vote .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line2); }
.vote.fired .dot { background: var(--green-deep); }
.consensus-readout { font-weight: 750; font-size: 1.05rem; margin-top: 0.7rem; }
.consensus-readout .n { color: var(--green-deep); font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer; font: inherit;
  font-weight: 650; font-size: 0.95rem; border-radius: 10px; padding: 0.6em 1.25em;
  border: 1px solid var(--ink); background: var(--ink); color: var(--surface);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn-ghost:hover { background: var(--panel); color: var(--ink); box-shadow: none; }
.btn-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.2rem, 5vw, 3.5rem); }
.hero .lede { margin: 1.1rem 0 1.6rem; }
.hero-demo { margin-top: 2.2rem; }

/* ---------- page hero (interior pages) ---------- */
.page-hero { padding: clamp(2.4rem, 5vw, 3.6rem) 0 clamp(1.6rem, 3vw, 2.4rem); border-bottom: 1px solid var(--line); }
.page-hero .lede { margin-top: 0.9rem; }

/* ---------- timeline (story page) ---------- */
.era { display: grid; grid-template-columns: 92px 1fr; gap: 1.2rem; padding: 1.4rem 0; border-top: 1px solid var(--line); }
.era:first-of-type { border-top: 0; }
.era .year { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.era h3 { margin-bottom: 0.3rem; }
.era p { color: var(--ink2); }
@media (max-width: 600px) { .era { grid-template-columns: 1fr; gap: 0.3rem; } }

/* ---------- glossary ---------- */
.gloss dt { font-weight: 700; margin-top: 1.2rem; font-family: var(--mono); font-size: 0.95rem; }
.gloss dd { margin: 0.25rem 0 0; color: var(--ink2); max-width: 46rem; }

/* ---------- steps ---------- */
.steps { counter-reset: step; display: grid; gap: 1rem; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 1rem; align-items: start; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel2); color: var(--ink); font-weight: 750; font-size: 0.95rem;
  border: 1px solid var(--line2);
}
/* The number is a ::before pseudo-element, so a .step with an <h3> and a <p>
   has three grid items; pin the text to column 2 so the paragraph doesn't flow
   back under the badge into the 44px column (one-word-per-line breakage). */
.step > h3, .step > p { grid-column: 2; }
.step h3 { margin-bottom: 0.2rem; font-size: 1.05rem; }
.step p { color: var(--ink2); font-size: 0.95rem; margin-bottom: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--panel); margin-top: 3rem; }
.site-footer .cols { display: grid; gap: 1.6rem; padding: 2.4rem 0 1.6rem; }
@media (min-width: 760px) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer h4 { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0.3rem 0; }
.site-footer a { color: var(--ink2); text-decoration: none; font-size: 0.92rem; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.site-footer .fineprint { border-top: 1px solid var(--line); padding: 1.1rem 0 1.6rem; font-size: 0.84rem; color: var(--muted); }
.site-footer .fineprint p { margin: 0.3rem 0; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 550ms ease, transform 550ms ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .theme-toggle, .nav-toggle, .btn-row, .demo-controls { display: none !important; }
  body { font-size: 11pt; }
  .section { padding: 1.2rem 0; }
}
