/* Q2RL Research Website Styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #7c3aed;
  --text: #111827;
  --text-muted: #6b7280;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-dark: #0f172a;
  --border: #e5e7eb;
  --section-gap: 5rem;
  --card-radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
p { color: var(--text); }

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

/* ── Layout ── */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--wide {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section { padding: var(--section-gap) 0; }
section:nth-child(even) { background: var(--bg-alt); }

#results {
  background: var(--bg);
  padding-bottom: 0rem;
}

#citation {
  background: var(--bg-alt);
  padding-top: 2.5rem;
}

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.6rem;
}

.section-title {
  margin-bottom: 0.8rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  /* max-width: 680px; */
  margin-bottom: 2.5rem;
}

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}
.nav-brand span { color: var(--primary); }
.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
}
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); text-decoration: none; }

/* ── Hero ── */
#hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  color: white;
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(37,99,235,0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(124,58,237,0.2) 0%, transparent 60%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 1.5rem;
}
.venue-badge .dot {
  width: 6px; height: 6px;
  background: #34d399;
  border-radius: 50%;
}
.hero-title {
  color: white;
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  /* max-width: 900px; */
  margin-bottom: 0.9rem;
  line-height: 1.25;
}
.hero-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 2rem;
}
.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  margin-bottom: 0.45rem;
  justify-content: center;
  max-width: 780px;
}
.author {
  font-size: 1.08rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  white-space: nowrap;
}
.author sup { color: #93c5fd; font-size: 0.72rem; }
.affiliations-row {
  gap: 0.35rem 1.4rem;
  margin-bottom: 1rem;
}
.affiliations-row .author {
  font-size: 1rem;
  color: rgba(255,255,255,0.78);
  font-weight: 500;
}
.affiliations-row .author sup {
  font-size: 0.75rem;
}
.affiliations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 2rem;
  color: rgba(255,255,255,0.55);
  font-size: 0.875rem;
  justify-content: center;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.35rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: white; }
.btn-outline {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
}
.btn-outline:hover { background: rgba(255,255,255,0.18); text-decoration: none; color: white; }
.btn-dark {
  background: var(--text);
  color: white;
}
.btn-dark:hover { background: #374151; text-decoration: none; color: white; }

/* ── Teaser Video ── */
#teaser {
  padding: 0;
  margin-top: -1px;
}
.teaser-wrap {
  background: var(--bg-dark);
  padding: 2.5rem 0;
}
.teaser-video-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #1a1a2e;
  box-shadow: var(--shadow-lg);
}
.video-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--card-radius);
  color: rgba(255,255,255,0.5);
  gap: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.video-placeholder:hover { border-color: rgba(255,255,255,0.35); }
.video-placeholder svg { opacity: 0.6; }
.video-placeholder p { font-size: 0.875rem; }
video {
  width: 100%;
  border-radius: var(--card-radius);
  display: block;
}
.teaser-caption {
  text-align: center;
  color: rgba(255,255,255,0.55);
  font-size: 0.875rem;
  margin-top: 1rem;
  font-style: italic;
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}
.stat-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  text-align: center;
}
.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ── Abstract ── */
.abstract-text {
  font-size: 1.1rem;
  line-height: 1.9;
  color: #374151;
  max-width: 760px;
  margin: 0 auto;
  text-align: left;
}

