/* ==========================================================================
   Shape-Bayes project page
   Layout: a single reading column (prose) with figures that break out to a
   wide measure, like a printed journal plate. Colour is semantic and matches
   the paper's method diagram:
     likelihood / evidence  -> magenta   (pink "Likelihood" box)
     prior                  -> olive     (yellow-green "Prior" box)
     posterior              -> cyan      (cyan "Posterior" box, cyan shapes)
     deterministic baseline -> neutral grey
   ========================================================================== */

:root {
  --paper: #FBFBFA;
  --paper-2: #F3F4F3;
  --plate: #FFFFFF;
  --ink: #121417;
  --ink-2: #3D444E;
  --muted: #6B7380;
  --rule: #E3E5E8;
  --rule-strong: #CBD0D6;
  --lik: #9C2C7A;
  --pri: #748300;
  --post: #1E9CBA;
  --base: #858B95;
  --post-wash: rgba(30, 156, 186, .09);
  --lik-wash: rgba(156, 44, 122, .07);
  --pri-wash: rgba(116, 131, 0, .09);
  --focus: #1E9CBA;
  --shadow: 0 1px 2px rgba(18, 20, 23, .04), 0 8px 28px rgba(18, 20, 23, .06);

  --f-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-sans: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --measure: 680px;
  --wide: 1080px;
  --full: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 60px;
  color-scheme: light;
}
/* Light is the default for every visitor; dark applies only when chosen with the toggle. */
:root[data-theme="dark"] {
  --paper: #0E1013; --paper-2: #14171B; --plate: #EEF0F2;
  --ink: #ECEEF1; --ink-2: #B4BBC5; --muted: #87909C; --rule: #242930; --rule-strong: #353C45;
  --lik: #C4498F; --pri: #8E9A1A; --post: #26A0BB; --base: #8E95A0;
  --post-wash: rgba(38, 160, 187, .13); --lik-wash: rgba(196, 73, 143, .11); --pri-wash: rgba(142, 154, 26, .12);
  --focus: #26A0BB; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-serif); font-size: 19px; line-height: 1.62;
  font-optical-sizing: auto; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--post); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--post-wash); }
p { margin: 0; }
sub, sup { line-height: 0; }

.c-lik { color: var(--lik); } .c-pri { color: var(--pri); } .c-post { color: var(--post); } .c-base { color: var(--base); }
.katex .lik { color: var(--lik); } .katex .pri { color: var(--pri); } .katex .post { color: var(--post); }
.katex { font-size: 1.04em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- containers ---------- */
.wrap { padding-inline: var(--gutter); }
.measure { max-width: var(--measure); margin-inline: auto; }
.wide { max-width: var(--wide); margin-inline: auto; }
.full { max-width: var(--full); margin-inline: auto; }
.stack { display: grid; gap: 22px; }
.stack > * { min-width: 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--rule); }
.nav-in { max-width: var(--full); margin-inline: auto; height: var(--nav-h); display: flex; align-items: center; gap: 24px; }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-serif); font-size: 20px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; }
.mark em { font-style: italic; font-weight: 400; }
.triad { display: inline-flex; gap: 3px; }
.triad i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.triad i:nth-child(1) { background: var(--lik); } .triad i:nth-child(2) { background: var(--pri); } .triad i:nth-child(3) { background: var(--post); }
.nav-links { display: flex; gap: 2px; margin-left: auto; font-family: var(--f-sans); font-size: 14px; }
.nav-links a { text-decoration: none; color: var(--muted); padding: 6px 11px; border-radius: 999px; transition: color .15s, background .15s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); background: var(--paper-2); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.icon-btn svg { width: 16px; height: 16px; }
@media (max-width: 900px) { .nav-links { display: none; } .nav-in { justify-content: space-between; } }

