/* Jev vs ML — Production Benchmark Design System */
/* Mobile-first, responsive, accessible, zero-dependency stylesheet */

:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #2563eb;
  --accent-foreground: #ffffff;
  --accent-subtle: #eff6ff;
  --accent-border: #bfdbfe;
  --border: #e4e4e7;
  --border-subtle: #f4f4f5;
  --input: #e4e4e7;
  --ring: #18181b;
  --radius: 6px;
  --radius-sm: 4px;

  --delta-pos-bg: #f0fdf4;
  --delta-pos-fg: #16a34a;
  --delta-pos-border: #bbf7d0;

  --delta-neg-bg: #fef2f2;
  --delta-neg-fg: #dc2626;
  --delta-neg-border: #fecaca;

  --delta-neutral-bg: #f4f4f5;
  --delta-neutral-fg: #71717a;
  --delta-neutral-border: #e4e4e7;

  --bar-jev: #2563eb;
  --bar-few: #60a5fa;
  --bar-classic: #71717a;
  --grid-line: rgba(0, 0, 0, 0.04);
  --drawer-overlay: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #0c0c0e;
  --card-foreground: #fafafa;
  --popover: #0c0c0e;
  --popover-foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --secondary: #141417;
  --secondary-foreground: #fafafa;
  --muted: #141417;
  --muted-foreground: #a1a1aa;
  --accent: #3b82f6;
  --accent-foreground: #ffffff;
  --accent-subtle: #172554;
  --accent-border: #1e3a8a;
  --border: #27272a;
  --border-subtle: #18181b;
  --input: #27272a;
  --ring: #d4d4d8;

  --delta-pos-bg: #052e16;
  --delta-pos-fg: #4ade80;
  --delta-pos-border: #14532d;

  --delta-neg-bg: #450a0a;
  --delta-neg-fg: #f87171;
  --delta-neg-border: #7f1d1d;

  --delta-neutral-bg: #141417;
  --delta-neutral-fg: #a1a1aa;
  --delta-neutral-border: #27272a;

  --bar-jev: #3b82f6;
  --bar-few: #93c5fd;
  --bar-classic: #a1a1aa;
  --grid-line: rgba(255, 255, 255, 0.04);
  --drawer-overlay: rgba(0, 0, 0, 0.75);
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Custom Sleek Scrollbar (Prevents thick Windows native scrollbar) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 13.5px;
  line-height: 1.5;
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
                    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 36px 36px;
  transition: background-color 150ms ease, color 150ms ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--foreground);
  text-decoration: none;
  transition: color 120ms ease;
}
a:hover { color: var(--accent); }

.text-accent { color: var(--accent); }
.text-muted { color: var(--muted-foreground); }
.text-foreground { color: var(--foreground); }
.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Focus Ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background-color: rgba(var(--background), 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo-img {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

.brand-title {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.brand-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  background-color: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.8125rem;
}

.nav-links a {
  color: var(--muted-foreground);
  font-weight: 500;
}
.nav-links a:hover { color: var(--foreground); }

/* Mobile Quick Navigation Strip */
.mobile-nav-strip {
  display: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--background);
  gap: 0.5rem;
}

.mobile-nav-strip a {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  border-radius: var(--radius-sm);
  background-color: var(--secondary);
  border: 1px solid var(--border);
}
.mobile-nav-strip a:hover {
  color: var(--foreground);
  border-color: var(--foreground);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-menu-btn {
  display: none;
}

/* Mobile Slide-In Side Navbar */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--drawer-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.mobile-nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-sidebar-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 290px;
  max-width: 85vw;
  background-color: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  z-index: 120;
  transform: translateX(-100%);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-sidebar-nav.open {
  transform: translateX(0);
}

.mobile-sidebar-header {
  padding: 0.875rem 1.125rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background-color: var(--secondary);
  position: sticky;
  top: 0;
  z-index: 2;
}

.mobile-sidebar-body {
  padding: 1.125rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mobile-sidebar-section-tag {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.mobile-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--foreground);
  border-radius: var(--radius-sm);
  min-height: 42px;
  transition: background-color 120ms ease, color 120ms ease;
}
.mobile-sidebar-link:hover, .mobile-sidebar-link:active {
  background-color: var(--secondary);
  color: var(--accent);
}
.mobile-sidebar-link .link-idx {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-weight: 600;
}

.mobile-sidebar-footer {
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  background-color: var(--secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  height: 32px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 120ms ease;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}
.btn-primary:hover { opacity: 0.9; color: var(--primary-foreground); }

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--foreground);
}
.btn-outline:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
}