/* ── Method ── */
.method-phases {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2.5rem;
}
@media (max-width: 768px) {
  .method-phases { grid-template-columns: 1fr; }
}
.phase-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.phase-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.phase-card.phase-1::before { background: linear-gradient(90deg, var(--primary), #60a5fa); }
.phase-card.phase-2::before { background: linear-gradient(90deg, var(--accent), #a78bfa); }
.phase-number {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.phase-1 .phase-number { color: var(--primary); }
.phase-2 .phase-number { color: var(--accent); }
.phase-title { font-size: 1.3rem; margin-bottom: 0.75rem; }
.phase-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.7; }
.equation-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 1rem;
  overflow-x: auto;
}
.phase-video {
  margin-top: 1.25rem;
  border-radius: 8px;
  overflow: hidden;
}
.phase-video .video-placeholder {
  aspect-ratio: 4/3;
  border-radius: 8px;
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #cbd5e1;
}

/* ── Overview Figure ── */
.figure-container {
  text-align: center;
  margin: 2rem 0;
}
.figure-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.figure-caption {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1rem;
  font-style: italic;
  text-align: left;
  line-height: 1.6;
}

/* ── Algorithm Box ── */
.algorithm-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--card-radius);
  padding: 1.75rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  overflow-x: auto;
  margin: 2rem 0;
}
.algo-title {
  color: #60a5fa;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}
.algo-comment { color: #64748b; }
.algo-keyword { color: #f472b6; }
.algo-phase { color: #34d399; }
.algo-indent { padding-left: 2rem; }
.algo-indent-2 { padding-left: 4rem; }

/* ── Video Grid ── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.video-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.video-card-media {
  background: #0f172a;
  aspect-ratio: 16/9;
}
.video-card-media .video-placeholder {
  border-radius: 0;
  border: none;
}
.video-card-body { padding: 1.25rem; }
.video-card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.video-card-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

/* ── Comparison ── */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}
@media (max-width: 640px) {
  .comparison-grid { grid-template-columns: 1fr; }
}

/* 4-col grid for baselines row */
.comparison-grid--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 900px) {
  .comparison-grid--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .comparison-grid--4 { grid-template-columns: 1fr; }
}

/* 3-col grid for baselines row */
.comparison-grid--3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 900px) {
  .comparison-grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .comparison-grid--3 { grid-template-columns: 1fr; }
}

/* Featured Q2RL card (sits above the baselines row) */
.comparison-featured {
  margin-top: 2rem;
  margin-bottom: 0;
}
.comparison-featured .comparison-card {
  max-width: 640px;
}
.comparison-featured .comparison-media {
  aspect-ratio: 16/9;
}

/* BC Policy card style (neutral gray) */
.comparison-card.bc {
  border-color: #9ca3af;
}
.bc .comparison-header {
  background: #f3f4f6;
  color: #374151;
}
.comparison-card {
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: var(--shadow);
}
.comparison-card--single {
  width: min(50%, 640px);
}
.comparison-card.ours { border-color: #10b981; }
.comparison-card.baseline { border-color: #f59e0b; }
.comparison-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
}
.comparison-card.ours .comparison-header { background: #d1fae5; color: #065f46; }
.comparison-card.baseline .comparison-header { background: #fef3c7; color: #92400e; }
.comparison-media { background: #0f172a; aspect-ratio: 2/1; }
.comparison-media .video-placeholder { border: none; border-radius: 0; }

@media (max-width: 640px) {
  .comparison-card--single { width: 100%; }
}

/* ── Video Carousel ── */
.vid-carousel {
  position: relative;
  margin: 1.5rem 0 0;
}
.vid-carousel__viewport {
  overflow: hidden;
}
.vid-carousel__track {
  display: flex;
  gap: 1rem;
  transition: transform 0.4s ease;
  will-change: transform;
}
.vid-carousel__slide {
  flex: 0 0 78%;
  opacity: 0.45;
  transform: scale(0.96);
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
}
.vid-carousel__slide.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.vid-carousel__btn {
  position: absolute;
  top: calc(50% - 1.5rem);
  transform: translateY(-50%);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 2;
  transition: background 0.15s;
}
.vid-carousel__btn:hover { background: #fff; }
.vid-carousel__btn--prev { left: -0.5rem; }
.vid-carousel__btn--next { right: -0.5rem; }
.vid-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.vid-carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.vid-carousel__dot.active { background: var(--primary); }

/* ── Results Table ── */
.results-table-wrap {
  overflow-x: auto;
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin: 2rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead { background: var(--bg-dark); color: white; }
thead th {
  padding: 0.85rem 1rem;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}
thead th:first-child { text-align: left; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td {
  padding: 0.75rem 1rem;
  text-align: center;
  white-space: nowrap;
}
tbody td:first-child { text-align: left; font-weight: 600; }
.result-best { color: #059669; font-weight: 700; }
.result-ours { background: #eff6ff; }
.result-ours td:first-child { color: var(--primary); }
tbody tr.bc-row { background: #fafafa; color: var(--text-muted); font-style: italic; }

/* ── Key Insights ── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.insight-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.insight-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.insight-title { font-size: 1rem; margin-bottom: 0.4rem; }
.insight-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }

/* ── Divider with phase arrow ── */
.phase-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
}
.phase-divider::before, .phase-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Citation ── */
.citation-box {
  background: #0f172a;
  border-radius: var(--card-radius);
  padding: 1.75rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.8;
  overflow-x: auto;
  position: relative;
}
.copy-btn {
  position: absolute;
  top: 1rem; right: 1rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.copy-btn:hover { background: rgba(255,255,255,0.18); color: white; }
.bib-key { color: #f472b6; }
.bib-field { color: #60a5fa; }
.bib-value { color: #34d399; }

/* ── Footer ── */
footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.875rem;
}
footer a { color: rgba(255,255,255,0.7); }
footer a:hover { color: white; }

/* ── Progress bar (used for perf) ── */
.perf-bar-wrap { margin: 0.25rem 0; }
.perf-bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 3px; }
.perf-bar-track { background: var(--border); border-radius: 100px; height: 8px; overflow: hidden; }
.perf-bar-fill { height: 100%; border-radius: 100px; transition: width 1s ease; }
.fill-ours { background: linear-gradient(90deg, var(--primary), #60a5fa); }
.fill-bc { background: #d1d5db; }
.fill-ibrl { background: #f59e0b; }

/* ── Callout box ── */
.callout {
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.callout p { font-size: 0.95rem; color: #1e40af; }

/* ── Timeline ── */
.timeline {
  position: relative;
  margin: 2rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
}
.timeline-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-content { padding-top: 0.4rem; }
.timeline-content h4 { margin-bottom: 0.3rem; }
.timeline-content p { font-size: 0.9rem; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero-title { font-size: 1.6rem; }
  .authors { gap: 0.35rem 0.8rem; }
  .author { font-size: 1rem; }
  .affiliations-row .author { font-size: 0.94rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  section { padding: 3rem 0; }
}

/* ── Scroll animations ── */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: none;
}
