/* ============================================================
   ReState project page — light academic style, "state machine" motif
   blue  = stage (prior paradigm)   orange = state (ReState)
   red   = erroneous reasoning      green  = corrected / preserved
   ============================================================ */
:root {
  --paper: #fbfaf7;
  --paper-2: #f3f1ea;
  --card: #ffffff;
  --ink: #1b1f2a;
  --dim: #6b7280;
  --rule: #e7e3da;
  --stage: #185FA5;
  --stage-50: #e6f1fb;
  --state: #D85A30;
  --state-50: #fbece6;
  --ok: #2e7d32;  --ok-50: #e8f5e9;
  --err: #c0392b; --err-50: #fdecea;
  --warn: #b7791f; --warn-50: #fdf3e1;
  --mind: #7f77dd;          /* MIND baseline color in charts */
  --chart-gray: #b8bcc6;    /* Direct SFT bars */
  --chart-gray-dark: #8a909c; /* Multimodal-CoT bars */
  --f-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --max: 72rem;
  --r: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.65 var(--f-sans); -webkit-font-smoothing: antialiased; }
a { color: var(--stage); text-decoration: none; }
code { font-family: var(--f-mono); font-size: .88em; }
img { max-width: 100%; display: block; }
em { font-style: italic; }
.w-stage { color: var(--stage); }
.w-state { color: var(--state); }
.c-state { color: var(--state); }
.restate-name { font-weight: 700; font-style: italic; }
.restate-re { color: var(--stage); fill: var(--stage); }
.restate-state { color: var(--state); fill: var(--state); }