.theme-icon-svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hero Section */
.hero-section {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(1.875rem, 3.5vw, 3rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.hero-lead {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--muted-foreground);
  margin-bottom: 1.25rem;
}

.hero-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Hero Benchmark Map (WOW #1) */
.hero-map-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  width: 100%;
  max-width: 100%;
}

.hero-map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.map-svg-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.map-node {
  cursor: pointer;
  transition: transform 140ms ease;
}
.map-node:hover {
  transform: scale(1.08);
}
.map-node:hover circle {
  stroke: var(--foreground);
  stroke-width: 2.5;
}

/* Snapshot Bar */
.snapshot-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--border);
  background-color: var(--background);
}

.snapshot-item {
  padding: 1rem 0.875rem;
  border-right: 1px solid var(--border);
}
.snapshot-item:last-child { border-right: none; }

.snapshot-num {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  display: block;
  margin-bottom: 0.25rem;
}

.snapshot-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.3;
}

/* Section Header */
.section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.section-desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  max-width: 38rem;
  margin-bottom: 0;
}

/* Sticky Control Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.control-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

/* Segmented Control */
.segmented-control {
  display: inline-flex;
  padding: 2px;
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.segmented-control label {
  cursor: pointer;
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: calc(var(--radius-sm) - 2px);
  transition: all 120ms ease;
  user-select: none;
  white-space: nowrap;
}

.segmented-control input:checked + span {
  background-color: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
}

/* Visuals Stack (Hero Range Comparison + Difference Plot) */
.visuals-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.25rem;
}

.vis-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  padding: 1.375rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.vis-card-hero {
  border-color: var(--border);
  background-color: var(--card);
}

.vis-badge-tag {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.vis-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.vis-head-main {
  flex: 1;
  min-width: 260px;
}

.vis-title {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.vis-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.vis-head-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.vis-sort-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vis-sort-control {
  display: inline-flex;
  gap: 2px;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.sort-btn {
  background: transparent;
  border: none;
  font-size: 0.6875rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 0.25rem 0.5rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
}

.sort-btn:hover {
  color: var(--foreground);
}

.sort-btn.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
}

.vis-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.6875rem;
}

.vis-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted-foreground);
}

.vis-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.vis-swatch.jev { background-color: var(--bar-jev); }
.vis-swatch.classic { background-color: var(--bar-classic); }
.vis-swatch-zero {
  width: 2px;
  height: 10px;
  background-color: var(--foreground);
  display: inline-block;
}
.vis-swatch-line {
  width: 14px;
  height: 3px;
  background-color: var(--bar-jev);
  border-radius: 2px;
  display: inline-block;
}

.chart-svg-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Range Hero & Diff Dot SVG */
.range-hero-svg, .diff-dot-svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 680px;
}

.range-row, .diff-row {
  cursor: pointer;
}

.row-hover-bg {
  transition: fill 120ms ease;
}

.range-row:hover .row-hover-bg, .diff-row:hover .row-hover-bg {
  fill: var(--secondary);
}

.range-row:focus-visible, .diff-row:focus-visible {
  outline: none;
}
.range-row:focus-visible .row-hover-bg, .diff-row:focus-visible .row-hover-bg {
  fill: var(--accent-subtle);
}

.editorial-tag {
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Mobile Views (Hidden on Desktop by default) */
.chart-mobile-view {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-range-card, .mobile-diff-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--background);
  padding: 0.875rem;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.mobile-range-card:hover, .mobile-diff-card:hover {
  border-color: var(--foreground);
  background-color: var(--secondary);
}

.mobile-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.mobile-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
  margin-top: 0.125rem;
}

