:root {
  --ink: #16202c;
  --muted: #5b6776;
  --line: #e3e7ed;
  --bg: #ffffff;
  --band: #f5f7fa;
  --blue: #2f6fdd;
  --blue-soft: #e8f0fd;
  --red: #e0493e;
  --red-soft: #fdecea;
  --green: #1f9d63;
  --green-soft: #e6f6ee;
  --gray: #9aa5b3;
  --radius: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; font: 16px/1.65 var(--sans); color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 0.88em; }
p code, li code, figcaption code { background: var(--band); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
h2 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.08rem; }
h4 { font-size: 1rem; }
small, .small { font-size: 0.86rem; color: var(--muted); }
.sc { font-variant: small-caps; letter-spacing: 0.02em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 820px; }
.section { padding: 72px 24px; }
.band { background: var(--band); padding: 72px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 700; color: var(--red); margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 820px; }
.small-lead { font-size: 0.95rem; }
.subhead { margin-top: 56px; font-size: 1.25rem; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 22px; font-size: 0.92rem; }
.nav-links a { color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--ink); text-decoration: none; }

/* hero */
.hero { text-align: center; padding-top: 40px; padding-bottom: 24px; }
.hero-logo { display: block; width: auto; height: clamp(200px, 26vw, 300px); margin: 0 auto 18px; }
.venue { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 4.2vw, 3rem); margin-bottom: 16px; }
.authors { font-size: 1.1rem; color: var(--muted); margin: 0 0 24px; }
.buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; font-size: 0.92rem; border: 1px solid var(--ink); }
.btn:hover { text-decoration: none; opacity: 0.88; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.disabled { background: var(--band); color: var(--muted); border-color: var(--line); cursor: default; }

.figure-hero { padding-top: 24px; padding-bottom: 24px; }
figure { margin: 0; }
figure img { border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
figure.plain img { border: none; }
figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 10px; text-align: center; }
.figure-hero figcaption { max-width: 820px; margin: 12px auto 0; }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 36px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px; text-align: center; }
.stat b { display: block; font-size: 1.7rem; font-family: var(--serif); }
.stat span { font-size: 0.82rem; color: var(--muted); }

#abstract p { text-align: justify; hyphens: auto; }

