/* ---------- tokens ---------- */
:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --ink: #15201c;
  --ink-2: #44514c;
  --ink-3: #6d7a75;
  --line: #dfe4e0;
  --grid: #e9ece9;
  --accent: #0f6e5c;
  --accent-2: #13866f;
  --accent-soft: #dcefe9;
  --warm: #c2571b;
  --hero-1: #0b2a2a;
  --hero-2: #12403b;
  --shadow: 0 1px 2px rgba(16, 32, 28, .06), 0 6px 24px rgba(16, 32, 28, .06);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;

  /* chart series (validated categorical palette, light) */
  --c-blue: #2a78d6;
  --c-orange: #eb6834;
  --c-aqua: #1baf7a;
  --c-yellow: #eda100;
  --c-magenta: #e87ba4;
  --c-green: #008300;
  --c-violet: #4a3aa7;
  --c-red: #e34948;

  /* architecture figure */
  --mhsa: #e98a2a;
  --mhsa-soft: #fdeedd;
  --ffn: #c9443c;
  --ffn-soft: #fbe6e3;
  --enc-soft: #e6f2e6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412;
    --surface: #151d1a;
    --surface-2: #1c2622;
    --ink: #e7eeea;
    --ink-2: #b4c1bb;
    --ink-3: #85938d;
    --line: #2a3632;
    --grid: #232e2a;
    --accent: #4cc3a5;
    --accent-2: #6ad3b8;
    --accent-soft: #173a32;
    --warm: #f08a4b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .3);
    --c-blue: #3987e5;
    --c-orange: #d95926;
    --c-aqua: #199e70;
    --c-yellow: #c98500;
    --c-magenta: #d55181;
    --c-green: #2f9e2f;
    --c-violet: #9085e9;
    --c-red: #e66767;
    --mhsa-soft: #3a2a17;
    --ffn-soft: #3a1d1b;
    --enc-soft: #18301f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412;
  --surface: #151d1a;
  --surface-2: #1c2622;
  --ink: #e7eeea;
  --ink-2: #b4c1bb;
  --ink-3: #85938d;
  --line: #2a3632;
  --grid: #232e2a;
  --accent: #4cc3a5;
  --accent-2: #6ad3b8;
  --accent-soft: #173a32;
  --warm: #f08a4b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .3);
  --c-blue: #3987e5;
  --c-orange: #d95926;
  --c-aqua: #199e70;
  --c-yellow: #c98500;
  --c-magenta: #d55181;
  --c-green: #2f9e2f;
  --c-violet: #9085e9;
  --c-red: #e66767;
  --mhsa-soft: #3a2a17;
  --ffn-soft: #3a1d1b;
  --enc-soft: #18301f;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font: 700 clamp(1.6rem, 3vw, 2.1rem)/1.15 var(--serif); letter-spacing: -.01em; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); font-size: .88em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.eyebrow {
  font: 600 .75rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .75rem; display: block;
}

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 56px; }
.nav .brand { font-weight: 700; color: var(--ink); white-space: nowrap; }
.nav .links { display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav .links::-webkit-scrollbar { display: none; }
.nav .links a { color: var(--ink-2); font-size: .9rem; white-space: nowrap; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav .links a.active, .nav .links a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--accent); }
.theme-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer; flex: none;
  display: grid; place-items: center;
}

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #eaf5f1;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(76, 195, 165, .25), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(235, 104, 52, .18), transparent 60%),
    linear-gradient(160deg, var(--hero-1), var(--hero-2));
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; pointer-events: none; }
.hero .wrap { position: relative; padding-top: 72px; padding-bottom: 64px; text-align: center; }
.venue {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  font-size: .85rem; font-weight: 600; letter-spacing: .02em;
}
.venue .dot { width: 8px; height: 8px; border-radius: 50%; background: #6ad3b8; box-shadow: 0 0 0 4px rgba(106, 211, 184, .2); }
.hero h1 {
  font: 700 clamp(1.9rem, 4.6vw, 3.25rem)/1.1 var(--serif); letter-spacing: -.015em;
  margin: 22px auto 10px; max-width: 920px;
}
.hero h1 .q { color: #8fe3cc; }
.hero .subtitle { font-size: clamp(1.02rem, 2vw, 1.25rem); color: #bcd6ce; max-width: 760px; margin: 0 auto 26px; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 26px; font-size: 1.08rem; font-weight: 600; }
.authors a { color: #fff; }
.authors sup { color: #8fe3cc; font-weight: 500; }
.affil { color: #a9c6bd; font-size: .95rem; margin-top: 6px; }
.btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  background: #f2fbf8; color: #0b2a2a; font-weight: 650; font-size: .95rem;
  border: 1px solid transparent; transition: transform .15s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); background: #fff; }
.btn.ghost { background: rgba(255, 255, 255, .08); color: #eaf5f1; border-color: rgba(255, 255, 255, .25); }
.btn.ghost:hover { background: rgba(255, 255, 255, .16); }
.btn.pending { opacity: .6; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

/* ---------- sections ---------- */
section { padding: 72px 0; }
section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { margin-bottom: 28px; max-width: 820px; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; margin-top: 12px; }

/* tldr */
.tldr {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); font-size: 1.08rem;
  margin-top: -40px; position: relative; z-index: 2;
}
.tldr b { color: var(--accent); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow);
}
.stat .v { font: 700 2rem/1 var(--serif); color: var(--ink); letter-spacing: -.02em; }
.stat .v small { font-size: 1.05rem; color: var(--ink-3); font-weight: 600; }
.stat .l { color: var(--ink-2); font-size: .9rem; margin-top: 8px; line-height: 1.4; }
.stat.hl .v { color: var(--accent); }
.stat.warm .v { color: var(--warm); }

/* abstract */
.abstract { columns: 2 340px; column-gap: 40px; color: var(--ink-2); text-align: left; }

/* cards & grids */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card h3 { margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px;
}
.tag.warm { background: color-mix(in srgb, var(--warm) 15%, transparent); color: var(--warm); }
.tag.new { background: color-mix(in srgb, var(--c-violet) 16%, transparent); color: var(--c-violet); }

/* findings list */
.findings { counter-reset: f; display: grid; gap: 14px; }
.finding { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.finding::before {
  counter-increment: f; content: counter(f);
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 700 1.2rem var(--serif);
}
.finding p { margin: 0; color: var(--ink-2); }
.finding b { color: var(--ink); }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 14px; }
.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap;
}
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: 550 .86rem var(--sans);
  padding: 6px 11px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.ctl-label { font-size: .78rem; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-right: 6px; }
.ctl { display: inline-flex; align-items: center; }

/* ---------- chart ---------- */
.chart-card { padding: 18px 18px 12px; }
.chart-title { font-weight: 650; font-size: 1rem; }
.chart-sub { color: var(--ink-3); font-size: .86rem; margin-bottom: 6px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--ink-3); font: 12px var(--sans); }
.chart .axis-title { fill: var(--ink-2); font: 600 12px var(--sans); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .series path.ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; transition: opacity .15s; }
.chart .series circle { stroke: var(--surface); stroke-width: 1.5; }
.chart .series.dim { opacity: .14; }
.chart .band { opacity: .14; }
.chart .ref { stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .ref-label { font: 600 11px var(--sans); fill: var(--ink-2); }
.chart .hair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hl-dot { stroke: var(--surface); stroke-width: 2; }
.chart .direct { font: 600 11px var(--sans); fill: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0 6px; }
.legend button {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); font: 500 .83rem var(--sans); padding: 3px 8px; border-radius: 7px; cursor: pointer;
}
.legend button:hover { background: var(--surface-2); color: var(--ink); }
.legend button[aria-pressed="false"] { opacity: .4; }
.legend button[aria-pressed="false"] span { text-decoration: line-through; }
.legend svg { width: 22px; height: 10px; flex: none; }
.chart-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.linkbtn { border: 0; background: none; color: var(--accent); font: 550 .82rem var(--sans); cursor: pointer; padding: 2px 0; }
.linkbtn:hover { text-decoration: underline; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 180px; max-width: 320px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 10px 12px; font-size: .82rem; line-height: 1.45;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .tt-h { font-weight: 650; color: var(--ink-2); margin-bottom: 6px; font-size: .78rem; }
.tooltip .row { display: grid; grid-template-columns: 18px auto 1fr; gap: 8px; align-items: center; }
.tooltip .row b { font-variant-numeric: tabular-nums; }
.tooltip .row span { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tooltip .key { width: 16px; height: 0; border-top: 2.5px solid; }
.tooltip .key.dash { border-top-style: dashed; }
.tooltip p { margin: 0; color: var(--ink-2); }
.tooltip p + p { margin-top: 6px; }
.tooltip .tt-title { font-weight: 700; color: var(--ink); margin-bottom: 4px; font-size: .9rem; }
.tooltip .eq { font-family: var(--mono); font-size: .78rem; color: var(--ink); background: var(--surface-2); padding: 4px 6px; border-radius: 6px; display: block; margin-top: 6px; white-space: pre-wrap; }

/* data table */
.dtable { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.dtable th, .dtable td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.dtable th:first-child, .dtable td:first-child { text-align: left; }
.dtable th { color: var(--ink-3); font-weight: 600; }
.table-wrap { overflow-x: auto; max-height: 340px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap[hidden] { display: none; }

/* ---------- architecture figure ---------- */
.arch-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
.arch svg { width: 100%; height: auto; display: block; }
.arch .hov { cursor: help; }
.arch .hov:hover > .hit, .arch .hov:focus > .hit { stroke: var(--accent); stroke-width: 2.5; }
.arch .hov:focus { outline: none; }
.arch text { font-family: var(--sans); fill: var(--ink); }
.arch .t-small { font-size: 14px; }
.arch .t-tiny { font-size: 12px; fill: var(--ink-2); }
.arch .t-bold { font-weight: 700; }
.arch .t-math { font-family: var(--serif); font-style: italic; }
.arch .box { fill: var(--surface-2); stroke: var(--ink-3); stroke-width: 1.4; }
.arch .flow { stroke: var(--ink-2); stroke-width: 1.6; fill: none; }
.arch .kept-a { fill: var(--mhsa); transition: width .25s ease; }
.arch .drop { fill: var(--surface); stroke: var(--ink-3); stroke-dasharray: 2 2; stroke-width: 1; }
.arch .neuron { stroke-width: 1.6; transition: fill .2s, stroke .2s; }
.arch .edge { transition: opacity .2s; }
.slider-box { margin-top: 10px; }
.slider-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.slider-row input[type="range"] { flex: 1; min-width: 200px; accent-color: var(--accent); height: 28px; }
.sval { font: 700 1.4rem var(--serif); min-width: 90px; font-variant-numeric: tabular-nums; }
.ticks-row { display: flex; justify-content: space-between; color: var(--ink-3); font-size: .74rem; padding: 0 2px; }
.readout { display: grid; gap: 10px; }
.readout .kv { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; font-size: .9rem; }
.readout .kv b { font-variant-numeric: tabular-nums; }
.readout .big { font: 700 2.2rem/1 var(--serif); color: var(--accent); }
.readout { grid-template-columns: 1.3fr 1.2fr repeat(5, 1fr); align-items: end; }
.readout .kv { flex-direction: column; border-bottom: 0; border-left: 1px dashed var(--line); padding: 0 0 0 12px; gap: 2px; }
.readout .wide { grid-column: 1 / -1; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s; }
select {
  font: 500 .9rem var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; width: 100%;
}

/* equations */
.eqs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.eqs .card { overflow-x: auto; }
.katex-display { margin: .6em 0; }

/* ---------- static figure gallery ---------- */
.fig-tabs { margin-bottom: 14px; }
.fig-panel[hidden] { display: none; }
.fig-row { display: grid; gap: 14px; }
.fig-row.c2 { grid-template-columns: repeat(2, 1fr); }
.fig-row.c3 { grid-template-columns: repeat(3, 1fr); }
.fig { background: #fff; border-radius: 10px; padding: 8px 8px 8px 22px; position: relative; border: 1px solid var(--line); }
.fig .yl { position: absolute; left: 4px; top: 50%; transform: translate(-25%, -50%) rotate(-90deg); transform-origin: center; font-size: 11px; color: #444; white-space: nowrap; }
.fig .xl { text-align: center; font-size: 11px; color: #444; margin-top: -2px; }
.fig .cap { font-size: .78rem; color: #555; text-align: center; margin-top: 2px; font-weight: 600; }
.fig-legend { background: #fff; border-radius: 10px; padding: 6px 10px; border: 1px solid var(--line); margin-bottom: 12px; }
.fig-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 24px; }
.fig-legend img { max-height: 26px; width: auto; max-width: 100%; }
.fig-caption { color: var(--ink-2); font-size: .92rem; margin-top: 12px; }

/* accordions */
details.acc { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
details.acc summary { cursor: pointer; padding: 14px 18px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; color: var(--ink-3); font-weight: 400; font-size: 1.2rem; line-height: 1; }
details.acc[open] summary::after { content: "−"; }
details.acc .acc-body { padding: 0 18px 16px; color: var(--ink-2); }

/* width guide */
.guide { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.guide .g { border-radius: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.guide .g .ds { font-weight: 700; }
.guide .g .meta { color: var(--ink-3); font-size: .82rem; }
.guide .g .budget { font: 700 1.5rem var(--serif); color: var(--accent); margin-top: 10px; }
.bar-track { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 8px; position: relative; }
.bar-track i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }

/* code */
pre.code {
  background: #0f1715; color: #d7e6e0; border-radius: 12px; padding: 18px; overflow-x: auto;
  font-size: .84rem; line-height: 1.6; border: 1px solid var(--line); margin: 0;
}
pre.code .k { color: #8fe3cc; }
pre.code .c { color: #6f8a82; font-style: italic; }
pre.code .s { color: #f3b37e; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--ink-2); }
.checklist li::before { content: "✓"; color: var(--accent); font-weight: 800; }

/* bibtex */
.bib { position: relative; }
.bib pre { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; overflow-x: auto; margin: 0; font-size: .85rem; }
.copy { position: absolute; top: 10px; right: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 8px; padding: 5px 10px; font: 600 .8rem var(--sans); cursor: pointer; }

footer { padding: 40px 0 56px; color: var(--ink-3); font-size: .86rem; border-top: 1px solid var(--line); }
footer .wrap { display: grid; gap: 8px; }
footer p { margin: 0; }

.note {
  font-size: .82rem; color: var(--ink-3); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 14px;
}

/* reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .readout { grid-template-columns: repeat(3, 1fr); }
  .readout > div:first-child { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .guide { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .fig-row.c3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  section { padding: 52px 0; }
  .grid-2, .grid-3, .eqs, .fig-row.c2, .fig-row.c3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 1.6rem; }
  .guide { grid-template-columns: 1fr; }
  .readout { grid-template-columns: 1fr 1fr; }
  .nav .brand { display: none; }
  .hero .wrap { padding-top: 48px; }
}

/* grid children may shrink; long formulas scroll instead of overflowing */
.grid-2 > *, .grid-3 > *, .eqs > *, .arch-layout > * { min-width: 0; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
@media (max-width: 680px) {
  #arch-svg { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #arch-svg svg { min-width: 700px; }
}

.hero .session { color: #bcd6ce; font-size: .88rem; margin-top: 10px; }

/* ---------- QR share overlay ---------- */
.nav .theme-btn + .theme-btn { margin-left: -10px; }
body.qr-open { overflow: hidden; }
.qr-overlay {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: rgba(6, 20, 18, .72); backdrop-filter: blur(6px);
  animation: qr-fade .18s ease;
}
.qr-overlay[hidden] { display: none; }
.qr-card {
  position: relative; width: min(420px, 100%); max-height: 100%; overflow: auto; text-align: center;
  background: linear-gradient(165deg, #0b2a2a, #12403b); color: #eaf5f1;
  border-radius: 24px; padding: 28px 24px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  animation: qr-pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.qr-close {
  position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .1); color: #eaf5f1; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.qr-close:hover { background: rgba(255, 255, 255, .2); }
.qr-venue { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #8fe3cc; }
.qr-card h2 { font: 700 1.45rem/1.15 var(--serif); margin: 8px 0 4px; color: #fff; }
.qr-sub { font-size: .9rem; color: #bcd6ce; margin: 0 0 18px; }
.qr-code { background: #fff; border-radius: 18px; padding: 10px; box-shadow: 0 0 0 6px rgba(143, 227, 204, .18); }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr-url { font: 500 .9rem var(--mono); color: #bcd6ce; margin: 14px 0 14px; word-break: break-all; }
.qr-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.qr-btn {
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #eaf5f1;
  font: 650 .92rem var(--sans); padding: 10px 18px; border-radius: 999px; cursor: pointer; min-width: 120px;
}
.qr-btn.primary { background: #f2fbf8; color: #0b2a2a; border-color: transparent; }
@keyframes qr-fade { from { opacity: 0; } }
@keyframes qr-pop { from { opacity: 0; transform: scale(.94) translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .qr-overlay, .qr-card { animation: none; } }
