/* C-Gate project page */

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-opsz-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --ink: #15203b;
  --text: #2c3446;
  --muted: #5d6576;
  --faint: #8a92a1;
  --rule: #e2e6ec;
  --tint: #f5f7fa;
  --blue: #2456a6;
  --blue-soft: #eaf0f9;
  --blue-mid: #9db4dc;
  --amber: #c98a2b;
  --amber-soft: #f7ecd9;
  --red: #c0492f;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --prose: 720px;
  --wide: 1080px;
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: #fff; color: var(--text);
  font: 400 16.5px/1.68 var(--sans);
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
b, strong { font-weight: 600; color: var(--ink); }
sup { font-size: .68em; line-height: 0; }
code { font: 13.5px/1.4 var(--mono); color: var(--ink); background: var(--tint); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- layout ---------- */
main > section, .masthead { padding: 0 var(--gutter); }
.prose { max-width: var(--prose); margin-left: auto; margin-right: auto; }
section.prose { padding-left: var(--gutter); padding-right: var(--gutter); max-width: calc(var(--prose) + 2 * var(--gutter)); }
.wide { max-width: var(--wide); margin-left: auto; margin-right: auto; }
main > section { margin-top: 88px; }
main > section.highlights { margin-top: 52px; }

h1, h2, h3 { color: var(--ink); font-family: var(--serif); font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 30px; line-height: 1.2; margin: 0 0 18px; }
h3 { font-size: 21px; line-height: 1.3; margin: 40px 0 10px; }
p { margin: 0 0 16px; }
.small { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ---------- nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topnav.scrolled { border-bottom-color: var(--rule); }
.topnav-inner { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topnav-name { font: 600 15px/1 var(--sans); color: var(--ink); text-decoration: none; opacity: 0; transition: opacity .2s; }
.topnav.scrolled .topnav-name { opacity: 1; }
.topnav-links { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.topnav-links a { font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; padding: 4px 0; border-bottom: 1.5px solid transparent; }
.topnav-links a:hover { color: var(--ink); }
.topnav-links a.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- masthead ---------- */
.masthead { max-width: calc(880px + 2 * var(--gutter)); margin: 0 auto; text-align: center; padding-top: 56px; }
.kicker { font-size: 13.5px; color: var(--muted); letter-spacing: .01em; margin-bottom: 18px; font-variant-numeric: tabular-nums; }
h1 { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.14; margin: 0 0 26px; font-weight: 600; text-wrap: balance; }
.h1-name { color: var(--blue); }
.authors { font-size: 17px; color: var(--ink); margin: 0 0 6px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.affils { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; margin-bottom: 4px; }
.notes { font-size: 13px; color: var(--faint); margin-bottom: 26px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 13px;
  border: 1px solid #cdd3dc; border-radius: 19px; background: #fff;
  font: 500 14.5px/1 var(--sans); color: var(--ink); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.btn[hidden] { display: none; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.btn svg.i-play { fill: currentColor; stroke: none; width: 15px; }
.btn:hover { border-color: var(--ink); }
.btn[aria-disabled="true"] { color: var(--faint); border-style: dashed; cursor: default; }
.btn[aria-disabled="true"]:hover { border-color: #cdd3dc; }
.btn em { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--muted); background: var(--tint); border-radius: 9px; padding: 3px 7px; margin-left: 2px; }
.logos { display: flex; justify-content: center; align-items: center; gap: 44px; flex-wrap: wrap; }
.logos img { width: auto; }

/* ---------- highlights ---------- */
.highlights { max-width: var(--wide); margin-left: auto; margin-right: auto; }
/* four numbers in one centred row, no rules between them; Figure 1 sits below on its own */
.hl-facts { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 36px; text-align: center; }
.hl-facts > div { min-width: 0; }
.hl-facts dt { font: 600 46px/1.05 var(--serif); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.hl-facts dd { margin: 10px auto 0; max-width: 250px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.hl-facts dd b { display: block; margin-bottom: 2px; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.hl-chart { margin: 56px auto 0; max-width: 860px; }
.hl-chart figcaption { margin-top: 10px; }
.hl-facts > div:first-child dt, .hl-facts > div:nth-child(2) dt { color: var(--blue); }

/* ---------- teaser ---------- */
.teaser { margin-top: 64px; padding: 0 var(--gutter); }
.teaser video { width: 100%; aspect-ratio: 16 / 9; background: #fff; border: 1px solid var(--rule); border-radius: 6px; }
/* our own captions over the video (site.js), in the film's subtitle style */
.video-wrap { position: relative; container-type: inline-size; }
.cc { position: absolute; left: 6%; right: 6%; bottom: 9%; text-align: center; pointer-events: none; }
.cc span { font: 500 max(11px, 1.98cqw)/1.32 var(--sans); color: var(--ink); white-space: pre-line;
  text-shadow: 0 0 2px #fff, 0 0 3px #fff, 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff; }
.video-wrap.cc-off .cc { display: none; }
.cc-toggle { position: absolute; top: 10px; right: 10px; font: 600 11.5px/1 var(--sans); letter-spacing: .04em; color: var(--ink); background: rgba(255,255,255,.9); border: 1px solid #cdd3dc; border-radius: 5px; height: 24px; padding: 0 7px; cursor: pointer; }
.cc-toggle:hover { border-color: var(--ink); }
.cc-toggle[aria-pressed="false"] { color: var(--faint); text-decoration: line-through; }
figcaption, .figure-note { font-size: 14px; line-height: 1.6; color: var(--muted); margin-top: 12px; text-align: center; text-wrap: pretty; }
.figure-note { padding: 0 var(--gutter); }
figcaption b { color: var(--ink); font-weight: 600; }

/* ---------- overview ---------- */
.tldr { font-family: var(--serif); font-size: 19.5px; line-height: 1.55; color: var(--ink); margin-bottom: 22px; }
.tldr b { font-family: var(--sans); font-size: 12.5px; font-weight: 600; letter-spacing: .06em; color: var(--blue); margin-right: 8px; vertical-align: 2px; }

/* ---------- figures ---------- */
.figure { margin-top: 36px; margin-bottom: 36px; padding: 0 var(--gutter); }
.figure figcaption, .figure-note { max-width: calc(var(--prose) + 2 * var(--gutter)); margin-left: auto; margin-right: auto; }
.table-wrap > .small { text-align: center; max-width: var(--prose); margin-left: auto; margin-right: auto; }
.figure.mid { max-width: calc(860px + 2 * var(--gutter)); }
.architecture-figure { width: 100%; height: auto; }
.model-mobile { display: none; }
.model-node { fill: #fff; stroke: #c9d0db; stroke-width: 1.1; }
.model-node-blue { fill: var(--blue-soft); stroke: #7f9ccf; }
.model-stack { fill: #f6f7f9; stroke: #dde2e9; stroke-width: 1; }
.model-token { fill: #eef1f5; stroke: #c3cad6; stroke-width: 1; }
.model-token-blue { fill: #d9e4f6; stroke: #7f9ccf; }
.model-route { fill: none; stroke: #97a1b1; stroke-width: 1.3; }
.model-route-blue { stroke: #4f74b8; }
.model-label { font: 500 13.5px var(--sans); fill: var(--ink); }
.model-note { font: 400 11.5px var(--sans); fill: var(--muted); }
.model-wave path { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }

.math-display { overflow-x: auto; overflow-y: hidden; margin: 6px 0 20px; padding: 4px 0; }
.katex { font-size: 1.08em; }
.math-display .katex { font-size: 1.12em; }

table.stages, table.prompts { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 12px; }
table.stages th, table.prompts th { text-align: left; font-weight: 600; color: var(--ink); font-size: 13px; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--ink); }
table.stages td, table.prompts td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.prompts td:first-child { color: var(--muted); white-space: nowrap; }
table.prompts code { font-size: 13px; }
table.params .num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 20px; }
table.params th.num { text-align: right; padding-right: 20px; }
table.params td:last-child { color: var(--muted); }
table.params tr.trained td { color: var(--blue); }
table.params tr.trained td:first-child { font-weight: 500; }
table.params tr.total td { border-bottom: 0; border-top: 1px solid var(--ink); font-weight: 600; color: var(--ink); }

/* ---------- charts ---------- */
.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 236px minmax(0, 1fr) 46px; align-items: center; gap: 14px; font-size: 14px; }
.bar-name { color: var(--text); text-align: right; white-space: nowrap; line-height: 1.25; }
.bar-name i { display: block; font-style: normal; font-size: 11.5px; color: var(--faint); }
.bar-track { position: relative; height: 22px; }
.bar { position: absolute; left: 0; top: 3px; bottom: 3px; background: #c8ced8; border-radius: 0 2px 2px 0; }
.whisk { position: absolute; top: 50%; height: 0; border-top: 1.5px solid var(--ink); opacity: .55; }
.whisk::before, .whisk::after { content: ""; position: absolute; top: -5px; height: 8px; border-left: 1.5px solid var(--ink); }
.whisk::before { left: 0; } .whisk::after { right: 0; }
.maj { position: absolute; top: -4px; bottom: -4px; border-left: 1.5px dashed var(--faint); }
.bar-val { font-variant-numeric: tabular-nums; color: var(--muted); }
.bar-row:not(.base):not(.axis) .bar { background: var(--blue-mid); }
.bar-row.ours .bar { background: var(--blue); }
.bar-row.ours .bar-name, .bar-row.ours .bar-val { color: var(--blue); font-weight: 600; }
.bar-row.axis { margin-top: 0; }
.bar-row.axis .bar-track { height: 34px; border-top: 1px solid var(--rule); }
.tick { position: absolute; top: 3px; transform: translateX(-50%); font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.maj-label { position: absolute; top: 18px; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

svg.dotstrip, svg.rank { width: 100%; height: auto; }
.chart-mobile { display: none; }
.grid { stroke: var(--rule); stroke-width: 1.2; }
.grid.strong { stroke: #b9c1cd; stroke-dasharray: 4 4; }
.grid.dash { stroke: #b9c1cd; stroke-dasharray: 5 5; }
.axis { stroke: var(--ink); stroke-width: 1.2; }
.tick-t { font: 400 13px var(--sans); fill: var(--faint); font-variant-numeric: tabular-nums; }
.note-t { font: 500 12.5px var(--sans); fill: var(--muted); }
.lab-t { font: 400 14px var(--sans); fill: var(--text); }
.lab-t.ours { fill: var(--blue); font-weight: 600; }
.val-t { font: 500 13px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.stem { stroke: var(--rule); stroke-width: 2; }
.dot { fill: #9aa3b2; }
.dot.ours { fill: var(--blue); }
.bar-emotion { fill: var(--blue); }
.bar-asr { fill: var(--amber); }

.tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; }
.tokens code { font-size: 14px; padding: 3px 9px; }
.tokens span { font-size: 14px; color: var(--muted); margin-left: 4px; }

/* ---------- interventions ---------- */
.iv { margin-top: 22px; margin-left: var(--gutter); margin-right: var(--gutter); border: 1px solid var(--rule); border-radius: 8px; max-width: calc(var(--wide) - 2 * var(--gutter)); }
@media (min-width: 1129px) { .iv { margin-left: auto; margin-right: auto; } }
.iv-controls { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--rule); padding: 0 8px; overflow-x: auto; }
.iv-controls button { all: unset; cursor: pointer; font: 500 14px var(--sans); color: var(--muted); padding: 14px 12px 12px; border-bottom: 2px solid transparent; white-space: nowrap; }
.iv-controls button:hover { color: var(--ink); }
.iv-controls button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.iv-controls button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.iv-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; }
.iv-stage { padding: 16px 18px 14px; min-width: 0; }
.iv-options { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; }
.iv-options button { all: unset; cursor: pointer; font: 500 13px var(--sans); color: var(--ink); border: 1px solid #cdd3dc; border-radius: 15px; height: 30px; padding: 0 12px; display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.iv-options button:hover { border-color: var(--ink); }
.iv-options button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.iv-options button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.iv-options .opt-label { font-size: 13px; color: var(--muted); align-self: center; margin-right: 4px; }
#iv-svg { display: block; width: 100%; height: auto; margin-top: 10px; }
.iv-explain { font-size: 14px; color: var(--text); margin: 16px 0 0; min-height: 3.2em; }
.iv-meters { border-left: 1px solid var(--rule); padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 18px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.meter-head b { font: 600 26px/1.1 var(--serif); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.meter svg { width: 100%; height: 36px; margin-top: 6px; }
.meter-foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; min-height: 1.3em; }
.meter .track { fill: var(--tint); }
.meter .fill-emo { fill: var(--blue); }
.meter .fill-wer { fill: var(--amber); }
.meter .ref { stroke: var(--ink); stroke-width: 2; }
.meter .maj { stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 3 3; }
.iv-src { margin: auto 0 0; font-size: 12.5px; }

/* ---------- results tables ---------- */
.table-wrap { padding: 0 var(--gutter); margin-top: 28px; }
.table-wrap + .table-wrap { margin-top: 44px; }
.table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.table-head h3 { margin: 0 0 12px; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-bottom: 12px; }
.table-scroll:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
table.results { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.results th, table.results td { padding: 9px 10px; white-space: nowrap; }
table.results thead th { font-weight: 500; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--rule); vertical-align: bottom; text-align: left; }
table.results thead th.grp { text-align: center; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--rule); }
table.results thead th.num { text-align: right; }
table.results .num { text-align: right; }
table.results td.c { text-align: center; width: 64px; }
table.results .gl { border-left: 1px solid var(--rule); }
table.results tbody th { text-align: left; font-weight: 400; color: var(--ink); }
table.results tbody tr + tr > * { border-top: 1px solid #eef0f3; }
table.results .ck { color: var(--ink); font-weight: 600; }
table.results .no, table.results .na { color: #c3c9d3; }
table.results tr.ours > * { background: var(--blue-soft); }
table.results tr.ours td.num { color: var(--blue); font-weight: 600; }
table.results .ours-h { color: var(--blue); font-weight: 600; }
table.results .ours-c { color: var(--blue); font-weight: 600; background: var(--blue-soft); }
table.results tr.sum > * { border-top: 1px solid var(--ink) !important; font-weight: 600; color: var(--ink); }

/* ---------- citation ---------- */
.bib { position: relative; }
.bib pre { margin: 0; padding: 18px 20px; background: var(--tint); border: 1px solid var(--rule); border-radius: 6px; overflow-x: auto; font: 13px/1.6 var(--mono); color: var(--ink); }
#copy-bib { position: absolute; top: 10px; right: 10px; font: 500 13px var(--sans); color: var(--ink); background: #fff; border: 1px solid #cdd3dc; border-radius: 14px; height: 28px; padding: 0 12px; cursor: pointer; }
#copy-bib:hover { border-color: var(--ink); }

/* ---------- footer ---------- */
.footer { margin-top: 96px; border-top: 1px solid var(--rule); padding: 32px var(--gutter) 40px; }
.footer-inner { max-width: var(--wide); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer p { margin: 0; font-size: 13.5px; color: var(--muted); }
.logos.small { gap: 28px; justify-content: flex-start; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .model-desktop { display: none; }
  .model-mobile { display: block; max-width: 420px; margin: 0 auto; }
  .hl-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
  .hl-chart { margin-top: 44px; }
  .iv-body { grid-template-columns: 1fr; }
  .iv-meters { border-left: 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; }
  .iv-src { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .hl-facts dt { font-size: 36px; }
  .hl-facts dd { font-size: 13px; }
  .hl-facts dd b { font-size: 14px; }
  :root { --gutter: 16px; }
  .chart-desktop { display: none; }
  .chart-mobile { display: block; }
  table.prompts thead { display: none; }
  table.prompts tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--rule); }
  table.prompts td { display: block; border: 0; padding: 2px 0; }
  table.prompts td:first-child { font-weight: 600; color: var(--ink); }
  table.prompts td:last-child::before { content: "Target: "; color: var(--muted); }
  body { font-size: 16px; }
  main > section { margin-top: 64px; }
  .masthead { padding-top: 36px; }
  .authors { font-size: 15.5px; gap: 2px 14px; }
  .affils { font-size: 13px; flex-direction: column; }
  .btn { height: 36px; padding: 0 13px 0 11px; font-size: 14px; }
  .logos { gap: 28px; }
  .logos img { height: 24px; }
  h2 { font-size: 26px; }
  .tldr { font-size: 18px; }
  .topnav-name { display: none; }
  .topnav-inner { justify-content: center; }
  .bar-row { grid-template-columns: 116px minmax(0, 1fr) 36px; gap: 8px; font-size: 12.5px; }
  .bar-name { white-space: normal; }
  .iv-meters { grid-template-columns: 1fr; }
  .iv-controls button { padding: 12px 9px 10px; font-size: 13px; }
}
@media print {
  .topnav, .iv-controls, #copy-bib { display: none; }
}

.model-math { font-family: var(--sans); color: var(--muted); white-space: nowrap; line-height: 28px; }
.model-math .katex { font-size: 1.08em; }

@font-face { font-family: "Token Typewriter"; src: url("katex/fonts/KaTeX_Typewriter-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
.tokens code { font-family: "Token Typewriter", "JetBrains Mono", monospace; font-size: 16px; font-variant-ligatures: none; }
.chart-mobile.dotstrip .lab-t { font-size: 12.5px; }