/* ---------- hero ---------- */
.hero { padding-block: clamp(48px, 9vw, 104px) clamp(28px, 4vw, 44px); text-align: center; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.hero h1 {
  font-family: var(--f-serif); font-weight: 500; font-size: clamp(36px, 5.5vw, 68px); line-height: 1;
  letter-spacing: -.035em; margin: 18px 0 0; font-variation-settings: "opsz" 72;
}
.hero h1 em { font-weight: 400; font-style: italic; letter-spacing: -.03em; }
.hero .subtitle { font-size: clamp(20px, 2.4vw, 27px); line-height: 1.3; color: var(--ink-2); margin: 20px auto 0; max-width: 30ch; text-wrap: balance; font-weight: 400; }
.authors { margin-top: 34px; font-size: 19px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 26px; }
.authors a { text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.authors a:hover { border-color: var(--post); }
.authors sup { font-family: var(--f-sans); font-size: 11px; color: var(--muted); margin-left: 2px; }
.affils { margin-top: 10px; font-family: var(--f-sans); font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 20px; }
.affils sup { margin-right: 3px; }
/* Formal footnote: set apart by a short hairline, neutral ink, readable size. Noticeable, not promotional. */
.authorship { margin: 16px auto 0; padding-top: 12px; max-width: 72ch; position: relative; font-family: var(--f-serif); font-style: italic; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.authorship::before { content: ""; position: absolute; top: 0; left: 50%; width: 48px; margin-left: -24px; border-top: 1px solid var(--rule-strong); }
.authorship sup { font-style: normal; font-size: 11px; margin-right: 3px; }
.links { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-sans); font-size: 14.5px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px; text-decoration: none; border: 1px solid var(--rule-strong); color: var(--ink); background: var(--paper);
  transition: border-color .15s, background .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { transform: translateY(-1px); }
.btn[aria-disabled="true"] { color: var(--muted); border-style: dashed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.btn small { font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* ---------- figures ---------- */
figure { margin: 0; }
.plate { background: var(--plate); border-radius: 12px; padding: clamp(10px, 1.6vw, 22px); box-shadow: var(--shadow); border: 1px solid var(--rule); }
.plate img { mix-blend-mode: multiply; width: 100%; }
.plate.bare { padding: 0; overflow: hidden; }
figcaption { font-family: var(--f-sans); font-size: 14px; line-height: 1.55; color: var(--muted); margin-top: 14px; max-width: 78ch; }
figcaption b { color: var(--ink-2); font-weight: 600; }
figcaption .fig-n { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; color: var(--ink-2); margin-right: 8px; text-transform: uppercase; }
.zoomable { cursor: zoom-in; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x > .plate { min-width: 640px; }

/* ---------- sections ---------- */
section.sec { padding-block: clamp(64px, 9vw, 116px); border-top: 1px solid var(--rule); }
section.sec.tint { background: var(--paper-2); }
.sec-head { display: grid; gap: 14px; margin-bottom: clamp(28px, 4vw, 44px); }
.sec-head .eyebrow { display: inline-flex; align-items: center; gap: 10px; }
.sec-head .eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--muted); }
h2 { font-family: var(--f-serif); font-weight: 400; font-size: clamp(32px, 4.2vw, 50px); line-height: 1.08; letter-spacing: -.022em; margin: 0; text-wrap: balance; font-variation-settings: "opsz" 60; }
h2 em { font-style: italic; }
h3 { font-family: var(--f-serif); font-weight: 500; font-size: 25px; line-height: 1.2; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h4 { font-family: var(--f-sans); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { font-size: 22px; line-height: 1.5; color: var(--ink-2); }
.prose p + p { margin-top: 1em; }
.prose em { font-style: italic; }
.prose strong { font-weight: 600; }
.mt-l { margin-top: clamp(36px, 5vw, 60px); }
.mt-m { margin-top: 28px; }

/* ---------- thesis ---------- */
.thesis { text-align: center; padding-block: clamp(36px, 6vw, 64px) 0; }
.thesis blockquote { margin: 0 auto; max-width: 24ch; font-size: clamp(24px, 3.2vw, 36px); line-height: 1.18; letter-spacing: -.02em; text-wrap: balance; font-weight: 400; }
.thesis blockquote .c-lik, .thesis blockquote .c-pri { font-style: italic; }
.thesis cite { display: block; margin-top: 18px; font-family: var(--f-sans); font-style: normal; font-size: 13px; color: var(--muted); }

/* ---------- abstract ---------- */
.abstract { margin-top: clamp(48px, 7vw, 80px); }
.abstract h4 { margin-bottom: 14px; }
.abstract p { font-size: 18px; color: var(--ink-2); hyphens: auto; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); margin-top: clamp(48px, 7vw, 80px); }
.stat { padding: 22px 22px 24px 0; display: grid; gap: 8px; align-content: start; }
.stat + .stat { padding-left: 22px; border-left: 1px solid var(--rule); }
.stat .v { font-family: var(--f-serif); font-size: clamp(36px, 4.2vw, 52px); line-height: 1; letter-spacing: -.03em; font-variant-numeric: lining-nums tabular-nums; }
.stat .v .arrow { color: var(--muted); font-size: .6em; margin: 0 .12em; vertical-align: .18em; }
.stat .v .to { color: var(--post); }
.stat .k { font-family: var(--f-sans); font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.stat .k b { color: var(--ink); font-weight: 600; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat:nth-child(3) { padding-left: 0; border-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--rule); } }
@media (max-width: 480px) { .stats { grid-template-columns: minmax(0, 1fr); } .stat, .stat + .stat { padding-left: 0; border-left: 0; } .stat + .stat { border-top: 1px solid var(--rule); } }

/* ---------- compare sliders ---------- */
.compare-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 22px); }
@media (max-width: 820px) { .compare-grid { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-inline: auto; } }
.compare { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1000 / 980; background: var(--paper-2); box-shadow: var(--shadow); --pos: 50%; user-select: none; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .top { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; z-index: 3; }
.compare .bar { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; z-index: 2; pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.compare .knob { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); display: grid; place-items: center; }
.compare .knob svg { width: 18px; height: 18px; color: #121417; }
.compare input:focus-visible ~ .bar .knob { outline: 2px solid var(--focus); outline-offset: 2px; }
.compare .tag { position: absolute; top: 10px; z-index: 2; pointer-events: none; font-family: var(--f-sans); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; padding: 4px 9px; border-radius: 999px; background: rgba(12, 14, 17, .66); color: #fff; backdrop-filter: blur(6px); }
.compare .tag.l { left: 10px; } .compare .tag.r { right: 10px; }
.compare .tag i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* ---------- idea / equation ---------- */
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.two.r { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.two.l { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
@media (max-width: 860px) { .two, .two.r, .two.l { grid-template-columns: minmax(0, 1fr); } }
.equation { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 22px 24px; overflow-x: auto; }
.tint .equation { background: var(--paper); }
.equation .katex-display { margin: .3em 0; }
.equation .katex { font-size: 1.16em; }
.equation .katex-display > .katex { max-width: 100%; }
.eq-note { font-family: var(--f-sans); font-size: 13px; line-height: 1.6; color: var(--ink-2); margin-top: 10px; border-top: 1px solid var(--rule); padding-top: 12px; }
.eq-note .katex { font-size: 1.05em; }
@media (max-width: 520px) { .equation { padding: 16px 14px; } .equation .katex { font-size: 1em; } }
.eq-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--f-sans); font-size: 13px; color: var(--ink-2); margin-top: 10px; border-top: 1px solid var(--rule); padding-top: 12px; }
.eq-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
@media (max-width: 520px) { .limits { grid-template-columns: minmax(0, 1fr); } }
.limit { border-radius: 10px; padding: 16px 18px; display: grid; gap: 6px; align-content: start; }
.limit.occ { background: var(--pri-wash); }
.limit.clean { background: var(--lik-wash); }
.limit h4 { color: var(--ink-2); }
.limit p { font-family: var(--f-sans); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.limit .katex { font-size: 1em; }

/* ---------- method steps ---------- */
.steps { display: grid; gap: clamp(48px, 7vw, 84px); }
.step { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 28px; }
@media (max-width: 760px) { .step { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.step-n { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 9px; border-top: 1px solid var(--ink); align-self: start; }
.step-body { display: grid; gap: 18px; min-width: 0; }
.step-body .prose { max-width: var(--measure); }
.spec { display: flex; flex-wrap: wrap; gap: 8px; }
.spec span { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 10px; background: var(--paper); }
.callout { border-left: 2px solid var(--post); padding: 4px 0 4px 18px; font-size: 18px; color: var(--ink-2); }
.callout b { color: var(--ink); font-weight: 600; }
.tall-fig { max-width: 420px; }
@media (max-width: 860px) { .tall-fig { max-width: 380px; margin-inline: auto; } }

/* ---------- tabs ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule); font-family: var(--f-sans); }
.tint .tabs { background: var(--paper); }
.tabs button { font: 500 13.5px var(--f-sans); color: var(--muted); background: transparent; border: 0; padding: 7px 15px; border-radius: 999px; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--f-sans); font-size: 13px; color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.base { border: 2px solid var(--base); background: var(--paper); }
.dot.sb { background: var(--post); }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 860px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.chart-card { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px 14px; display: grid; gap: 10px; min-width: 0; position: relative; }
.chart-card h4 { color: var(--ink-2); }
.chart-card .sub { font-family: var(--f-sans); font-size: 12.5px; color: var(--muted); margin-top: -4px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { font-family: var(--f-sans); font-size: 12px; fill: var(--ink-2); }
svg.chart text.num { font-family: var(--f-mono); font-size: 11.5px; fill: var(--ink-2); }
svg.chart text.num.sb { fill: var(--ink); font-weight: 500; }
svg.chart text.axis { font-family: var(--f-mono); font-size: 10.5px; fill: var(--muted); }
svg.chart .grid { stroke: var(--rule); stroke-width: 1; }
svg.chart .conn { stroke: var(--rule-strong); stroke-width: 2; }
svg.chart .pt-base { fill: var(--paper); stroke: var(--base); stroke-width: 2; }
svg.chart .pt-sb { fill: var(--post); stroke: var(--paper); stroke-width: 2; }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover { fill: var(--paper-2); }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--paper); font-family: var(--f-sans); font-size: 12.5px; line-height: 1.45; padding: 8px 11px; border-radius: 7px; max-width: 260px; box-shadow: var(--shadow); }
.tip b { font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }
table.data { width: 100%; border-collapse: collapse; font-family: var(--f-sans); font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 11px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
table.data thead th { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); background: var(--paper-2); text-transform: uppercase; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.m { font-weight: 600; color: var(--ink); }
table.data td .tag-native { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
table.data .b { color: var(--muted); }
table.data .sb { color: var(--ink); font-weight: 600; }
table.data .arrow { color: var(--muted); margin: 0 5px; }
table.data .delta { font-family: var(--f-mono); font-size: 11.5px; color: var(--post); margin-left: 6px; }
table.data .na { color: var(--muted); }
table.data tr.ours td { background: var(--post-wash); }
table.data tr.sep td { border-top: 1px solid var(--rule-strong); }
table.data td.best { font-weight: 700; color: var(--ink); }
.table-note { font-family: var(--f-sans); font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
th abbr { text-decoration: none; }

/* ablation progression */
table.ablation td:first-child { white-space: normal; min-width: 260px; }
table.ablation td:nth-child(2) { min-width: 150px; }
table.ablation .lvl { display: inline-block; width: 22px; font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); }
table.ablation .bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--post); vertical-align: middle; margin-right: 10px; opacity: .85; }
table.ablation tr:first-child .bar { background: var(--base); }

/* ---------- gallery ---------- */
.gallery-panel[hidden] { display: none; }

/* ---------- efficiency ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule-strong); }
.fact { padding: 18px 18px 18px 0; display: grid; gap: 4px; align-content: start; }
.fact:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--rule); }
.fact:nth-child(n+3) { border-top: 1px solid var(--rule); }
.fact .v { font-family: var(--f-serif); font-size: 34px; letter-spacing: -.02em; line-height: 1.1; }
.fact .k { font-family: var(--f-sans); font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- citation ---------- */
.bib { position: relative; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; }
.bib pre { margin: 0; padding: 22px 24px; overflow-x: auto; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.bib button { position: absolute; top: 12px; right: 12px; font: 500 12.5px var(--f-sans); color: var(--ink-2); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.bib button:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); padding-block: 40px 56px; font-family: var(--f-sans); font-size: 13.5px; color: var(--muted); }
footer .full { display: flex; flex-wrap: wrap; gap: 14px 40px; justify-content: space-between; }
footer p { max-width: 62ch; line-height: 1.55; }

/* ---------- lightbox ---------- */
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
dialog.lightbox::backdrop { background: rgba(8, 9, 11, .86); backdrop-filter: blur(4px); }
dialog.lightbox img { max-width: 96vw; max-height: 90vh; width: auto; border-radius: 8px; background: #fff; }
dialog.lightbox .close { position: fixed; top: 16px; right: 16px; }
dialog.lightbox .close.icon-btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }

/* ---------- load-in ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
  .hero > *:nth-child(2) { animation-delay: .05s; } .hero > *:nth-child(3) { animation-delay: .1s; }
  .hero > *:nth-child(4) { animation-delay: .15s; } .hero > *:nth-child(5) { animation-delay: .2s; } .hero > *:nth-child(6) { animation-delay: .25s; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* ---------- posterior sampling ---------- */
.c-gold { color: #B88A00; font-weight: 600; }
:root[data-theme="dark"] .c-gold { color: #E0B12E; }

/* Hero figure: row of deterministic stills over row of live posterior videos. */
.live { margin-top: 6px; }
.live-grid { display: grid; grid-template-columns: 96px repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto; grid-auto-flow: column; gap: clamp(8px, 1.2vw, 14px); }
.live-col, .live-rowlabels { display: contents; }
.live-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow); }
.live-tile img, .live-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.live-tile.sb { outline: 2px solid var(--post); outline-offset: 2px; }
.live-cap { font-family: var(--f-sans); font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.live-cap b { display: block; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.live-rowlabels .rl { display: flex; flex-direction: column; justify-content: center; gap: 8px; font-family: var(--f-sans); font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--ink-2); }
.live-rowlabels .rl i { width: 22px; height: 3px; border-radius: 2px; display: block; }
.live-rowlabels .det i { background: #E0B12E; }
.live-rowlabels .sb i { background: var(--post); }
@media (max-width: 860px) {
  .live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-flow: row; }
  .live-rowlabels { display: none; }
  .live-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
  .live-cap { grid-column: 1 / -1; }
}
@media (max-width: 480px) { .live-grid { grid-template-columns: minmax(0, 1fr); } }

/* Hypothesis rows */
.hyp-rows { display: grid; gap: clamp(18px, 2.4vw, 28px); }
.hyp-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.2vw, 14px); }
@media (max-width: 860px) { .hyp-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hyp { display: grid; gap: 8px; align-content: start; min-width: 0; }
.hyp-img { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow); }
.hyp-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hyp.sbh .hyp-img { outline: 2px solid var(--post); outline-offset: 2px; }
.hyp-cap { font-family: var(--f-sans); font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.hyp-k { display: block; color: var(--ink); font-weight: 600; font-size: 13px; }

.ladder { display: grid; gap: 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 20px 22px; }
.ladder h4 { color: var(--ink-2); }
.rung { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-family: var(--f-sans); font-size: 13.5px; color: var(--ink-2); }
.rb { height: 10px; background: var(--paper-2); border-radius: 5px; overflow: hidden; }
.rb i { display: block; height: 100%; background: var(--post); border-radius: 5px; }
.rb i.base { background: var(--base); }
.rv { font-family: var(--f-mono); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
@media (max-width: 480px) { .rung { grid-template-columns: minmax(0, 1fr) auto; } .rb { grid-column: 1 / -1; grid-row: 2; } }

.apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
@media (max-width: 980px) { .apps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .apps { grid-template-columns: minmax(0, 1fr); } }
.app { padding: 18px 20px 20px 0; display: grid; gap: 8px; align-content: start; min-width: 0; }
.app + .app { padding-left: 20px; border-left: 1px solid var(--rule); }
@media (max-width: 980px) { .app:nth-child(3) { padding-left: 0; border-left: 0; } .app:nth-child(n+3) { border-top: 1px solid var(--rule); } }
@media (max-width: 560px) { .app, .app + .app { padding-left: 0; border-left: 0; } .app + .app { border-top: 1px solid var(--rule); } }
.app-k { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--post); }
h4.app-h { font-family: var(--f-serif); font-size: 21px; font-weight: 500; letter-spacing: -.01em; text-transform: none; color: var(--ink); line-height: 1.2; }
.app p { font-family: var(--f-sans); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.hyp-k.c-gold { color: #B88A00; } .hyp-k.c-post { color: var(--post); }
:root[data-theme="dark"] .hyp-k.c-gold { color: #E0B12E; }

.sw-c { color: var(--post); } .sw-w { color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 0 4px; font-weight: 600; }


/* ---------- arbitration sweep ---------- */
.sweep { margin-top: clamp(28px, 4vw, 44px); }
.sweep-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sweep-heads, .sweep-video { min-width: 720px; }
.sweep-heads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.sh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; font-family: var(--f-sans); font-size: 13.5px; font-weight: 600; color: var(--ink); padding-right: 6px; }
.sh-k { display: inline-flex; align-items: center; gap: 8px; }
.ln { width: 20px; height: 3px; border-radius: 2px; display: inline-block; }
.ln.gold { background: #E0B12E; } .ln.cyan { background: var(--post); }
.badge { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--muted); background: var(--paper); transition: color .15s, background .15s, border-color .15s; }
.badge.ok { color: var(--post); border-color: var(--post); }
.badge.bad { color: #fff; background: #C2410C; border-color: #C2410C; }
.gate-legend { display: inline-flex; gap: 10px; font-weight: 500; color: var(--ink-2); font-size: 12.5px; }
.gate-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sweep-video { border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.sweep-video video { display: block; width: 100%; height: auto; }
.sweep-live { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; margin-top: 12px; font-family: var(--f-sans); font-size: 13px; color: var(--muted); }
.sl-item { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.sweep-live b { font-family: var(--f-mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.sl-prior { margin-left: auto; }
@media (max-width: 760px) { .sl-prior { margin-left: 0; } }

/* ---------- arbitration stills ---------- */
.arb-bar { margin-bottom: 14px; }
.arb-live { font-family: var(--f-sans); font-size: 13.5px; color: var(--ink-2); }
.arb-live b { font-family: var(--f-mono); font-weight: 500; color: var(--pri); font-size: 15px; }
.arb-stage { display: grid; min-width: 720px; }
.arb-set { grid-area: 1 / 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s; }
.arb-set.on { opacity: 1; visibility: visible; transition: opacity .6s ease; }
.arb-panel { border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 1 / 1; }
.arb-panel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arb-set .arb-panel:nth-child(2) { outline: 2px solid var(--post); outline-offset: 2px; }

/* ---------- Fig. 2 grid ---------- */
.arb-grid { display: grid; grid-template-columns: 132px repeat(3, minmax(0, 1fr)); gap: 10px 8px; align-items: center; min-width: 760px; }
.arb-grid .sh { align-self: end; padding-bottom: 2px; }
.arb-label { display: grid; gap: 4px; font-family: var(--f-sans); font-size: 13px; line-height: 1.35; color: var(--muted); padding-right: 8px; }
.arb-label b { color: var(--ink); font-weight: 600; font-size: 13.5px; }
.arb-panel { border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 1 / 1; }
.arb-panel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arb-panel.sb { outline: 2px solid var(--post); outline-offset: 2px; }

/* ---------- logo: likelihood (pink) x prior (olive) -> posterior (cyan, their exact Gaussian product) ---------- */
.logo { width: 30px; height: 30px; flex: none; overflow: visible; }
.logo .l-lik, .logo .l-pri { fill: none; stroke-width: 1.7; }
.logo .l-lik { stroke: var(--lik); } .logo .l-pri { stroke: var(--pri); }
.logo .l-post { fill: var(--post); }

.arb { margin-top: clamp(36px, 5vw, 56px); }
