:root {
  --bg: #0E1116;
  --panel: #1C2230;
  --line: #2A3242;
  --fg: #F2F4F7;
  --dim: #98A2B3;
  --a: #FFB03B;
  --u: #5AC8FA;
  --e: #FF6B6B;
  --g: #7EE081;
  --w: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 18px/1.6 Lato, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--a); }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 16px; }
section.wrap, section.closing { margin-bottom: 176px; }
.mask { overflow: hidden; }

/* Wordmark: Lato Black, tight tracking, as on the video's title slide. */
.wordmark { font-weight: 900; letter-spacing: -.02em; line-height: 1; margin: 0; }

/* Hero: the video's title wall under a veil that lifts as the page scrolls. */
.hero { padding: 24px 16px 0; }
.wall { position: relative; max-width: 1600px; margin: 0 auto; aspect-ratio: 1416 / 534; border-radius: 6px; overflow: hidden; }
.wall video { display: block; width: 100%; height: 100%; animation: fadein .9s ease-out both; }
.wall-labels b {
  position: absolute; transform: translate(-100%, -100%); padding: 0 .5em .2em 0;
  font-size: clamp(11px, 1.35vw, 22px); font-weight: 900; font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0,0,0,.9); white-space: nowrap;
}
.veil { position: absolute; inset: 0; background: var(--bg); opacity: 0; backdrop-filter: blur(6px); }
.hero-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 16px; }
.hero-title .wordmark { font-size: clamp(48px, 9vw, 150px); animation: rise 1s cubic-bezier(.2,.8,.2,1) 1.1s both; }
.hero-title .rule { height: 5px; width: min(36vw, 520px); background: var(--a); margin: 1.4vw 0 1.7vw; transform-origin: center; animation: grow .9s cubic-bezier(.2,.8,.2,1) 1.4s both; }
.subtitle { font-size: clamp(16px, 2.3vw, 38px); font-weight: 300; color: #E1E5EC; margin: 0; animation: rise .8s cubic-bezier(.2,.8,.2,1) 1.6s both; }
/* Title in the upper band of the wall, so the two circular fisheyes stay visible beside the subtitle. */
#hero .hero-title { justify-content: flex-start; padding-top: 3.2%; }
.hero-title .wordmark, .hero-title .subtitle { text-shadow: 0 2px 24px rgba(14,17,22,.9); }
.wall-note { max-width: 1600px; margin: 10px auto 0; text-align: right; color: var(--dim); font-size: 14px; }
@keyframes rise { from { transform: translateY(110%); } to { transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Closing: the hero wall again, with the video's closing line. */
.closing { padding: 0 16px; }
.closing .veil { opacity: .74; }
.closing h2::before { display: none; }
.closing .wordmark { padding: 0; font-size: clamp(40px, 7vw, 110px); }
.closing .links { margin-top: 2.2vw; }
.closing .btn { background: rgba(28,34,48,.9); }
.lens-play { bottom: auto; top: 10px; right: auto; left: 10px; }

/* Authors and links */
.people { text-align: center; margin-top: 40px; margin-bottom: 96px; }
.authors, .affil { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 26px; margin: 0; }
.authors { font-size: 20px; font-weight: 700; }
.authors a { color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.authors a:hover { color: var(--a); }
.badge {
  font-style: normal; font-size: 10px; font-weight: 900; line-height: 1; padding: 3px 4px; border-radius: 3px;
  background: var(--line); color: var(--dim); letter-spacing: .02em;
}
.authors a:hover .badge { background: var(--a); color: var(--bg); }
.affil { color: var(--dim); font-size: 16px; margin-top: 8px; }
sup { color: var(--a); font-size: .65em; margin-left: 1px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 9px 20px; border-radius: 999px;
  background: var(--panel); color: var(--fg); text-decoration: none; font-weight: 700;
  border: 1px solid var(--line); transition: border-color .15s, color .15s;
}
.btn:hover { border-color: var(--a); color: var(--a); }
.btn small { color: var(--dim); font-weight: 400; font-size: 13px; }
.btn.is-off { opacity: .55; pointer-events: none; }

/* Text */
h2 { font-size: 30px; font-weight: 900; margin: 0 0 18px; padding-top: 24px; letter-spacing: -.01em; }
h2::before { content: ""; display: block; width: 56px; height: 5px; background: var(--a); margin-bottom: 8px; }
h3 { font-size: 19px; font-weight: 900; margin: 14px 0 2px; }
.prose p, .lead { color: #D5DAE2; margin: 0 0 14px; }
.lead { max-width: 820px; }
.caption { color: var(--dim); font-size: 15px; margin: 6px 0 0; }

/* Media */
.media { display: block; width: 100%; border: 0; border-radius: 6px; background: var(--panel); }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.pipeline { margin-top: 72px; }
.pipeline .figure { margin-top: 18px; }
.figure { margin: 40px 0 0; overflow-x: auto; background: var(--panel); border-radius: 6px; padding: 18px; }
.figure img { display: block; width: 100%; min-width: 640px; height: auto; }
.tag {
  position: absolute; top: 10px; z-index: 3; font-size: 14px; font-weight: 700;
  background: rgba(14,17,22,.8); padding: 2px 10px; border-radius: 3px; font-variant-numeric: tabular-nums;
}
.tag.left { left: 10px; } .tag.right { right: 10px; }
.u { color: var(--u); } .e { color: var(--e); }

/* Before/after: the second video is underneath, the first is clipped to the divider. */
.compare {
  --x: 50%;
  position: relative; overflow: hidden; border-radius: 6px; background: var(--panel);
  cursor: ew-resize; touch-action: pan-y; user-select: none;
}
.compare video { display: block; width: 100%; }
.compare video:first-child { position: absolute; inset: 0; height: 100%; object-fit: cover; clip-path: inset(0 calc(100% - var(--x)) 0 0); z-index: 1; }
.compare::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: var(--x); width: 2px; margin-left: -1px;
  background: var(--fg); z-index: 2; box-shadow: 0 0 8px rgba(0,0,0,.6);
}

/* Trade-off */
.tradeoff { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 36px; margin-top: 24px; align-items: start; }
.to-view { position: relative; }
.pill {
  position: absolute; right: 10px; bottom: 10px; z-index: 3; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--a); background: rgba(14,17,22,.85); color: var(--a);
}
.pill[aria-pressed="true"] { background: var(--a); color: var(--bg); }
.bands { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 14px; color: #D5DAE2; margin-top: 10px; opacity: .35; transition: opacity .2s; }
.bands.on { opacity: 1; }
.bands i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.bands em { font-style: normal; color: var(--dim); }
.readout { display: flex; gap: 36px; }
.readout span { display: block; color: var(--dim); font-size: 14px; }
.readout b { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.lens .readout b { font-size: 24px; font-weight: 700; }
.to-chart { width: 100%; height: auto; margin-top: 18px; }
.to-slider { grid-column: 1 / -1; }
.to-ticks { display: flex; justify-content: space-between; color: var(--dim); font-size: 14px; font-weight: 700; }
.to-ticks span:nth-child(2) { color: var(--fg); }
input[type="range"] { width: 100%; accent-color: var(--a); margin: 10px 0 6px; }

/* Method: one chapter per step, text beside its figure, alternating sides. Every figure is interactive. */
.chapters { display: flex; flex-direction: column; gap: 72px; margin-top: 44px; }
.chap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.chap:nth-child(even) .chap-text { order: 2; }
.chap-n { color: var(--a); font-weight: 900; font-size: 15px; letter-spacing: .12em; margin: 0 0 6px; }
.chap h3 { font-size: 22px; margin: 0 0 10px; }
.chap-text p { color: #D5DAE2; margin: 0 0 10px; }
.chap-text a { color: var(--u); text-decoration: none; border-bottom: 1px solid rgba(90,200,250,.4); }
.chap-text a:hover { border-bottom-color: var(--u); }
.fig { margin: 0; background: var(--panel); border-radius: 6px; padding: 14px 14px 12px; }
.fig figcaption { color: var(--dim); font-size: 13px; margin-top: 6px; }
.fig input[type="range"] { margin: 8px 0 2px; }
.eq { overflow-x: auto; overflow-y: hidden; font-size: 15px; padding: 4px 0; }
.eq .katex-display { margin: .4em 0; }
.glyph { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; cursor: grab; touch-action: none; }
.glyph:active { cursor: grabbing; }
.glyph text { font-family: Lato, sans-serif; }
.nobr { white-space: nowrap; }

/* Lens sweep: video at about its native width, scene picker and readout beside it. */
.lens { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 8px; }
.lens-view { position: relative; }
.lens-view .media { aspect-ratio: 16 / 9; object-fit: cover; }
.lens-view .lens-play { left: 10px; top: 10px; right: auto; bottom: auto; }
.lens-side .lead { margin-bottom: 18px; }
.lens-side .readout { margin-bottom: 18px; }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chips button { padding: 0; border: 2px solid transparent; border-radius: 5px; background: none; cursor: pointer; overflow: hidden; opacity: .55; transition: opacity .15s, border-color .15s; }
.chips button img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.chips button:hover { opacity: 1; }
.chips button[aria-selected="true"] { border-color: var(--a); opacity: 1; }
/* No native play overlay on a scrubbed video. */
video::-webkit-media-controls, video::-webkit-media-controls-overlay-play-button, video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }

/* Camera effects: three columns so none is hidden behind a tab. */
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.effect { position: relative; }
.effect .media, .effect .compare { aspect-ratio: 4 / 3; object-fit: cover; }
.effect .compare video { height: 100%; object-fit: cover; }
.effect input[type="range"] { margin-top: 12px; }
.ends { display: flex; justify-content: space-between; gap: 8px; color: var(--dim); font-size: 13px; margin-top: -2px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 6px 0 22px; }
.stats div { background: var(--panel); border-radius: 6px; padding: 16px 20px; border-left: 4px solid var(--a); }
.stats b { display: block; font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stats span { color: var(--dim); font-size: 15px; }

/* BibTeX */
.bib { position: relative; }
.bib pre { margin: 0; background: var(--panel); border-radius: 6px; padding: 18px 20px; overflow-x: auto; font-size: 14px; line-height: 1.5; }
.copy { position: absolute; top: 10px; right: 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 4px 12px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.copy:hover { border-color: var(--a); }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--dim); font-size: 14px; padding-top: 20px; padding-bottom: 48px; border-top: 1px solid var(--line); }
.foot a { color: var(--dim); text-decoration: none; }
.foot a:hover { color: var(--a); }


/* Side-by-side layouts hold until phone width; method chapters stack text over figure. */
@media (max-width: 760px) {
  .chap { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .chap:nth-child(even) .chap-text { order: 0; }
  .chapters { gap: 56px; }
  .cols3, .tradeoff { grid-template-columns: minmax(0, 1fr); }
  .to-view { max-width: 560px; width: 100%; margin: 0 auto; }
  .lens { grid-template-columns: minmax(0, 1fr); }
  .lens-side { order: -1; }
  .chips { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
/* Below this width the wall is too short for an overlaid title: title above the wall, veil off. */
@media (max-width: 900px) {
  .wall { overflow: visible; aspect-ratio: auto; display: flex; flex-direction: column; }
  .wall video { aspect-ratio: 1416 / 534; border-radius: 6px; }
  .veil { display: none; }
  .hero-title, #hero .hero-title { position: static; order: -1; padding: 8px 0 24px; opacity: 1 !important; }
  .closing .hero-title { order: 0; padding: 24px 0 0; }
  .wall-labels { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  section.wrap, section.closing { margin-bottom: 112px; }
  .readout b { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
