/* =========================================
   Lucky HDR — Project Page
   ========================================= */

:root {
  --bg:        #0a0a0a;
  --bg-card:   #141410;
  --bg-dark:   #080806;
  --surface:   #1c1a16;
  --border:    #332e26;
  --text:      #f0ece4;
  --text-dim:  #a8a090;
  --accent:    #ee7f2d;       /* Princeton orange */
  --accent2:   #f5a623;       /* warm amber secondary */
  --gold:      #ee7f2d;       /* Princeton orange as highlight */
  --glow:      rgba(238, 127, 45, 0.15);
  --radius:    12px;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 820px; }

.section {
  padding: 100px 0;
  position: relative;
}
.section-dark { background: var(--bg-dark); }

.section-title {
  font-family: var(--font-head);
  font-size: 2.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.section-desc {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 48px;
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ---- Sticky Navbar with Frosted Glass ---- */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 24px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}
#navbar.scrolled {
  border-bottom-color: var(--border);
  background: rgba(10, 10, 10, 0.95);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-logo {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-links {
  display: flex;
  gap: 24px;
}
/* Hamburger button (hidden on desktop) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* ---- Scroll Progress Bar ---- */
.scroll-progress {
  position: fixed;
  top: 56px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  z-index: 101;
  width: 0%;
  transition: width 0.1s linear;
}

/* ---- Fade-in on scroll (staggered) ---- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: calc(var(--delay, 0) * 100ms);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== HERO ========== */
#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 56px; /* navbar height */
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-parallax {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.hero-image-pan {
  position: absolute;
  inset: -10%;
  animation: heroPan 30s ease-in-out infinite alternate;
}
.hero-image-pan img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55) saturate(1.1);
}
@keyframes heroPan {
  0%   { transform: scale(1.15) translate(-2%, -1%); }
  50%  { transform: scale(1.1) translate(1%, 1%); }
  100% { transform: scale(1.15) translate(2%, -0.5%); }
}

/* Ken Burns crossfade slideshow (hero background) */
.hero-slideshow {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  /* 5 slides, each visible for 5s with 1s crossfade -> total cycle 25s */
  animation: heroCrossfade 25s infinite ease-in-out;
  animation-delay: var(--delay, 0s);
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55) saturate(1.1);
  transform: scale(1.1);
  animation: heroKenBurns 10s ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}
@keyframes heroCrossfade {
  0%   { opacity: 0; }
  4%   { opacity: 1; }   /* 1s fade-in */
  20%  { opacity: 1; }   /* hold 4s */
  24%  { opacity: 0; }   /* 1s fade-out */
  100% { opacity: 0; }
}
@keyframes heroKenBurns {
  0%   { transform: scale(1.08) translate(-1.5%, -0.5%); }
  100% { transform: scale(1.15) translate(1.5%, 0.5%); }
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10,10,15,0.3) 0%,
    rgba(10,10,15,0.5) 40%,
    rgba(10,10,15,0.85) 80%,
    rgba(10,10,15,1) 100%
  );
}
.hdr-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 65% 35%, rgba(238,127,45,0.1) 0%, transparent 60%);
  animation: glowPulse 5s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes glowPulse {
  0%   { opacity: 0.4; }
  100% { opacity: 1; }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 850px;
  padding: 0 24px;
}
.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(238,127,45,0.15), rgba(245,166,35,0.15));
  border: 1px solid rgba(238,127,45,0.3);
  color: var(--accent);
  margin-bottom: 24px;
}
#hero h1 {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 3.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ffffff 30%, #ee7f2d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto 28px;
  line-height: 1.65;
}
.hero-authors {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--text);
}
.hero-authors span { white-space: nowrap; }
.hero-authors .author-pair { font-weight: 600; }
.hero-authors a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}
.hero-authors a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.hero-affiliations {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}
.affil-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.institute-logos {
  display: flex;
  gap: 36px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 12px;
}
.inst-logo {
  height: 56px;
  width: auto;
  object-fit: contain;
}
.cofirst {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.hero-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: #f5943a; transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); transform: translateY(-1px); }

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  cursor: pointer;
  text-decoration: none;
}
.scroll-arrow {
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  position: relative;
}
.scroll-arrow::after {
  content: '';
  width: 4px;
  height: 8px;
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollBounce 2s ease-in-out infinite;
}
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  50% { transform: translateX(-50%) translateY(12px); opacity: 0.3; }
}

