:root {
  --accent: #3a6df0;
  --accent-soft: #eef2ff;
  --ink: #1f2430;
  --muted: #6b7280;
  --card-bg: #ffffff;
  --line: #e5e7eb;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans', 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: #fafbfc;
}

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, #ffffff 0%, #f4f6fb 100%); }

.publication-title {
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 1.2rem;
}
.publication-title .subtitle-line {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--muted);
}

.publication-authors { margin: 0.4rem 0; }
.publication-authors .author-block a { color: var(--accent); }
.publication-authors.note { color: var(--muted); margin-top: 0.3rem; }

.publication-links { margin-top: 1.6rem; }
.publication-links .link-block { margin: 0.25rem; display: inline-block; }
.publication-links .button.is-dark { background: var(--ink); transition: transform .12s ease, background .12s ease; }
.publication-links .button.is-dark:hover { transform: translateY(-2px); background: #000; }

/* ---------- Teaser ---------- */
.teaser-section { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.teaser-tagline {
  font-size: 1.25rem;
  color: var(--ink);
  max-width: 820px;
  margin: 0 auto 1.6rem auto;
  line-height: 1.5;
}

/* ---------- Section helpers ---------- */
/* demo sections span nearly the full viewport to minimise side whitespace,
   but stay centered and capped on ultra-wide monitors */
.demo-container { max-width: 1700px; margin: 0 auto; padding-left: 2rem; padding-right: 2rem; }
.section-lead, .caption { color: var(--muted); max-width: 880px; margin: 0.5rem auto 1.8rem auto; }
.abstract-text,
.method-summary {
  font-size: 0.92rem;
  line-height: 1.55;
}
.abstract-text p,
.method-summary p { margin-bottom: 0.75rem; }
.method-summary { max-width: 920px; margin: 0 auto 1.1rem auto; }
.pipeline-figure { max-width: 1000px; margin: 0 auto; }
.architecture-figure { max-width: 1000px; }
.pipeline-figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(20,30,60,.06);
}

/* ---------- Editing chains ---------- */
.chains-container { display: flex; flex-direction: column; gap: 2.5rem; }

.edit-chain { }
.chain-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
}
.chain-title .chain-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* horizontal, scrollable row to convey an unbounded chain */
.chain-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scroll-snap-type: x proximity;
}
.chain-row::-webkit-scrollbar { height: 8px; }
.chain-row::-webkit-scrollbar-thumb { background: #cbd2e0; border-radius: 8px; }

.vid-card {
  flex: 0 0 auto;
  width: 420px;
  max-width: 88vw;
  scroll-snap-align: start;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(20,30,60,.05);
}
.vid-card video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0d1018;
}
.vid-label {
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--line);
}
.vid-label.source { color: var(--accent); }
.vid-label .step-idx { color: var(--muted); font-weight: 500; }

/* connector between two clips: arrow + the instruction that produced the next clip */
.chain-arrow {
  flex: 0 0 auto;
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 0.4rem;
}
.chain-arrow .instr {
  position: relative;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  line-height: 1.3;
  margin-bottom: 0.4rem;
  max-width: 100%;
}
.chain-arrow .arrow-glyph {
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}

/* long-instruction popover */
.instr.has-full { cursor: pointer; }
.instr .instr-icon {
  font-size: 0.72rem;
  color: var(--accent);
  margin-left: 0.3rem;
  opacity: 0.8;
}
.instr .instr-full {
  display: none;
  position: fixed;
  width: 280px;
  max-width: calc(100vw - 24px);
  background: #0d1018;
  color: #eef0f5;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(10,15,30,.35);
  z-index: 40;
  white-space: normal;
  pointer-events: none;
}
.instr.has-full:hover .instr-full,
.instr.open .instr-full { display: block; }

/* category section */
.category-block { margin-bottom: 2.5rem; }
.category-title {
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  border-left: 4px solid var(--accent);
  padding-left: 0.7rem;
  margin-bottom: 1rem;
}
/* cases laid out in a centered, wrapping grid; one case now, many later */
.cases-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2rem;
}
.short-case { margin-bottom: 0; flex: 0 0 auto; }
.short-case .chain-row { overflow-x: visible; justify-content: center; }
/* two cases per category share a row, so use smaller clips to fit the page width */
.short-case .vid-card { width: 300px; }
.short-case .chain-arrow { width: 100px; }

/* comparison rows: many clips per row -> smaller clips so a full chain stays visible */
.chain-compare .vid-card { width: 290px; }
.chain-compare .chain-arrow { width: 110px; }

/* scene-prompt stand-in card for pure-T2V (prompt-switch) baselines */
.scene-card .scene-body {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
  background: linear-gradient(135deg, #eef2ff, #f4f6fb);
}
.scene-card .instr {
  cursor: pointer;
  background: #fff;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink);
  max-width: 92%;
  text-align: center;
}
.comparison-note { font-size: 0.85rem; margin-top: 1.2rem; }

/* ---------- BibTeX ---------- */
pre.bibtex {
  background: #0d1018;
  color: #e6e9f0;
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-size: 0.9rem;
}
pre.bibtex code { background: transparent; color: inherit; }

/* ---------- Footer ---------- */
.footer { background: #f4f6fb; }
.footer a { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .demo-container { padding-left: 1rem; padding-right: 1rem; }
  .publication-title .subtitle-line { font-size: 1.1rem; }
  .vid-card { width: 220px; }
  .chain-arrow { width: 120px; }
  .short-case { flex: 1 1 100%; max-width: 100%; }
  .short-case .chain-row {
    overflow-x: auto;
    justify-content: flex-start;
  }
  .short-case .vid-card { width: min(220px, 72vw); }
  .short-case .chain-arrow { width: 90px; }
  pre.bibtex { font-size: 0.78rem; }
}
