/* FoundationFlow project page. Layout and type follow the NVIDIA research project pages
   (black NVIDIA bar, NVIDIA Sans, green accents). */

@font-face {
  font-family: "NVIDIA Sans";
  src: url("https://images.nvidia.com/etc/designs/nvidiaGDC/clientlibs_base/fonts/nvidia-sans/GLOBAL/var/NVIDIASansVF_W_Wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --nv-green: #76b900;
  --nv-green-dark: #456f00;
  --ink: #171a1c;
  --muted: #5d656b;
  --line: #d9dddf;
  --surface: #f5f6f6;
  --focus: #3d7fc2;
  --radius: 4px;
  --page: 78rem;
  --text: 70rem;
  --font: "NVIDIA Sans", Arial, Helvetica, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: #fff; font: 1.0625rem/1.65 var(--font); }
img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--nv-green-dark); text-underline-offset: 0.2em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link { position: absolute; top: -4rem; left: 0.75rem; z-index: 10; padding: 0.5rem 0.75rem; background: var(--nv-green); color: #000; font-weight: 700; }
.skip-link:focus { top: 0.75rem; }

/* NVIDIA bar */
.nv-bar { background: #fff; border-bottom: 1px solid var(--line); }
.nv-bar-inner { display: flex; align-items: center; gap: 0.9rem; max-width: var(--page); min-height: 3.25rem; margin: 0 auto; padding: 0 1.25rem; }
.nv-logo { display: block; color: var(--ink); }
.nv-logo svg { display: block; width: 6.75rem; height: 1.25rem; }
.nv-divider { width: 1px; height: 1.25rem; background: var(--line); }
.nv-lab { color: var(--ink); font-size: 0.875rem; font-weight: 700; text-decoration: none; }
.nv-lab:hover { color: var(--nv-green-dark); }

/* Paper header */
main { padding: 0 1.25rem; }
.paper-header { max-width: var(--page); margin: 0 auto; padding: 2.75rem 0 2.5rem; text-align: center; }
.venue { margin: 0 0 0.75rem; color: var(--nv-green-dark); font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; }
h1 { max-width: var(--text); margin: 0 auto; font-size: 2.625rem; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.title-line { display: block; }
h1 strong { color: var(--nv-green); font-weight: 800; white-space: nowrap; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.5rem; max-width: 40rem; margin: 1.25rem auto 0; padding: 0; list-style: none; font-size: 1.3rem; }
.authors li { white-space: nowrap; }
.authors a { color: inherit; text-decoration: none; }
.authors a:hover { color: var(--nv-green-dark); text-decoration: underline; }
.affiliation-logo { display: block; width: 11rem; margin: 1.25rem auto 0; }
.affiliation-logo img { display: block; width: 100%; height: auto; }
.paper-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-width: 7.25rem; min-height: 2.75rem; padding: 0.625rem 1.25rem; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff; font: inherit; font-size: 1rem; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color 150ms, border-color 150ms, color 150ms; }
.button:hover { border-color: var(--nv-green); background: var(--nv-green); color: #000; }
.button svg { flex: 0 0 18px; }
.button[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
.button[aria-disabled="true"]:hover { border-color: var(--ink); background: var(--ink); color: #fff; }
.button small, .soon { font-size: 0.8em; font-weight: 400; opacity: 0.85; }

/* Content */
.teaser { max-width: var(--text); margin: 0 auto; }
.teaser video { width: 100%; border-radius: 8px; background: #fff; }
section { max-width: var(--text); margin: 0 auto; padding-top: 3rem; }
h2 { margin: 0 0 1rem; font-size: 2rem; line-height: 1.25; }
h2::after { content: ""; display: block; width: 2.5rem; height: 3px; margin-top: 0.5rem; background: var(--nv-green); }
h3 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
h2 + h3 { margin-top: 1.25rem; }
p { margin: 0 0 1rem; }
figure { margin: 0 0 1.5rem; }
figure img, figure video { width: 100%; }
figcaption { margin-top: 0.6rem; color: var(--muted); font-size: 0.9375rem; }
.teaser figcaption { text-align: center; }
.data-figure { max-width: 52rem; margin-left: auto; margin-right: auto; }
.section-index { display: block; margin-bottom: 0.75rem; color: var(--nv-green-dark); font-size: 0.8125rem; font-weight: 600; }
.abstract { font-size: 1.0625rem; }
.highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; margin: 1.5rem 0; }
.highlights article { border-top: 1px solid var(--line); padding-top: 1rem; }
.step-number { color: var(--nv-green-dark); font-size: 0.8125rem; font-weight: 700; }
.highlights h3 { font-size: 1.0625rem; margin: 0 0 0.25rem; }
.highlights p { font-size: 0.9375rem; color: var(--muted); }
.method-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 2rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }

/* Benchmark video viewer */
.viewer { margin-top: 1.25rem; }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 0.75rem; }
.tabs, .toggle { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0; padding: 0; }
.control-label { display: block; margin-bottom: 0.25rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.chip { min-height: 2.25rem; padding: 0.375rem 0.875rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 0.9375rem; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.toggle .chip[aria-pressed="true"][data-method="foundationflow"] { border-color: var(--nv-green); background: var(--nv-green); color: #000; }
.viewer .tabs { margin-bottom: 0.75rem; }
.stage + .stage { margin-top: 0.5rem; }
.stage { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.stage video { width: 100%; }
.clip-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; margin-top: 0.6rem; color: var(--muted); font-size: 0.9375rem; }
.clip-info strong { color: var(--ink); font-weight: 600; }
.metric-pair { white-space: nowrap; }
@media (max-width: 640px) { .metric-pair { white-space: normal; } }
.metric-pair .ff { color: var(--nv-green-dark); font-weight: 700; }

/* Results table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
th, td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface); font-weight: 600; vertical-align: bottom; }
thead th small { display: block; color: var(--muted); font-weight: 400; font-size: 0.75rem; }
tbody tr:last-child td { border-bottom: 0; }
tr.group td { padding-top: 0.75rem; color: var(--muted); font-size: 0.8125rem; font-style: italic; background: #fff; }
tr.ours td { background: #f2f8e6; }
tr.ours td:first-child { font-weight: 600; }
/* Best and second best, coloured as in the paper. */
tr td.best { background: #a6d9a0; font-weight: 700; }
tr td.second { background: #ddf1d9; }
.swatch { display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.3em; vertical-align: -0.05em; border-radius: 2px; }
.swatch.best { background: #a6d9a0; }
.swatch.second { background: #ddf1d9; margin-left: 0.6em; }
td.seen { color: var(--muted); }
/* Phones: the method column stays put while the scores scroll. */
@media (max-width: 640px) {
  tr:not(.group) > :first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line); }
  thead tr > :first-child { background: var(--surface); }
  tr.ours > :first-child { background: #f2f8e6; }
  tr.group span { position: sticky; left: 0.75rem; }
}
td.seen::after { content: "\2020"; font-size: 0.75em; vertical-align: super; }
.table-note { margin-top: 0.6rem; color: var(--muted); font-size: 0.875rem; }
/* The ends of the depth-change colour map (RdBu). */
.dz-toward { color: #2166ac; font-weight: 700; }
.dz-away { color: #b2182b; font-weight: 700; }

pre { margin: 0; overflow-x: auto; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font: 0.875rem/1.5 var(--mono); }
.citation-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.copy { min-height: 2.25rem; padding: 0.375rem 0.875rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font: inherit; font-size: 0.875rem; cursor: pointer; }
.copy:hover { border-color: var(--ink); }

/* Footer */
.nv-footer { margin-top: 4rem; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.8125rem; }
.nv-footer-inner { max-width: var(--page); margin: 0 auto; padding: 1.75rem 1.25rem 2.25rem; }
.nv-footer p { margin: 0 0 0.75rem; }
.nv-footer a { color: var(--muted); }
.nv-footer .legal { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin-bottom: 0.75rem; }

@media (max-width: 48rem) {
  .highlights, .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  main { padding: 0 1rem; }
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.625rem; }
  .authors { font-size: 1.05rem; gap: 0.375rem 0.875rem; }
  .affiliation-logo { width: 8.5rem; margin-top: 1rem; }
  .nv-logo svg { width: 5.5rem; height: 1rem; }
  .nv-lab { font-size: 0.75rem; }
}

/* Interactive 3D scene flow beside the input video */
.stage-3d { display: grid; grid-template-columns: 1fr 2fr; aspect-ratio: 1600 / 600; }  /* until the first clip sets its layout */
.stage-3d video { width: 100%; height: 100%; object-fit: contain; }
.input-view { position: relative; min-width: 0; min-height: 0; container-type: inline-size; }
.input-view .chip-label { font-size: min(0.875rem, 5.4cqi); white-space: nowrap; }  /* one line in narrow columns */
.cloud { position: relative; min-width: 0; min-height: 0; cursor: grab; touch-action: none; }
.cloud:active { cursor: grabbing; }
.cloud canvas { display: block; width: 100%; height: 100%; }
.chip-label { position: absolute; top: 0; left: 0; padding: 0.15em 0.5em; background: var(--nv-green); color: #000; font-size: 0.875rem; font-weight: 700; line-height: 1.4; pointer-events: none; }
.chip-label.chip-flow { top: 50%; }
.stage-3d.wide .chip-label.chip-flow { top: 0; left: 50%; }
.stage-3d.narrow .cloud { aspect-ratio: 4 / 3; border-top: 1px solid var(--line); }
.stage-3d.narrow video { height: auto; }
.cloud-hint { position: absolute; right: 0.5rem; bottom: 0.4rem; color: var(--muted); font-size: 0.75rem; pointer-events: none; }
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 0.9rem; }
.mode { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; min-height: 5.5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font: inherit; font-size: 0.875rem; line-height: 1.35; text-align: center; cursor: pointer; }
.mode strong { color: var(--ink); font-size: 1.125rem; }
.mode:hover { border-color: var(--ink); }
.mode[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.mode-orange { color: #c2410c; font-weight: 700; }
@media (max-width: 760px) { .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Phones. Wide multi-panel media keeps a readable size and scrolls sideways instead of shrinking;
   the teaser shows its 3D trails under the input. */
.teaser-trails, .pan-hint, .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}
@media (max-width: 40rem) {
  .paper-header { padding: 1.75rem 0 1.75rem; }
  section { padding-top: 2.25rem; }
  .button { min-width: 0; padding: 0.55rem 1.1rem; }

  .teaser.split video { aspect-ratio: 1280 / 720; object-fit: cover; object-position: left center; }
  .teaser.split .teaser-trails { display: block; aspect-ratio: 972 / 720; margin-top: 0.5rem; object-position: right center; }

  .pan { overflow-x: auto; overscroll-behavior-x: contain; }
  .pan > img, .pan > video { width: var(--pan, 48rem); max-width: none; }
  .stage.pan { overflow-x: auto; }
  .pan-hint { display: block; margin: 0.35rem 0 0; color: var(--muted); font-size: 0.8125rem; }

  table { font-size: 0.8125rem; }
  th, td { padding: 0.45rem 0.55rem; }
  tr:not(.group) > :first-child { min-width: 7rem; max-width: 7.5rem; white-space: normal; }

  .cloud-hint { right: 0.25rem; bottom: 0.25rem; padding: 0.1rem 0.35rem; border-radius: 3px; background: rgba(255, 255, 255, 0.85); font-size: 0.6875rem; }
  .chip { min-height: 2.25rem; padding: 0.3rem 0.75rem; font-size: 0.875rem; }
  .modes { gap: 0.5rem; }
  .mode { min-height: 0; padding: 0.6rem 0.5rem; font-size: 0.8125rem; }
  .mode strong { font-size: 1rem; }

  pre { padding: 0.75rem 0.875rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8125rem; }
}
@media (max-width: 40rem) {
  .paper-links { display: grid; grid-template-columns: repeat(2, minmax(0, 9.5rem)); justify-content: center; gap: 0.6rem; }
}