/* ========== VIDEO SECTION ========== */
.video-container {
  max-width: 800px;
  margin: 0 auto;
}
.video-placeholder {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  cursor: pointer;
  transition: all 0.3s;
}
.video-placeholder:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 40px rgba(238, 127, 45, 0.15);
}
.video-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.5);
}
.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(238, 127, 45, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 4px 24px rgba(238, 127, 45, 0.4);
}
.video-placeholder:hover .play-button {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 8px 40px rgba(238, 127, 45, 0.6);
}
.play-button svg {
  margin-left: 4px;
}
.video-caption {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: var(--text-dim);
  background: rgba(0,0,0,0.6);
  padding: 4px 14px;
  border-radius: 4px;
}

/* ========== STATS STRIP ========== */
#stats {
  padding: 60px 0;
}
.stats-strip {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.stat-item {
  text-align: center;
  min-width: 140px;
}
.stat-number {
  font-family: var(--font-head);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  display: inline;
}
.stat-suffix {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent2);
  margin-left: 2px;
}
.stat-label {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ========== MERGE DEMO ========== */
.merge-demo {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 24px 32px;
  flex-wrap: nowrap;
}
.merge-demo-inputs-wrap {
  flex: 0 0 auto;
  max-width: min(400px, 100%);
}
/* Input thumbnails: exactly 3 per row; extra frames wrap to the next row. */
.merge-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(380px, 100%);
}
.merge-inputs .merge-frame {
  width: auto;
  height: auto;
  min-width: 0;
  aspect-ratio: 4 / 3;
}
.merge-frame {
  position: relative;
  width: 200px;
  height: 150px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: default;
  transition: all 0.4s ease;
  opacity: 0.5;
  transform: scale(0.92);
}
.merge-scene-selector {
  margin-bottom: 20px !important;
}
.merge-scene-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.merge-scene-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(238,127,45,0.1);
}
.merge-scene-btn:hover { border-color: var(--accent); }
.merge-frame.selected {
  opacity: 1;
  transform: scale(1);
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(238,127,45,0.2);
}
.merge-frame:not(.selected):hover {
  opacity: 0.75;
  border-color: var(--text-dim);
}
.merge-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.merge-frame-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: rgba(0,0,0,0.7);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}
.merge-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.merge-frame.selected .merge-check {
  display: flex;
}
.merge-arrow {
  color: var(--text-dim);
  flex-shrink: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 -6px;
}
.merge-arrow svg {
  display: block;
}
.merge-demo-output-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  width: min(620px, 52vw);
  max-width: 680px;
  min-width: 260px;
}
.merge-result {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 40px rgba(238,127,45,0.2);
  transition: box-shadow 0.4s ease;
}
.merge-result img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}
.merge-result-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  background: rgba(0,0,0,0.8);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  transition: all 0.3s;
}
.hdr-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.06) 45%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.06) 55%,
    transparent 60%
  );
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

