/* Four-way comparison slider: the four clips are stacked in perfect
   registration and each is clipped to one quadrant. Dragging the puck moves
   the split point, so pushing it into a corner gives the opposite clip the
   full frame. */

.quad {
  position: relative;
  width: 100%;
  aspect-ratio: 416 / 240;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.quad video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.quad-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 2;
}

.quad-line--v { top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.quad-line--h { left: 0; right: 0; height: 2px; margin-top: -1px; }

.quad-handle {
  position: absolute;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  cursor: grab;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #363636;
  font-size: 13px;
  line-height: 1;
}

.quad-handle:active { cursor: grabbing; }

.quad-handle:focus-visible {
  outline: 3px solid #8C1515;
  outline-offset: 2px;
}

.quad-label {
  position: absolute;
  padding: 3px 9px;
  font-size: 0.85rem;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
  transition: opacity 0.12s ease;
}

.quad-label--tl { top: 6px;    left: 6px;  }
.quad-label--tr { top: 6px;    right: 6px; }
.quad-label--bl { bottom: 6px; left: 6px;  }
.quad-label--br { bottom: 6px; right: 6px; }

.quad-label--accent { background: rgba(140, 21, 21, 0.85); }

.quad-hint {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  color: #363636;
  text-align: center;
}

.quad-hint .arch-icon {
  color: #8C1515;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.26em;
  margin-right: 0.4em;
}

@media screen and (max-width: 480px) {
  .quad-label { font-size: 0.7rem; padding: 2px 6px; }
  .quad-handle { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
}

/* Four episodes per task, so the puck and labels shrink to suit a half-width
   card. */
.column.is-half .quad-handle {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  font-size: 11px;
}

.column.is-half .quad-label {
  font-size: 0.78rem;
  padding: 2px 7px;
}

/* Task pickers: a row of buttons instead of a dropdown. */
.task-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.task-picker button {
  border: 1px solid #dbdbdb;
  background: #fff;
  color: #363636;
  border-radius: 999px;
  padding: 0.3rem 0.95rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.task-picker button:hover {
  border-color: #8C1515;
  color: #8C1515;
}

.task-picker button[aria-selected="true"] {
  background: #8C1515;
  border-color: #8C1515;
  color: #fff;
}

.task-picker button:focus-visible {
  outline: 3px solid #8C1515;
  outline-offset: 2px;
}

/* Side-by-side baseline comparison: one row per task, four models across. */
.baseline-task {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #363636;
}

.baseline-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 1.5rem;
}

.baseline-cell { position: relative; line-height: 0; }

.baseline-cell video,
.baseline-cell img {
  width: 100%;
  aspect-ratio: 416 / 240;
  display: block;
  border-radius: 4px;
  background: #000;
}

.baseline-label {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 3px 9px;
  font-size: 0.85rem;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  border-radius: 3px;
  white-space: nowrap;
}

.baseline-label--accent { background: rgba(140, 21, 21, 0.85); }

@media screen and (max-width: 768px) {
  .baseline-row { grid-template-columns: repeat(2, 1fr); }
}

/* Video Model topic tabs. Panels are toggled with the `hidden` attribute. */
.vm-tabs { margin-bottom: 1.25rem; gap: 0.5rem; }

/* The section tabs carry more weight than the per-task pickers, so they get a
   larger hit area and bold labels. */
.vm-tabs button {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
}

/* One accent per topic: cardinal, deep green, plum and blue. The tab and its
   panel share the hue -- solid on the
   button, a faint wash behind the content -- so the two read as one block. */
.vm-tabs button[data-vm-tab="architecture"],  #vm-architecture  { --vm-accent: #8C1515; --vm-wash: #fdf8f8; }
.vm-tabs button[data-vm-tab="training-data"], #vm-training-data { --vm-accent: #175E54; --vm-wash: #f6fbf9; }
.vm-tabs button[data-vm-tab="distractor"],    #vm-distractor    { --vm-accent: #620059; --vm-wash: #fbf7fb; }
.vm-tabs button[data-vm-tab="quality"],       #vm-quality       { --vm-accent: #016895; --vm-wash: #f5fafd; }

.vm-tabs button:hover {
  border-color: var(--vm-accent);
  color: var(--vm-accent);
}

.vm-tabs button[aria-selected="true"] {
  background: var(--vm-accent);
  border-color: var(--vm-accent);
  color: #fff;
}

.vm-tabs button:focus-visible { outline-color: var(--vm-accent); }

.vm-panel {
  background: var(--vm-wash);
  border-radius: 8px;
  padding: 1.5rem 1.75rem 1.25rem;
  margin-bottom: 2rem;
}

@media screen and (max-width: 480px) {
  .vm-tabs button {
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
  }
}

.vm-panel[hidden] { display: none; }

.vm-panel > *:first-child { margin-top: 0; }

/* headings inside a panel need room from whatever figure precedes them */
.vm-panel h3.title.is-4 { margin-top: 2.25rem; }
.vm-panel > h3.title.is-4:first-child { margin-top: 0; }

/* Generated episodes sits outside the tabs, so it needs air to read as its
   own block rather than a continuation of the panel above. */
.vm-followup { margin-top: 3.5rem; }

/* Interactive architecture figure. The diagram is a flat PNG, so the regions
   are percentage-positioned buttons laid over it; percentages keep them
   registered to the artwork at any width. Colours follow the panel accent. */
.arch-figure {
  margin: 1.25rem 0 2rem;
}

/* Inline so it inherits the surrounding colour rather than depending on the
   FontAwesome JS build to swap an <i> that we injected ourselves. */
.arch-icon {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.1em;
  margin-right: 0.4em;
  color: var(--vm-accent);
}

.arch-wrap {
  position: relative;
  display: block;
}

.arch-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.arch-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.arch-hot {
  position: absolute;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.arch-hot:hover,
.arch-hot:focus-visible,
.arch-hot.is-active {
  background: rgba(140, 21, 21, 0.10);
  background: color-mix(in srgb, var(--vm-accent) 12%, transparent);
  border-color: var(--vm-accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
  outline: none;
}

.arch-card {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 0.9rem;
  /* fixed floor so swapping between regions does not jog the page */
  min-height: 7.5rem;
}

.arch-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--vm-accent);
  margin: 0 0 0.45rem;
}

.arch-card-body {
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: justify;
}

.arch-card.is-idle .arch-card-body {
  color: #363636;
}

@media screen and (max-width: 768px) {
  .arch-card { min-height: 10rem; }
}


/* Native task-type donut, replacing the chart PNG. */
.corpus-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 0.5rem;
}

.corpus-chart {
  position: relative;
  flex: 0 0 auto;
  width: 250px;
  height: 250px;
}

.corpus-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.corpus-arc {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.corpus-arc.is-dim {
  opacity: 0.28;
}

/* centred over the ring's hole, and click-through so the arcs stay hoverable */
.corpus-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}

.corpus-center-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: #363636;
}

