:root {
  --bg: #ffffff;
  --band: #f5f7fa;
  --text: #1d2433;
  --muted: #5b6474;
  --line: #e1e5ec;
  --accent: #1a73e8;
  --accent-ink: #ffffff;
  --navy: #1f2a44;
  --green: #1e8e3e;
  --green-bg: #e6f4ea;
  --red: #c5221f;
  --red-bg: #fce8e6;
  --amber: #b06000;
  --amber-bg: #fef7e0;
  --blue-bg: #e8f0fe;
  --code-bg: #1f2a44;
  --code-text: #e8ecf4;
  --img-bg: #ffffff;
  /* Chart series: gray = Standard, blue = Thinking-in-Bets, amber = stand-firm
     rules, purple = other variants, green = On-Demand. Validated light/dark. */
  --s-std: #80868b;
  --s-tib: #1a73e8;
  --s-rule: #e37400;
  --s-other: #9334e6;
  --s-ondemand: #188038;
  --grid: #e8eaed;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c;
    --band: #171c25;
    --text: #e6e9ef;
    --muted: #9aa3b2;
    --line: #2a3140;
    --accent: #8ab4f8;
    --accent-ink: #11151c;
    --green: #81c995;
    --green-bg: #1b2e22;
    --red: #f28b82;
    --red-bg: #33201f;
    --amber: #fdd663;
    --amber-bg: #302a17;
    --blue-bg: #1c2638;
    --code-bg: #0b0e13;
    --img-bg: #f4f5f7;
    --s-std: #8e959c;
    --s-tib: #4c8df6;
    --s-rule: #d07f00;
    --s-other: #af5cf7;
    --s-ondemand: #34a853;
    --grid: #252c3a;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

section { padding: 56px 0; }
section.wrap { padding-left: 16px; padding-right: 16px; }
.band { background: var(--band); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; margin: 0 0 .6em; font-weight: 600; }
h2 { font-size: 1.85rem; text-align: center; margin-bottom: 1em; }
h3 { font-size: 1.25rem; margin-top: 1.6em; }
h4 { font-size: 1.1rem; margin-bottom: .3em; }
p { margin: 0 0 1em; }
a { color: var(--accent); }

/* Hero */
.hero { text-align: center; padding: 72px 0 40px; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.7rem); max-width: 860px; margin: 0 auto .6em; }
.venue { color: var(--muted); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 1.2em; }
.authors { font-size: 1.2rem; margin: 0; }
.authors a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.affil { color: var(--muted); margin-bottom: 1.6em; }

.links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--navy); color: #fff; text-decoration: none;
  font-weight: 500; font-size: .95rem;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; }
