/* Simple academic layout inspired by the team's previous project websites. */

:root {
  color-scheme: light;
  --text: #363636;
  --muted: #666666;
  --link: #1677bc;
  --border: #dddddd;
  --surface: #f5f5f5;
  --one-step: #d1495b;
  --reference: #1f6f8b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  color: var(--text);
  background: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 4px;
}

button,
select {
  font: inherit;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

h2 {
  margin-bottom: 24px;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 600;
  text-align: center;
}

.container {
  width: min(1000px, calc(100% - 48px));
  margin-inline: auto;
}

.text-container {
  max-width: 850px;
  margin-inline: auto;
}

.section {
  padding-block: 30px;
}

.prose {
  text-align: justify;
}

.prose p + p {
  margin-top: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 12px;
  color: #ffffff;
  background: var(--text);
}

.skip-link:focus {
  top: 10px;
}

/* Title, author names, and publication links. */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 16px 0;
  text-align: center;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--border);
}

.team-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
}

.section-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 5px 10px 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.section-nav a:hover {
  color: var(--link);
  text-decoration: none;
}

.team-button img {
  width: 77px;
  height: auto;
  flex-shrink: 0;
}

.team-button:hover {
  border-color: #aaaaaa;
  background: #ffffff;
  text-decoration: none;
}

.publication-header {
  padding-top: 38px;
  padding-bottom: 22px;
  text-align: center;
}

.publication-header h1 {
  margin-bottom: 22px;
  font-size: 42px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -1px;
}

.publication-authors {
  max-width: 950px;
  margin-inline: auto;
  font-size: 19px;
  line-height: 1.7;
}

.publication-authors > span {
  display: inline-block;
  margin-inline: 3px;
}

.publication-authors sup {
  font-size: 12px;
}

.publication-affiliation {
  margin-top: 7px;
  font-size: 18px;
}

.equal-contribution {
  margin-top: 2px;
  font-size: 14px;
  font-style: italic;
}

.publication-venue {
  margin-top: 17px;
  font-size: 17px;
  font-weight: 600;
}

.conference-details {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.publication-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 19px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: #ffffff;
  font-size: 15px;
  line-height: 1.5;
}

.button:hover {
  background: var(--surface);
  text-decoration: none;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button-dark {
  border-color: var(--text);
  color: #ffffff;
  background: var(--text);
}

.button-dark:hover {
  border-color: #202020;
  background: #202020;
}

.button-disabled,
.button-disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--text);
  background: var(--text);
}

/* Figures, findings, and real-world tasks. */

.paper-figure {
  margin-block: 24px;
}

.paper-figure img {
  width: 100%;
}

.paper-figure a img {
  cursor: zoom-in;
}

figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

figcaption > span {
  font-weight: 600;
}

figcaption > .term-tip {
  font-weight: inherit;
}

.overview-summary {
  max-width: 850px;
  margin-inline: auto;
  text-align: center;
}

.training-figure {
  max-width: 850px;
  margin-inline: auto;
}

.findings-list {
  padding-left: 24px;
}

.findings-list li + li {
  margin-top: 15px;
}

.question-list {
  margin-block: 16px 0;
  padding-left: 24px;
  list-style: none;
}

.question-list li + li {
  margin-top: 8px;
}

.subsection-title {
  margin: 36px 0 16px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

/* Figure 4 stacks the bar charts above the trajectory plot so labels stay legible. */
.figure-pair {
  display: grid;
  justify-items: center;
  gap: 20px;
}

.trajectory-view {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  max-width: 620px;
}

.trajectory-view label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.trajectory-view label[hidden] {
  display: none;
}

.trajectory-view select {
  width: 140px;
}

.trajectory-plot {
  width: 100%;
}

.trajectory-plot[hidden],
.trajectory-view a[hidden] {
  display: none;
}

.trajectory-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.trajectory-panel-title {
  margin: 0 0 4px;
  font-size: 16px;
  text-align: center;
}

.trajectory-panel canvas {
  display: block;
  width: 100%;
  aspect-ratio: 66 / 76;
  border: 1px solid #e6e5e1;
  background: #ffffff;
  cursor: crosshair;
  touch-action: pan-y;
}

.trajectory-readout {
  min-height: 1.6em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.task-videos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 12px;
  max-width: 640px;
  margin-inline: auto;
  font-size: 14px;
  text-align: center;
}

.task-video video {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 8px;
}

/* Term tooltip: opens on hover or focus without JavaScript; script.js adds tap and Escape. */

.term-tip {
  position: relative;
}

.term-tip-trigger {
  padding: 0;
  border: 0;
  color: var(--link);
  background: none;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}

.term-tip-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  width: 340px;
  max-width: calc(100vw - 36px);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s, visibility 0.15s;
}