.mobile-card-meta {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.mobile-spark-wrap {
  margin: 0.75rem 0 0.875rem;
}

.mobile-spark-track {
  position: relative;
  height: 8px;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.mobile-spark-range {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: var(--bar-jev);
  opacity: 0.4;
  border-radius: 3px;
}

.mobile-spark-dot {
  position: absolute;
  top: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateX(-50%);
  border: 2px solid var(--card);
}

.mobile-spark-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.5625rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.mobile-scores-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  font-size: 0.75rem;
}

.mobile-score-item {
  display: flex;
  flex-direction: column;
}

.mobile-score-label {
  font-size: 0.625rem;
  color: var(--muted-foreground);
}

.mobile-score-val {
  font-size: 0.875rem;
  font-weight: 700;
}

/* Swiss Editorial Small Multiples Grid */
.swiss-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.sm-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  padding: 0.875rem;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, background-color 120ms ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
}

.sm-card:hover {
  border-color: var(--foreground);
  background-color: var(--secondary);
}

.sm-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.sm-card-domain {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  display: block;
}

.sm-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.125rem;
}

.sm-spark {
  margin: 0.625rem 0 0.875rem;
}

.sm-spark-track {
  position: relative;
  height: 6px;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.sm-spark-bar {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: var(--accent);
  opacity: 0.25;
}

.sm-spark-dot {
  position: absolute;
  top: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateX(-50%);
  border: 2px solid var(--card);
}
.dot-jev { background-color: var(--bar-jev); z-index: 2; }
.dot-classic { background-color: var(--bar-classic); z-index: 1; }

.sm-spark-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.5625rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.sm-card-stats {
  display: flex;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  font-size: 0.6875rem;
}

.sm-stat-label {
  color: var(--muted-foreground);
  display: block;
  font-size: 0.5625rem;
}
.sm-stat-val { font-weight: 600; }

/* Tables */
.table-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background-color: var(--card);
  width: 100%;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.table-scroll-hint {
  display: none;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  padding: 0.375rem 0.75rem;
  background-color: var(--secondary);
  border-bottom: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  text-align: left;
}

#summary-table {
  width: 100%;
  table-layout: auto;
}

thead th {
  background-color: var(--secondary);
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th.sortable {
  cursor: pointer;
  user-select: none;
}
thead th.sortable:hover {
  color: var(--foreground);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 100ms ease;
}
tbody tr:last-child { border-bottom: none; }

tbody td, tbody th {
  padding: 0.625rem 0.75rem;
  color: var(--foreground);
  white-space: nowrap;
}

.summary-row {
  cursor: pointer;
}
.summary-row:hover {
  background-color: var(--secondary);
}

.sticky-col {
  position: sticky;
  left: 0;
  background-color: var(--card);
  z-index: 10;
  border-right: 1px solid var(--border);
}
thead .sticky-col {
  background-color: var(--secondary);
  z-index: 20;
}

/* Badges & Chips */
.badge-domain {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--foreground);
}

.delta-chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.delta-pos {
  background-color: var(--delta-pos-bg);
  color: var(--delta-pos-fg);
  border-color: var(--delta-pos-border);
}
.delta-neg {
  background-color: var(--delta-neg-bg);
  color: var(--delta-neg-fg);
  border-color: var(--delta-neg-border);
}
.delta-neutral {
  background-color: var(--delta-neutral-bg);
  color: var(--delta-neutral-fg);
  border-color: var(--delta-neutral-border);
}

.sd-sub {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-weight: 400;
}

.best-model-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-weight: 400;
}

.score-winner {
  color: var(--foreground);
  font-weight: 600;
}

.inspect-tag {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  transition: color 120ms;
}
.summary-row:hover .inspect-tag {
  color: var(--accent);
}

