/* TAC-4DGS project page. Dark by default; the header toggle sets <html data-theme="light|dark">. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1b1f22;
  --text-muted: #5b636a;
  --border: #e3e3de;
  --accent: #0f766e;
  --accent-strong: #0b5e57;
  --accent-soft: #e0f2ef;
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 32, .04), 0 4px 16px rgba(16, 24, 32, .06);
  --shadow-hover: 0 2px 4px rgba(16, 24, 32, .06), 0 12px 32px rgba(16, 24, 32, .10);
  --header-bg: rgba(247, 247, 245, .8);
  --hero-glow: rgba(15, 118, 110, .10);

  --radius: 14px;
  --radius-sm: 8px;
  --container: 68rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  color-scheme: light;
}

/* Dark palette: once for the system setting, once for an explicit choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1113;
    --surface: #161a1d;
    --surface-2: #1d2226;
    --text: #e8eaec;
    --text-muted: #9aa3aa;
    --border: #2a3035;
    --accent: #5eead4;
    --accent-strong: #99f6e4;
    --accent-soft: rgba(94, 234, 212, .12);
    --accent-contrast: #062b27;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, .45);
    --header-bg: rgba(14, 17, 19, .75);
    --hero-glow: rgba(94, 234, 212, .08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1113;
  --surface: #161a1d;
  --surface-2: #1d2226;
  --text: #e8eaec;
  --text-muted: #9aa3aa;
  --border: #2a3035;
  --accent: #5eead4;
  --accent-strong: #99f6e4;
  --accent-soft: rgba(94, 234, 212, .12);
  --accent-contrast: #062b27;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, .45);
  --header-bg: rgba(14, 17, 19, .75);
  --hero-glow: rgba(94, 234, 212, .08);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1rem, .96rem + .2vw, 1.0625rem);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s, color .25s;
}

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px));
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: .5rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.75rem;
}

.brand {
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.home-link {
  color: var(--text-muted);
  font-size: .925rem;
  font-weight: 500;
  padding: .4rem .7rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.home-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.home-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.home-link .icon { width: 1rem; height: 1rem; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon { grid-area: 1 / 1; }

/* Show the moon in light mode, the sun in dark mode */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- Hero / title block ---------- */
.hero {
  position: relative;
  padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2.5rem, 6vw, 4rem);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(60rem 26rem at 50% -6rem, var(--hero-glow), transparent 70%);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.venue-badge {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 0 1.75rem;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.venue-badge-main {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 1.1rem .5rem 1rem;
  font-family: var(--font-mono);
  font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--accent-contrast);
  background: var(--accent);
}
.venue-badge-full {
  display: inline-flex;
  align-items: center;
  padding: .5rem 1.1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}

.status-dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  70%  { box-shadow: 0 0 0 .5rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

h1.title {
  margin: 0;
  font-size: clamp(2.5rem, 1.7rem + 4vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.035em;
}

.subtitle {
  max-width: 50rem;
  text-wrap: balance;
  margin: .9rem 0 0;
  font-size: clamp(1.1rem, 1rem + .6vw, 1.45rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -.01em;
  color: var(--text);
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .35rem 1.25rem;
  max-width: 46rem;
  margin: 1.75rem 0 .5rem;
  font-size: 1.02rem;
  font-weight: 500;
}
.authors .author, .nowrap { white-space: nowrap; }
.authors a { color: var(--text); }
.authors a:hover { color: var(--accent); }
.authors sup, .affiliations sup {
  margin-left: .1em;
  font-size: .7em;
  font-weight: 600;
  color: var(--accent);
}

.affiliations {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  color: var(--text-muted);
  font-size: .95rem;
}

.link-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin-top: 2rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .6rem 1.1rem;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform .15s, border-color .15s, background-color .15s, color .15s;
}
a.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.btn-primary {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}
a.btn-primary:hover { color: var(--accent-contrast); background: var(--accent-strong); border-color: var(--accent-strong); }

/* ---------- Sections ---------- */
.section { padding-block: clamp(2rem, 5vw, 3.5rem); }

.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.75rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.prose { max-width: none; }
.prose-justify p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.prose p { margin: 0 0 1.1em; color: var(--text-muted); }
.prose .lead {
  font-size: clamp(1.15rem, 1.05rem + .5vw, 1.35rem);
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -.01em;
}
.prose em { font-style: normal; color: var(--accent); }
.prose strong { color: var(--text); font-weight: 600; }

/* Figures have white backgrounds: keep them on a white tile in both themes */
.figure-tile {
  padding: .75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Results / tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 0 auto 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.results-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
}
table.results-table caption {
  caption-side: top;
  padding: .9rem 1rem .4rem;
  text-align: left;
  font-weight: 600;
}
table.results-table th,
table.results-table td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
table.results-table th:first-child,
table.results-table td:first-child { text-align: left; }
table.results-table tbody tr:last-child td { border-bottom: none; }
table.results-table thead th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-muted);
}
table.results-table tbody tr.highlight-row {
  background: var(--accent-soft);
  font-weight: 600;
}
table.results-table tbody tr.highlight-row td:first-child { color: var(--accent); }

