/* =================================================================
   MemOIR project page: warm editorial light theme
   ================================================================= */

:root {
  --bg: #fbf8f2;          /* warm paper */
  --bg-2: #f3ede1;        /* beige band */
  --surface: #fffdf9;
  --surface-2: #f7f2e8;
  --ink: #1f1b16;
  --ink-2: #4a433a;
  --muted: #7b7366;
  --faint: #aaa192;
  --line: #e7dfd0;
  --line-2: #d4c8b3;

  --accent: #c2552d;      /* terracotta, echoes the vehicle blocks */
  --accent-ink: #a5421c;
  --accent-wash: rgb(194 85 45 / .09);
  --accent-mark: rgb(236 150 80 / .32);

  --code-bg: #221d18;
  --code-ink: #efe6d8;

  --font-sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 12px;
  --aspect: 3 / 2;
  --maxw: 1180px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-mark); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

code { font-family: var(--font-mono); font-size: .86em; }
:not(pre) > code {
  padding: .08em .4em;
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.mark {
  background: linear-gradient(180deg, transparent 58%, var(--accent-mark) 58%);
  color: var(--ink);
  font-weight: 600;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding-block: 28px clamp(48px, 7vw, 88px);
  background:
    radial-gradient(900px 480px at 92% -10%, rgb(236 150 80 / .16), transparent 70%),
    radial-gradient(700px 420px at -10% 110%, rgb(194 85 45 / .07), transparent 70%);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}

.hero-meta, .kicker, .card-k, .step-n, .codeblock-tag, .hero-cap {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hero-meta { color: var(--muted); font-size: 12px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}
@media (min-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; }
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  color: var(--accent);
  font-size: clamp(48px, 8vw, 92px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
}
.wordmark img { width: .78em; height: .78em; }

.hero-title {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.hero-thesis {
  margin: 22px 0 0;
  color: var(--ink-2);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
}
.hero-thesis strong { color: var(--ink); font-weight: 600; }
.hero-thesis .arr { color: var(--accent); }


.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn-solid { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.is-disabled { opacity: .5; pointer-events: none; }

.hero-cap { margin: 10px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

/* ---------- sticky nav ---------- */

.toc {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding-inline: 16px;
  margin-top: -22px;
  pointer-events: none;
}
.toc .wrap {
  display: flex;
  gap: 2px;
  width: auto;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 253 249 / .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgb(80 60 30 / .10);
  pointer-events: auto;
}
.toc a {
  flex: none;
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s, background-color .15s;
}
.toc a:hover { color: var(--ink); background: var(--surface-2); }
.toc a.is-active { color: var(--bg); background: var(--ink); }

/* ---------- sections ---------- */

.section { padding-block: clamp(64px, 8vw, 112px); border-top: 1px solid var(--line); }
.section.bg { background: var(--bg-2); }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.kicker .kn { color: var(--accent-ink); }
.kicker::after { content: ""; width: 34px; height: 1px; background: var(--line-2); }

.sec-head { display: grid; gap: 20px; margin-bottom: clamp(32px, 5vw, 56px); }
@media (min-width: 900px) {
  .sec-head.split { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: end; }
}
@media (min-width: 900px) {
  #abstract .sec-head.split { align-items: start; }
  #abstract .sec-head.split > div { position: sticky; top: 96px; }
}

.sec-title {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 54px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.sec-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--accent-ink);
}
#bibtex .sec-title { margin-bottom: 24px; }

.sec-lede { margin: 0; color: var(--ink-2); font-size: clamp(16px, 1.4vw, 19px); line-height: 1.55; }
.sec-lede strong { color: var(--ink); font-weight: 600; }

.abstract { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.7; text-align: justify; hyphens: auto; }

.sub { margin: clamp(48px, 6vw, 72px) 0 10px; font-size: clamp(20px, 2vw, 24px); font-weight: 700; letter-spacing: -.015em; }
.desc { margin: 0 0 20px; color: var(--muted); font-size: 15px; max-width: 78ch; }


/* ---------- placeholders ---------- */

.ph-text {
  margin-block: 10px 20px;
  padding: 8px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}
.ph-text::before { content: "[placeholder] "; opacity: .7; }

.ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgb(120 90 50 / .045) 14px 28px),
    var(--surface-2);
}
.ph-label { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.ph code { color: var(--muted); font: 11px/1.3 var(--font-mono); word-break: break-all; background: none; padding: 0; }
.is-loaded > .ph, .is-loaded .ph { display: none; }

/* ---------- media ---------- */

.slot { margin: 0; min-width: 0; }

.slot-media, .img-slot, .wipe, .explainer {
  position: relative;
  aspect-ratio: var(--aspect);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.slot-media video, .wipe video, .img-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.explainer { aspect-ratio: 16 / 9; box-shadow: 0 18px 50px -24px rgb(80 50 20 / .35); }
.explainer video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

.slot figcaption { margin-top: 7px; color: var(--muted); font-size: 13px; text-align: center; }
.slot.is-ours figcaption { color: var(--accent-ink); font-weight: 600; }
.slot.is-ours .slot-media { border: 2px solid var(--accent); }

.img-slot { aspect-ratio: 21 / 9; }
.img-slot img { object-fit: contain; background: #fff; }

/* ---------- teaser wipe ---------- */

.wipe {
  --pos: 50%;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  box-shadow: 0 24px 60px -28px rgb(80 50 20 / .4);
}
.wipe .layer { position: absolute; inset: 0; }
.wipe .layer.top { clip-path: inset(0 0 0 var(--pos)); }
.wipe .layer.bottom .ph { padding-right: 50%; }
.wipe .layer.top .ph { padding-left: 50%; background-color: var(--bg-2); }
.wipe .handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  pointer-events: none;
}
.wipe .handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1b16' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l-5 6 5 6M15 6l5 6-5 6'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: 0 2px 10px rgb(0 0 0 / .25);
}
.wipe .tag {
  position: absolute;
  top: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  background: rgb(31 27 22 / .7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}
.wipe .tag.left { left: 10px; }
.wipe .tag.right { right: 10px; }

/* ---------- comparison blocks ---------- */

.compare {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(80 60 30 / .05);
}

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

.grid-row {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 10px;
}
.grid-row + .grid-row { margin-top: 12px; }

.panel[hidden] { display: none; }

@media (max-width: 720px) {
  .grid-row { grid-template-columns: repeat(min(var(--n), 2), minmax(0, 1fr)); }
}

.sync { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.sync button {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.sync .track { position: relative; flex: 1; }
.sync input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); }
.sync .time { flex: none; min-width: 88px; color: var(--muted); font: 12px var(--font-mono); text-align: right; }
.sync .speed {
  flex: none;
  padding: 4px 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}
.marker {
  position: absolute;
  top: -18px;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- footer ---------- */

footer { padding-block: 40px 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; justify-content: center; }

/* =================================================================
   Rebuttal page additions
   ================================================================= */

.hero.slim { padding-block: 28px clamp(40px, 6vw, 72px); }
.hero.slim .hero-top { margin-bottom: clamp(32px, 5vw, 56px); }
.hero.slim .wordmark { font-size: clamp(44px, 7vw, 80px); margin-bottom: 14px; }
.hero.slim .hero-title { max-width: 26ch; }
.hero-note { margin: 18px 0 0; max-width: 66ch; color: var(--ink-2); font-size: clamp(15.5px, 1.4vw, 18px); line-height: 1.55; }

.sec-head.compact { margin-bottom: clamp(8px, 2vw, 16px); }
.section .sub:first-of-type { margin-top: clamp(24px, 3vw, 36px); }

/* sub-heading with a small reference tag (e.g. "Table R1") */
.sub .ref {
  margin-left: 10px;
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  font: 500 11px/1.6 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  vertical-align: 4px;
}

/* tabs: same pills as the project page, with a soft rail and a scene counter */
.tabs {
  align-items: center;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  gap: 2px;
}
.tab { border-color: transparent; padding: 6px 16px; transition: color .15s, background-color .15s, border-color .15s; }
.tab:hover { border-color: transparent; background: var(--surface); }
.tab[aria-selected="true"] { box-shadow: 0 2px 8px rgb(31 27 22 / .18); }

.slot.is-ours figcaption { color: var(--accent-ink); font-weight: 600; }

footer .anon { font-family: var(--font-mono); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.slot-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* bland overrides (user 11-14): no gradients, no italics, plain numbered headings */
.hero.plain { padding-block: clamp(40px, 6vw, 64px) clamp(36px, 5vw, 56px); background: none; }
.hero.plain .hero-title { max-width: none; font-size: clamp(24px, 2.8vw, 34px); font-weight: 700; }
.hero.plain .hero-note { margin-top: 12px; color: var(--muted); font-size: 16px; }
.section { padding-block: clamp(40px, 5vw, 64px); }
.section .sec-title { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.25; letter-spacing: -.015em; }
.section .sub, .section .sub:first-of-type { margin: clamp(28px, 3.5vw, 40px) 0 6px; font-size: 18px; font-weight: 600; letter-spacing: 0; }
.sec-title em { font-family: inherit; font-style: normal; color: inherit; }
/* medium-size headings (user 11-14) */
.section .sec-title { font-size: 21px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.section .sub, .section .sub:first-of-type { font-size: 16px; font-weight: 600; margin: 28px 0 4px; }
/* equal slot size across rows of a block; shorter rows centred (user 11-14) */
.grid-row {
  grid-template-columns: repeat(var(--k, var(--n)), calc((100% - (var(--n) - 1) * 10px) / var(--n)));
  justify-content: center;
}
@media (max-width: 720px) {
  .grid-row { grid-template-columns: repeat(min(var(--k, var(--n)), 2), calc((100% - 10px) / 2)); }
}
/* smaller headings, roomier rows (user 11-14) */
.section .sec-title { font-size: 18px; font-weight: 650; }
.section .sub, .section .sub:first-of-type { font-size: 15px; margin: 36px 0 4px; }
.grid-row + .grid-row { margin-top: 28px; }
.slot figcaption { margin-top: 9px; }
.compare { padding: 22px; }
.tabs { margin-bottom: 20px; }
.sync { margin-top: 22px; }
/* heading sizes fitted to one line at full width (measured with Inter Tight): h2 34px (longest h2 max 34.4px), h3 24px (longest h3 max 26px) */
.section .sec-title { font-size: clamp(22px, 2.9vw, 34px); font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
.section .sub, .section .sub:first-of-type { font-size: clamp(17px, 2.05vw, 24px); font-weight: 600; line-height: 1.3; margin: 44px 0 6px; letter-spacing: -.01em; }
.section .desc { font-size: 15.5px; }
/* subtitle under the paper title (user 11-14) */
.hero-sub { margin: 14px 0 0; color: var(--accent-ink); font-size: clamp(20px, 2.3vw, 28px); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.hero.plain .hero-note { margin-top: 10px; }
.slot.is-contain .slot-media video { object-fit: contain; background: #000; }
.note { margin: 14px 0 0; max-width: 92ch; padding: 10px 14px; border-left: 3px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.note b { color: var(--ink); font-weight: 600; }
/* frame-rate note as a footnote under 1.1 */
.note.footnote-note { margin: 12px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line-2); background: none; color: var(--muted); font-size: 13.5px; }
.note.footnote-note b { color: var(--ink-2); }
/* deep links from the OpenReview rebuttal: headings land below the sticky nav (~44px) */
html { scroll-padding-top: 0; }
section[id], h3[id] { scroll-margin-top: 60px; }
.desc .c1 { color: #2f7fe0; font-weight: 600; }
.desc .c2 { color: #d9761a; font-weight: 600; }