.merge-info {
  text-align: center;
  margin-top: 12px;
  min-height: 28px;
  width: 100%;
}
#mergeCaption {
  color: var(--text-dim);
  font-size: 0.95rem;
  transition: opacity 0.3s;
}
.merge-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.merge-reset-btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.merge-reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== METHOD ========== */
#method::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(238,127,45,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.method-image {
  margin: 0 -24px 48px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-dark);
  border: none;
  padding: 0;
  position: relative;
}
.pan-container {
  overflow: hidden;
  cursor: grab;
  position: relative;
}
.pan-container:active { cursor: grabbing; }
.pan-container img {
  width: 100%;
  display: block;
  transition: transform 0.1s ease-out;
}
.method-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.3s;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(238,127,45,0.08);
}
.feature-icon {
  color: var(--accent);
  margin-bottom: 16px;
}
.feature-card h3 {
  font-family: var(--font-head);
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.feature-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ========== VISUALIZATIONS ========== */
.explainer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.explainer-card {
  background: var(--card-bg, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.explainer-card h3 {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.explainer-card p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 10px;
}
.explainer-card p:last-child { margin-bottom: 0; }
.explainer-card .explainer-viz-hint {
  font-size: 0.85rem;
  color: var(--text-muted, rgba(255,255,255,0.55));
  font-style: italic;
}
.explainer-card em { font-style: italic; color: var(--text); }
.explainer-card strong { font-weight: 600; color: var(--accent); }
@media (max-width: 768px) {
  .explainer-grid { grid-template-columns: 1fr; }
}

.vis-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.vis-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s;
}
.vis-card:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}
.vis-card img {
  width: 100%;
  display: block;
}
.vis-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

/* ========== COMPARISONS ========== */
#comparisons::before {
  content: '';
  position: absolute;
  bottom: -100px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(238,127,45,0.03) 0%, transparent 70%);
  pointer-events: none;
}

.scene-selector, .method-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.scene-btn, .method-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.scene-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(238,127,45,0.1);
}
.method-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(238,127,45,0.1);
}
.scene-btn:hover, .method-btn:hover { border-color: var(--accent); }

.comparison-container {
  margin-top: 24px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.comparison-slider {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  aspect-ratio: 3/4;
}
.comp-image {
  position: absolute;
  inset: 0;
}
.comp-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.25s ease;
}
.comp-left {
  clip-path: inset(0 50% 0 0);
  z-index: 1;
}
.comp-label {
  position: absolute;
  bottom: 16px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 10;
  pointer-events: none;
}
.comp-label-left {
  left: 16px;
  background: rgba(0,0,0,0.7);
  color: var(--text-dim);
}
.comp-label-right {
  right: 16px;
  background: rgba(238,127,45,0.2);
  color: var(--gold);
  border: 1px solid rgba(238,127,45,0.3);
}
.comp-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}
.comp-handle-line {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.7);
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
}
.comp-handle-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  color: #333;
}

/* ========== ZOOM CROP INSET ========== */
.zoom-controls {
  text-align: center;
  margin-top: 16px;
}
.zoom-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.zoom-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(238,127,45,0.1);
}
.zoom-btn:hover { border-color: var(--accent); }

.zoom-inset {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 260px;
  height: 260px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  overflow: hidden;
  z-index: 5;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7);
  pointer-events: none;
}
.zoom-inset.active { display: flex; }
.zoom-left, .zoom-right {
  width: 50%;
  height: 100%;
  background-size: 600%;
  background-position: 50% 50%;
  background-repeat: no-repeat;
}
.zoom-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: white;
  transform: translateX(-50%);
}
.zoom-label-left, .zoom-label-right {
  position: absolute;
  bottom: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0,0,0,0.7);
  z-index: 6;
}
.zoom-label-left { left: 6px; color: var(--text-dim); }
.zoom-label-right { right: 6px; color: var(--accent); }

/* Side-by-side comparison sliders (3 in a row) */
.comp-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px auto 0;
}
.comp-row {
  position: relative;
}
.comp-scene-label {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Single large slider (one scene at a time, switched via scene tabs) */
.comp-single {
  margin: 24px auto 0;
  max-width: min(1100px, 100%);
  display: flex;
  justify-content: center;
}
/* Fits in the viewport: max height 90vh, max width 100vw — whichever is tighter (4:3). */
.comp-single .comparison-slider {
  aspect-ratio: 4 / 3;
  width: min(100%, 100vw, calc(85vh * 4 / 3));
  max-height: 85vh;
}

/* ========== QUANTITATIVE TABLE ========== */
.table-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.table-tab {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.table-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(238,127,45,0.1);
}
.table-tab:hover { border-color: var(--accent); }
.table-panel { display: none; }
.table-panel.active { display: block; }
.table-wrapper {
  overflow-x: auto;
  max-width: 900px;
  margin: 0 auto;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.results-table th, .results-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.results-table th {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.results-table td:first-child {
  text-align: left;
  font-weight: 500;
}
.results-table tbody tr:not(.highlight-row):hover {
  background: rgba(255,255,255,0.04);
}
.highlight-row {
  background: rgba(238,127,45,0.06);
}
.highlight-row td {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.dim-row td {
  opacity: 0.5;
  font-style: italic;
}
.table-caption {
  text-align: center;
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 0.8rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ========== GALLERY ========== */
.rwg-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 18px;
}
.rwg-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.rwg-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,179,237,0.15);
}
.rwg-scene-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 90px;
  text-align: center;
}

/* Body: column — top row then inner row */
.rwg-body {
  --rwg-cell: 20vh;
  --rwg-gap: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rwg-gap);
}

