/* Experiments: grouped bar charts (js/results.js) and result tables. */

.exp-h { max-width: var(--measure); margin: var(--sp-4) auto var(--sp-2); font: 400 24px/1.2 var(--serif); text-align: center; }
#experiments .figure { margin-top: var(--sp-3); padding-top: 0; }
#experiments .figure + .text { margin-top: var(--sp-4); }
.eq { text-align: center; overflow-x: auto; }

/* Bar charts (vertical, grouped) */
.chart { max-width: 760px; margin-inline: auto; }
.chart-tabs { display: flex; justify-content: center; gap: 6px; margin-bottom: var(--sp-2); }
.ctab {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer;
  font: 400 13px/1 var(--mono); color: var(--muted);
}
.ctab[aria-selected="true"] { border-color: var(--ink); color: var(--ink); }
.ctab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.vc-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.vc-legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.vc-plot { position: relative; height: 280px; margin: 0 0 52px 44px; border-bottom: 1px solid var(--muted); }
.vc-grid { position: absolute; inset: 0; }
.vc-tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); transition: bottom 0.4s ease; }
.vc-tick span { position: absolute; right: calc(100% + 8px); top: -7px; font: 400 12px/1 var(--mono); color: var(--faint); }
.vc-cols { position: absolute; inset: 0; display: flex; justify-content: space-around; }
.vc-group { position: relative; display: flex; flex-direction: column; height: 100%; }
.vc-bars { display: flex; gap: 8px; height: 100%; }
.vc-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.vc-stack { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.vc-b { width: 46px; height: 0; border-radius: 3px 3px 0 0; transition: height 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.vc-v { margin-bottom: 4px; font: 400 12px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); opacity: 0; transition: opacity 0.3s ease 0.4s; }
.vc-v.in { opacity: 1; }
.vc-gl, .vc-xl { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); text-align: center; font-size: 14px; color: var(--ink); }
.vc-gl { white-space: nowrap; font-weight: 500; }
.vc-xl { width: 110px; font-size: 13px; line-height: 1.3; color: var(--muted); }
.sw.s1, .vc-b.s1 { background: var(--accent); }
.sw.s2, .vc-b.s2 { background: #d9853b; }
.sw.s3, .vc-b.s3 { background: #ecbd8c; }
.sw.base { background: var(--ghost); }
.sw.dmd, .vc-b.dmd { background: #7d8696; }
.vc-b.base { background: var(--ghost); }
.single .vc-group { flex: 1; }
.single .vc-bars { justify-content: space-around; }
.single .vc-ref { left: 0; right: 0; }
.sw.dash { width: 18px; height: 0; border-top: 1.5px dashed var(--ink); border-radius: 0; }
.vc-ref { position: absolute; left: -10px; right: -10px; height: 0; border-top: 1.5px dashed var(--ink); opacity: 0; transition: bottom 0.5s ease, opacity 0.3s ease 0.6s; pointer-events: none; }
.vc-ref.in { opacity: 0.8; }
.vc-reftag { position: absolute; left: calc(100% + 6px); top: -6px; font: 400 11px/1 var(--mono); color: var(--ink); white-space: nowrap; }
.single .vc-reftag { left: 4px; top: -16px; }
.compact .vc-reftag { display: none; }
.vc-plot.compact { height: 190px; margin: 0 0 40px 34px; }
.compact .vc-b { width: 34px; }
.compact .vc-bars { gap: 6px; }
.compact .vc-v { font-size: 12.5px; }
.compact .vc-gl { font-size: 14px; font-weight: 400; }

.vc-b.mid, .sw.mid { background: #ecbd8c; }
@media (max-width: 640px) {
  .vc-plot { height: 240px; margin-left: 36px; margin-bottom: 64px; }
  .vc-plot.single { margin-bottom: 76px; }
  .ctab { white-space: nowrap; font-size: 12px; }
  .vc-b { width: 22px; }
  .vc-bars { gap: 4px; }
  .vc-v { font-size: 10px; writing-mode: vertical-rl; transform: rotate(180deg); margin-bottom: 4px; }
  .vc-gl { font-size: 12px; white-space: normal; width: 120px; }
  .vc-xl { width: 64px; font-size: 11px; }
  .single .vc-b { width: 30px; }
}
@media (prefers-reduced-motion: reduce) { .vc-b, .vc-v, .vc-tick { transition: none; } }

/* Phased charts (storyAnim in js/results.js): values inside the bars, the change above the + Ours bar */
.story .vc-b, .story .vc-v, .story .vc-ref { transition: none; }
.story .vc-b { position: relative; z-index: 1; }
.story .vc-ref { z-index: 0; }
.story .vc-v { position: absolute; top: 5px; left: 0; right: 0; margin: 0; text-align: center; color: var(--ink); }
.story .vc-b.s1 .vc-v { color: #fff; }
@media (max-width: 640px) { .story .vc-v { writing-mode: horizontal-tb; transform: none; font-size: 10px; letter-spacing: -0.02em; } }
.story .vc-col { position: relative; }
.story .vc-ref { transform-origin: left center; }
.vc-ghost { position: absolute; left: 0; right: 0; box-sizing: border-box; border: 1.5px dashed var(--accent); border-bottom: 0; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 6%, transparent); pointer-events: none; }
.vc-mark { position: absolute; left: 3px; right: 3px; height: 0; border-top: 2px dashed #fff; pointer-events: none; }
.vc-delta { position: absolute; left: 50%; transform: translateX(-50%); font: 600 13.5px/1 var(--mono); color: var(--accent); white-space: nowrap; opacity: 0; }

/* Tables */
.table-fig { max-width: 1040px; margin-inline: auto; }
.table-fig.narrow { max-width: 760px; }
.table-scroll { overflow-x: auto; }
table.res { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.res th, table.res td { padding: 7px 10px; text-align: center; }
table.res th:first-child, table.res td:first-child { text-align: left; }
table.res thead th { font: 500 12px/1.3 var(--mono); letter-spacing: 0.02em; color: var(--muted); border-bottom: 1px solid var(--line); }
table.res thead tr:first-child th { border-top: 1.5px solid var(--ink); }
table.res tbody tr:last-child td { border-bottom: 1.5px solid var(--ink); }
table.res tr.grp td { padding-top: 12px; font: 400 12px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); border-top: 1px solid var(--line); }
table.res tr.ref td { color: #8a8f96; }
table.res tr.ours td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
table.res tr.ours td:first-child { font-weight: 600; color: var(--accent); }
table.res tr.block-start td { border-top: 1px solid var(--line); }
/* Rank shading within each block (initRankTables in js/page.js): darker blue is a higher rank. */
table.res td.r1 { color: var(--blue); font-weight: 600; }
table.res td.r2 { color: color-mix(in srgb, var(--blue) 78%, var(--ground)); }
table.res td.r3 { color: color-mix(in srgb, var(--blue) 56%, var(--ground)); }
table.res td.r4 { color: color-mix(in srgb, var(--blue) 42%, var(--ground)); }
table.res td.r5, table.res td.r6 { color: color-mix(in srgb, var(--blue) 32%, var(--ground)); }
.table-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); max-width: 1040px; margin-inline: auto; align-items: start; }
@media (max-width: 860px) { .table-pair { grid-template-columns: 1fr; } }

/* Figure 1 of the paper, rebuilt: synchronized videos of FlowMap + Ours vs FlowMap next to two small charts per panel */
.f1 { max-width: min(740px, calc(100vw - 2 * var(--side-nav-room, 0px))); margin-inline: auto; }
.f1-legend { display: flex; justify-content: flex-end; gap: 6px 18px; margin: 0 0 6px; font-size: 14.5px; color: var(--muted); flex-wrap: wrap; }
.f1-legend span { display: inline-flex; align-items: center; gap: 7px; }
.f1-panel + .f1-panel { margin-top: var(--sp-4); }
.f1-panel h4 { margin: 0 0 8px; font: 500 19px/1.2 var(--serif); }
.f1-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.f1-video .players { gap: 6px; }
.f1-video .player { aspect-ratio: 832 / 480; }
.f1-video .player.ours { outline: 2px solid var(--accent); outline-offset: -2px; }
.f1-video .group .prompt { margin: 8px 0 0; font-size: 14px; }
.f1-dn .f1-row { grid-template-columns: minmax(0, 1fr) 340px; }
.f1-dn .f1-charts { grid-template-columns: repeat(3, 1fr); gap: 10px; padding-right: 14px; }
.f1-dn .compact .vc-b { width: 28px; }
.f1-dn .compact .vc-bars { gap: 5px; }
.f1-dn .players { grid-template-columns: 1fr 1fr; }
.f1-dn .player .label { text-transform: none; letter-spacing: 0; }
.f1-dn .scene-select { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: var(--sp-2); }
@media (max-width: 640px) { .f1-dn .scene-select { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.f1-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f1-charts .chart { width: 100%; max-width: none; margin: 0; }
@media (max-width: 900px) {
  .f1-row, .f1-dn .f1-row { grid-template-columns: 1fr; }
  .f1-dn .f1-charts { max-width: 400px; }
  .f1-dn .players { grid-template-columns: 1fr; }
  .f1-dn .compact .vc-b { width: 22px; }
  .f1-dn .compact .vc-bars { gap: 4px; }
  .f1-charts { max-width: 340px; margin-inline: auto; width: 100%; }
}

/* Figure 1: (a) and (b) side by side, videos in one row, the legend under them, then the charts of each panel */
.f1-two .f1-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; align-items: start; }
.f1-two .f1-panel { display: contents; }
.f1-two .f1-panel h4 { grid-row: 1; }
.f1-two .f1-video { grid-row: 2; }
.f1-two .f1-charts { grid-row: 4; }
.f1-two .f1-panel:nth-child(2) > * { grid-column: 1; }
.f1-two .f1-panel:nth-child(3) > * { grid-column: 2; }
.f1-two .f1-legend { grid-row: 3; grid-column: 1 / -1; justify-content: center; margin: var(--sp-3) 0 var(--sp-2); }
.f1-two .f1-charts { gap: 24px; padding: 0 10px; }
.f1-two .vc-plot.compact { height: 210px; }
.f1-two .compact .vc-b { width: 44px; }
.f1-two .compact .vc-bars { gap: 10px; }
@media (max-width: 900px) {
  .f1-two .f1-cols { grid-template-columns: minmax(0, 1fr); }
  .f1-two .f1-panel > * { grid-column: 1 !important; }
  .f1-two .f1-panel:nth-child(3) h4 { grid-row: 5; margin-top: var(--sp-4); }
  .f1-two .f1-panel:nth-child(3) .f1-video { grid-row: 6; }
  .f1-two .f1-panel:nth-child(3) .f1-charts { grid-row: 7; margin-top: var(--sp-3); }
  .f1-two .f1-charts { max-width: 420px; width: 100%; margin-inline: auto; }
  .f1-two .compact .vc-b { width: 34px; }
}

/* Result tabs: 5 s, long video, ablations */
.exp-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 auto var(--sp-3); }
.exp-tabs .ctab { font-size: 14px; padding: 7px 14px; }
.figure + .exp-tabs { margin-top: var(--sp-4); }

/* Lipschitz line chart (js/cvchart.js) */
.cv-chart { max-width: 760px; margin-inline: auto; }
.cv-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.cv-legend span { display: inline-flex; align-items: center; gap: 7px; }
.cv-sw { width: 22px; height: 0; border-top: 2.5px solid; }
.cv-sw.ours { border-color: var(--accent); }
.cv-sw.slg { border-color: #6b4fa8; }
.cv-sw.cfg { border-color: #8a94a6; }
.cv-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px; align-items: center; }
.cv-ylabel { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; color: var(--muted); text-align: center; }
.cv-panel { width: 100%; height: auto; display: block; overflow: visible; }
.cv-title { font: 500 13px/1 var(--sans); fill: var(--ink); text-anchor: middle; }
.cv-tick { font: 400 10px/1 var(--mono); fill: var(--faint); }
.cv-label { font: 400 12px/1 var(--sans); fill: var(--muted); }
.cv-grid { stroke: var(--line); stroke-width: 1; }
.cv-zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.cv-axis { stroke: var(--muted); stroke-width: 1; }
.cv-line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.cv-line.ours { stroke: var(--accent); stroke-width: 2.8; }
.cv-line.slg { stroke: #6b4fa8; }
.cv-line.cfg { stroke: #8a94a6; }
.cv-chart.in .cv-line { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s ease calc(var(--i) * 0.6s); }
@media (max-width: 640px) { .cv-row { grid-template-columns: 14px minmax(0, 1fr); } .cv-row .cv-panel + .cv-panel { grid-column: 2; } }
#why-motion > .figure { margin-top: var(--sp-2); }