/* ---------- Section intro + key numbers ---------- */
.section-intro {
  max-width: none;
  margin: -.5rem 0 1.5rem;
  color: var(--text-muted);
}

/* One panel split into columns */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stats li {
  padding: 1.1rem 1.25rem 1.2rem;
  box-shadow: -1px 0 0 var(--border), 0 -1px 0 var(--border);
}
.stats strong {
  display: block;
  font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.025em;
  color: var(--accent);
}
.stats span {
  display: block;
  margin-top: .3rem;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* ---------- Video carousel ---------- */
.carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: .25rem;
  border-radius: var(--radius);
}
.carousel-track::-webkit-scrollbar { display: none; }

.carousel-slide {
  flex: 0 0 calc((100% - 1rem) / 2);
  margin: 0;
  scroll-snap-align: start;
}
.carousel-slide video {
  width: 100%;
  height: auto;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.carousel-slide figcaption {
  margin-top: .6rem;
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
}

.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  margin-top: 1.25rem;
}
.carousel-dots { display: flex; gap: .4rem; }
.carousel-dots button {
  width: .55rem;
  height: .55rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: width .2s, background-color .2s;
}
.carousel-dots button.active { width: 1.5rem; background: var(--accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: color .15s, border-color .15s, opacity .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn:disabled { opacity: .4; cursor: default; color: var(--text-muted); border-color: var(--border); }
.icon-btn .icon { width: 1.15rem; height: 1.15rem; }

/* ---------- Method ---------- */
.figure { margin: 2rem 0 0; }
.figure img { width: 100%; }
.figure figcaption {
  margin-top: .6rem;
  text-align: center;
  font-size: .88rem;
  color: var(--text-muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.card {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 0;
  padding: 1.2rem 1.25rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card h3 {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: 0 0 .6rem;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -.01em;
}
.card p { margin: 0; font-size: .925rem; line-height: 1.6; color: var(--text-muted); }

/* Swatches echo the box colours of the pipeline figure */
.swatch {
  flex-shrink: 0;
  width: .8rem;
  height: .8rem;
  margin-top: .3em;
  border-radius: 3px;
  border: 2px solid;
}
.swatch-red   { background: #f8d7dc; border-color: #8f1d2c; }
.swatch-blue  { background: #cfe0fb; border-color: #1d4ea8; }
.swatch-green { background: #d4ece0; border-color: #1e6b3e; }

.note {
  margin: 1.75rem 0 0;
  padding: .2rem 0 .2rem 1rem;
  font-size: .925rem;
  color: var(--text-muted);
  border-left: 3px solid var(--accent);
}

/* ---------- Results table extras ---------- */
table.results-table thead th { font-size: .8rem; }
table.results-table th.th-group { text-align: center; color: var(--text); }
table.results-table td:first-child { white-space: nowrap; }
table.results-table tr.group-row th {
  padding-top: .9rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  background: transparent;
}
table.results-table .delta {
  margin-left: .25rem;
  font-size: .76rem;
  white-space: nowrap;
  color: var(--accent);
}
.table-note { margin: 0; font-size: .82rem; color: var(--text-muted); }

/* ---------- Interactive viewer embed ---------- */
.viewer-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 26rem;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.viewer-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .55;
}
.viewer-launch {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem;
  text-align: center;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .45), transparent);
}
.viewer-launch .btn { min-height: 3rem; padding-inline: 1.4rem; font-size: 1rem; cursor: pointer; }
.viewer-launch .btn:hover { transform: translateY(-1px); }
.viewer-note { font-size: .85rem; color: #e8eaec; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.viewer-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.viewer-links { margin: .75rem 0 0; font-size: .9rem; }

/* ---------- BibTeX ---------- */
.bibtex-wrap { position: relative; }

pre.bibtex {
  margin: 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.copy-btn {
  position: absolute;
  top: .6rem;
  right: .6rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.1rem;
  padding: .3rem .75rem;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn .icon { width: .95rem; height: .95rem; }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(2rem, 6vw, 4rem);
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  .viewer-embed { aspect-ratio: auto; height: min(80vh, 40rem); }
  .stats { grid-template-columns: 1fr 1fr; }
  .carousel-slide { flex-basis: 86%; scroll-snap-align: center; }
  .venue-badge { border-radius: var(--radius); }
  .venue-badge-main, .venue-badge-full { width: 100%; justify-content: center; }
  .venue-badge-full { font-size: .8rem; padding: .45rem 1rem; }
  pre.bibtex { padding-top: 3.25rem; }
}

/* Phone */
@media (max-width: 600px) {
  .header-inner { gap: .5rem; }
  .link-buttons .btn { flex: 1 1 9rem; justify-content: center; }
}

@media (hover: none) {
  a.btn:hover { transform: none; }
}

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