/* ===========================================
   Project Page — Transferable RL (ICML 2026)
   Custom modern styling on top of clean base
   =========================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #fafbff;
  --bg-section: #ffffff;
  --bg-soft: #f4f6fb;
  --ink: #1a1f36;
  --ink-soft: #4a5275;
  --ink-muted: #7a8299;
  --accent: #4b6cff;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --card-border: rgba(75, 108, 255, 0.08);
  --card-shadow: 0 1px 3px rgba(26, 31, 54, 0.04), 0 4px 16px rgba(26, 31, 54, 0.04);
  --card-shadow-hover: 0 4px 12px rgba(75, 108, 255, 0.08), 0 12px 32px rgba(26, 31, 54, 0.08);
  --radius: 14px;
  --radius-sm: 8px;
  --max-w: 1080px;
}

[data-theme="dark"] {
  --bg: #0e1220;
  --bg-section: #151a2e;
  --bg-soft: #1a2038;
  --ink: #e8ecf7;
  --ink-soft: #b8bfd3;
  --ink-muted: #8089a8;
  --card-border: rgba(139, 92, 246, 0.15);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.25);
  --card-shadow-hover: 0 4px 12px rgba(139, 92, 246, 0.2), 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

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

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-2); }

/* ---------- Layout container ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 64px 0;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 1000;
  transition: transform 0.25s, box-shadow 0.25s;
  color: var(--ink);
}
.theme-toggle:hover { transform: scale(1.08); box-shadow: var(--card-shadow-hover); }

/* ===========================================
   HERO section
   =========================================== */
.hero {
  position: relative;
  padding: 100px 24px 80px;
  background:
    radial-gradient(circle at 20% 20%, rgba(75, 108, 255, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  overflow: hidden;
  text-align: center;
}

[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(75, 108, 255, 0.22) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(139, 92, 246, 0.20) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(6, 182, 212, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

/* Floating decorative blobs */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  animation: float 12s ease-in-out infinite;
}
.blob-1 { width: 320px; height: 320px; background: var(--accent); top: -80px; left: -80px; }
.blob-2 { width: 260px; height: 260px; background: var(--accent-2); top: 20%; right: -60px; animation-delay: -4s; }
.blob-3 { width: 200px; height: 200px; background: var(--accent-3); bottom: -50px; left: 40%; animation-delay: -8s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 25px) scale(0.95); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 100px;
  margin-bottom: 24px;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(75, 108, 255, 0.25);
  position: relative;
  animation: venue-pulse 3.6s ease-in-out infinite;
}
@keyframes venue-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(75, 108, 255, 0.25),
                         0 0 0 0 rgba(139, 92, 246, 0.35); }
  50%      { box-shadow: 0 6px 18px rgba(75, 108, 255, 0.35),
                         0 0 0 8px rgba(139, 92, 246, 0); }
}
.venue-badge .venue-logo {
  height: 26px;
  width: 26px;
  display: block;
  background: #1a1f36;        /* dark tile so the official ICML logo's white figure is visible */
  border-radius: 7px;
  padding: 3px;
  box-sizing: border-box;
}
.venue-badge::before {
  content: '';
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.4);
  margin: 0 6px 0 8px;
  order: 1;
}
.venue-badge .venue-logo { order: 0; margin-left: 2px; }
.venue-badge span { order: 2; }

