/* RMRRT project page. Layout after the HULK project page (full-width video cover with the title over it,
   eyebrow + heading sections, metric cards, side-by-side method videos, light/dark theme). */
:root {
  --paper: #ffffff;
  --ink: #16181d;
  --muted: #5b6270;
  --line: #e3e7ee;
  --surface: #f5f7fa;
  --accent: #0a8fb8;
  --accent-ink: #ffffff;
  --eq: #0a8fb8;      /* equality: projection, manifold */
  --ineq: #e8590c;    /* inequality: barrier */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --content: 1080px;
  --radius: 12px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --paper: #111418;
  --ink: #eef1f6;
  --muted: #aeb8c6;
  --line: #303844;
  --surface: #191e25;
  --accent: #69c9e6;
  --accent-ink: #111418;
  --eq: #69c9e6;
  --ineq: #ff9a5c;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --paper: #111418; --ink: #eef1f6; --muted: #aeb8c6; --line: #303844; --surface: #191e25;
    --accent: #69c9e6; --accent-ink: #111418; --eq: #69c9e6; --ineq: #ff9a5c; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
img, video { display: block; max-width: 100%; }
sup { font-size: 0.7em; }
h1, h2, h3, h4 { font-family: var(--sans); }

/* ---------- header ---------- */
.site-header { display: flex; justify-content: center; align-items: center; gap: 24px; padding: 22px 20px 18px; flex-wrap: wrap; }
.header-links { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.header-links a { font: 500 11px/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.header-links a:hover { color: var(--ink); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 30px;
  background: none; color: var(--ink); font: 500 11px/1.3 var(--sans); cursor: pointer;
}
.theme-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }

/* ---------- cover ---------- */
.cover-media { position: relative; isolation: isolate; background: #0d0f12; }
.cover-media video, .cover-media img { width: 100%; height: min(56.25vw, calc(100svh - 112px)); object-fit: cover; }
.cover-title {
  position: absolute; inset: 0; z-index: 2; display: grid; align-content: end; justify-items: center; text-align: center;
  padding: 0 24px 40px; color: #fff; pointer-events: none;
  background: linear-gradient(to top, rgba(8,10,14,.86) 0%, rgba(8,10,14,.5) 24%, transparent 46%);
}
.cover-title h1 {
  max-width: 980px; margin: 0; font: 700 clamp(30px, 4.2vw, 50px)/1.15 var(--sans); letter-spacing: -.025em;
  text-wrap: balance; text-shadow: 0 2px 16px rgba(0,0,0,.45);
}
.cover-title h1 .name { color: #8fdcf2; }
.cover-title .venue { margin: 18px 0 0; font-size: clamp(16px, 2vw, 26px); font-weight: 700; letter-spacing: .08em; }
.cover-credit { position: absolute; top: 12px; right: 16px; z-index: 2; color: rgba(255,255,255,.55); font-size: 11px; }
.cover-copy { padding: 28px 20px 0; text-align: center; }
.authors { margin: 0; font-size: 1.1rem; font-weight: 600; }
.affiliations { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.affiliations a { color: inherit; }
.publication-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.button {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: 600 .92rem/1.65 var(--sans); text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
.button:hover { transform: translateY(-1px); border-color: var(--muted); }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button[aria-disabled="true"] { background: var(--surface); color: var(--muted); pointer-events: none; }
.button[aria-disabled="true"]::after { content: " · soon"; font-weight: 400; }
.button svg { width: 15px; height: 15px; }

/* ---------- sections ---------- */
.page-content, footer { width: calc(100% - 48px); max-width: var(--content); margin: 0 auto; }
.page-section { margin-top: 56px; padding-top: 56px; border-top: 1px solid var(--line); scroll-margin-top: 20px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font: 500 12px/1.5 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
h2 { margin: 0 0 16px; font: 700 1.75rem/1.4 var(--sans); letter-spacing: -.025em; }
h3 { margin: 0 0 10px; font: 700 1.35rem/1.4 var(--sans); letter-spacing: -.015em; }
.intro { max-width: 820px; margin: 0 0 28px; }
.muted { color: var(--muted); }
.question { margin: 24px 0; padding-left: 16px; border-left: 3px solid var(--accent); font-size: 1.15rem; font-weight: 600; }
.t-eq { color: var(--eq); }
.t-ineq { color: var(--ineq); }

/* ---------- video and figure cards ---------- */
.video-card, .paper-figure { margin: 0; min-width: 0; }
.video-card video { width: 100%; border-radius: var(--radius); background: var(--surface); cursor: zoom-in; }
.video-card figcaption { padding-top: 10px; }
.video-card h4 { margin: 0; font: 600 15px/1.5 var(--sans); }
.video-card p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.video-card.is-ours h4 { color: var(--accent); }
.video-card.is-ours video { outline: 2px solid var(--accent); outline-offset: 2px; }
.paper-figure img { width: 100%; border-radius: var(--radius); background: #fff; }
.paper-figure figcaption { margin-top: 10px; color: var(--muted); font-size: .95rem; text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.block { margin-top: 64px; }
.grid-5 .video-card video { aspect-ratio: 1 / 1; object-fit: cover; }
.teaser { margin-top: 28px; }
.yt { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.yt iframe, .yt-facade { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-facade { padding: 0; cursor: pointer; background: #000; }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.yt-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 999px; background: rgba(255,255,255,.95); color: #16181d; font-weight: 700;
}
.yt-play svg { width: 20px; height: 20px; }

/* ---------- metric cards ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.metric-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric-value { font: 700 1.6rem/1.2 var(--sans); letter-spacing: -.02em; color: var(--accent); }
.metric-card h3 { margin: 10px 0 4px; font: 600 1.02rem/1.5 var(--sans); }
.metric-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.findings-summary { margin: 28px 0 0; padding-left: 22px; }
.findings-summary li + li { margin-top: 12px; }

/* ---------- method ---------- */
.equation { margin: 14px 0 0; padding: 14px 16px; border-radius: 10px; background: var(--surface); overflow-x: auto; text-align: center; }
.method-text { max-width: 820px; min-width: 0; }
.tag { display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 999px; font: 600 11px/1.6 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.tag.ineq { background: color-mix(in srgb, var(--ineq) 14%, transparent); color: var(--ineq); }
.tag.eq { background: color-mix(in srgb, var(--eq) 14%, transparent); color: var(--eq); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 24px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { color: var(--muted); font: 500 11px/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.data-table .is-ours { background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.data-table .is-ours td:first-child { color: var(--accent); font-weight: 700; }
.data-table td.best { color: var(--accent); font-weight: 700; }
.table-note { margin-top: 10px; color: var(--muted); font-size: .88rem; }
.table2 { table-layout: fixed; min-width: 860px; }
.table2 th, .table2 td { padding: 9px 12px; font-size: 14px; }
.table2 thead tr:first-child th:first-child { width: 21%; }
.table2 thead tr + tr th:first-child { text-align: center; }
.table2 thead tr:first-child th.sep { color: var(--ink); font-size: 12px; font-weight: 700; }
.table2 .sep { border-left: 1px solid var(--line); }
.table2 tr.group td { padding: 16px 12px 6px; color: var(--muted); font-size: 13px; font-style: italic; text-align: left; }

/* ---------- interactive demo ---------- */
.demo { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; align-items: start; }
.demo-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius); background: #303030; }
.demo-stage canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.demo-stage canvas:active { cursor: grabbing; }
.demo-overlay { position: absolute; left: 16px; top: 12px; color: #fff; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.demo-overlay .name { font-size: 1.2rem; font-weight: 700; }
.demo-overlay .live { font-size: .85rem; opacity: .85; font-variant-numeric: tabular-nums; }
.demo-final {
  position: absolute; left: 16px; bottom: 14px; display: none; grid-template-columns: auto auto; gap: 2px 18px;
  padding: 10px 14px; border-radius: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: .9rem; font-variant-numeric: tabular-nums;
}
.demo-final.show { display: grid; }
.demo-final b { text-align: right; }
.demo-load {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; cursor: pointer; background: #303030; font: inherit;
}
.demo-load span { position: relative; z-index: 1; padding: 10px 22px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; }
.demo-load img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel + .panel { margin-top: 12px; }
.panel h4 { margin: 0 0 10px; color: var(--muted); font: 500 11px/1.5 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.method-btns { display: grid; gap: 6px; }
.demo-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.demo-tab {
  padding: 7px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
  font: 600 .88rem/1.4 var(--sans); cursor: pointer;
}
.demo-tab:hover { border-color: var(--muted); }
.demo-tab[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.demo-note { margin: 10px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.method-btn {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: 600 .9rem/1.4 var(--sans); cursor: pointer; text-align: left;
}
.method-btn small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.method-btn:hover { border-color: var(--muted); }
.method-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.play-row { display: flex; gap: 8px; }
.play-row button {
  flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
  font: 600 .88rem/1.4 var(--sans); cursor: pointer;
}
.speed { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: .85rem; }
.speed input { flex: 1; accent-color: var(--accent); }
.legend { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .85rem; }
.legend i { display: inline-block; width: 18px; height: 4px; margin-right: 8px; border-radius: 2px; vertical-align: middle; }

/* ---------- BibTeX and footer ---------- */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0; padding: 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  font: .85rem/1.55 var(--mono);
}
.copy-button {
  position: absolute; top: 10px; right: 10px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: .8rem/1.6 var(--sans); cursor: pointer;
}
footer {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 80px; padding: 28px 0 44px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
footer a { color: inherit; }

/* ---------- video viewer ---------- */
.video-viewer {
  width: min(1100px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 48px 12px 12px; border: 0;
  border-radius: var(--radius); background: #101827; color: #fff;
}
.video-viewer::backdrop { background: rgb(0 0 0 / 80%); }
.video-viewer video { width: 100%; max-height: calc(100dvh - 140px); object-fit: contain; background: #000; }
.video-viewer p { margin: 10px 4px 0; }
.video-viewer-close { position: absolute; top: 4px; right: 8px; width: 44px; height: 44px; border: 0; background: none; color: #fff; font-size: 28px; cursor: pointer; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
mjx-container[jax="CHTML"][display="false"] { display: inline-block !important; margin: 0 .05em; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-content, footer { width: calc(100% - 32px); }
  .metric-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-title { position: static; padding: 22px 16px 0; color: var(--ink); background: var(--paper); }
  .cover-title h1 { font-size: 28px; text-shadow: none; }
  .cover-title h1 .name { color: var(--accent); }
  .cover-media video, .cover-media img { height: 56.25vw; }
  .cover-credit { display: none; }
}