/* Bridges the gap so the pointer can move onto the popup without closing it. */
.term-tip-popup::before {
  position: absolute;
  inset: -9px 0 auto;
  height: 9px;
  content: '';
}

.term-tip:hover .term-tip-popup,
.term-tip:focus-within .term-tip-popup,
.term-tip.is-open .term-tip-popup {
  visibility: visible;
  opacity: 1;
}

.term-tip.is-dismissed .term-tip-popup {
  visibility: hidden;
  opacity: 0;
}

/* Benchmark explorer using Tables 2 and 3 of the paper. */

.results-panel {
  max-width: 900px;
  margin: 26px auto 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.results-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
}

.results-controls label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
}

.results-options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
}

/* Per-task switch, shown only for the real-world benchmark. */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: none;
  font-size: 14px;
  cursor: pointer;
}

.toggle[hidden] {
  display: none;
}

.toggle-track {
  position: relative;
  flex: none;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #bbbbbb;
  transition: background 0.15s;
}

.toggle-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  content: '';
  transition: transform 0.15s;
}

.toggle[aria-checked='true'] .toggle-track {
  background: var(--link);
}

.toggle[aria-checked='true'] .toggle-track::after {
  transform: translateX(14px);
}

select {
  width: 330px;
  padding: 9px 30px 9px 10px;
  border: 1px solid #bbbbbb;
  border-radius: 4px;
  color: var(--text);
  background: #ffffff;
  font-size: 14px;
  font-weight: 400;
}

.legend {
  display: flex;
  gap: 20px;
  padding-bottom: 10px;
  font-size: 12px;
}

.legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
}

.legend-one {
  background: var(--one-step);
}

.legend-ref {
  background: var(--reference);
}

.chart-heading,
.chart-row {
  display: grid;
  grid-template-columns: 130px 1fr 115px 110px;
  grid-template-areas: 'model bars value verdict';
  align-items: center;
  gap: 20px;
}

.chart-model,
.chart-heading > :nth-child(1) {
  grid-area: model;
}

.chart-bars,
.chart-heading > :nth-child(2) {
  grid-area: bars;
}

.chart-value,
.chart-heading > :nth-child(3) {
  grid-area: value;
}

.chart-verdict,
.chart-ci,
.chart-heading > :nth-child(4) {
  grid-area: verdict;
}

.chart-heading {
  padding-block: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.chart-heading > :nth-child(n + 3) {
  text-align: right;
}

.chart-row {
  position: relative;
  padding-block: 12px;
  border-bottom: 1px solid #eeeeee;
}

.chart-row[tabindex] {
  cursor: default;
  outline-offset: -2px;
}

.chart-row[tabindex]:hover,
.chart-row[tabindex]:focus-visible {
  background: var(--surface);
}

.chart-row:last-child {
  border-bottom: 0;
}

.chart-model {
  font-size: 14px;
  font-weight: 600;
}

.chart-model small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-block: 3px;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(25% - 1px),
    #eeeeee calc(25% - 1px),
    #eeeeee 25%
  );
}

.chart-bar {
  width: var(--value);
  min-width: 2px;
  height: 9px;
}

.chart-bar.one {
  background: var(--one-step);
}

.chart-bar.reference {
  background: var(--reference);
}

