:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --text: #16181d;
  --muted: #5b6270;
  --line: #e3e7ee;
  --accent: #0a8fb8;       /* Q-CBF blue, matches the paper figures */
  --accent-soft: #e4f4fa;
  --warm: #f29a1a;         /* orange accent from the paper figures */
  --radius: 12px;
  --max: 1120px;
  --narrow: 820px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

img, video { display: block; max-width: 100%; }

.container { max-width: var(--max); margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.narrow { max-width: var(--narrow); margin-left: auto; margin-right: auto; }
.container.narrow { max-width: calc(var(--narrow) + 40px); }

main > section { padding-top: 56px; padding-bottom: 56px; }
main > section + section { border-top: 1px solid var(--line); }

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 6px; }

/* ---------- Hero ---------- */
/* Title sits bottom-centre over the video; authors and links sit below it. */
/* Full-width banner. Never taller than 16:9 and anchored to the top, so on wide
   screens only the bottom edge (under the title) is trimmed; never stretched. */
.hero-media {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: min(56.25vw, 92vh);
  min-height: 360px;
  overflow: hidden;
  background: #0d0f12;
}
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 10, 14, 0.82) 0%, rgba(8, 10, 14, 0.45) 22%, rgba(8, 10, 14, 0) 42%);
}
.hero-title { position: relative; width: 100%; padding-bottom: 40px; text-align: center; color: #fff; }

h1 { margin: 0; }
h1 .acronym {
  display: block;
  font-size: clamp(3rem, 9vw, 5.5rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}
h1 .subtitle {
  display: block;
  max-width: 760px;
  margin: 12px auto 0;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.hero-meta { padding-top: 28px; text-align: center; }
.authors { margin: 0 0 4px; font-size: 1.05rem; }
.authors a { color: var(--text); }
.affiliations { margin: 0 0 22px; color: var(--muted); font-size: 0.92rem; }
.affiliations span + span { margin-left: 16px; }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 8px; }
.btn {
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
}
.btn:hover { text-decoration: none; background: #333a46; }
.btn.soon { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); pointer-events: none; }
.btn.soon::after { content: " · soon"; font-weight: 400; }

/* ---------- Abstract / text ---------- */
.abstract { text-align: justify; hyphens: auto; }
section p { margin: 0 0 12px; }

/* ---------- Contribution cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card-num { display: block; margin-bottom: 8px; color: var(--accent); font-weight: 700; font-size: 0.85rem; }

/* ---------- Figures ---------- */
.figure { margin: 28px auto 0; }
.figure-scroll { display: block; }
.figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.figure figcaption { margin-top: 12px; color: var(--muted); font-size: 0.93rem; }

/* ---------- Result sections ---------- */
.section-head { max-width: var(--narrow); margin-bottom: 24px; }
.section-head p { color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.stat-val { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat-lbl { font-size: 0.88rem; line-height: 1.35; }
.stat-lbl small { color: var(--muted); font-size: 0.8rem; }

/* ---------- Gallery ---------- */
.section-head .task {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text);
}
.task b { margin-right: 6px; color: var(--accent); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.06em; }

/* Video-set switcher: one full-width bar of equal, clearly clickable segments. */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}
.tab {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  border: 1.5px solid #cfd6e1;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.tab:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(10, 143, 184, 0.15); }
.tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(10, 143, 184, 0.3); }
.tab-count {
  min-width: 26px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}
.tab.active .tab-count { background: rgba(255, 255, 255, 0.25); color: #fff; }

.next-row { display: flex; justify-content: flex-end; margin-top: 18px; }
.next-set {
  padding: 10px 20px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.next-set:hover { background: var(--accent); color: #fff; }

/* Same tile size everywhere (2 per row); short rows are centred. Wide clips span the row. */
.grid { --cols: 2; --gap: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.grid > .tile { width: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.grid > .tile.wide { width: 100%; }
.grid[hidden] { display: none; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}
.tile[hidden] { display: none; }
.tile-media { position: relative; overflow: hidden; border-radius: 10px; background: #0d0f12; aspect-ratio: 16 / 9; }
.tile-media video { width: 100%; height: 100%; object-fit: contain; }
.tile:hover .tile-media { box-shadow: 0 0 0 2px var(--accent); }
.tile:focus-visible .tile-media { outline: 3px solid var(--accent); outline-offset: 2px; }
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(13, 15, 18, 0.72);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.tile-title { font-size: 0.92rem; font-weight: 500; }

/* ---------- Video status markers (window.SHOW_VIDEO_STATUS) ---------- */
.tile.placeholder { cursor: default; }
.placeholder .tile-media {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #c3cad6;
  background: repeating-linear-gradient(135deg, #f4f6f9 0 12px, #eceff4 12px 24px);
}
.placeholder-body { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; }
.placeholder-id { font-size: 1.05rem; font-weight: 700; color: #6b7382; letter-spacing: 0.04em; }
.placeholder-note { max-width: 90%; color: var(--muted); font-size: 0.85rem; line-height: 1.35; }
.placeholder-file { padding: 2px 8px; border-radius: 6px; background: #fff; color: var(--muted); font-size: 0.75rem; }
.placeholder .tile-title { color: var(--muted); }

.status-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.status-tag.draft { background: var(--warm); color: #fff; }
.hero-media > .status-tag { top: 16px; right: 16px; font-size: 0.8rem; }

.status-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  max-width: min(340px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.14);
  font-size: 0.85rem;
}
.status-panel summary { padding: 10px 14px; cursor: pointer; white-space: nowrap; }
.status-panel b.ready { color: #1f9d55; }
.status-panel b.draft { color: var(--warm); }
.status-panel b.missing { color: #8a93a3; }
.status-list { max-height: 50vh; margin: 0; padding: 4px 14px 12px 34px; overflow-y: auto; border-top: 1px solid var(--line); }
.status-list li { padding: 3px 0; }
.status-list a { color: var(--text); }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }
.status-dot.draft { background: var(--warm); }
.status-dot.missing { border: 1.5px dashed #8a93a3; }

/* ---------- Lightbox ---------- */
.lightbox {
  width: min(1200px, 94vw);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: #000;
  color: #fff;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.8); }
.lightbox video { width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
.lightbox-caption { margin: 0; padding: 10px 16px; font-size: 0.95rem; }
.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- BibTeX ---------- */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  line-height: 1.5;
}
.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ---------- Footer ---------- */
footer { padding: 32px 20px 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main > section { padding-top: 40px; padding-bottom: 40px; }
  .container { padding-left: 16px; padding-right: 16px; }
  /* Phones: video full-width, title moves below it */
  .hero { padding-top: 0; }
  .hero-media { display: block; height: auto; min-height: 0; background: none; overflow: visible; }
  .hero-video { position: static; aspect-ratio: 16 / 9; background: #0d0f12; }
  .hero-shade { display: none; }
  .hero-title { padding: 20px 16px 0; color: var(--text); }
  h1 .acronym, h1 .subtitle { text-shadow: none; }
  .hero-meta { padding-top: 18px; }

  /* Video-set switcher: buttons stacked full width, all visible */
  .tabs { flex-direction: column; }
  .tab { justify-content: space-between; min-height: 48px; }
  .next-row { justify-content: stretch; }
  .next-set { width: 100%; }

  /* Figures: keep a readable size, swipe sideways; tap opens the full image */
  .figure-scroll { display: block; overflow-x: auto; border-radius: var(--radius); }
  .figure-scroll img { width: auto; max-width: none; height: 300px; }
  #limbo .figure-scroll img { height: 220px; }

  .status-panel { right: 8px; bottom: 8px; font-size: 0.78rem; }
  .hero-title { padding-bottom: 28px; }
  .grid { --cols: 1; }
  .abstract { text-align: left; }
}