/* principles & findings */
.principles, .findings, .steps { list-style: none; padding: 0; margin: 32px 0 0; counter-reset: n; display: grid; gap: 16px; }
.principles { grid-template-columns: repeat(3, 1fr); }
.findings { grid-template-columns: repeat(5, 1fr); }
.principles li, .findings li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; counter-increment: n; }
.principles li::before, .findings li::before, .steps li::before { content: counter(n, decimal-leading-zero); display: block; font-family: var(--serif); font-size: 1.5rem; color: var(--red); margin-bottom: 6px; }
.principles p, .findings p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* benchmark */
.layers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0; }
.layer { border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
.layer p { margin: 0 0 8px; font-size: 0.95rem; }
.layer .tag { display: inline-block; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.layer.visible { background: var(--blue-soft); border-color: #cfe0fb; }
.layer.visible .tag { color: var(--blue); }
.layer.advice { background: var(--red-soft); border-color: #f8d1cd; }
.layer.advice .tag { color: var(--red); }
.layer.hidden { background: #eef0f3; }
.layer.hidden .tag { color: var(--muted); }
.actions code { background: #fff; padding: 2px 6px; border-radius: 4px; margin-right: 4px; font-size: 0.8rem; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; }
.card p { font-size: 0.95rem; margin: 0 0 10px; }
.eq { font-family: var(--serif); font-size: 1.08rem; text-align: center; background: var(--band); border-radius: 8px; padding: 10px; }

.measure { display: grid; grid-template-columns: 3fr 2fr; gap: 32px; margin-top: 40px; }
.source { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.source b { font-family: var(--serif); font-size: 1.6rem; min-width: 44px; }
.source span { font-size: 0.94rem; color: var(--muted); }
.source em { color: var(--ink); font-style: normal; font-weight: 600; }

/* results */
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 14px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font: inherit; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--ink); color: #fff; }
.check { font-size: 0.9rem; color: var(--muted); display: flex; gap: 8px; align-items: center; cursor: pointer; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
.results th, .results td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: 0.93rem; }
.results th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: #fafbfc; }
.results th[data-sort] { cursor: pointer; user-select: none; }
.results th[data-sort]:hover { color: var(--ink); }
.results th.sorted::after { content: " ↓"; }
.results th.sorted.asc::after { content: " ↑"; }
.results tr:last-child td { border-bottom: 0; }
.results tr.extra td { background: #fcfcfd; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.results td.delta { font-weight: 700; }
.results tr.sig td.delta { color: var(--red); }
.results td.ci { color: var(--muted); }
.plot-col { width: 32%; min-width: 220px; }
.pill { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; background: var(--band); color: var(--muted); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.sig-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); vertical-align: 0; }
.note { font-size: 0.86rem; color: var(--muted); margin-top: 12px; }
.ci-plot { position: relative; height: 22px; }
.ci-zero { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(22, 32, 44, 0.4); }
.ci-range { position: absolute; top: 9px; height: 4px; border-radius: 2px; min-width: 2px; }
.ci-dot { position: absolute; top: 5px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; border: 2px solid #fff; }

.takeaway { margin-top: 24px; background: #fff; border-left: 4px solid var(--red); padding: 16px 20px; border-radius: 0 var(--radius) var(--radius) 0; }
.takeaway.wide { margin-top: 32px; }

/* analysis */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; align-items: start; }
.split.tight { margin-top: 20px; }
.split > *, .grid3 > *, .measure > *, .layers > *, .principles > li, .findings > li, .steps > li { min-width: 0; }
.split > div, .card { overflow-x: auto; }
.subhead.first { margin-top: 28px; }
.wide-fig { margin-top: 16px; }
.wide-fig img { width: 100%; max-width: 980px; margin: 0 auto; }
table.mini { font-size: 0.9rem; margin: 12px 0; }
table.mini th, table.mini td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
table.mini th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
table.mini small { color: var(--muted); }
.neg { color: var(--red); font-weight: 700; }
.pos { color: var(--green); font-weight: 700; }

.bars { display: grid; gap: 6px; margin: 14px 0; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 52px; align-items: center; gap: 10px; font-size: 0.86rem; }
.bars.compact .bar-row { grid-template-columns: 110px 1fr 44px; }
.bar-track { position: relative; height: 16px; background: var(--band); border-radius: 4px; }
.bar-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; }
.bar-fill.red { background: var(--red); }
.bar-fill.blue { background: var(--blue); }
.bar-fill.gray { background: var(--gray); }
.bar-ref { position: absolute; top: -3px; bottom: -3px; border-left: 2px dashed var(--ink); opacity: 0.5; }
.bar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { font-variant-numeric: tabular-nums; text-align: right; }
.bar-group { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 8px; }

.stack-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.84rem; color: var(--muted); margin: 10px 0; }
.stack-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.m1 { background: #9aa5b3; } .m2 { background: #f2a93b; } .m3 { background: var(--red); } .m4 { background: var(--blue); }
.stack-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; font-size: 0.86rem; margin: 6px 0; }
.stack { display: flex; height: 22px; border-radius: 5px; overflow: hidden; }
.stack span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.74rem; font-weight: 700; }
.stack-model { font-weight: 700; margin-top: 12px; font-size: 0.9rem; }

.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 20px; }
.notes blockquote { margin: 0; background: var(--band); border-radius: var(--radius); padding: 18px 20px; font-size: 0.95rem; }
.notes cite { display: block; font-style: normal; font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--red); margin-bottom: 6px; }

/* get started */
.steps { counter-reset: n; }
.steps li { counter-increment: n; border-left: 2px solid var(--line); padding: 0 0 8px 20px; }
.steps li::before { font-size: 1.1rem; margin-bottom: 2px; }
.steps p { margin: 0 0 6px; color: var(--muted); font-size: 0.95rem; }
pre { background: #0f1723; color: #e6edf5; border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 6px 0 8px; line-height: 1.5; }
pre code { background: none; padding: 0; color: inherit; font-size: 0.86rem; }
.cta { background: var(--band); border-radius: var(--radius); padding: 28px; position: sticky; top: 80px; }
.cta p { color: var(--muted); }

.footer { border-top: 1px solid var(--line); padding: 24px 0; font-size: 0.9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .principles, .layers, .grid3 { grid-template-columns: 1fr; }
  .findings { grid-template-columns: 1fr 1fr; }
  .measure, .split { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .cta { position: static; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .findings { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr 44px; }
  .stack-row { grid-template-columns: 1fr; gap: 2px; }
}