/* Affiliation row with mini logo */
.affiliations {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.affiliations .aff-logo {
  width: 22px;
  height: 22px;
  display: block;
}

.hero h1 {
  font-family: 'Source Serif Pro', 'Georgia', serif;
  font-size: clamp(28px, 4.2vw, 46px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 28px;
  color: var(--ink);
  background: linear-gradient(
    120deg,
    var(--ink) 0%,
    var(--accent) 35%,
    var(--accent-2) 60%,
    var(--accent-3) 85%,
    var(--ink) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: title-shimmer 12s ease-in-out infinite;
}
[data-theme="dark"] .hero h1 {
  background: linear-gradient(
    120deg,
    #e8ecf7 0%,
    #a5b8ff 35%,
    #c4b5fd 60%,
    #7dd3fc 85%,
    #e8ecf7 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes title-shimmer {
  0%, 100% { background-position: 0% center; }
  50%      { background-position: 100% center; }
}

.authors {
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 500;
}
.authors sup { font-size: 12px; color: var(--accent); margin: 0 2px; }
.affiliations {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 36px;
  line-height: 1.6;
}
.affiliations sup { color: var(--accent); margin-right: 4px; }

/* Badge buttons */
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--bg-section);
  color: var(--ink);
  border: 1px solid var(--card-border);
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(26, 31, 54, 0.04);
}
.badge:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 24px rgba(75, 108, 255, 0.18);
  border-color: var(--accent);
  color: var(--accent);
}
.badge svg, .badge i { font-size: 16px; }

.badge-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===========================================
   Generic section title
   =========================================== */
.section-title {
  font-family: 'Source Serif Pro', 'Georgia', serif;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.section-subtitle {
  text-align: center;
  color: var(--ink-muted);
  font-size: 15px;
  margin-bottom: 40px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===========================================
   Card wrapper
   =========================================== */
.card {
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

/* ===========================================
   Teaser
   =========================================== */
.teaser-section {
  padding: 30px 0 50px;
}
.teaser-img {
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  cursor: zoom-in;
  transition: transform 0.3s, box-shadow 0.3s;
  background: var(--bg-section);
  display: block;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  /* Native (smooth) image rendering — crisp-edges/pixelated only suits pixel art */
  image-rendering: auto;
}
.teaser-img:hover { transform: scale(1.01); box-shadow: var(--card-shadow-hover); }
.figure-caption {
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
  line-height: 1.6;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.figure-caption.justify {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* ===========================================
   Key Insight highlight box
   =========================================== */
.insight-box {
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.05), rgba(139, 92, 246, 0.05));
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px 36px;
  margin: 0 auto;
  max-width: 900px;
  animation: insight-pulse 4s ease-in-out infinite;
}
@keyframes insight-pulse {
  0%, 100% { box-shadow: 0 1px 3px rgba(75, 108, 255, 0.10),
                         0 0 0 0 rgba(139, 92, 246, 0.18); }
  50%      { box-shadow: 0 6px 18px rgba(75, 108, 255, 0.15),
                         0 0 0 10px rgba(139, 92, 246, 0); }
}
[data-theme="dark"] .insight-box {
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.12), rgba(139, 92, 246, 0.12));
}
.insight-box .label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.insight-box ul {
  list-style: none;
  padding: 0;
}
.insight-box li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-size: 16px;
}
.insight-box li:last-child { margin-bottom: 0; }
.insight-box li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 6px rgba(75, 108, 255, 0.3);
}

/* ===========================================
   Abstract / Method / Results body text
   =========================================== */
.prose {
  max-width: 820px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.8;
  text-align: justify;
}
.prose p { margin-bottom: 16px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); }

/* ===========================================
   Video embed (16:9 responsive)
   =========================================== */
.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #000;
}
.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===========================================
   Method / Results figures
   =========================================== */
.figure-block {
  max-width: 960px;
  margin: 0 auto 32px;
}
.figure-block img {
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  cursor: zoom-in;
  transition: transform 0.3s, box-shadow 0.3s;
  background: var(--bg-section);
}
.figure-block img:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

/* ===========================================
   BibTeX section
   =========================================== */
.bibtex-section { background: var(--bg-soft); }

.bibtex-wrapper {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  background: #1a1f36;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.bibtex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.bibtex-header span {
  color: #8b9bbd;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(75, 108, 255, 0.2);
  color: #a5b8ff;
  border: 1px solid rgba(75, 108, 255, 0.3);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.copy-btn:hover { background: rgba(75, 108, 255, 0.35); color: white; }
.copy-btn.copied { background: rgba(34, 197, 94, 0.3); color: #86efac; border-color: rgba(34, 197, 94, 0.4); }

.bibtex-code {
  padding: 24px;
  color: #e8ecf7;
  font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  text-align: left;
}

/* ===========================================
   Footer
   =========================================== */
footer {
  background: var(--bg-section);
  border-top: 1px solid var(--card-border);
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.8;
}
footer a { color: var(--accent); }

/* ----- Page stats (counter + map) ----- */
.page-stats {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px dashed var(--card-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
}
.stats-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}
.stats-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
#visitCounter { height: 28px; width: auto; display: block; }
.map-placeholder {
  width: 280px;
  padding: 28px 18px;
  border: 1px dashed var(--card-border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
  line-height: 1.6;
  background: var(--bg-soft);
}
.map-placeholder a { color: var(--accent); }

/* ===========================================
   Scroll-triggered animations.
   Simple, robust: opacity + translate, transition-based.
   Gated by .js class so without JS everything is visible.
   =========================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1 !important; transform: none !important; }
}

/* ===========================================
   Scene cards (task environment images, equal heights)
   =========================================== */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 1000px;
  margin: 0 auto;
}
.scene-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  position: relative;
}
.scene-card:hover {
  box-shadow: var(--card-shadow-hover);
}
.scene-img-wrap {
  width: 100%;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--bg-soft), transparent);
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow: hidden;
}
.scene-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  border-radius: 6px;
  transition: transform 0.4s ease;
}
.scene-card:hover .scene-img-wrap img { transform: scale(1.025); }