/* DATASET DETAIL DRAWER (Responsive Slide & Bottom Sheet) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--drawer-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 500px;
  background-color: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.drawer-panel.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background-color: var(--secondary);
  position: sticky;
  top: 0;
  z-index: 2;
}

.drawer-title-group h3 {
  font-size: 1.125rem;
  font-weight: 700;
}
.drawer-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.drawer-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.drawer-close:hover {
  color: var(--foreground);
  background-color: var(--background);
}

.drawer-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-metric-hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  padding: 0.875rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.drawer-m-card {
  display: flex;
  flex-direction: column;
}
.drawer-m-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.drawer-m-val {
  font-size: 1.125rem;
  font-weight: 700;
}

.drawer-variance-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
}

.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

.drawer-models-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.drawer-model-card {
  padding: 0.5rem 0.625rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-model-card.best {
  border-color: var(--foreground);
  background-color: var(--background);
}

/* INTERACTIVE PIPELINE (WOW #4) */
.pipeline-stepper {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.25rem;
  white-space: nowrap;
}

.pipeline-step-btn {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 0.875rem;
  border: none;
  background: transparent;
  border-right: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.pipeline-step-btn:last-child { border-right: none; }
.pipeline-step-btn:hover { background-color: var(--secondary); }
.pipeline-step-btn.active {
  background-color: var(--secondary);
  border-bottom: 2px solid var(--accent);
}

.step-btn-num {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  display: block;
}
.step-btn-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.pipeline-pane {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
}

.pipeline-flow-diagram {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.flow-box {
  padding: 0.875rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Reproducibility Terminal */
.terminal-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: #0c0c0e;
  color: #fafafa;
  overflow: hidden;
  margin-top: 1.25rem;
}

.terminal-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background-color: #141416;
  border-bottom: 1px solid #27272a;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}
.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #27272a;
}

.terminal-tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 0.375rem;
  max-width: 100%;
}

.term-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #a1a1aa;
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.term-tab-btn.active {
  background-color: #27272a;
  color: #fafafa;
}

