/* A classic academic project page: sans-serif text, serif section headings
   over hairline rules, quiet grey buttons and boxes. Chart colours (speech,
   face, fused) are one validated palette. */
:root {
  --ink: #202122;
  --ink-2: #54595d;
  --link: #3366cc;
  --rule: #a2a9b1;
  --rule-2: #c8ccd1;
  --wash: #f8f9fa;
  --wash-2: #eaecf0;
  --grid: #e6e6e6;
  --bg: #ffffff;
  --speech: #2a78d6;
  --face: #eb6834;
  --fused: #1baf7a;
  --heat-1: #cde2fb;
  --heat-2: #9ec5f4;
  --heat-3: #6da7ec;
  --heat-4: #3987e5;
  --heat-5: #256abf;
  --heat-6: #104281;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Linux Libertine", Georgia, Times, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--rule); background: var(--bg); }
.topbar .inner { max-width: 1000px; margin: 0 auto; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.topbar .name { font-size: 1.25em; color: var(--ink); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar nav { display: flex; gap: 18px; font-size: 14px; flex: none; }
@media (max-width: 600px) {
  .topbar .inner { padding: 10px 16px; }
  .topbar .name { font-size: 1em; }
  .topbar nav { gap: 12px; }
}

.container { max-width: 1000px; margin: 0 auto; padding: 10px 20px 40px; }
@media (max-width: 600px) { .container { padding: 10px 16px 32px; } }

/* Title block */
header.paper { text-align: center; margin: 36px 0 0; }
h1 { font-size: 2em; line-height: 1.25; margin: 0 0 6px; color: #000; }
.subtitle { font-size: 1.15em; color: var(--ink-2); margin: 0 0 18px; }
.authors { margin: 0; font-size: 1.1em; }
.affil { margin: 4px 0 0; color: #666; }

.buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.button {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--wash); border: 1px solid var(--rule); border-radius: 4px;
  color: var(--ink); font-size: 14px; transition: background 0.15s;
}
.button:hover { background: var(--wash-2); text-decoration: none; }
.button svg { width: 16px; height: 16px; flex: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 8px 0 12px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--wash); border: 1px solid var(--wash-2); border-radius: 8px; padding: 14px 18px; }
.stat b { display: block; font-size: 1.6em; line-height: 1.25; font-weight: 600; }
.stat span { color: var(--ink-2); font-size: 0.95em; }

/* Sections */
h2 {
  font: normal 1.8em/1.3 var(--serif); color: #000;
  margin: 44px 0 16px; padding-bottom: 0.25em; border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.2em; color: #162441; margin: 32px 0 8px; }
p, ul, ol { margin: 0.8em 0; }
li { margin: 0.35em 0; }

/* Figures and tables */
figure { margin: 28px 0; }
figcaption, caption { font-size: 0.95em; color: var(--ink); text-align: center; line-height: 1.55; }
figcaption { margin: 12px auto 0; max-width: 46em; }
figcaption b, caption b { font-weight: 600; }
.note-text { font-size: 0.9em; color: var(--ink-2); }
.figure-img { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; border-radius: 4px; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--wash); padding: 1px 4px; border-radius: 3px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; margin: 16px auto; font-size: 0.95em; font-variant-numeric: tabular-nums; }
caption { caption-side: top; padding-bottom: 8px; }
table.booktabs { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
table.booktabs thead th { border-bottom: 1px solid var(--ink); font-weight: 600; }
table.booktabs th, table.booktabs td { padding: 6px 14px; text-align: right; }
table.booktabs th:first-child, table.booktabs td:first-child { text-align: left; }
@media (max-width: 600px) { table.booktabs th, table.booktabs td { padding: 5px 8px; } }
table.booktabs tr.group td { color: var(--ink-2); font-style: italic; padding-top: 10px; text-align: left; }
table.booktabs tr.sep td { border-top: 1px solid var(--rule-2); }

table.audio td { padding: 5px 12px; vertical-align: middle; }
table.audio audio { display: block; width: 280px; max-width: 100%; height: 36px; }
@media (max-width: 600px) { table.audio audio { width: 130px; } table.audio td { padding: 4px 6px; } }

.equation { text-align: center; margin: 18px 0; font-size: 1.15em; }

/* Method diagram: two lanes of boxes merging into one. */
.diagram { font-size: 14px; line-height: 1.4; }
.lane { display: flex; align-items: stretch; margin: 8px 0; }
.lane-name { width: 5.5em; flex: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.box { flex: 1 1 0; min-width: 0; border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px; background: var(--wash); }
.box b { display: block; font-weight: 600; }
.arrow { flex: none; width: 20px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.arrow::before { content: "→"; }
.merge { display: flex; margin-left: 5.5em; }
.merge .box { text-align: center; background: var(--bg); border: 1.5px solid var(--fused); }
.down { margin-left: 5.5em; text-align: center; color: var(--ink-2); line-height: 1.2; }
@media (max-width: 600px) {
  .lane { flex-direction: column; }
  .lane-name { width: auto; margin-bottom: 4px; }
  .arrow { width: auto; height: 18px; }
  .arrow::before { content: "↓"; }
  .merge, .down { margin-left: 0; }
}
.swatch { width: 10px; height: 10px; display: inline-block; flex: none; border-radius: 2px; }
.swatch.dot { border-radius: 50%; }
.swatch.line { height: 2px; width: 16px; border-radius: 1px; }

/* Charts */
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin: 0 0 8px; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart text { font: 12px var(--sans); fill: var(--ink-2); }
.chart .tick { fill: #72777d; font-variant-numeric: tabular-nums; }
.chart .row-label { fill: var(--ink); font-size: 13px; }
.chart .strong { fill: var(--ink); font-weight: 600; }
.chart .halo { paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.chart .hit { fill: transparent; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(0, 0, 0, 0.035); outline: none; }

/* Model selector: radio inputs drawn as a joined button group. */
.selector { display: flex; justify-content: center; margin: 16px 0 6px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; background: var(--wash); }
.seg label { position: relative; cursor: pointer; font-size: 14px; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; padding: 8px 16px; color: var(--ink); transition: background 0.15s; }
.seg label:hover span { background: var(--wash-2); }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--link); outline-offset: -2px; }
@media (max-width: 600px) {
  .seg { flex-direction: column; width: 100%; }
  .seg label + label { border-left: 0; border-top: 1px solid var(--rule); }
  .seg span { text-align: center; }
}
.summary { text-align: center; color: var(--ink-2); font-size: 0.95em; margin: 8px auto 0; max-width: 46em; }

/* Confusion matrices */
.matrices { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 48px; }
.matrix h4 { margin: 0; font-size: 14px; font-weight: 600; text-align: center; }
.matrix .note { font-size: 12px; color: var(--ink-2); text-align: center; }
table.cm { border-collapse: separate; border-spacing: 2px; margin: 8px auto 0; font-size: 12px; }
table.cm th { font-weight: normal; color: var(--ink-2); padding: 0 4px; }
table.cm tbody th { text-align: right; }
table.cm td { width: 30px; height: 26px; text-align: center; color: #0b0b0b; border-radius: 3px; }
table.cm td.z { background: var(--wash); }
table.cm td.b1 { background: var(--heat-1); }
table.cm td.b2 { background: var(--heat-2); }
table.cm td.b3 { background: var(--heat-3); }
table.cm td.b4 { background: var(--heat-4); color: #fff; }
table.cm td.b5 { background: var(--heat-5); color: #fff; }
table.cm td.b6 { background: var(--heat-6); color: #fff; }

details { margin: 8px 0 0; text-align: center; }
details summary { cursor: pointer; color: var(--link); font-size: 0.95em; }
details .table-wrap { text-align: left; }
table.scores { font-size: 0.85em; }

ol.refs { padding-left: 1.6em; font-size: 0.95em; }
ol.refs li { margin: 0.45em 0; }

pre.bibtex {
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--wash); border: 1px solid var(--wash-2); border-radius: 4px; padding: 14px 16px; overflow-x: auto;
}

footer { border-top: 1px solid var(--rule); margin-top: 48px; padding-top: 16px; font-size: 0.875em; color: var(--ink-2); text-align: center; }

/* Tooltip */
.tip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 130px; max-width: 260px;
  background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 6px 9px; opacity: 0;
  font: 12px/1.45 var(--sans); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.tip.on { opacity: 1; }
.tip .tip-title { color: var(--ink-2); margin-bottom: 2px; }
.tip .tip-row { display: flex; align-items: center; gap: 7px; }
.tip .tip-row b { font-variant-numeric: tabular-nums; min-width: 3.2em; }
.tip .tip-row .name { color: var(--ink-2); }
.tip .swatch.line { width: 12px; }
