/* Modern Responsive & Dark-Mode CSS for Speed-Variation Distillation */
:root {
  /* Light Theme Variables */
  --primary: #c00f7d;
  --primary-hover: #9a0b63;
  --primary-light: #fdf2f8;
  --text-dark: #111827;
  --text-muted: #4b5563;
  --text-light: #6b7280;
  --bg-page: #ffffff;
  --bg-header: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  --bg-light: #f9fafb;
  --bg-card: #ffffff;
  --bg-code: #1e293b;
  --border-color: #e5e7eb;
  --tldr-bg: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  --tldr-border: #bae6fd;
  --tldr-accent: #0284c7;
  --tldr-text: #0c4a6e;
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', 'Google Sans', var(--font-sans);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --primary: #f43f5e;
  --primary-hover: #fb7185;
  --primary-light: rgba(244, 63, 94, 0.15);
  --text-dark: #f9fafb;
  --text-muted: #d1d5db;
  --text-light: #9ca3af;
  --bg-page: #0b0f19;
  --bg-header: linear-gradient(180deg, #0b0f19 0%, #111827 100%);
  --bg-light: #111827;
  --bg-card: #1f2937;
  --bg-code: #030712;
  --border-color: #374151;
  --tldr-bg: linear-gradient(135deg, #0c4a6e 0%, #0369a1 100%);
  --tldr-border: #0284c7;
  --tldr-accent: #38bdf8;
  --tldr-text: #e0f2fe;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-sans);
  color: var(--text-dark);
  background-color: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 920px;
}

/* Floating Dark/Light Mode Toggle */
.theme-toggle-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  background: var(--bg-card);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.theme-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Header Section */
header {
  padding: 60px 0 40px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
}

.hero-content {
  text-align: center;
  max-width: 960px;
  margin: 0 auto 40px;
}

.brand-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}

.site-header-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(192, 15, 125, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header-logo:hover {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 12px 32px rgba(192, 15, 125, 0.4);
}

.venue-badge {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 18px;
  border-radius: 30px;
  margin-bottom: 20px;
  border: 1px solid var(--primary);
}

.paper-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-dark);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.paper-title .highlight {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.authors-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  margin-bottom: 14px;
}

.author-item {
  color: #3b82f6;
  font-weight: 600;
  text-decoration: none;
}

.author-item:hover {
  text-decoration: underline;
}

.affiliation {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-primary {
  background: var(--text-dark);
  color: var(--bg-page);
  border-color: var(--text-dark);
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Teaser Container */
.teaser-container {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.teaser-container img {
  width: 100%;
  height: auto;
  display: block;
}

/* TL;DR Section */
.tldr-section {
  padding: 40px 0;
}

.tldr-box {
  background: var(--tldr-bg);
  border: 1px solid var(--tldr-border);
  border-left: 6px solid var(--tldr-accent);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
  .tldr-box {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }
}

.tldr-label {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--tldr-accent);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .tldr-label {
    padding-right: 24px;
    border-right: 2px solid var(--tldr-border);
  }
}

.tldr-text {
  font-size: 1.125rem;
  color: var(--tldr-text);
  line-height: 1.6;
}

/* Section Title */
section {
  padding: 60px 0;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 36px;
  color: var(--text-dark);
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--primary);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* Abstract Box */
.abstract-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.85;
  box-shadow: var(--card-shadow);
}

/* Method Cards */
.method-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 36px;
}

@media (min-width: 768px) {
  .method-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.method-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.25s ease;
}

.method-card:hover {
  transform: translateY(-4px);
}

.method-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.method-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-dark);
}

.method-card p {
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.6;
}

/* Interactive Visualizer */
.visualizer-section {
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.dataset-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.tab-btn {
  padding: 10px 24px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(192, 15, 125, 0.3);
}

/* Step Slider Control & Play/Pause */
.slider-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px clamp(16px, 3vw, 32px);
  margin-bottom: 30px;
  box-shadow: var(--card-shadow);
}

.slider-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.slider-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slider-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dark);
}

.play-pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.play-pause-btn:hover {
  transform: scale(1.04);
  background: var(--primary);
  color: #ffffff;
}

.play-pause-btn.playing {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(192, 15, 125, 0.4);
}

.step-badge {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 4px 14px;
  border-radius: 20px;
}

.range-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(192, 15, 125, 0.25);
  transition: transform 0.15s ease;
}

.step-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: clamp(0.75rem, 2vw, 0.875rem);
  color: var(--text-light);
  font-weight: 500;
}

/* Comparison Display */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .comparison-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.comparison-card.ours {
  border: 2px solid var(--primary);
}

.card-header {
  padding: 14px 20px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.card-header.ours-header {
  background: var(--primary-light);
  color: var(--primary);
}

.card-header.baseline-header {
  background: var(--bg-light);
  color: var(--text-muted);
}

.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.tag-success {
  background: #dcfce7;
  color: #15803d;
}

.tag-warning {
  background: #fee2e2;
  color: #b91c1c;
}

.card-body {
  position: relative;
  padding: 12px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.card-body img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.card-caption {
  padding: 14px 20px;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

/* Plots & Results */
.plots-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  align-items: center;
}

@media (min-width: 992px) {
  .plots-container {
    grid-template-columns: 1fr 1fr;
  }
}

.plot-img-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.plot-img-box img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

/* Citation Box */
.citation-box {
  background: var(--bg-code);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  font-family: 'Fira Code', monospace;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  line-height: 1.6;
  overflow-x: auto;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
}

.copy-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
  background: var(--bg-light);
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

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