.terminal-body {
  padding: 1rem;
  font-size: 0.75rem;
  line-height: 1.6;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.term-cmd { color: #38bdf8; }
.term-pass { color: #4ade80; }
.term-comment { color: #71717a; }

/* Limitations Grid */
.limits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  margin-top: 1.25rem;
}

.limit-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
}
.limit-title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}
.limit-card p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

/* Artifacts Download Cards */
.artifacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.artifact-card {
  padding: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.artifact-card:hover {
  border-color: var(--foreground);
  background-color: var(--secondary);
}

.artifact-tag {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}
.artifact-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}
.artifact-sub {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background-color: var(--background);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-logo-img {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  display: inline-block;
  object-fit: contain;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-links a { color: var(--muted-foreground); }
.footer-links a:hover { color: var(--foreground); }

/* Responsive Media Queries (Mobile-First Engineering Pass) */

/* Tablets & Small Laptops (768px - 1024px) */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .swiss-grid { grid-template-columns: repeat(2, 1fr); }
  .limits-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-flow-diagram { grid-template-columns: repeat(2, 1fr); }
  .chart-desktop-view { display: block; }
  .chart-mobile-view { display: none; }
}

/* Mobile & Phablet Breakpoint (< 680px) */
@media (max-width: 680px) {
  .container {
    padding: 0 1rem;
  }

  .site-header {
    height: auto;
  }
  .header-inner {
    height: 48px;
  }
  .nav-links {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
  }
  .header-github-btn {
    display: none;
  }
  .mobile-nav-strip {
    display: flex;
    padding: 0.375rem 0.75rem;
    scrollbar-width: none;
  }
  .mobile-nav-strip::-webkit-scrollbar {
    display: none;
  }
  .mobile-nav-strip a {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
  }

  /* Hero Mobile Re-Composition */
  .hero-section {
    padding: 1.75rem 0 1.25rem;
  }
  .hero-title {
    font-size: clamp(1.75rem, 6.5vw, 2.375rem);
    line-height: 1.12;
    margin-bottom: 0.5rem;
  }
  .hero-lead {
    font-size: 0.875rem;
    line-height: 1.55;
    margin-bottom: 1rem;
  }
  .hero-meta-strip {
    font-size: 0.6875rem;
    gap: 0.25rem 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
  }
  .hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .hero-actions .btn {
    width: 100%;
    min-height: 40px;
    font-size: 0.8125rem;
  }

  /* Snapshot Bar Mobile */
  .snapshot-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .snapshot-item {
    padding: 0.75rem 0.625rem;
  }
  .snapshot-item:nth-child(2) {
    border-right: none;
  }
  .snapshot-item:last-child {
    grid-column: span 2;
    border-top: 1px solid var(--border);
    border-right: none;
  }
  .snapshot-num {
    font-size: 1.1875rem;
  }
  .snapshot-label {
    font-size: 0.6875rem;
  }

  /* Section Headings */
  .section {
    padding: 2rem 0;
  }
  .section-title {
    font-size: 1.25rem;
  }
  .section-desc {
    font-size: 0.8125rem;
  }

  /* Sticky Toolbar Controls */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .toolbar-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.375rem;
  }
  .toolbar-group .segmented-control {
    display: flex;
    width: 100%;
  }
  .toolbar-group .segmented-control label {
    flex: 1;
    text-align: center;
  }
  .toolbar-group .segmented-control span {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
  }
  #csv-download {
    width: 100%;
    min-height: 38px;
    text-align: center;
  }

  /* Chart View Switcher */
  .chart-desktop-view {
    display: none !important;
  }
  .chart-mobile-view {
    display: flex !important;
  }

  .vis-card {
    padding: 1rem;
  }
  .vis-head {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }
  .vis-head-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.625rem;
  }
  .vis-sort-group {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.375rem;
  }
  .vis-sort-control {
    display: flex;
    width: 100%;
  }
  .sort-btn {
    flex: 1;
    min-height: 36px;
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Swiss Grid */
  .swiss-grid {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }

  /* Tables Mobile Containment & Sticky Columns */
  .table-scroll-hint {
    display: block;
  }
  .table-container {
    border-radius: var(--radius);
  }
  table {
    font-size: 0.75rem;
  }
  thead th {
    padding: 0.5rem 0.625rem;
    min-height: 40px;
  }
  tbody td, tbody th {
    padding: 0.5rem 0.625rem;
  }
  .sticky-col {
    position: sticky;
    left: 0;
    background-color: var(--card);
    z-index: 10;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
  }
  thead .sticky-col {
    background-color: var(--secondary);
    z-index: 20;
  }

  /* Methodology Pipeline Mobile */
  .pipeline-stepper {
    margin-bottom: 0.875rem;
  }
  .pipeline-step-btn {
    min-height: 44px;
    padding: 0.625rem 0.75rem;
  }
  .pipeline-pane {
    padding: 1rem;
  }
  .pipeline-flow-diagram {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* Terminal & Limitations */
  .terminal-tabs {
    gap: 0.25rem;
  }
  .term-tab-btn {
    min-height: 34px;
    padding: 0.25rem 0.5rem;
  }
  .limits-grid {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }
  .artifacts-grid {
    grid-template-columns: 1fr;
  }

  /* Mobile Bottom Sheet Modal */
  .drawer-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    max-height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
  }
  .drawer-panel.open {
    transform: translateY(0);
  }
  .drawer-header {
    padding: 0.875rem 1rem;
    border-radius: 16px 16px 0 0;
  }
  .drawer-body {
    padding: 1rem;
    gap: 1rem;
  }
  .drawer-models-grid {
    grid-template-columns: 1fr;
  }
  .drawer-metric-hero {
    grid-template-columns: repeat(3, 1fr);
    padding: 0.625rem;
    gap: 0.375rem;
  }
  .drawer-m-val {
    font-size: 0.9375rem;
  }

  /* Footer Mobile */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .footer-links {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Very Small Mobile (< 380px) */
@media (max-width: 380px) {
  .hero-title {
    font-size: 1.625rem;
  }
  .snapshot-bar {
    grid-template-columns: 1fr;
  }
  .snapshot-item {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .snapshot-item:last-child {
    grid-column: span 1;
    border-bottom: none;
  }
  .drawer-metric-hero {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}
