:root {
  --bg: #f8fafc;
  --bg-soft: #eef2f8;
  --ink: #0b1526;
  --ink-soft: #4a5872;
  --ink-faint: #52627b;
  --line: #e2e7f0;
  --card: #ffffff;
  --blue: #003366;
  --blue-bright: #0072ce;
  --cyan: #00b4d8;
  --gradient: linear-gradient(120deg, #001f3f 0%, #003366 35%, #0072ce 70%, #00b4d8 100%);
  --gradient-2: linear-gradient(135deg, #001f3f 0%, #003366 50%, #00b4d8 100%);
  --shadow-sm: 0 2px 8px -2px rgb(11 21 38 / 0.06);
  --shadow-md: 0 12px 28px -10px rgb(11 21 38 / 0.14);
  --shadow-lg: 0 30px 60px -20px rgb(11 21 38 / 0.28);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

[id] { scroll-margin-top: 6.5rem; }
[hidden] { display: none !important; }

body, h1, h2, h3, p, figure, pre { margin: 0; }

a { color: var(--blue); }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--blue-bright);
  outline-offset: 3px;
}

.container { width: min(100%, 1120px); margin-inline: auto; }
.is-max-desktop { max-width: 900px; }
.has-text-centered { text-align: center; }
.content p + p { margin-top: 1rem; }
.mt-6 { margin-top: 2.5rem; }
.title { margin-bottom: 1rem; }
.title.is-5 { font-size: 1.125rem; }
.centered { margin-inline: auto; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 1rem;
  left: 1rem;
  transform: translateY(-180%);
  padding: 0.65rem 0.9rem;
  background: var(--card);
  border-radius: var(--radius-sm);
}

.skip-link:focus { transform: translateY(0); }

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

::selection { background: rgba(0, 114, 206, 0.2); }

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(249, 250, 252, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.nav-inner, .nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.nav-inner {
  justify-content: space-between;
  gap: 0.15rem 1.2rem;
  padding: 0.65rem 1.5rem;
}

.nav-links { gap: 0.25rem 1.15rem; }

.site-nav a {
  display: inline-block;
  padding-block: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover { color: var(--blue-bright); text-decoration: underline; }

.site-brand a {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Hero ---------- */
.hero-dark {
  position: relative;
  background: radial-gradient(ellipse 60% 50% at 20% 0%, rgba(0, 51, 102, 0.65), transparent 60%),
    radial-gradient(ellipse 55% 45% at 85% 15%, rgba(0, 180, 216, 0.4), transparent 60%),
    radial-gradient(ellipse 60% 60% at 50% 100%, rgba(27, 78, 155, 0.35), transparent 60%),
    #060a14;
  color: #f2f6fb;
  overflow: hidden;
  padding: 5.5rem 1.5rem 5rem;
}

.hero-dark::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.35;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.publication-title {
  font-weight: 800;
  font-size: clamp(1.65rem, 3.5vw, 2.75rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 1.4rem;
  background: linear-gradient(115deg, #ffffff 15%, #a9c8f2 45%, #7fe3ff 75%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.publication-authors {
  font-weight: 500;
  line-height: 1.8;
  color: #cfd0e6;
  font-size: 1.02rem;
}

.publication-authors a {
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.publication-authors a:hover { border-color: var(--cyan); color: var(--cyan); }

.author-block { display: inline-block; margin: 0 0.3rem 0.15rem 0; }

.venue-line {
  margin-top: 1rem;
  color: #9ea1c4;
  font-weight: 600;
  font-size: 0.95rem;
}

.venue-line strong { color: #f5f5fb; }

.lead-note {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: #aab6cf;
}

.publication-links {
  margin-top: 2.2rem;
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.hero-link {
  padding: 0.7rem 1.15rem;
  border: 1px solid #8296b4;
  border-radius: 999px;
  color: #f5f9ff;
  font-weight: 700;
  text-decoration: none;
}

.hero-link.primary {
  background: #eef6ff;
  border-color: #eef6ff;
  color: var(--blue);
}

.hero-link:hover { text-decoration: underline; }
.hero-link:focus-visible { outline-color: #7fe3ff; }

/* ---------- Teaser ---------- */
.teaser-wrap {
  background: var(--bg);
  padding: 0 1.5rem 5.5rem;
  margin-top: -2.5rem;
  position: relative;
  z-index: 2;
}

.teaser-frame {
  max-width: 1080px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 22px;
  padding: 0.6rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

.teaser-frame img {
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

.caption {
  margin-top: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.65;
  max-width: 760px;
}

.caption.centered { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Sections ---------- */
.section-tight { padding: 5rem 1.5rem; }
.section-alt { background: var(--bg-soft); }

.section-kicker {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.6rem;
  display: inline-block;
}

.section-kicker::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 0.5rem;
  background: var(--gradient);
  vertical-align: middle;
}

.title.is-3 {
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.content.prose {
  font-size: 1.06rem;
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 820px;
}

.content.prose.centered { margin: 0 auto; text-align: left; }

/* ---------- Stat cards ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 2.2rem;
}

.stat {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.4rem 1.1rem;
  text-align: center;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient);
}

.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat .num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat .label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}

.table-note {
  margin-top: 0.7rem;
  font-size: 0.87rem;
  color: var(--ink-faint);
  max-width: 820px;
}

.table-note.centered { margin: 0.9rem auto 0; text-align: center; }

/* ---------- Method ---------- */
.method-intro {
  max-width: 68ch;
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.method-components {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.method-component {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.method-component h3 { margin-bottom: 0.45rem; font-size: 1.12rem; }
.method-component p { color: var(--ink-soft); line-height: 1.65; }

/* ---------- Figures ---------- */
.figure-frame {
  margin-top: 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}

.figure-frame img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}

/* ---------- Demo cases ---------- */
.case-browser {
  display: grid;
  grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
}

.case-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-link {
  display: block;
  height: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.case-link:hover { background: #e2eaf6; }

.case-link[aria-current] {
  border-color: #becde1;
  background: var(--card);
  box-shadow: inset 3px 0 var(--blue), var(--shadow-sm);
}

.case-benchmark {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 750;
}

.example-card {
  padding: clamp(0.9rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.example-card + .example-card { margin-top: 1rem; }
.example-card[hidden] + .example-card { margin-top: 0; }
.example-card:target { scroll-margin-top: 6.5rem; }

.example-card h3 {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  line-height: 1.25;
  margin-bottom: 0.45rem;
}

.case-description { color: var(--ink-soft); }

.example-card video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  background: #0d111b;
}

.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  font-weight: 650;
}

.case-answer {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.case-answer summary {
  width: fit-content;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.case-answer p { margin-top: 0.5rem; }

.tool-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  margin: 0.75rem 0 1.15rem;
}

.tool-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 700;
}

.tool-legend i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
}

.swatch-clip { background: #3478f6; }
.swatch-lce { background: #16a378; }
.swatch-ver { background: #ea8214; }
.swatch-ovw { background: #965adc; }

/* ---------- Results tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  margin-top: 0.8rem;
  box-shadow: var(--shadow-sm);
}

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 690px;
}

table.results th,
table.results td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

table.results th:first-child,
table.results td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
  min-width: 10rem;
}

table.results thead th {
  background: #071a3d;
  color: #e7f1ff;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: none;
}

table.results thead th:first-child { background: #071a3d; }

table.results tbody tr:hover td { background: rgba(0, 114, 206, 0.045); }
table.results tbody tr.ours:hover td { background: #dde9f9; }

table.results tr.group td {
  background: var(--bg-soft);
  text-align: left;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

table.results tr.ours td {
  background: #eaf1fb;
  font-weight: 650;
}

table.results tr.ours td:first-child {
  background: #eaf1fb;
  box-shadow: inset 3px 0 0 0 var(--blue);
}

table.results td.best { font-weight: 800; color: var(--blue); }
table.results tr.ours td.best { color: #001f3f; }

/* ---------- Ablations ---------- */
.ablation-studies { margin-top: 2.75rem; }
.ablation-studies .title { margin-bottom: 0.35rem; }
.experiment-units { color: var(--ink-soft); margin-bottom: 0.9rem; }

.experiment-carousel.is-interactive {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 0.8rem;
}

.experiment-arrow {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid #b8c7db;
  border-radius: 50%;
  background: var(--card);
  color: var(--blue);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.experiment-arrow::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
}

.experiment-arrow.previous::before { transform: translateX(1px) rotate(-135deg); }
.experiment-arrow.next::before { transform: translateX(-1px) rotate(45deg); }
.experiment-arrow:hover { background: var(--blue); color: white; }

.experiment-dots {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.experiment-dot {
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.experiment-dot::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #70819b;
}

.experiment-dot:hover::before { background: var(--blue); }
.experiment-dot[aria-current]::before { background: var(--blue); transform: scale(1.3); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.experiment-panel {
  padding: clamp(0.65rem, 2.25vw, 1.35rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.experiment-panel:not([hidden]) ~ .experiment-panel:not([hidden]) { margin-top: 1.75rem; }
.experiment-panel h4 { margin: 0 0 0.35rem; font-size: 1.12rem; }
.experiment-description { color: var(--ink-soft); max-width: 80ch; }

.experiment-panel table.results { min-width: 0; }
.experiment-panel table.results th:first-child,
.experiment-panel table.results td:first-child {
  min-width: 0;
  position: static;
  white-space: normal;
}

.experiment-panel table.results tbody th { font-weight: 500; }
.experiment-panel table.results tbody tr.ours th {
  background: #eaf1fb;
  box-shadow: inset 3px 0 var(--blue);
  font-weight: 650;
}

.experiment-figure { max-width: 48rem; margin-top: 0.8rem; }

/* ---------- BibTeX ---------- */
.bibtex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.copy-bibtex-btn {
  background: var(--gradient);
  color: #f5f9ff;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.copy-bibtex-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.bibtex-header .title { margin-bottom: 0; }
.copy-status:not(:empty) { margin-top: 0.55rem; color: var(--ink-soft); }

#bibtex-code {
  background: #0a1830;
  color: #dbe7fb;
  border: 1px solid #1b3a63;
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  font-size: 0.87rem;
  overflow-x: auto;
  margin-top: 1rem;
}

#bibtex-code code {
  font-family: "SF Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  color: #d9dcfb;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding: 2.4rem 1.5rem;
}

.footer .content { color: var(--ink-faint); font-size: 0.88rem; }
.footer a { color: var(--blue); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (max-width: 760px) {
  .stats, .case-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-browser, .method-components { grid-template-columns: minmax(0, 1fr); }
  .case-list { gap: 0.15rem; }
  .case-link { padding: 0.5rem 0.65rem; }
}

@media (max-width: 560px) {
  .nav-inner { padding-inline: 1rem; }
  .nav-links { gap: 0.15rem 0.85rem; }
  .hero-dark { padding: 3.3rem 1rem 4rem; }
  .teaser-wrap { padding: 0 1rem 2.5rem; }
  .section-tight { padding: 3rem 1rem; }
  .figure-frame { padding: 0.7rem; }
  .experiment-carousel.is-interactive { column-gap: 0.3rem; }
  .experiment-arrow { width: 2.25rem; height: 2.25rem; }
  .experiment-panel table.results th { white-space: normal; }
  table.results th:first-child, table.results td:first-child { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
