/* Parts of this page that the PixVid stylesheets do not have: the two-column hero, the wide video cards for the
 * quality and diversity rows, the collapsed "Why FlowMap distillation?" block, and the text under the
 * step-through diagrams (js/stepfig.js). Colors and fonts come from the theme tokens in css/theme.css. */

/* ---------- Hero: title, authors and links on the left; TL;DR on the right ---------- */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--sp-4); align-items: start; max-width: 920px; margin: 0 auto; padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.hero-grid h1 { text-align: left; font-size: clamp(30px, 3.4vw, 40px); line-height: 1.12; font-weight: 400; letter-spacing: -0.02em; text-wrap: balance; }
.authors { margin: var(--sp-2) 0 0; font-size: 16px; color: var(--ink); }
.affil { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: var(--sp-3) 0 0; padding: 0; list-style: none; }
.links a, .links span {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  font: 400 13px/1 var(--mono); letter-spacing: 0.02em; color: var(--ink); text-decoration: none; background: none;
}
.links a:hover { border-color: var(--ink); }
.links span { color: var(--faint); border-style: dashed; }
.tldr { padding: var(--sp-2) 0 0 var(--sp-4); border-left: 1px solid var(--line); }
.tldr h2 { margin: 0 0 var(--sp-1); font: 400 11px/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.tldr .lead { margin: 0; font: 400 21px/1.4 var(--serif); color: var(--ink); text-wrap: pretty; }
.tldr p + p { margin-top: var(--sp-2); font-size: 15px; line-height: 1.62; color: var(--muted); }

/* ---------- Wide video cards ---------- */
.teaser-row.has-media {
  justify-self: center; width: min(1040px, calc(100vw - 2 * var(--gutter)), calc(100vw - 2 * var(--side-nav-room, 0px)));
}
.teaser-row .scene-select { max-width: 100%; margin-inline: auto; }
.teaser-row .group .prompt, .teaser-row .group .note { max-width: var(--measure); margin-inline: auto; text-align: center; }
.result > h2 { text-align: center; }
.teaser-row > h3.row-h { margin: 0 0 4px; text-align: center; font: 400 13px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.teaser-row + .teaser-row { margin-top: var(--sp-4); }
.result > .desc { text-align: center; }
.result .group .prompt { margin: 10px 0 0; font-size: 15px; }
pre.bib { white-space: pre-wrap; overflow-wrap: anywhere; }
.result .group .note { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--faint); }
.player.ours { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Quality: five models in one row, labels on the tiles. */
.teaser-row .players { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.teaser-row .player { aspect-ratio: 832 / 480; }
.teaser-row .player .label { text-transform: none; letter-spacing: 0.02em; }

/* Diversity: one row per model (label cell, then five seeds). */

/* ---------- "Why FlowMap distillation?" (collapsed by default) ---------- */
.why { max-width: var(--measure); margin: var(--sp-5) auto 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.why summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 0; cursor: pointer; list-style: none;
  font: 400 20px/1.3 var(--serif); color: var(--ink);
}
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: ""; width: 0; height: 0; border-left: 7px solid var(--muted); border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .15s; }
.why[open] summary::before { transform: rotate(90deg); }
.why summary .opt { margin-left: auto; font: 400 12px/1 var(--mono); color: var(--faint); }
.why .body { padding: 0 0 var(--sp-3); }
.why .body p { margin: 0 0 12px; }

/* ---------- Step-through readout below the figure: centered [• Title] + [Body] ---------- */
.step-texts { display: none; }
.step-readout {
  min-height: 3.8em; max-width: var(--measure); margin: var(--sp-2) auto 0;
}
.step-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.step-item[hidden] { display: none; }
.step-item .step-title {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin: 0;
  font: 600 15px/1.35 var(--sans); letter-spacing: -0.005em; color: var(--accent);
}
.step-dot {
  flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.step-item .step-body {
  margin: 0; max-width: var(--measure);
  font: 450 15px/1.55 var(--sans); color: var(--ink); text-wrap: pretty;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .tldr { padding: var(--sp-2) 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .teaser-row.has-media { width: auto; }
  .teaser-row .players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .teaser-row .players { grid-template-columns: minmax(0, 1fr); }
}
.result > .desc.lead-d { max-width: var(--measure); font-size: 17px; color: var(--muted); line-height: 1.4; }
.result > .desc.lead-d + .desc { margin-top: -6px; }
.result > h2.lead-h { max-width: 860px; margin-inline: auto; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.25; text-align: center; }

/* ---------- Collapsed section (Background): the heading is the toggle ---------- */
.toggle-sec > summary { list-style: none; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 12px; max-width: var(--measure); margin: 0 auto; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toggle-sec > summary::-webkit-details-marker { display: none; }
.toggle-sec > summary::before { content: ""; flex: none; border-left: 6px solid var(--muted); border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; transition: transform .15s; }
.toggle-sec[open] > summary::before { transform: rotate(90deg); }
.toggle-sec > summary h2 { margin: 0; font-size: 20px; font-weight: 400; color: var(--muted); }
.toggle-sec[open] > summary h2 { color: var(--ink); }
.toggle-sec > summary:hover h2 { color: var(--accent); }
.toggle-sec > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.toggle-sec[open] > summary { margin-bottom: var(--sp-2); }
/* Sub toggles (Experiments, "Why ..." under Method): the disclosure rows of the Pi2-Flow page, "+" / "−" on the right. */
.toggle-sec.sub > summary { justify-content: space-between; gap: var(--sp-2); padding: 14px 0; }
.toggle-sec.sub > summary::before { content: none; }
.toggle-sec.sub > summary::after { content: "+"; flex: none; font: 400 13px/1.4 var(--mono); color: var(--faint); }
.toggle-sec.sub[open] > summary::after { content: "\2212"; }
.toggle-sec.sub > summary h4 { margin: 0; font: 400 13px/1.4 var(--mono); color: var(--ink); }
.toggle-sec.sub > summary:hover h4, .toggle-sec.sub > summary:hover::after { color: var(--accent); }
.toggle-sec.sub[open] > summary { margin-bottom: var(--sp-2); }
.toggle-sec.sub + .toggle-sec.sub > summary { border-top: 0; }
.toggle-sec.sub[open] + .toggle-sec.sub > summary { border-top: 1px solid var(--line); margin-top: var(--sp-3); }
.toggle-sec.sub .star { margin-right: 6px; color: var(--accent); }
.figure + .toggle-sec.sub { margin-top: var(--sp-3); }

/* ---------- Teaser: one row at a time, chosen with the buttons above (js/page.js initTabs) ---------- */
#quality > h2.teaser-h { text-align: center; }
.tabbar.exp-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: var(--sp-2) auto 0; }
.tabbar button {
  min-height: 34px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer;
  font: 400 13px/1 var(--mono); letter-spacing: 0.02em; color: var(--muted);
}
.tabbar button:hover { color: var(--ink); border-color: var(--ink); }
.tabbar button[aria-selected="true"] { color: var(--accent); border-color: var(--accent); }
.tabbar button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.results-grid.tabbed { margin-top: var(--sp-2); }
.results-grid.tabbed .teaser-row > h3.row-h { display: none; }
.results-grid.tabbed .teaser-row + .teaser-row { margin-top: 0; }

/* Step text above the diagram, so it is read before the figure. */
.step-texts.above { margin: 0; }
.results-grid.tabbed > [hidden] { display: none; }
.tldr .lead em { font-style: italic; font-weight: 400; color: var(--accent); }

/* ---------- Technical challenges: Figure 1 as a step-through ---------- */
#fig-motiv .f1-panel > *, #fig-motiv .f1-charts, #fig-motiv .f1-legend, #fig-motiv .player { transition: opacity .35s; }
#fig-motiv[data-cur="1"] .p-motion > *, #fig-motiv[data-cur="2"] .p-drift > * { opacity: .2 !important; }
#fig-motiv[data-cur="0"] .player.ours, #fig-motiv[data-cur="1"] .player.ours, #fig-motiv[data-cur="2"] .player.ours { opacity: .15; }
#fig-motiv[data-cur="0"] .f1-charts, #fig-motiv[data-cur="1"] .f1-charts, #fig-motiv[data-cur="2"] .f1-charts, #fig-motiv[data-cur="3"] .f1-charts,
#fig-motiv[data-cur="0"] .f1-legend, #fig-motiv[data-cur="1"] .f1-legend, #fig-motiv[data-cur="2"] .f1-legend, #fig-motiv[data-cur="3"] .f1-legend { opacity: .16 !important; pointer-events: none; }
#fig-motiv[data-cur="4"] .f1-video, #fig-motiv[data-cur="4"] .f1-panel > h4 { opacity: .35; }
.toggle-sec:not(.sub):not([open]) + .toggle-sec:not(.sub) > summary { border-top: 0; }
.sec > .exp-h:first-child { margin-top: 0; }
#fig-motiv.figure.stepfig { max-width: min(740px, calc(100vw - 2 * var(--side-nav-room, 0px))); }
.method-sub { margin-top: var(--sp-4); }
.method-sub h3 { text-align: center; margin-bottom: 10px; }
.method-sub + .figure { margin-top: var(--sp-3); }
.figure + .method-sub { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
#experiments .table-fig { max-width: var(--fig-w); margin-inline: auto; }