.scene-card figcaption {
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  text-align: left;
}
.task-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 10px;
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.12), rgba(139, 92, 246, 0.12));
  color: var(--accent);
  border-radius: 100px;
  font-weight: 700;
  font-size: 13px;
  vertical-align: middle;
}
[data-theme="dark"] .task-tag {
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.22), rgba(139, 92, 246, 0.22));
  color: #c4b5fd;
}

/* Analysis grid (Figure 3 left vs Figure 4 right) — enlarged for legibility */
.analysis-grid { max-width: 1200px; gap: 28px; }
.analysis-grid .figure-grid-item { display: flex; flex-direction: column; padding: 22px; }

.analysis-grid .stacked-imgs {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.analysis-grid .stacked-imgs img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
}

.analysis-grid .single-img {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.analysis-grid .single-img img {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
}

/* ===========================================
   Cursor spotlight (subtle radial follow)
   =========================================== */
/* ===========================================
   Pointer-follow effects.
   - Light mode: a small ring + dot follows the cursor (doesn't overlap text).
   - Dark mode: a large soft spotlight gradient (more atmospheric on dark bg).
   They never coexist — CSS gates each by theme.
   =========================================== */

/* Spotlight — dark mode only (light mode has no background tint at all) */
.cursor-spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
[data-theme="dark"] .cursor-spotlight.active { opacity: 1; }
[data-theme="dark"] .cursor-spotlight {
  background: radial-gradient(
    500px circle at var(--mx, 50%) var(--my, 50%),
    rgba(139, 92, 246, 0.22) 0%,
    rgba(75, 108, 255, 0.12) 30%,
    transparent 65%
  );
}

/* Ring + dot — light mode only */
.cursor-ring, .cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9998;
  border-radius: 50%;
  transform: translate3d(var(--rx, 0px), var(--ry, 0px), 0) translate(-50%, -50%);
  will-change: transform;
  opacity: 0;
  transition: opacity 0.25s ease,
              width 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.25s ease,
              border-color 0.25s ease;
}
.cursor-ring {
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(75, 108, 255, 0.7);
  background: rgba(75, 108, 255, 0.02);
}
.cursor-dot {
  width: 5px;
  height: 5px;
  background: var(--accent);
  transition: opacity 0.25s ease;
}
.cursor-ring.active, .cursor-dot.active { opacity: 1; }

/* Ring expands and fills softly when hovering interactive targets */
.cursor-ring.hovering {
  width: 52px;
  height: 52px;
  background: rgba(75, 108, 255, 0.12);
  border-color: rgba(139, 92, 246, 0.7);
}

/* Hide ring/dot in dark mode (spotlight takes over) */
[data-theme="dark"] .cursor-ring,
[data-theme="dark"] .cursor-dot { display: none; }

/* Touch devices skip everything */
@media (hover: none) {
  .cursor-spotlight,
  .cursor-ring,
  .cursor-dot { display: none; }
}

/* ===========================================
   3D tilt cards (set transform via JS)
   =========================================== */
.tilt-card {
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(0) rotateY(0) translateZ(0);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.tilt-card.tilting { transition: transform 0.08s linear, box-shadow 0.3s ease; }

/* Shine layer that follows cursor across tilt cards */
.tilt-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    260px circle at var(--cx, 50%) var(--cy, 50%),
    rgba(255, 255, 255, 0.18),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: soft-light;
}
.tilt-card:hover::after { opacity: 1; }

/* ===========================================
   Magnetic / glowing badges
   =========================================== */
.badge {
  position: relative;
  overflow: hidden;
  will-change: transform;
}
.badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    120px circle at var(--bx, 50%) var(--by, 50%),
    rgba(75, 108, 255, 0.25),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.badge:hover::before { opacity: 1; }

/* ===========================================
   Scroll progress bar (top)
   =========================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  z-index: 9999;
  transition: width 0.05s linear;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(75, 108, 255, 0.4);
}

/* ===========================================
   Scroll-down chevron indicator (bottom of hero)
   =========================================== */
