/* FreeForward4D project page: a plain single-column paper page. */
:root {
  --bg: #ffffff;
  --panel: #f5f5f5;
  --line: #dbdbdb;
  --heading: #000000;
  --dark: #363636;
  --text: #4a4a4a;
  --mute: #7a7a7a;
  --link: hsl(204, 86%, 45%);
  --stage: #0a0a0a;

  /* Layer swatches: the magma depth ramp and the object palette used in the videos. */
  --depth-ramp: linear-gradient(90deg, #000004, #51127c 25%, #b73779 50%, #fc8961 75%, #fcfdbf);
  --objects-ramp: linear-gradient(90deg, #ff6b29 0 17%, #ffd11a 17% 34%, #9ef240 34% 50%, #29b8ff 50% 67%, #8c66ff 67% 84%, #ff338c 84%);

  --font-heading: "Google Sans", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Noto Sans", "Helvetica Neue", Arial, sans-serif;

  --container: 1024px;
  --prose: 820px;
  --gutter: 16px;
  --space-section: 3rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- Title block ---------- */
.masthead {
  max-width: var(--container);
  margin: 0 auto;
  padding: 3rem var(--gutter) 2rem;
  text-align: center;
  font-family: var(--font-heading);
}
.masthead h1 {
  margin: 0;
  color: var(--heading);
  font-size: clamp(1.75rem, 1.1rem + 2.4vw, 3rem);
  font-weight: 500;
  line-height: 1.125;
  text-wrap: balance;
}
.nowrap { white-space: nowrap; }
.authors { margin: 1.25rem 0 0; font-size: 1.125rem; }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.25rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 40px; padding: .5rem 1.25rem;
  border-radius: 999px;
  background: var(--dark); color: #fff;
  font-size: 1rem; line-height: 1;
}
.btn:hover { background: #2f2f2f; text-decoration: none; }
.btn-disabled, .btn-disabled:hover { background: #767676; cursor: default; }

/* ---------- Sections ---------- */
main { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
main > section { margin-top: var(--space-section); }

h2 {
  margin: 0 0 1.25rem;
  color: var(--dark);
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.125;
  text-align: center;
}

.prose { max-width: var(--prose); margin-left: auto; margin-right: auto; }
.prose p { margin: 0; text-align: justify; hyphens: auto; }
.prose b { color: var(--dark); }

figure { margin: 0; }
figcaption { margin-top: .75rem; font-size: .9375rem; text-align: justify; hyphens: auto; }
figcaption b { color: var(--dark); }

.teaser figcaption { font-family: var(--font-heading); font-size: 1.0625rem; }

.figure { margin-top: 1.5rem; }
section > .figure { margin-top: 0; }
.figure a + a { display: block; margin-top: 1.5rem; }

/* ---------- Comparison player ---------- */
.stage {
  position: relative;
  aspect-ratio: 9 / 2;
  background: var(--stage);
  overflow: hidden;
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
}

.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.stage-label {
  position: absolute; top: .5rem;
  padding: .15rem .5rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: .75rem;
  pointer-events: none;
}
.stage-label-left { left: .5rem; }
.stage-label-right { right: .5rem; }

.handle {
  --split: 50%;
  position: absolute; top: 0; bottom: 0; left: var(--split);
  width: 44px; margin-left: -22px;
  display: flex; align-items: center; justify-content: center;
  cursor: ew-resize;
}
.handle::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px; margin-left: -1px; background: #fff;
}
.handle-grip {
  position: relative;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.handle-grip::before,
.handle-grip::after {
  content: ""; position: absolute; top: 50%; margin-top: -4px;
  border: 4px solid transparent;
}
.handle-grip::before { left: 3px; border-right-color: var(--dark); }
.handle-grip::after { right: 3px; border-left-color: var(--dark); }
.handle:focus-visible { outline: none; }
.handle:focus-visible .handle-grip { outline: 2px solid var(--link); outline-offset: 3px; }

.stage-loading {
  position: absolute; inset: 0;
  background: var(--panel);
  transition: opacity 300ms;
  pointer-events: none;
}
.player.is-ready .stage-loading { opacity: 0; }

.controls {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: .5rem .75rem;
  margin-top: .75rem;
}

.play {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--dark); cursor: pointer;
  display: grid; place-items: center;
}
.play:hover { border-color: #b5b5b5; }
.play-icon { display: block; width: 10px; height: 12px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.play.is-paused .play-icon { width: 0; height: 0; border: 0; border-left: 11px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 3px; }

.modes { display: inline-flex; gap: .25rem; }
.mode {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 36px; padding: 0 .75rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text); cursor: pointer;
  font: .875rem/1 var(--font-body);
}
.mode:hover { border-color: #b5b5b5; }
.mode[aria-pressed="true"] { border-color: var(--dark); color: var(--dark); box-shadow: inset 0 0 0 1px var(--dark); }

.swatch { display: inline-block; width: 18px; height: 8px; border-radius: 4px; flex: none; }
.swatch-depth { background: var(--depth-ramp); }
.swatch-objects { background: var(--objects-ramp); }

/* Timeline: thin rail, ticks mark context frames, head shows playback. */
.road { position: relative; height: 28px; cursor: pointer; }
.road::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 2px; background: var(--line); }
.road-ticks { position: absolute; inset: 0; }
.road-tick { position: absolute; top: 10px; width: 1px; height: 8px; background: var(--mute); }
.road-head { position: absolute; top: 4px; bottom: 4px; left: 0; width: 3px; margin-left: -1.5px; background: var(--dark); }

/* ---------- Tables ---------- */
.lead { max-width: var(--prose); margin: 0 auto 1.5rem; color: var(--dark); font-size: 1.0625rem; text-align: center; }
.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
caption { margin-bottom: .5rem; color: var(--dark); font-family: var(--font-heading); font-weight: 500; font-size: 1.0625rem; }
th, td { padding: .3rem .6rem; text-align: center; font-weight: 400; }
thead { border-top: 2px solid var(--dark); border-bottom: 1px solid var(--dark); }
thead th { color: var(--dark); font-weight: 500; }
tbody { border-bottom: 2px solid var(--dark); }
tbody b { color: var(--heading); }
.left { text-align: left; }
.group th { padding-top: .5rem; color: var(--mute); font-style: italic; border-top: 1px solid var(--line); }
.group:first-child th { border-top: 0; }
td.yes { color: #1a7f37; font-weight: 700; }
td.no { color: #b42318; }
.ours { background: #eef5fb; border-top: 1px solid var(--dark); }
.ours th, .ours td { font-weight: 500; color: var(--heading); }
.ours td.yes { color: #1a7f37; font-weight: 700; }
.note { margin: .75rem 0 0; color: var(--mute); font-size: .8125rem; text-align: justify; hyphens: auto; }

/* ---------- Clip wall ---------- */
.models { display: flex; justify-content: center; gap: .25rem; margin-bottom: 1rem; }
.model {
  min-height: 36px; padding: 0 1rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text); cursor: pointer;
  font: .875rem/1 var(--font-body);
}
.model:hover { border-color: #b5b5b5; }
.model[aria-pressed="true"] { background: var(--dark); border-color: var(--dark); color: #fff; }

h3 { margin: 2rem 0 .25rem; color: var(--dark); font-family: var(--font-heading); font-size: 1.25rem; font-weight: 500; text-align: center; }
.wall-note { margin: 0 0 1rem; font-size: .875rem; text-align: center; }
.tile-wall { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.tile { display: block; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; text-align: center; }
.tile video { display: block; width: 100%; height: auto; background: var(--panel); outline: 2px solid transparent; outline-offset: 2px; }
.tile span { display: block; margin-top: .3rem; font-size: .8125rem; }
.tile:hover video { outline-color: var(--line); }
.tile[aria-pressed="true"] video { outline-color: var(--dark); }
.tile[aria-pressed="true"] span { color: var(--dark); font-weight: 700; }

/* ---------- Close-ups ---------- */
.closeups { max-width: var(--prose); margin-left: auto; margin-right: auto; }
.closeup-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.closeup-grid span { color: var(--dark); font-size: .875rem; text-align: center; }
.closeup-grid .closeup-ours { font-weight: 700; }
.closeup-grid img { width: 100%; }
.closeups + .figure { margin-top: 2rem; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  padding: 2.5rem var(--gutter);
  background: #fafafa;
  font-size: .875rem;
  text-align: center;
}
.site-footer p { margin: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .stage { aspect-ratio: 3 / 2; }
  .controls { grid-template-columns: auto 1fr; }
  .road { grid-column: 1 / -1; }
  .modes { justify-self: start; }
  .tile-wall { grid-template-columns: 1fr; }
  .lead { text-align: left; }
  .note { text-align: left; hyphens: manual; }
  h2 { font-size: 1.625rem; }
  .prose p, figcaption { text-align: left; hyphens: manual; }
  .teaser figcaption { font-size: .9375rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}

/* Paper metadata */
.authors { line-height: 1.9; text-wrap: balance; }
.affiliations { margin: .75rem 0 0; line-height: 1.8; text-wrap: balance; }
.author-notes { margin: .5rem 0 0; font-size: .875rem; color: var(--muted); }
#citation-heading + pre { overflow-x: auto; padding: 1.25rem; border-radius: .5rem; background: #f5f5f5; font-size: .8rem; line-height: 1.6; }

/* Project overview video. */
.project-video { margin: 0; }
.project-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #f5f5f5; border-radius: 4px; }

/* Balanced title and project branding. */
.masthead { padding-top: 2rem; }
.project-logo { width: 132px; height: auto; margin: 0 auto 1rem; }
.masthead h1 { font-size: clamp(1.6rem, 3.1vw, 2.35rem); line-height: 1.22; text-wrap: initial; }
.title-line { display: block; }
@media (min-width: 960px) { .title-line { white-space: nowrap; } }
@media (max-width: 600px) { .project-logo { width: 100px; } .masthead h1 { font-size: 1.65rem; } }

/* Keep the logo beside the two-line title. */
.title-lockup { display: flex; align-items: center; justify-content: center; gap: 14px; }
.title-lockup .project-logo { flex: 0 0 100px; width: 100px; margin: 0; }
.title-lockup h1 { min-width: 0; font-size: clamp(1.4rem, 2.75vw, 2.05rem); }
@media (max-width: 959px) { .title-lockup .title-line { white-space: normal; } }
@media (max-width: 600px) {
  .title-lockup { gap: 6px; }
  .title-lockup .project-logo { flex-basis: 64px; width: 64px; }
  .title-lockup h1 { font-size: clamp(1rem, 4vw, 1.5rem); }
}

/* Separate the two method components for readability. */
#method-heading ~ p + p { margin-top: 1rem; }

/* Let prose extend slightly beyond centered scientific figures. */
.prose { max-width: 100%; }
.figure { width: 92%; margin-left: auto; margin-right: auto; }
@media (max-width: 600px) { .figure { width: 100%; } }

/* Keep author links quiet while retaining a clear hover/focus affordance. */
.authors, .authors a { font-weight: 400; }
.authors a { color: var(--link); text-decoration: none; }
.authors a:hover, .authors a:focus-visible { color: var(--link); text-decoration: underline; text-underline-offset: .15em; }

/* Homepage refinement — 2026-11-21. */
:root { --space-section: 3.75rem; }
.masthead { padding-top: 3rem; padding-bottom: 1rem; }
.project-tagline { max-width: 700px; margin: 1.25rem auto 0; color: #617083; font-size: 1.08rem; line-height: 1.7; text-wrap: balance; }
.author { display: inline-block; white-space: nowrap; }
.authors a { color: #1675bc; text-underline-offset: .22em; }
.authors a:hover { color: #084d83; }
.author-notes { color: var(--mute); }
.links { gap: .7rem; }
.btn { transition: background-color .15s ease, box-shadow .15s ease; }
.btn:hover { box-shadow: 0 3px 10px #162d4820; }
.prose p { line-height: 1.8; }
.project-video { overflow: hidden; border-radius: 12px; border: 1px solid #e2e7ed; box-shadow: 0 10px 32px #152d4810; }
.project-video video { border-radius: 0; }
.method-figure { width: 100%; margin-top: 1.8rem; padding: clamp(12px, 2.5vw, 28px); border: 1px solid #e2e7ed; border-radius: 12px; background: #fff; box-shadow: 0 8px 28px #152d4808; }
.pipeline-link { display: block; border-radius: 4px; }
.method-figure img { width: 100%; }
.method-figure figcaption { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e8edf2; line-height: 1.7; text-align: left; }
.method-figure figcaption a { display: inline-block; }
.table-wrap { border-radius: 8px; }
@media (max-width: 600px) {
  :root { --space-section: 2.75rem; }
  .masthead { padding-top: 1.75rem; }
  .title-lockup { flex-direction: column; gap: .9rem; }
  .title-lockup .project-logo { flex: none; width: 76px; }
  .title-lockup h1 { font-size: 1.65rem; line-height: 1.25; }
  .project-tagline { font-size: .98rem; }
  .authors { font-size: 1rem; line-height: 2; }
  .affiliations { font-size: .9rem; }
  .method-figure { padding: 10px; }
}
