:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #666666;
  --color-accent: #1a56c4;
  --color-card: #ffffff;
  --color-card-border: #e3e3e3;
  --color-code-bg: #f4f5f7;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 6px 16px rgba(0,0,0,.05);
  --radius: 14px;
  --font-sans: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  --font-body: 'Noto Sans', system-ui, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --max-text: 880px;
  --max-wide: 1100px;
  --section-pad: 4rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-sans);
  font-weight: 700;
  margin: 0 0 1rem;
}

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

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

.container-text {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Sticky nav --- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  transition: background .2s ease, box-shadow .2s ease;
}

.site-nav.is-scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
}

.site-nav-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav-brand {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--color-text);
}
.site-nav-brand:hover { text-decoration: none; color: var(--color-accent); }

.site-nav-links {
  display: flex;
  gap: 1.5rem;
}

.site-nav-links a {
  color: var(--color-muted);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.site-nav-links a:hover,
.site-nav-links a.is-active {
  color: var(--color-text);
  text-decoration: none;
  border-bottom-color: var(--color-accent);
}

@media (max-width: 640px) {
  .site-nav-links { gap: 0.9rem; }
  .site-nav-links a { font-size: 0.85rem; }
}

/* --- Hero header --- */
.hero-header { padding: 3.5rem 0 1rem; }
.hero-header-inner { text-align: center; }

.hero-title {
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.3;
}

.hero-authors {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}
.hero-authors .author-block { display: inline-block; }

.hero-affiliations {
  color: var(--color-muted);
  font-size: 0.95rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 0.6rem;
}

.hero-venue {
  font-weight: 700;
  color: var(--color-muted);
}

/* --- Footer --- */
.site-footer {
  padding: 3rem 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  border-top: 1px solid rgba(0,0,0,.08);
  margin-top: var(--section-pad);
}
.footer-link { color: var(--color-muted); text-decoration: underline; }
.footer-link:hover { color: var(--color-accent); }

/* --- Link buttons --- */
.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.5rem 0 2.5rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-card);
  position: relative;
  cursor: default;
  text-decoration: none;
}

a.link-btn {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

a.link-btn:hover {
  background: var(--color-accent-soft, rgba(0,0,0,.05));
  border-color: rgba(0,0,0,.2);
}

.link-btn.is-disabled {
  color: var(--color-muted);
  background: rgba(0,0,0,.03);
}

/* --- Hero video --- */
.hero-video-frame {
  max-width: var(--max-wide);
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.hero-video-frame iframe {
  display: block;
  width: 100%;
  height: 480px; /* fallback until the iframe reports its real content height */
  border: 0;
}

.section-block {
  padding: var(--section-pad) 0;
}

/* Sits directly under the hero teaser, which already reports its own
   real content height (see compare.html's compare-resize postMessage) -
   the full 6rem section-pad on top of that stacks with the hero's own
   bottom padding into a gap that reads too large. Bottom padding is left
   at the default so the gap before the next section (Abstract) is
   unchanged. */
.section-block--tight-top {
  padding-top: 2rem;
}

.lead-paragraph {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  line-height: 1.6;
  text-align: center;
  color: var(--color-text);
}

.section-heading {
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 2rem;
}

.card-panel {
  text-align: justify;
}

.gallery {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.gallery-track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.5rem;
  flex: 1;
}

.gallery-item {
  flex: 0 0 auto;
  width: min(var(--max-text), 100%);
  scroll-snap-align: center;
  margin: 0;
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: auto;
  display: block;
}

.figure-heading {
  font-family: var(--font-sans);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin: 3.5rem 0 0;
}

.figure-heading + .figure-card {
  margin-top: 1.5rem;
}

.figure-caption {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--color-muted);
  text-align: center;
  margin: 0.75rem auto 0;
}

.gallery-item figcaption {
  text-align: center;
  padding: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-muted);
}

.gallery-nav {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text);
}
.gallery-nav:hover { color: var(--color-accent); }

@media (max-width: 640px) {
  .gallery-nav { display: none; }
}

.card-panel + .card-panel,
.figure-card + .card-panel,
.card-panel + .figure-card {
  margin-top: 2rem;
}

.figure-card {
  margin: 2rem 0 0;
}

.figure-card img { width: 100%; height: auto; }

.gif-wrap {
  display: block;
  position: relative;
  cursor: pointer;
}

.gif-hint {
  display: block;
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.figure-card--90 img { width: 90%; margin: 0 auto; display: block; }

.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  margin: 0.1rem 0.15rem;
}

.code-card {
  position: relative;
  background: var(--color-code-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
}

.code-card pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.15);
  background: var(--color-card);
  color: var(--color-text);
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.copy-btn.is-copied { color: var(--color-accent); border-color: var(--color-accent); }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s ease, transform .5s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html { scroll-behavior: auto; }
}