.scroll-indicator {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  color: var(--ink-muted);
  opacity: 0.55;
  cursor: pointer;
  animation: chevron-bounce 2s ease-in-out infinite;
  z-index: 2;
  user-select: none;
  transition: opacity 0.25s, color 0.25s;
}
.scroll-indicator:hover { opacity: 1; color: var(--accent); }
@keyframes chevron-bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 8px); }
}

/* ===========================================
   Animated underline for author links
   =========================================== */
.authors a {
  position: relative;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  transition: color 0.2s;
}
.authors a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 2px;
}
.authors a:hover { color: var(--accent); }
.authors a:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* ===========================================
   Section "halo" — soft floating orb behind section titles
   (No blur filter — uses a wider gradient stop for the same visual effect
   at a fraction of the rendering cost.)
   =========================================== */
section { position: relative; }
.section-title {
  position: relative;
  z-index: 1;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(75, 108, 255, 0.16) 0%,
    rgba(139, 92, 246, 0.10) 35%,
    transparent 75%
  );
  transform: translate(-50%, -50%);
  z-index: -1;
  pointer-events: none;
}
[data-theme="dark"] .section-title::before {
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.30) 0%,
    rgba(75, 108, 255, 0.20) 35%,
    transparent 75%
  );
}

/* ===========================================
   Confetti for BibTeX copy (JS appends pieces)
   =========================================== */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.9;
  will-change: transform, opacity;
}
@keyframes confetti-fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0.95; }
  100% { transform: translate(var(--dx, 0), var(--dy, 120px)) rotate(var(--rot, 360deg)); opacity: 0; }
}

/* ===========================================
   Soft 4-side halo on scene / figure-grid cards (hover)
   Uses box-shadow instead of a blurred pseudo-element so the glow
   wraps evenly around all sides without leaking into a diagonal band.
   =========================================== */
.scene-card, .figure-grid-item {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.scene-card:hover, .figure-grid-item:hover {
  box-shadow:
    0 4px 16px rgba(26, 31, 54, 0.06),
    0 0 0 1px rgba(75, 108, 255, 0.22),
    0 0 28px rgba(75, 108, 255, 0.18),
    0 0 60px rgba(139, 92, 246, 0.12);
}
[data-theme="dark"] .scene-card:hover,
[data-theme="dark"] .figure-grid-item:hover {
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(139, 92, 246, 0.35),
    0 0 28px rgba(139, 92, 246, 0.28),
    0 0 60px rgba(75, 108, 255, 0.20);
}

/* ===========================================
   Key Innovations: animated bullet markers
   =========================================== */
.insight-box li::before {
  animation: bullet-pulse 3.6s ease-in-out infinite;
}
.insight-box li:nth-child(2)::before { animation-delay: 0.6s; }
.insight-box li:nth-child(3)::before { animation-delay: 1.2s; }
@keyframes bullet-pulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(75, 108, 255, 0.3),
                         0 0 0 0 rgba(75, 108, 255, 0.4); }
  50%      { box-shadow: 0 2px 8px rgba(75, 108, 255, 0.5),
                         0 0 0 6px rgba(75, 108, 255, 0); }
}

/* ===========================================
   Image lightbox
   =========================================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

/* ===========================================
   Subsection title (h3) inside a section
   =========================================== */
.subsection-title {
  font-family: 'Source Serif Pro', 'Georgia', serif;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 22px;
  color: var(--ink);
  letter-spacing: -0.005em;
}

/* ===========================================
   Local <video> element (uses .video-wrapper sizing)
   =========================================== */
.video-wrapper.local-video { padding-bottom: 56.25%; }
.video-wrapper.local-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ===========================================
   Results table with hover preview
   =========================================== */
.table-wrapper {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
}

.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  font-size: 15px;
}

.results-table thead {
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.08), rgba(139, 92, 246, 0.08));
}
[data-theme="dark"] .results-table thead {
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.18), rgba(139, 92, 246, 0.18));
}

.results-table th {
  padding: 14px 18px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  border-bottom: 2px solid var(--card-border);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.results-table td {
  padding: 14px 18px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--card-border);
}

.results-table tbody tr:last-child td { border-bottom: 0; }

.task-cell {
  font-weight: 700;
  color: var(--accent);
  background: rgba(75, 108, 255, 0.04);
  vertical-align: middle;
  font-size: 15px;
}
[data-theme="dark"] .task-cell { background: rgba(75, 108, 255, 0.10); }