.corpus-center-label {
  font-size: 0.82rem;
  color: #363636;
}

.corpus-legend {
  flex: 1 1 380px;
  max-width: 520px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.1rem 1.25rem;
}

.corpus-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.16rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.corpus-row.is-on {
  background: rgba(0, 0, 0, 0.06);
}

.corpus-swatch {
  flex: 0 0 auto;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 2px;
}

.corpus-name {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.corpus-pct {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #363636;
}

.corpus-caption {
  font-size: 0.85rem;
  color: #363636;
  text-align: center;
  margin-bottom: 1.25rem;
}

@media screen and (max-width: 600px) {
  .corpus-legend { grid-template-columns: minmax(0, 1fr); }
}

/* Native autoregressive-quality plots, replacing the figure PNG. */
.arq-figure {
  margin: 1.25rem 0 0.5rem;
}

.arq-plots {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.arq-plot {
  flex: 1 1 320px;
  max-width: 420px;
}

.arq-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.arq-grid {
  stroke: #e4e4e4;
  stroke-width: 1;
}

.arq-axis {
  stroke: #b5b5b5;
  stroke-width: 1;
}

.arq-tick {
  font-size: 10px;
  fill: #363636;
}

.arq-axis-label,
.arq-plot-title {
  font-size: 11px;
  fill: #363636;
}

.arq-plot-title {
  font-weight: 700;
}

.arq-line {
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: opacity 0.15s ease;
}

.arq-dot {
  transition: opacity 0.15s ease;
}

.arq-line.is-dim,
.arq-dot.is-dim {
  opacity: 0.2;
}

.arq-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.arq-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.arq-legend-item.is-on {
  background: rgba(0, 0, 0, 0.06);
}

.arq-key {
  width: 0.9rem;
  height: 0.2rem;
  border-radius: 2px;
}

/* Quantitative results table: sized to its content and centred, rather than
   stretched full-width where the numbers drift away from their headers. */
.quant-table {
  margin: 0 auto;
}

/* .table.is-narrow sets its own padding at equal-or-higher specificity, so
   match it here rather than being silently overridden. */
.table.quant-table th,
.table.quant-table td {
  padding: 0.55rem 1.7rem;
  white-space: nowrap;
}

/* Distractor rows pair one condition with one result, so two panes not three. */
.baseline-row--pair {
  grid-template-columns: repeat(2, 1fr);
  max-width: 760px;
  margin: 0 auto;
}

#vm-distractor .baseline-task {
  text-align: center;
}

/* Per-point hover: highlight the dot, tie it to its time, and read out all
   three models at that time so the comparison is direct. */
.arq-hit {
  fill: transparent;
  cursor: pointer;
}

.arq-guide {
  stroke: #b5b5b5;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.arq-guide.is-on {
  opacity: 1;
}

.arq-dot.is-hot {
  r: 6;
  stroke: #fff;
  stroke-width: 2;
}

.arq-dot.is-peer {
  r: 5;
  stroke: #fff;
  stroke-width: 1.5;
}

.arq-readout {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin-top: 0.5rem;
  min-height: 2.1rem;
  font-size: 0.85rem;
}

.arq-readout.is-idle {
  color: #363636;
}

/* cardinal rather than the panel's blue, so the prompt reads as a call to act */
.arq-readout .arch-icon {
  color: #8C1515;
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.28em;
  margin-right: 0.45em;
}

.arq-readout-t {
  font-weight: 700;
  color: #363636;
}

.arq-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  color: #363636;
}