/* subtle dot grid behind everything = "state space" */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(#d9d4c7 1px, transparent 1px);
  background-size: 22px 22px; opacity: .45;
}

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 30; background: rgba(251,250,247,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.bar-inner { max-width: var(--max); margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand .re { color: var(--stage); } .brand .st { color: var(--state); }
.nav { display: flex; gap: 1.1rem; margin-left: auto; }
.nav a { color: var(--dim); font-size: .9rem; font-weight: 500; padding: .2rem 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.nav a:hover, .nav a.on { color: var(--ink); border-color: var(--state); }

/* ---------- hero ---------- */
.hero { max-width: var(--max); margin: 0 auto; padding: 4.5rem 1.25rem 3rem; display: grid; grid-template-columns: 1.35fr 1fr; gap: 2rem; align-items: center; }
.title { font-family: var(--f-serif); font-weight: 400; font-size: clamp(2.8rem, 6.4vw, 5rem); line-height: 1.02; letter-spacing: -.015em; margin: 0; }
.title .w-state { font-style: italic; }
.subtitle { font-size: 1.2rem; color: #3b4252; margin: .9rem 0 1.3rem; max-width: 34rem; }
.links { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 999px; border: 1px solid #d5d0c4; background: var(--card); color: var(--ink); font-weight: 500; font-size: .92rem; transition: transform .15s, border-color .2s, background .2s; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.btn:hover { transform: translateY(-1px); border-color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: var(--state); border-color: var(--state); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .75rem; margin-top: 2rem; }
.stat { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: .75rem .85rem; }
.stat b { display: block; font-size: 1.4rem; font-weight: 600; letter-spacing: -.01em; }
.stat span { font-size: .72rem; color: var(--dim); line-height: 1.35; display: block; margin-top: .15rem; }
.expand { margin: -.6rem 0 1.1rem; font-size: .92rem; color: #3b4252; }

.hero-visual { position: relative; min-height: 400px;   /* sketch.js draws the whiteboard scene in here */ background: var(--card); border: 1px solid var(--rule); border-radius: 22px; padding: 1.5rem; display: flex; flex-direction: column; justify-content: center; align-items: center; overflow: hidden; }
.hero-visual::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 70% 20%, var(--state-50), transparent 55%), radial-gradient(circle at 20% 85%, var(--stage-50), transparent 55%); }
@keyframes flow { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes pulse { 0%, 20%, 100% { transform: scale(1); } 8% { transform: scale(1.12); } }
.op { position: relative; z-index: 2; margin-top: 1.1rem; font: .82rem var(--f-mono); color: var(--dim); background: var(--paper); border: 1px dashed #d5d0c4; padding: .35rem .7rem; border-radius: 8px; }

/* ---------- tldr ---------- */
.tldr { max-width: 56rem; margin: 0 auto 1rem; padding: 0 1.25rem; }
.tldr p { margin: 0; background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--state); border-radius: 12px; padding: 1.1rem 1.3rem; font-size: 1.05rem; }
.tag { font: 600 .72rem var(--f-mono); background: var(--ink); color: #fff; padding: .15rem .5rem; border-radius: 6px; margin-right: .4rem; vertical-align: 2px; }

/* ---------- blocks ---------- */
.block { max-width: var(--max); margin: 0 auto; padding: 4.5rem 1.25rem; }
.block.alt { max-width: none; background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.block.alt > * { max-width: calc(var(--max) - 2.5rem); margin-left: auto; margin-right: auto; }
.sec-head { margin-bottom: 2rem; }
.sec-num { font: 500 .8rem var(--f-mono); color: var(--state); }
.sec-head h2 { font-family: var(--f-serif); font-weight: 400; font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.1; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
.lede { color: #3b4252; max-width: none; margin: 0; }
.note { font-size: .82rem; color: var(--dim); margin: .7rem 0 0; }
.block, .tldr { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.block.in, .tldr.in { opacity: 1; transform: none; }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.3rem 1.4rem; }
.card h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kicker { font: 500 .72rem var(--f-mono); color: var(--dim); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .25rem; }

/* segmented control */
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; font: 500 .82rem var(--f-sans); color: var(--dim); padding: .35rem .75rem; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.mini { font: 500 .8rem var(--f-sans); border: 1px solid #d5d0c4; background: var(--card); color: var(--ink); padding: .35rem .75rem; border-radius: 8px; cursor: pointer; }
.mini:hover { border-color: var(--ink); }

/* ---------- 01 paradigm ---------- */
.toggle { display: inline-flex; gap: .4rem; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 4px; margin-bottom: 1rem; }
.tg { border: 0; background: transparent; padding: .55rem 1rem; border-radius: 9px; font: 600 .92rem var(--f-sans); color: var(--dim); cursor: pointer; }
.tg small { font-weight: 400; }
.tg[data-mode="stage"].on { background: var(--stage-50); color: var(--stage); }
.tg[data-mode="state"].on { background: var(--state-50); color: var(--state); }
.paradigm-wrap { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 2rem 1.5rem; min-height: 280px; }
#paradigm .paradigm-wrap > .toggle { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .65rem; width: fit-content; max-width: 100%; margin: 0 auto 2rem; }
.pd { display: none; animation: fade .45s ease; }
.pd.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.flow { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .5rem; }
.box { border: 1.5px solid #cfd3da; border-radius: 12px; padding: .7rem .9rem; text-align: center; font-size: .9rem; background: #fff; min-width: 120px; }
.box small { display: block; font-size: .72rem; color: var(--dim); margin-top: .15rem; }
.box.model { font: 600 1.05rem var(--f-mono); }
.box.blue { border-color: var(--stage); background: var(--stage-50); color: var(--stage); }
.box.orange { border-color: var(--state); background: var(--state-50); color: var(--state); }
.box.big { padding: 1rem 1.4rem; font-size: 1.25rem; }
.box.in { background: var(--paper); }
.box.out { background: var(--paper); }
.arr { color: #9aa1ad; font-size: 1.3rem; }
.gap-note { display: flex; gap: .7rem; align-items: flex-start; max-width: 44rem; margin: 1.1rem auto 0; font-size: .9rem; color: #3b4252; }
.warn { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #f5b300; color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .8rem; margin-top: 2px; }
.loop-line { max-width: 30rem; margin: .4rem auto 0; height: 46px; border: 2px dashed var(--state); border-top: 0; border-radius: 0 0 40px 40px; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.loop-line span { font: .75rem var(--f-mono); color: var(--state); background: var(--card); padding: 0 .5rem; transform: translateY(.6rem); }
.loop-line::before { content: "▲"; position: absolute; left: -7px; top: -10px; color: var(--state); font-size: .7rem; }
.state-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.8rem; }
.sc { font: 500 .82rem var(--f-mono); padding: .35rem .7rem; border-radius: 8px; border: 1px solid; }
.sc em { font-family: var(--f-sans); font-style: normal; opacity: .75; }
.s-empty { border-color: #9aa1ad; color: #4b5563; background: #f3f4f6; }
.s-pos { border-color: var(--ok); color: var(--ok); background: var(--ok-50); }
.s-neg { border-color: var(--err); color: var(--err); background: var(--err-50); }
.s-hist { border-color: var(--mind); color: #4c45a8; background: #eeedfe; }
details summary { cursor: pointer; font-size: .88rem; color: var(--dim); font-weight: 500; }
.paper-figure { margin-top: 1.5rem; }
.paper-figure > summary { width: fit-content; padding: .4rem 0; color: var(--stage); font-size: 1rem; }
.paper-figure > summary:hover { color: var(--state); }

/* ---------- 02 method ---------- */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.eq { font: .88rem var(--f-mono); background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: .6rem .8rem; margin: .9rem 0; text-align: center; overflow-x: auto; }
.eq.small { font-size: .8rem; margin-bottom: 0; }
.ursm-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.ut { border: 1.5px solid var(--rule); background: #fff; border-radius: 10px; padding: .55rem; cursor: pointer; font: 500 .82rem var(--f-sans); color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.ut b { font: 600 1.05rem var(--f-mono); }
.ut[data-s="empty"].on { border-color: #6b7280; color: #374151; background: #f3f4f6; }
.ut[data-s="pos"].on { border-color: var(--ok); color: var(--ok); background: var(--ok-50); }
.ut[data-s="neg"].on { border-color: var(--err); color: var(--err); background: var(--err-50); }
.ursm-body { min-height: 128px; margin-top: .9rem; font-size: .92rem; }
.ursm-body p { margin: .7rem 0 0; }
.ursm-flow { display: flex; align-items: center; justify-content: center; gap: .6rem; font: 600 1rem var(--f-mono); animation: fade .35s ease; }
.ursm-flow span { padding: .3rem .7rem; border-radius: 8px; border: 1.5px solid currentColor; }
.ursm-flow .op { color: var(--state); background: var(--state-50); }
.ursm-flow .pos { color: var(--ok); background: var(--ok-50); }
.ursm-flow.s-empty, .ursm-flow.s-pos, .ursm-flow.s-neg { border: 0; background: none; }
.ursm-flow i { color: #9aa1ad; font-style: normal; }
.loop3 { display: flex; align-items: center; justify-content: center; gap: .45rem; flex-wrap: wrap; font-size: .82rem; }
.loop3 span { background: var(--state-50); color: #8c3a1d; border-radius: 999px; padding: .25rem .7rem; font-weight: 500; }
.loop3 i { font-style: normal; color: var(--state); }
.loop3 .back { font-size: 1.2rem; animation: spin 3s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(-360deg); } }
.pool-demo { margin-top: 1rem; border: 1px dashed #c9c3b4; border-radius: 12px; padding: .9rem; }
.pool-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-size: .8rem; color: var(--dim); flex-wrap: wrap; }
.pool { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .7rem; }
.slot { border: 1.5px solid var(--mind); background: #eeedfe; color: #4c45a8; border-radius: 10px; padding: .55rem; text-align: center; font: 600 .95rem var(--f-mono); }
.slot small { display: block; font: .7rem var(--f-sans); color: var(--dim); }
.slot.empty { border-style: dashed; border-color: #c9c3b4; background: transparent; color: #a8a29e; font-weight: 400; font-size: .8rem; }
.slot.new { animation: pop .45s ease; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.pool-log { font-size: .8rem; color: #3b4252; margin: .7rem 0 0; min-height: 3.2em; }
.wide-fig { margin: 1.6rem 0 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem; }
.wide-fig img { cursor: zoom-in; border-radius: 6px; }
figcaption { font-size: .84rem; color: var(--dim); margin-top: .7rem; }

/* ---------- 03 demo ---------- */
.case-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.case-tabs button { border: 1px solid #d5d0c4; background: #fff; border-radius: 999px; padding: .45rem .95rem; font: 500 .88rem var(--f-sans); cursor: pointer; color: var(--dim); }
.case-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.demo { display: grid; grid-template-columns: 340px 1fr; gap: 1.2rem; align-items: start; }
.q-panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.1rem; position: sticky; top: 80px; }
.q-meta { font: 500 .74rem var(--f-mono); color: var(--state); margin-bottom: .6rem; }
.q-panel img { width: 100%; max-height: 220px; object-fit: contain; background: var(--paper); border-radius: 8px; border: 1px solid var(--rule); cursor: zoom-in; }
.q-text { font-weight: 600; font-size: .95rem; margin: .8rem 0 .5rem; }
.q-opts { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.q-opts li { font-size: .86rem; border: 1px solid var(--rule); border-radius: 8px; padding: .3rem .6rem; display: flex; justify-content: space-between; gap: .5rem; }
.q-opts li.gt { border-color: var(--ok); background: var(--ok-50); }
.q-opts li em { font-style: normal; font-size: .7rem; color: var(--ok); font-family: var(--f-mono); align-self: center; }
details.ref { margin-top: .8rem; }
details.ref p { font-size: .8rem; color: #3b4252; margin: .5rem 0 0; max-height: 200px; overflow: auto; }
.r-panel { min-width: 0; }
.timeline { display: flex; align-items: center; flex-wrap: wrap; row-gap: .7rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: clamp(.7rem, 2vw, 1rem) clamp(.7rem, 2.4vw, 1.2rem); overflow: visible; }   /* no scrollbars: nodes shrink with width, wrap only as last resort */
.tnode { flex: none; font: 600 clamp(.74rem, 1.9vw, .85rem) var(--f-mono); border: 2px solid; border-radius: 10px; padding: clamp(.3rem, 1vw, .4rem) clamp(.45rem, 1.6vw, .7rem); cursor: pointer; background: #fff; transition: transform .2s, opacity .2s; }
.tnode.empty { border-color: #9aa1ad; color: #4b5563; cursor: default; }
.tnode.bad { border-color: var(--err); color: var(--err); background: var(--err-50); }
.tnode.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-50); }
.tnode.future { opacity: .35; }
.tnode.cur { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(216,90,48,.18); }
.tline { flex: 1 1 0; min-width: 12px; height: 2px; background: #e2ded4; margin: 0 .3rem; position: relative; }
.tline.lit { background: var(--state); }
.tline.lit::after { content: "▸"; position: absolute; right: -4px; top: -11px; color: var(--state); font-size: .8rem; }
.r-controls { display: flex; gap: .5rem; margin: .8rem 0; }
.r-controls .play { background: var(--state); color: #fff; border-color: var(--state); }
.r-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.2rem 1.3rem; }
.r-card.flash { animation: fade .4s ease; }
.r-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.r-round { font: 600 .82rem var(--f-mono); }
.r-verb { font: 600 .74rem var(--f-mono); text-transform: uppercase; letter-spacing: .04em; padding: .15rem .5rem; border-radius: 6px; }
.v-empty { background: #f3f4f6; color: #374151; }
.v-neg { background: var(--err-50); color: var(--err); }
.v-pos { background: var(--ok-50); color: var(--ok); }
.r-sub { font-size: .8rem; color: var(--dim); }
.r-cot { font-size: .93rem; line-height: 1.75; margin: .9rem 0; }
mark { padding: .05em .2em; border-radius: 4px; }
mark.err { background: var(--err-50); color: var(--err); text-decoration: underline wavy rgba(192,57,43,.5); text-underline-offset: 3px; }
mark.fix { background: var(--ok-50); color: var(--ok); }
mark.warnm { background: var(--warn-50); color: var(--warn); }
.r-choice { display: flex; align-items: center; gap: .7rem; border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; }
.r-choice span { font-size: .78rem; color: var(--dim); }
.r-choice em { margin-left: auto; font: 600 .78rem var(--f-mono); font-style: normal; }
.r-choice.ok { background: var(--ok-50); color: var(--ok); }
.r-choice.bad { background: var(--err-50); color: var(--err); }
.r-note { font-size: .82rem; color: var(--dim); margin: .8rem 0 0; padding-left: .7rem; border-left: 3px solid var(--rule); }

/* ---------- 04 dataset ---------- */
.pipeline { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; counter-reset: s; }
.pipeline li { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.1rem 1.2rem; position: relative; }
.pipeline li:not(:last-child)::after { content: "→"; position: absolute; right: -.85rem; top: 50%; transform: translateY(-50%); color: var(--state); font-weight: 700; z-index: 1; }
.pipeline li > span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--state); color: #fff; font: 600 .8rem var(--f-mono); margin-bottom: .4rem; }
.pipeline b { display: block; }
.pipeline p { font-size: .86rem; color: #3b4252; margin: .3rem 0 0; }
.domains { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .7rem; margin-bottom: 1.4rem; }
.dom { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: .8rem .9rem; transition: transform .2s, border-color .2s; }
.dom:hover { transform: translateY(-2px); border-color: var(--stage); }
.dom b { display: block; font-size: .95rem; }
.dom span { display: block; font-size: .8rem; color: #3b4252; margin: .15rem 0 .35rem; }
.dom small { font: .72rem var(--f-mono); color: var(--stage); }
.fig-card { margin: 0; }
.fig-card img { cursor: zoom-in; }

/* ---------- 05 results ---------- */
.chart-box { position: relative; height: 320px; }
/* hard cap: a chart can never be wider than its card, whatever size Chart.js computed */
.chart-box > canvas { max-width: 100% !important; }
/* grid items default to min-width:auto, so a wide canvas or table could push a card
   past its column (phones showed a chart twice as wide as the screen). Let them shrink. */
.res-grid > *, .method-grid > *, .ds-row > *, .findings > *, .gallery > *, .demo > *,
.hero > *, .ev-mats > *, .domains > *, .stats > * { min-width: 0; }
.chart-box.short { height: 240px; }
.chart-box.tall { height: 420px; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 1.2rem 0; }
#results > .card + .res-grid, #results > .res-grid + .card { margin-top: 1.2rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: #cfc8b6; border-radius: 3px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: .5rem .55rem; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { font-weight: 600; color: var(--dim); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.tbl tr.hl td { background: var(--state-50); color: #8c3a1d; font-weight: 600; }

/* paper tables: red = best, blue = second best (marked * and ^ in data.js) */
.tbl td.best { font-weight: 700; color: #d1342c; }
.tbl td.second { font-weight: 600; color: #2f6db5; }
.tbl tr.grp td { text-align: center; font-style: italic; font-size: .78rem; letter-spacing: .03em;
  color: var(--dim); background: var(--paper-2); }
.tbl th.grp-col { text-align: center; }
.tbl.compact tr.zs-row { display: none; }          /* collapsed: matched backbones only */
.tbl small.gap { color: #7030a0; margin-left: .3em; font-size: .72rem; font-weight: 400; }
.tbl.bd td:nth-child(-n+4), .tbl.bd th:nth-child(-n+4) { text-align: center; }
.tbl.bd td:first-child, .tbl.bd th:first-child { text-align: left; }
.tbl-legend { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tbl-legend .best-k { color: #d1342c; } .tbl-legend .second-k { color: #2f6db5; }
.sec-head.sub { margin-top: 2.4rem; }
.sec-head.sub h3 { font-family: var(--f-serif); font-size: 1.6rem; margin: 0 0 .4rem; }

/* ---------- 06 cite ---------- */
.bib { position: relative; }
.bib pre { margin: 0; background: #1f2330; color: #e6e1d6; border-radius: var(--r); padding: 1.3rem 1.4rem; overflow-x: auto; font: .85rem/1.6 var(--f-mono); }
.copy { position: absolute; top: .8rem; right: .8rem; border: 1px solid #4a5063; background: #2b3042; color: #e6e1d6; border-radius: 8px; padding: .3rem .7rem; font: 500 .78rem var(--f-sans); cursor: pointer; }
.copy:hover { background: var(--state); border-color: var(--state); }

/* ---------- footer / overlays ---------- */
.foot { text-align: center; padding: 2.5rem 1.25rem 3rem; font-size: .85rem; color: #3b4252; }
.foot p { margin: .2rem 0; }
.foot .dim { color: var(--dim); }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(20,22,30,.82); display: grid; place-items: center; padding: 2rem; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; background: #fff; border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .55rem 1rem; border-radius: 10px; font-size: .86rem; z-index: 110; }
.toast[hidden] { display: none; }

/* ---------- 01 evidence matrices ---------- */

/* ---------- 02 method extras ---------- */
.ursm-flow span.s-empty { color: #4b5563; background: #f3f4f6; }
.ursm-flow span.s-pos { color: var(--ok); background: var(--ok-50); }
.ursm-flow span.s-neg { color: var(--err); background: var(--err-50); }
.props { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .7rem; }
.props li { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: .7rem .9rem; font-size: .85rem; color: #3b4252; }
.props b { font: 600 1.3rem var(--f-mono); color: var(--state); margin-right: .35rem; }

/* ---------- 04 dataset stats ---------- */
.ds-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.ds-stats div { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: .75rem .9rem; }
.ds-stats b { display: block; font-size: 1.35rem; font-weight: 600; color: var(--stage); }
.ds-stats span { font-size: .78rem; color: var(--dim); }

/* ---------- 05 findings + tables ---------- */
.findings { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.fd { background: var(--state-50); border: 1px solid #f3cdbd; border-radius: var(--r); padding: 1rem 1.1rem; }
.fd b { display: block; color: #8c3a1d; font-size: .95rem; }
.fd p { margin: .35rem 0 0; font-size: .86rem; color: #4a3a33; }
.tbl small.dl { display: block; font-size: .68rem; color: var(--ok); font-weight: 500; }
.tbl .yes { color: var(--ok); font-weight: 700; } .tbl .no { color: #b8bcc6; }

/* ---------- 06 gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.gcard { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, border-color .2s; }
.gcard:hover { transform: translateY(-3px); border-color: var(--state); }
.gthumb { height: 190px; overflow: hidden; border-bottom: 1px solid var(--rule); background: #fff; }
.gthumb img { width: 100%; object-fit: cover; object-position: top; cursor: zoom-in; }
.gcard figcaption { padding: .8rem 1rem 1rem; margin: 0; color: var(--ink); }
.gds { display: block; font: 500 .7rem var(--f-mono); color: var(--state); margin-bottom: .2rem; }
.gcard b { font-size: .98rem; }
.gcard p { font-size: .84rem; color: #3b4252; margin: .35rem 0 0; }

/* ---------- 07 limitations ---------- */
.block.narrow { max-width: 56rem; }

/* ---------- theme switcher (shared by all themes) ---------- */
.sk-controls { position: fixed; left: 1rem; bottom: 1rem; z-index: 90; display: flex; align-items: center; gap: 2px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border: 1px solid var(--rule); border-radius: 999px; padding: 3px; font: 500 .74rem var(--f-sans); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.sk-controls span { color: var(--dim); padding: 0 .5rem 0 .6rem; }
.sk-controls a { color: var(--dim); padding: .3rem .7rem; border-radius: 999px; cursor: pointer; }
.sk-controls a:hover { color: var(--ink); }
.sk-controls a.on { background: var(--ink); color: #fff; }
.credit a { color: inherit; text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 3rem; }
  .hero-visual { min-height: 260px; }
  .method-grid, .res-grid, .ds-row { grid-template-columns: 1fr; }
  .demo { grid-template-columns: 1fr; }
  .q-panel { position: static; }
  .domains { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .findings, .gallery { grid-template-columns: 1fr 1fr; }
  .props, .ds-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .nav { display: none; }
  /* phones: charts shorter, tables denser and swipeable, hint that they scroll sideways */
  .chart-box { height: 260px; }
  .chart-box.tall { height: 360px; }
  .tbl { font-size: .78rem; }
  .tbl th, .tbl td { padding: .4rem .4rem; }
  .tbl th { font-size: .68rem; }
  .table-wrap { position: relative; }
  .table-wrap::after { content: "swipe →"; position: sticky; left: 100%; bottom: 0; float: right;
    font-size: .64rem; color: var(--dim); background: var(--card); padding: 0 .2rem; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pipeline { grid-template-columns: 1fr; }
  .findings, .gallery, .ev-mats { grid-template-columns: 1fr; }
  .pipeline li:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -1rem; transform: translateX(50%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .block, .tldr { opacity: 1; transform: none; }
}
.sec-head.sub .lede + .lede { margin-top: .8rem; }