.btn.disabled { opacity: .45; cursor: default; }
.btn.disabled:hover { transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { background: #2b3750; }
}

/* Figures */
figure { margin: 0 0 1.5em; }
figure img, .finding img {
  width: 100%; height: auto; display: block;
  background: var(--img-bg); border-radius: 10px; border: 1px solid var(--line);
  padding: 8px;
}
figcaption { color: var(--muted); font-size: .92rem; margin-top: .8em; line-height: 1.55; }

.intro-video { padding-top: 8px; padding-bottom: 24px; }
.intro-video video {
  width: 100%; display: block; aspect-ratio: 16 / 9;
  border-radius: 14px; background: #0d1320;
  box-shadow: 0 20px 60px rgba(13, 19, 32, .25);
}
.video-caption { color: var(--muted); font-size: .9rem; text-align: center; margin: .8em 0 0; }

.teaser { padding-top: 24px; }
.tldr {
  background: var(--blue-bg); border-left: 4px solid var(--accent);
  padding: 14px 18px; border-radius: 6px; font-size: 1.05rem;
}
.tldr span { font-weight: 700; margin-right: .4em; color: var(--accent); }

#abstract p { font-family: var(--serif); font-size: 1.1rem; text-align: justify; hyphens: auto; }

/* Cards */
.two-col, .three-col { display: grid; gap: 16px; margin-bottom: 1.5em; }
.two-col { grid-template-columns: repeat(2, 1fr); }
.three-col { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px;
}
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card h3 { margin-top: 0; }
.card.bad { border-top: 4px solid var(--red); }
.card.warn { border-top: 4px solid var(--amber); }
.lead { font-size: 1.05rem; }

/* Code */
pre.code, .bib pre {
  background: var(--code-bg); color: var(--code-text);
  font-family: var(--mono); font-size: .82rem; line-height: 1.6;
  padding: 18px 20px; border-radius: 10px; overflow-x: auto; margin: 0 0 1em;
}
pre.code .c { color: #8fa1c4; }

/* Revision rule grid */
.grid-rule {
  display: grid; grid-template-columns: 130px 1fr 1fr; gap: 10px; margin: 1em 0 1.5em;
}
.colhead, .rowhead { font-weight: 600; display: flex; flex-direction: column; justify-content: center; }
.colhead { text-align: center; }
.colhead small, .rowhead small { font-weight: 400; color: var(--muted); font-size: .82rem; }
.cell {
  border-radius: 10px; padding: 16px; text-align: center; border: 2px solid;
  display: flex; align-items: center; justify-content: center; min-height: 72px;
}
.cell.keep { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.cell.check { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); }
.cell.ask { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.cell.fix { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.note { color: var(--muted); font-size: .95rem; text-align: center; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 1.5em; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 20px 18px; }
.stat .num { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--accent); line-height: 1.2; margin-bottom: .4em; }
.stat .num .from { color: var(--muted); font-weight: 400; }
.stat .lbl { font-size: .9rem; color: var(--muted); line-height: 1.5; }

/* Findings */
.finding {
  padding: 32px 0; border-bottom: 1px solid var(--line);
}
.finding:last-child { border-bottom: 0; }
.finding .text { max-width: 760px; margin: 0 auto 22px; }
.chart-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Bar charts (static/js/charts.js) */
.chart { min-width: 0; }
.bc {
  margin: 0; height: 100%;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px 14px;
}
.bc-title { font-family: var(--sans); font-weight: 600; font-size: 1rem; color: var(--text); margin: 0; }
.bc-note { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.bc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 12px; font-size: .82rem; color: var(--muted); }
.bc-key { display: inline-flex; align-items: center; gap: 7px; }
.bc-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.bc-group { font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 10px 0 2px; }
.bc-row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 12px; padding: 6px 0; }
.bc-label { font-size: .86rem; color: var(--text); line-height: 1.25; }
.bc-methods .bc-row { grid-template-columns: 150px 1fr; }
.bc-methods .bc-legend { margin: 6px 0 4px; }
.bc-emph .bc-label { font-weight: 600; }
.bc-plot { position: relative; display: flex; flex-direction: column; gap: 2px; margin-right: 64px; }
.bc-grid { position: absolute; top: -6px; bottom: -6px; width: 1px; background: var(--grid); }
.bc-line { position: relative; height: 14px; display: flex; align-items: center; }
.bc-bar {
  flex: none; width: var(--w); height: 12px; min-width: 2px; background: var(--c);
  border-radius: 0 4px 4px 0; position: relative; z-index: 1;
  outline: none; transition: filter .15s ease;
}
.bc-bar::after { content: ""; position: absolute; inset: -3px -4px; }
.bc-bar:hover, .bc-bar:focus-visible { filter: brightness(1.12) saturate(1.1); }
.bc-bar:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.bc-zero { width: 2px !important; border-radius: 0; }
.bc-val { position: absolute; left: calc(var(--w) + 8px); font-size: .78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bc-val-strong { color: var(--text); font-weight: 600; }
.bc-axis { padding-top: 4px; }
.bc-axis .bc-plot { height: 18px; }
.bc-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bc-data { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.bc-data summary { cursor: pointer; width: max-content; }
.bc-data table { border-collapse: collapse; margin-top: 8px; width: 100%; font-variant-numeric: tabular-nums; }
.bc-data th, .bc-data td { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.bc-data tr:first-child th { font-weight: 600; color: var(--text); }
.bc-tip {
  position: absolute; z-index: 10; pointer-events: none; opacity: 0;
  background: var(--text); color: var(--bg); font-size: .8rem; line-height: 1.45;
  padding: 7px 11px; border-radius: 8px; max-width: 260px;
  transition: opacity .12s ease;
}
.bc-tip.on { opacity: 1; }
.bc-tip-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c); margin-right: 6px; }
.finding h3 { margin-top: 0; }
.finding .text p { color: var(--muted); margin: 0; }

ul.plain { padding-left: 1.2em; margin: 0; }
ul.plain li { margin-bottom: .6em; }

/* BibTeX */
.bib { position: relative; }
.copy {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px; padding: 4px 12px; font: 500 .8rem var(--sans); cursor: pointer;
}
.copy:hover { background: rgba(255,255,255,.22); }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .88rem; text-align: center; }

@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .three-col { grid-template-columns: 1fr; }
  .chart-pair { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  section { padding: 40px 0; }
  .two-col, .stats { grid-template-columns: 1fr; }
  .grid-rule { grid-template-columns: 1fr 1fr; }
  .grid-rule .corner { display: none; }
  .colhead { display: none; }
  .rowhead { grid-column: 1 / -1; flex-direction: row; gap: 8px; align-items: baseline; margin-top: 6px; }
  .cell.keep::after, .cell.ask::after { content: " (vague reply)"; font-size: .8rem; opacity: .8; margin-left: 4px; }
  .cell.check::after, .cell.fix::after { content: " (specific reply)"; font-size: .8rem; opacity: .8; margin-left: 4px; }
  #abstract p { text-align: left; }
  .bc { padding: 16px 14px 10px; }
  .bc-row, .bc-methods .bc-row { grid-template-columns: 92px 1fr; gap: 10px; }
  .bc-plot { margin-right: 52px; }
  .bc-tick:nth-child(2n):not(:last-child) { display: none; }
}