.arq-chip b {
  font-variant-numeric: tabular-nums;
  color: #363636;
}

.arq-chip.is-hot {
  background: rgba(0, 0, 0, 0.07);
  color: #363636;
}

/* Leader at the hovered time. Direction is per metric: PSNR wants high,
   LPIPS wants low, so this is not simply the largest number. */
.arq-chip.is-best b {
  color: #8C1515;
}

.arq-chip.is-best::after {
  content: "best";
  margin-left: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8C1515;
}

/* Tables sit on the tinted tab panels, where a white fill draws a visible
   rectangle against the wash. The bordered grid carries the structure, so let
   the backdrop show through. Outside the panels the page is white anyway. */
.table {
  background-color: transparent;
}

/* Heavier rules so the grid still reads now that the fill is transparent, and
   tinted toward the panel accent so the table belongs to its block. Outside a
   tab panel --vm-accent is unset and these fall back to cardinal. The mixes
   land on `transparent`, so they composite over the wash rather than painting
   an opaque rectangle over it. */
.table.is-bordered td,
.table.is-bordered th {
  border-width: 2px;
  border-color: #dbdbdb;
  border-color: color-mix(in srgb, var(--vm-accent, #8C1515) 30%, transparent);
}

.table thead th {
  background: rgba(0, 0, 0, 0.04);
  background: color-mix(in srgb, var(--vm-accent, #8C1515) 11%, transparent);
  border-color: #cfcfcf;
  border-color: color-mix(in srgb, var(--vm-accent, #8C1515) 42%, transparent);
  color: #2b2b2b;
}

/* The success-rate table has nine columns, so it needs tighter cells than the
   quantitative one to stay inside the column. */
.table.sr-table th,
.table.sr-table td {
  padding: 0.5rem 0.5rem;
}

/* Native category chart replacing the figure PNG. */
.cat-figure {
  margin: 1.25rem 0 0.5rem;
}

#cat-chart svg {
  width: 100%;
  max-width: 760px;
  height: auto;
  display: block;
  margin: 0 auto;
  overflow: visible;
}

.cat-bar {
  transition: opacity 0.15s ease;
}

/* the no-distractor extension: same hue, drawn open so the solid bar reads as
   the headline number */
.cat-bar--clean {
  fill-opacity: 0.18;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.cat-bar.is-dim {
  opacity: 0.18;
}

.cat-value {
  font-size: 10px;
  font-weight: 700;
  fill: #363636;
}

.cat-value--clean {
  font-weight: 600;
  font-style: italic;
}

.arq-key--block {
  height: 0.75rem;
  border-radius: 2px;
}

/* Scaling plots */
.scale-task {
  stroke-width: 2;
  stroke-dasharray: 5 2 1 2;
}

.scale-avg {
  stroke: #8C1515;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.scale-avg-dot {
  fill: #8C1515;
}

.scale-ref {
  stroke: #9a9a9a;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

/* the average chip is the headline number, not a winner -- no "best" tag */
.arq-chip.is-avg {
  background: rgba(140, 21, 21, 0.07);
  color: #363636;
}

.arq-chip.is-avg b {
  color: #8C1515;
}

/* Column-wide hover targets for the scaling plots. */
.scale-band {
  fill: transparent;
  cursor: pointer;
}

.scale-guide {
  stroke: #b5b5b5;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.scale-guide.is-on {
  opacity: 1;
}

/* Sequential stages shown all at once rather than behind a selector. */

.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 0 0 1.75rem;
}

/* the base grid is auto-fit; this pins four cards to a 2x2 */
.stage-grid.stage-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media screen and (max-width: 600px) {
  .stage-grid.stage-grid--two { grid-template-columns: minmax(0, 1fr); }
}

.stage-card {
  background: #f7f7f7;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}

.stage-title {
  color: var(--vm-accent, #8C1515);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
}

.stage-card p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: justify;
  color: #363636;
}

/* Section sub-headings were sitting almost flush against whatever preceded
   them -- one had a 0px gap. The first-child override inside tab panels
   still wins, so a panel never opens with a leading gap. */
section h3.title.is-4 {
  margin-top: 2.5rem;
}

/* Diagonal before/after reveal: both clips in one frame, split bottom-left to
   top-right. The clips are frame-matched, so the halves stay in step. */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1rem;
  max-width: 820px;
  margin: 0 auto;
}

.diag {
  position: relative;
  aspect-ratio: 416 / 240;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  cursor: grab;
  touch-action: none;
}

.diag video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.diag-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.diag-line line {
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  opacity: 0.9;
}

.diag-label {
  position: absolute;
  padding: 3px 9px;
  font-size: 0.85rem;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.diag-label--tl { left: 6px; top: 6px; }
.diag-label--br { right: 6px; bottom: 6px; }
.diag-label--accent { background: #8C1515; }

.diag-handle {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #363636;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: grab;
  touch-action: none;
}

.diag-handle:active { cursor: grabbing; }

.diag-handle:focus-visible {
  outline: 3px solid #8C1515;
  outline-offset: 2px;
}

@media screen and (max-width: 600px) {
  .diag-grid { grid-template-columns: minmax(0, 1fr); }
}

.diag-handle svg {
  width: 17px;
  height: 17px;
  display: block;
}


/* Affiliation row: wider gaps than the author list, standing in for \qquad. */
.publication-affiliations {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 2.25rem;
  margin-top: 0.35rem;
}

.publication-equal {
  margin-top: 0.3rem;
  color: #363636;
}