.task-row { cursor: pointer; transition: background 0.18s; }
.task-row:hover {
  background: rgba(75, 108, 255, 0.06);
}
[data-theme="dark"] .task-row:hover { background: rgba(75, 108, 255, 0.12); }

.phase-cell {
  font-weight: 600;
  color: var(--ink);
  background: rgba(75, 108, 255, 0.02);
  vertical-align: middle;
  white-space: nowrap;
}
[data-theme="dark"] .phase-cell { background: rgba(75, 108, 255, 0.06); }

/* Visual separator between Train and Deploy rows */
.deploy-row:first-of-type td { border-top: 2px solid var(--card-border); }

/* Best-in-row highlighting (bold + soft tint) */
.results-table td.best {
  font-weight: 700;
  color: var(--accent);
  background: rgba(75, 108, 255, 0.08);
}
[data-theme="dark"] .results-table td.best {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
}

/* Table caption (above the table) */
.table-caption {
  text-align: center;
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 18px;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.table-caption em { color: var(--ink-soft); }

/* Numeric cells use tabular-nums for clean column alignment */
.results-table tbody td:not(.task-cell):not(.phase-cell) {
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  text-align: right;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

/* Floating preview that follows the row */
.table-preview {
  position: fixed;
  z-index: 800;
  display: none;
  pointer-events: none;
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 36px rgba(26, 31, 54, 0.25);
  padding: 10px;
  max-width: 380px;
  transition: opacity 0.18s;
}
.table-preview.active { display: block; }
.table-preview img {
  max-width: 360px;
  max-height: 240px;
  width: auto;
  height: auto;
  border-radius: 6px;
  display: block;
}
.table-preview-label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

/* ===========================================
   Side-by-side figure grid (Figure 3 + Figure 4)
   =========================================== */
.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.figure-grid-item {
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--card-shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}
.figure-grid-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}
.figure-grid-item img {
  width: 100%;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
  background: var(--bg-soft);
}
.figure-grid-item figcaption {
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  text-align: left;
}

/* Vertically stacked images within one figure-grid-item */
.stacked-imgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stacked-imgs img { display: block; }

/* Section reference inline tag — fixes (Section 4.1) overlap by
   using plain (non-italic) styling with a subtle color */
.sec-ref {
  font-style: normal;
  font-size: 0.92em;
  color: var(--ink-muted);
  font-weight: 500;
  white-space: nowrap;
}
.sec-ref::before { content: ' '; }

/* Small caps for task names like PointGoal2 */
.smallcaps {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* ===========================================
   Modal (Paper not available / Code coming soon)
   =========================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 38, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card {
  background: var(--bg-section);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 36px 36px 30px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(15, 20, 38, 0.35);
  position: relative;
  animation: popIn 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--ink-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--bg-soft); color: var(--ink); }

.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(75, 108, 255, 0.15), rgba(139, 92, 246, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
}

.modal-card h3 {
  font-family: 'Source Serif Pro', 'Georgia', serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--ink);
}
.modal-card p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 12px;
}
.modal-sub {
  font-size: 13px !important;
  color: var(--ink-muted) !important;
  margin-bottom: 22px !important;
}

.modal-action {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: 0;
  padding: 10px 28px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.modal-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(75, 108, 255, 0.3);
}

/* Make .badge work as a <button> too */
button.badge {
  font-family: inherit;
  background: var(--bg-section);
  color: var(--ink);
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
  section { padding: 48px 0; }
  .hero { padding: 80px 20px 60px; }
  .hero h1 { font-size: 26px; }
  .authors { font-size: 16px; }
  .section-title { font-size: 24px; }
  .subsection-title { font-size: 18px; }
  .card { padding: 24px 20px; }
  .insight-box { padding: 24px 22px; }
  .badges { gap: 8px; }
  .badge { padding: 9px 16px; font-size: 14px; }
  .bibtex-code { font-size: 12px; padding: 18px; }
  .blob-1 { width: 200px; height: 200px; }
  .blob-2 { width: 160px; height: 160px; }
  .theme-toggle { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 16px; }
  .figure-grid { grid-template-columns: 1fr; gap: 18px; }
  .results-table { font-size: 13px; }
  .results-table th, .results-table td { padding: 10px 10px; }
  .table-preview { display: none !important; }  /* skip popover on touch devices */
  .modal-card { padding: 28px 22px 24px; }
}