/* Top row: 5 equal square cells */
.rwg-top-crops {
  display: flex;
  gap: var(--rwg-gap);
}

/* Shared square cell — used by both top and left items */
.rwg-crop-cell {
  width: var(--rwg-cell);
  height: var(--rwg-cell);
  flex-shrink: 0;
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.rwg-crop-cell.is-ours {
  border-color: var(--accent);
}
.rwg-crop-cell canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.rwg-crop-cell .rwg-crop-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 6px 4px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.rwg-crop-cell.is-ours .rwg-crop-label {
  color: var(--accent);
}

/* Inner row: left column + main image */
.rwg-inner-row {
  display: flex;
  gap: var(--rwg-gap);
  align-items: flex-start;
}
.rwg-left-crops {
  width: var(--rwg-cell);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--rwg-gap);
}

/* Main image */
.rwg-main-wrap {
  min-width: 0;
}
.rwg-img-container {
  position: relative;
  cursor: move;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  /* Fixed height = 3 cells + 2 gaps */
  height: calc(3 * var(--rwg-cell) + 2 * var(--rwg-gap));
  background: #000;
}
.rwg-img-container img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.rwg-selector {
  position: absolute;
  border: 3px solid var(--accent2);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.08);
  background: rgba(99,179,237,0.07);
  cursor: move;
  display: none;
}
.rwg-selector.visible {
  display: block;
}
/* Main image label — same overlay as crop cells */
.rwg-img-container .rwg-crop-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 6px 4px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.95);
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.active {
  opacity: 1;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  transition: transform 0.3s ease;
}
.lightbox.active .lightbox-content img {
  animation: lightboxIn 0.3s ease forwards;
}
@keyframes lightboxIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 1.6rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1001;
}
.lightbox-content {
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
}


/* ========== ABSTRACT ========== */
.abstract-text p {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.abstract-text em {
  color: var(--accent);
  font-style: italic;
}

/* ========== BIBTEX ========== */
.bibtex-block {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow-x: auto;
}
.bibtex-block pre {
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-dim);
}
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== FOOTER ========== */
footer {
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--border);
}
footer p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent); }

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-image-pan { animation: none; }
  .hdr-glow { animation: none; }
  .hdr-shimmer { animation: none; }
  .fade-in { opacity: 1; transform: none; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .section { padding: 60px 0; }
  .section-title { font-size: 1.8rem; }
  .section-desc { font-size: 0.95rem; }

  /* Hamburger menu at 768px */
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 24px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 0.95rem; padding: 8px 0; }

  .merge-demo {
    flex-direction: column;
    flex-wrap: wrap;
  }
  .merge-demo-inputs-wrap {
    max-width: 100%;
  }
  .merge-inputs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(380px, 100%);
    margin-left: auto;
    margin-right: auto;
  }
  .merge-frame { width: auto; height: auto; min-height: 0; }
  .merge-demo-output-wrap {
    width: min(100%, 420px);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .merge-arrow { transform: rotate(90deg); }

  .stats-strip { gap: 24px; }
  .stat-number { font-size: 2.2rem; }

  .vis-grid { grid-template-columns: repeat(2, 1fr); }

  .comparison-slider { max-width: 100%; }
  .comp-stack { grid-template-columns: 1fr; max-width: 400px; }

  .zoom-inset { width: 140px; height: 140px; }

  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .hero-authors { font-size: 0.9rem; }
  .hero-links { flex-direction: column; align-items: center; }
  .vis-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .stats-strip { gap: 16px; }
  .stat-item { min-width: 100px; }
}