.chart-value {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.chart-value .rate-one {
  color: var(--one-step);
}

.chart-value .rate-reference {
  color: var(--reference);
}

.chart-value .slash,
.task-rate .slash {
  padding-inline: 5px;
  color: var(--muted);
}

.chart-verdict {
  text-align: right;
}

.chart-ci {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* CI of the paired gap, shown on hover or focus of a row or task cell. */
.chart-ci-popup {
  position: absolute;
  right: 0;
  bottom: calc(100% - 6px);
  z-index: 10;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s, visibility 0.15s;
}

/* script.js sets left and top from the mouse position. */
.ci-follows-pointer .chart-ci-popup {
  right: auto;
  bottom: auto;
}

/* Per-task view: one column per real-world task plus the pooled total. */
.per-task .chart-heading,
.per-task .chart-row {
  grid-template-columns: 130px repeat(5, minmax(0, 1fr));
  grid-template-areas: none;
  gap: 4px 12px;
}

.per-task .chart-heading > *,
.per-task .chart-model {
  grid-area: auto;
}

.per-task .chart-heading > :nth-child(n + 2) {
  padding-left: 6px;
  text-align: left;
}

.per-task .chart-heading > :last-child,
.task-cell.pooled {
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.task-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: default;
  outline-offset: -2px;
}

.task-cell.pooled {
  border-radius: 0 3px 3px 0;
}

.task-cell:hover,
.task-cell:focus-visible {
  background: var(--surface);
}

.task-rate {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.task-rate .rate-one {
  color: var(--one-step);
}

.task-rate .rate-reference {
  color: var(--reference);
}

.task-significant {
  margin-left: 1px;
  line-height: 0;
  color: var(--muted);
  font-weight: 600;
}

.chart-ci-popup small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.ci-target:hover > .chart-ci-popup,
.ci-target:focus > .chart-ci-popup {
  visibility: visible;
  opacity: 1;
}

/* TOST verdict colors match the paper's tables. */
.verdict {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.verdict-eq {
  color: #1b5e20;
  background: #c8e6c9;
}

.verdict-ref,
.verdict-one {
  color: #b71c1c;
  background: #ffcdd2;
}

.verdict-inc {
  color: #7a4f01;
  background: #ffe0b2;
}

.chart-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

/* Inference table and BibTeX. */

.table-scroll {
  margin-top: 22px;
  overflow-x: auto;
}

.latency-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.latency-table th,
.latency-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.latency-table th:first-child {
  text-align: left;
}

.latency-table thead {
  background: var(--surface);
}

.latency-table tbody th {
  font-weight: 400;
}

.latency-table small {
  color: var(--muted);
  font-size: 12px;
}

.table-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.citation-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.copy-button {
  border-radius: 4px;
  font-size: 13px;
}

.copy-button[hidden] {
  display: none;
}

pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.7;
  tab-size: 2;
}

pre code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.copy-status {
  min-height: 25px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* Team portraits and organization logos. */

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding-top: 10px;
  text-align: center;
}

.team-member img {
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
  border-radius: 50%;
  object-fit: cover;
}

.team-member h3 {
  min-height: 45px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.team-member p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.team-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 14px;
}

.organization-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 55px;
  padding-block: 40px 55px;
}

.organization-logos img {
  width: auto;
  height: 60px;
}

.site-footer {
  padding: 28px 24px;
  color: var(--muted);
  background: #fafafa;
  font-size: 13px;
  text-align: center;
}

.site-footer p + p {
  margin-top: 5px;
}

/* Smaller screens preserve the same reading order. */

@media (max-width: 800px) {
  .publication-header h1 {
    font-size: 35px;
  }

  .publication-authors {
    max-width: 620px;
    font-size: 17px;
  }

  .title-break {
    display: none;
  }

  .results-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  .legend {
    padding-bottom: 0;
  }

  /* The TOST verdict moves under the success rates. */
  .chart-heading,
  .chart-row {
    grid-template-columns: 130px 1fr 115px;
    grid-template-areas:
      'model bars value'
      'model bars verdict';
    row-gap: 4px;
  }

  .per-task .chart-heading,
  .per-task .chart-row {
    grid-template-columns: 110px repeat(5, minmax(0, 1fr));
    gap: 4px 8px;
  }

  .organization-logos img {
    max-width: 260px;
    height: 45px;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .container {
    width: calc(100% - 36px);
  }

  .section {
    padding-block: 24px;
  }

  h2 {
    margin-bottom: 20px;
    font-size: 26px;
  }

  .site-header {
    padding-top: 18px;
  }

  .team-button {
    padding: 9px 16px;
    font-size: 13px;
  }

  .publication-header {
    padding-top: 28px;
    padding-bottom: 15px;
  }

  .publication-header h1 {
    margin-bottom: 20px;
    font-size: 29px;
    line-height: 1.25;
    letter-spacing: -0.5px;
  }

  .publication-authors {
    font-size: 16px;
  }

  .publication-affiliation {
    font-size: 16px;
  }

  .publication-venue {
    font-size: 15px;
  }

  .conference-details,
  .equal-contribution {
    font-size: 12px;
  }

  .prose {
    text-align: left;
  }

  figcaption {
    font-size: 12px;
    text-align: left;
  }

  .results-panel {
    padding: 14px;
  }

  .results-controls label,
  select {
    width: 100%;
  }

  select {
    font-size: 12px;
  }

  .chart-heading,
  .chart-row {
    grid-template-columns: 73px 1fr 90px;
    gap: 4px 9px;
  }

  .chart-heading {
    font-size: 10px;
  }

  .results-options {
    width: 100%;
  }

  .per-task .chart-heading,
  .per-task .chart-row {
    grid-template-columns: 64px repeat(5, minmax(0, 1fr));
    gap: 4px 4px;
  }

  .per-task .chart-heading > :last-child,
  .task-cell.pooled {
    padding-left: 4px;
  }

  .task-cell {
    padding-inline: 2px;
  }

  .per-task .chart-heading > :nth-child(n + 2) {
    text-align: right;
  }

  .per-task .chart-model small {
    display: none;
  }

  .task-rate {
    font-size: 11px;
    text-align: right;
  }

  .task-rate .slash {
    padding-inline: 2px;
  }

  .chart-model,
  .chart-value,
  .chart-ci {
    font-size: 11px;
  }

  .verdict {
    padding-inline: 5px;
    font-size: 10px;
  }

  .chart-model small {
    font-size: 9px;
  }

  .chart-footer {
    display: block;
    font-size: 11px;
  }

  .task-videos {
    gap: 12px 8px;
    font-size: 13px;
  }

  .subsection-title {
    margin-top: 28px;
    font-size: 19px;
  }

  .latency-table {
    font-size: 13px;
  }

  .latency-table th,
  .latency-table td {
    padding: 9px 8px;
  }

  pre {
    padding: 16px;
    font-size: 11px;
  }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px 15px;
  }

  .team-member img {
    width: 115px;
    height: 115px;
  }

  .team-member h3 {
    font-size: 14px;
  }

  .team-member p {
    font-size: 11px;
  }

  .organization-logos {
    gap: 25px;
    padding-block: 25px 40px;
  }

  .organization-logos img {
    max-width: 100%;
    height: auto;
    max-height: 40px;
  }

  .site-footer {
    padding-inline: 18px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .term-tip-popup,
  .toggle-track,
  .toggle-track::after {
    transition: none;
  }
}

/* Interactive overview retains the original figure as a no-JS fallback. */
#overview-interactive { position: relative; }
.overview-hint { color: #656565; font-size: 0.85rem; margin: 0 0 12px; }
.overview-scroll { overflow-x: auto; }
#overview-chart { display: block; width: 100%; min-width: 850px; height: auto; font: 12px system-ui, sans-serif; }
#overview-chart .overview-title { font-size: 18px; }
#overview-chart .overview-small { font-size: 10px; }
.overview-point { cursor: pointer; }
.overview-point.is-active, .overview-point:focus-visible { stroke: #111; stroke-width: 2.5; outline: none; filter: drop-shadow(0 0 2px white); }
#overview-tooltip { position: absolute; z-index: 10; width: max-content; max-width: min(440px, 100%); max-height: 240px; overflow-y: auto; padding: 12px 15px; background: #fff; color: #202020; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 4px 18px #0002; font-size: 0.8rem; line-height: 1.5; box-sizing: border-box; }
#overview-tooltip > div + div { margin-top: 10px; padding-top: 8px; border-top: 1px solid #eee; }
