/* TweenGS project page. One content width for text, players, figures and tables; centered title and section headings,
   left-aligned subsection headings, justified text, flat players. Blue = TweenGS, orange = RetimeGS-dagger, as in the paper. */
:root {
  --ink: #363636;
  --ink-2: #4a4a4a;
  --muted: #6a6a6a;
  --line: #e5e5e5;
  --line-2: #d0d0d0;
  --bg: #ffffff;
  --tint: #f5f5f5;
  --ours: #1d6aa8;
  --rt: #c8592a;
  --link: #3273dc;
  --w: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink-2); font-family: var(--font); font-size: 16px; line-height: 1.65; }
img, video, canvas { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
sup, sub { line-height: 0; }
.wrap { max-width: calc(var(--w) + 48px); margin: 0 auto; padding: 0 24px; }

/* title block */
.head { padding: 56px 0 0; text-align: center; }
h1 { margin: 0 auto; max-width: 900px; font-size: 2.3rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
.authors, .affils { margin: 0 auto; max-width: 900px; text-wrap: balance; }
.authors span, .affils span { display: inline-block; margin: 0 10px; white-space: nowrap; }
.authors { margin-top: 18px; font-size: 1.1rem; color: var(--ink); }
.affils { margin-top: 6px; font-size: 1rem; }
.corr { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 20px 0 0; }
.btn { display: inline-block; min-width: 84px; padding: 7px 18px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 500;
  line-height: 1.4; text-align: center; }
.btn:hover { background: #222; text-decoration: none; }

/* teaser: bullet time and free viewpoint side by side, as wide as the text */
.teaser { padding: 36px 0 0; }
.hero { margin: 0; }
.hero-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-frame { position: relative; overflow: hidden; aspect-ratio: 1080 / 1350; background: var(--tint); }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-ring { position: absolute; right: 2.5%; bottom: 2%; width: 19%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.hero-ring svg { display: block; width: 100%; height: 100%; }
.hero-label { margin: 6px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.hero figcaption { margin-top: 14px; font-size: 14.5px; line-height: 1.6; text-align: justify; }

/* sections; every gap from a paragraph to the block it introduces is 20 px */
.section { padding: 64px 0 0; }
h2 { margin: 0 0 22px; font-size: 1.8rem; font-weight: 600; line-height: 1.25; color: var(--ink); text-align: center; }
h3 { margin: 56px 0 12px; font-size: 1.3rem; font-weight: 600; line-height: 1.35; color: var(--ink); }
h2 + h3 { margin-top: 8px; }
.prose p, .lede { margin: 0 0 16px; text-align: justify; }
.prose p:last-child { margin-bottom: 0; }
.lede { margin-bottom: 20px; }
.lede + .more { margin-top: -8px; }
.note { margin: 12px 0 0; font-size: 14.5px; line-height: 1.6; text-align: justify; }
.more { margin: 8px 0 0; font-size: 14.5px; line-height: 1.6; }
.more summary { cursor: pointer; color: var(--link); }
.more p { margin: 6px 0 0; text-align: justify; }
.prose p, .lede, .note, .more p, figcaption { text-justify: inter-word; }

.figure { margin: 28px 0 0; }
.prose + .figure, .lede + .figure { margin-top: 20px; }
.figure + .prose, .tbl + .prose, .note + .prose { margin-top: 32px; }
.lede + .lede { margin-top: -4px; }
.figure + .lede, .tbl + .lede, .fig-row + .lede { margin-top: 32px; }
.figure img { width: 100%; height: auto; }
.figure figcaption { margin-top: 10px; font-size: 14.5px; line-height: 1.6; text-align: justify; }
figcaption b { color: var(--ink); }
.zoomable { cursor: zoom-in; }
.fig-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; align-items: start; }
.fig-row .figure { margin: 0; }
.fig-row figcaption { text-align: left; }

/* method labels on the videos and images */
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 13px; font-weight: 600; line-height: 1.45; white-space: nowrap;
  color: #fff; background: rgba(0, 0, 0, .6); }
.tag-ours { background: var(--ours); }
.tag-rt { background: var(--rt); }
.tag-gt { background: rgba(0, 0, 0, .6); }

/* players */
.player-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.player-bar .mode-seg { margin-left: auto; }   /* stays right-aligned when the scene row wraps */
.seg[hidden] { display: none; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.scene-seg { flex: 1 1 0; min-width: 0; column-gap: 18px; }
.mode-seg { flex: none; }
.seg-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seg button { appearance: none; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 4px;
  padding: 4px 11px; cursor: pointer; line-height: 1.35; text-align: left; }
.seg button:hover { border-color: #a8a8a8; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg-label { align-self: center; font-size: 14px; color: var(--muted); }
.stage { position: relative; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.player .stage { display: flex; justify-content: center; }
.stage-inner { position: relative; width: 100%; }
.stage-canvas { width: 100%; height: auto; outline: none; background: var(--tint); }
.stage-canvas:focus-visible { outline: 2px solid var(--ours); outline-offset: 2px; }
.stage-labels { position: absolute; inset: 0; pointer-events: none; }
.stage-labels .tag { position: absolute; top: 8px; }
.player-foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 0 0; }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-small { appearance: none; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 4px;
  padding: 4px 12px; cursor: pointer; line-height: 1.35; }
.btn-small:hover { border-color: #a8a8a8; }
.readout { margin-left: auto; font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.maps { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; align-items: start; }
.ring-legend { display: flex; justify-content: center; gap: 12px; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ring-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); margin-right: 5px; vertical-align: 1px; }
.ring-legend i.view { width: 9px; height: 9px; background: #fff; border: 2px solid var(--ours); vertical-align: 0; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.tl-legend i { display: inline-block; margin-right: 6px; vertical-align: 1px; }
.tl-legend i.sq { width: 7px; height: 7px; background: var(--ink-2); }
.tl-legend i.dm { width: 7px; height: 7px; border: 1.5px solid var(--ours); background: #fff; transform: rotate(45deg); }
.tl-legend .tl-total { margin-left: auto; }
.map-title { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.ringmap svg, .timeline svg { display: block; width: 100%; height: auto; overflow: visible; }
.ringmap svg.drag { cursor: grab; touch-action: none; }          /* only the maps that respond to the pointer */
.timeline svg.drag { cursor: pointer; touch-action: pan-y; }
.ringmap text, .timeline text { font-family: var(--font); }

/* held-out frames */
.held-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; background: #fff;
  width: min(100%, calc((100vh - 100px) * 2 * var(--ar, 0.8))); margin: 0 auto; }
.held-grid[hidden], .held-slider[hidden] { display: none; }
.held-cell { position: relative; background: var(--tint); }
.held-cell img { width: 100%; height: auto; }
.held-cell .tag { position: absolute; top: 6px; left: 6px; }
.held-cell.is-ours { outline: 2px solid var(--ours); outline-offset: -2px; z-index: 1; }
.held-slider .pick-row { display: flex; flex-wrap: wrap; gap: 18px; padding: 0 0 10px; font-size: 14px; color: var(--muted); }
.held-slider select { font: inherit; font-size: 14px; padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 4px; margin-left: 6px; color: var(--ink);
  background: #fff; }
.compare-stage { width: min(100%, 720px, calc(64vh * var(--ar, 0.8))); margin: 0 auto; background: var(--tint); }
.compare-stage img { width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
.cmp-a-wrap { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 50% 0 0); }
.cmp-a-wrap img { width: 100%; height: 100%; object-fit: cover; }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 32px; margin-left: -16px; cursor: ew-resize; outline: none; }
.cmp-handle span { position: absolute; top: 0; bottom: 0; left: 15px; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.cmp-handle span::after { content: ""; position: absolute; top: 50%; left: -6px; width: 14px; height: 30px; margin-top: -15px; border-radius: 3px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
.cmp-handle:focus-visible span::after { box-shadow: 0 0 0 3px var(--ours); }
.cmp-tag-a { position: absolute; top: 8px; left: 8px; }
.cmp-tag-b { position: absolute; top: 8px; right: 8px; }

/* tables: Table 1 at the full width; the small tables centered, as in the paper, above a caption at least 600 px wide */
.tbl { margin: 24px 0 0; }
.lede + .tbl { margin-top: 0; }
.tbl figcaption { margin-top: 10px; font-size: 14.5px; line-height: 1.6; text-align: justify; }
.tbl-fit { display: table; margin: 32px auto 0; min-width: min(100%, 600px); max-width: 100%; }
.lede + .tbl-fit { margin-top: 0; }
.tbl-fit table { margin: 0 auto; }
.tbl-fit figcaption { display: table-caption; caption-side: bottom; }
.table-scroll { overflow-x: auto; }
table.tb { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.t1 { width: 100%; min-width: 930px; }
table.tb th, table.tb td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tb th:first-child, table.tb td:first-child { text-align: left; }
table.tb.center th:first-child, table.tb.center td:first-child { text-align: center; }
table.tb th.rd, table.tb td.rd { text-align: left; }
table.tb thead th { font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line-2); }
table.tb thead tr:not(:last-child) th { border-bottom: 0; }   /* group headers: a rule under each span, trimmed as \cmidrule(lr) */
table.tb thead tr:not(:last-child) th:not(:empty) { background: linear-gradient(var(--line), var(--line)) center bottom / calc(100% - 8px) 1px no-repeat; }
table.tb tr.group td { text-align: left; font-style: italic; color: var(--muted); background: var(--tint); }
table.tb tr:has(+ tr.sep) > td, table.tb td[rowspan] { border-bottom-color: var(--line-2); }   /* \midrule: the upper cell wins a collapsed border */
table.tb td.best { background: #c6dee3; font-weight: 700; }
table.tb td.second { background: #e6f0f2; }
table.tb tr.ours td:first-child, table.tb td.nm-ours { font-weight: 700; color: var(--ours); }
table.tb tr.full td { font-weight: 700; }

/* charts, drawn at the width of their column */
.linechart svg, .compchart svg { width: 100%; height: auto; display: block; overflow: visible; }
.linechart text, .compchart text { font-family: var(--font); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 5px 8px; border-radius: 3px;
  line-height: 1.4; transform: translate(-50%, -120%); white-space: nowrap; }

/* bibtex */
.bib { position: relative; padding: 14px 16px; background: var(--tint); }
.bib pre { margin: 0; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; overflow-x: auto; color: var(--ink); }
.bib .copy { position: absolute; top: 10px; right: 10px; }

.footer { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }
.footer p { margin: 0; text-wrap: balance; }

/* lightbox: main.js picks the width; a figure wider than the window is panned by scrolling */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 10, .88); display: grid; place-items: center; padding: 24px; overflow: auto;
  overscroll-behavior: contain; cursor: zoom-out; }
.lightbox.pan { place-items: center start; padding: 0; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; background: #fff; }
.lightbox.pan img { max-width: none; }

/* wide screens: the camera ring beside the transport row and the timeline, so a player fits on one laptop screen */
@media (min-width: 641px) {
  .player-foot { grid-template-columns: 120px minmax(0, 1fr); grid-template-areas: "ring transport" "ring timeline"; column-gap: 20px; row-gap: 6px;
    align-items: start; }
  .maps { display: contents; }
  .ringmap { grid-area: ring; }
  .transport { grid-area: transport; }
  .timeline { grid-area: timeline; }
  .player .map-title, .player .ring-legend { display: none; }
}

/* narrow screens; the readout keeps the height of its longest text, so nothing below it moves */
@media (max-width: 1000px) {
  .readout { margin-left: 0; flex-basis: 100%; min-height: 1.5em; }
  .prose p, .lede, .note, .more p, figcaption, .tbl figcaption, .figure figcaption, .hero figcaption { text-align: left; }
  table.t1 thead th:first-child, table.t1 tbody tr:not(.group) td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); box-shadow: inset -1px 0 0 var(--line-2); }
  table.t1 tr.group td span { position: sticky; left: 6px; }
}
@media (max-width: 760px) {
  .fig-row { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { margin-top: 44px; font-size: 1.15rem; }
  .head { padding-top: 36px; }
  .authors { font-size: 1rem; }
  .affils { font-size: 0.92rem; }
  .authors span, .affils span { margin: 0 6px; }
  .section { padding-top: 48px; }
  .hero-pair { gap: 6px; }
  .hero-ring { width: 24%; }
  .hero-label { font-size: 12.5px; }
  .scene-seg { flex-basis: 100%; }
  .readout { min-height: 3em; }
  .maps { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ringmap { max-width: 170px; margin: 0 auto; }
  .held-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); width: auto; }
  .stage-labels .tag { font-size: 11px; padding: 1px 5px; }
  .tbl-fit { display: block; min-width: 0; }
  .tbl-fit figcaption { display: block; }
  table.tb { font-size: 12px; }
  table.tb th, table.tb td { padding: 4px 5px; }
  table.tb.tight th, table.tb.tight td { padding: 4px 2px; }
  table.tb td.rd, table.tb td[rowspan], table.tb.tight td:first-child { white-space: normal; }
}
@media (max-width: 374px) {
  table.tb.tight { font-size: 11px; }
}

/* short screens (phones in landscape): the held-out slider fits the height like the video players */
@media (max-height: 500px) {
  .compare-stage { width: min(100%, 720px, calc(85vh * var(--ar, 0.8))); }
}
