/* ── Design Token Alignment ──
   Extends the EnrichReader design token system (docs/styles/design-tokens.css)
   for the Lord of the Mysteries data visualization page. */
:root {
  /* Typography — aligned with design tokens */
  --font-display: 'Bona Nova', serif;        /* --font-master */
  --font-body:    'Spectral', serif;          /* --font-reading */
  --font-ui:      'Manrope', sans-serif;      /* --font-interface */
  --font-mono:    'JetBrains Mono', monospace; /* local extension: tabular data */

  /* Fluid Type Scale (design tokens — modular 1.25 ratio) */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.2vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.3vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-md:   clamp(1.125rem, 1rem    + 0.4vw,  1.375rem);
  --text-lg:   clamp(1.25rem,  1.15rem + 0.5vw,  1.5rem);
  --text-xl:   clamp(1.563rem, 1.4rem  + 0.8vw,  2rem);
  --text-2xl:  clamp(1.953rem, 1.7rem  + 1.2vw,  2.75rem);
  --text-3xl:  clamp(2.441rem, 2.1rem  + 1.8vw,  3.5rem);
  --text-4xl:  clamp(3.052rem, 2.5rem  + 2.5vw,  4.5rem);
  --text-5xl:  clamp(3.815rem, 3rem    + 4vw,     6rem);

  --leading-tight:   1.1;
  --leading-snug:    1.35;
  --leading-relaxed: 1.7;

  /* Surface Colors — from design tokens neutral scale (hue 35) */
  --color-surface-base:     oklch(10%  0.02 35);   /* --color-neutral-900 */
  --color-surface-elevated: oklch(14%  0.02 35);   /* --color-neutral-800 */
  --color-surface-sunken:   oklch(7%   0.01 35);   /* --color-neutral-950 */
  --color-surface-divider:  oklch(20%  0.02 35);   /* --color-neutral-700 */

  /* Text Colors — from design tokens cream/neutral scales */
  --color-text-primary:   oklch(98%  0.01 85);    /* --color-cream-100  */
  --color-text-secondary: oklch(92%  0.02 85);    /* --color-cream-200  */
  --color-text-muted:     oklch(78%  0.02 50);    /* --color-neutral-400 */
  --color-text-dim:       oklch(62%  0.02 35);    /* --color-neutral-500 */

  /* Brand Gold — from design tokens gold scale */
  --color-accent:        oklch(75% 0.14 85);       /* --color-gold-500 */
  --color-accent-soft:   oklch(75% 0.14 85 / 0.1);
  --color-accent-mid:    oklch(75% 0.14 85 / 0.4);
  --color-accent-glow:   oklch(75% 0.14 85 / 0.55);
  --color-accent-hover:  oklch(80% 0.12 85);       /* --color-gold-400 */
  --color-accent-bright: oklch(85% 0.09 85);       /* --color-gold-300 */

  /* Backward-compat aliases for JS chart references */
  --color-ink:           var(--color-surface-base);
  --color-ink-lighter:   var(--color-surface-elevated);
  --color-parchment:     var(--color-text-primary);
  --color-parchment-dim: var(--color-text-secondary);

  /* Archival entity category colors */
  --color-person:   oklch(75% 0.14 85);   /* Matte Gold */
  --color-org:      oklch(65% 0.12 180);  /* Alchemical Teal */
  --color-lore:     oklch(58% 0.18 28);   /* Ancient Crimson */
  --color-location: oklch(62% 0.10 250);  /* Mystic Blue */

  /* Borders */
  --border-subtle:        1px solid oklch(100% 0 0 / 0.08);
  --border-subtle-bright: 1px solid oklch(100% 0 0 / 0.15);
  --border-gold-dim:      1px solid oklch(75% 0.14 85 / 0.25);
  --border-gold:          1px solid oklch(75% 0.14 85 / 0.4);

  /* Legacy aliases */
  --border-scholarly:        var(--border-subtle);
  --border-scholarly-bright: var(--border-subtle-bright);

  /* Spacing (design tokens — 4pt system) */
  --spacing-1:  0.25rem;
  --spacing-2:  0.5rem;
  --spacing-3:  0.75rem;
  --spacing-4:  1rem;
  --spacing-6:  1.5rem;
  --spacing-8:  2rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;
  --spacing-24: 6rem;
  --spacing-32: 8rem;
}

/* ── Base ── */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Subtle film-grain texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body {
  background-color: var(--color-surface-base);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
}

/* ── Font helpers ── */
.font-display { font-family: var(--font-display); }
.font-ui      { font-family: var(--font-ui); }
.font-body    { font-family: var(--font-body); }

/* ── Background ── */
.void-bg {
  z-index: -1;
  background: radial-gradient(
    ellipse 80% 60% at 50% -10%,
    oklch(18% 0.02 50) 0%,
    var(--color-surface-base) 65%
  );
  position: fixed;
  inset: 0;
}

/* ── Navigation ── */
nav {
  background: oklch(10% 0.02 35 / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid oklch(75% 0.14 85 / 0.1);
  box-shadow: 0 4px 24px oklch(0% 0 0 / 0.2);
}

.logo {
  height: 40px;
  width: auto;
  transition: opacity 0.25s ease;
}

.logo:hover {
  opacity: 0.75;
}

/* ── Hero Section ── */
.hero-section {
  padding-top: clamp(8rem, 16vw, 12rem);
  padding-bottom: var(--spacing-32);
}

.hero-title {
  font-size: var(--text-5xl);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: var(--spacing-16);
  color: var(--color-text-primary);
}

/* NO gradient-text — solid color only */
.editorial-title {
  color: var(--color-text-primary);
  font-weight: 800;
}

.hero-subtitle {
  display: block;
  font-style: normal;
  font-weight: 300;
  font-size: var(--text-xl);
  color: var(--color-text-muted);
  margin-top: var(--spacing-8); /* Increased separation */
  letter-spacing: -0.01em;
}

.hero-stats-grid {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: calc(-1 * var(--spacing-6));
}

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 0 var(--spacing-6);
  min-width: 140px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--color-surface-divider);
  opacity: 1;
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-secondary); /* Increased contrast */
  margin-top: var(--spacing-3);
}

.hero-description {
  font-size: var(--text-base) !important; /* Reduced to ~18-20px range */
  color: oklch(88% 0.06 85) !important;
  line-height: 1.7;
  max-width: 50ch;
}

.hero-visual-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-8);
}

.chapter-constellation {
  width: 110%; /* Slightly bleed for presence */
  max-width: 500px;
  filter: drop-shadow(0 0 30px var(--color-accent-soft));
}

.pulse-point {
  animation: pulse-svg 3s infinite ease-in-out;
}

@keyframes pulse-svg {
  0%, 100% { opacity: 0.4; r: 3; }
  50% { opacity: 1; r: 5; }
}

.hero-visual-metadata {
  display: flex;
  gap: var(--spacing-8);
  opacity: 1;
}

.hero-visual-metadata span {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
}

/* ── Bottom Bar ── */
.hero-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--color-surface-base) 0%, transparent 100%);
  border-top: 1px solid oklch(100% 0 0 / 0.08); /* Grounded full-width divider */
  backdrop-filter: blur(8px);
}

.next-vol-teaser {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border-right: 1px solid var(--color-surface-divider);
  padding-right: var(--spacing-8);
  text-align: right;
  transition: border-color 0.3s ease;
}

.next-vol-teaser:hover {
  border-color: var(--color-accent-glow);
}

.teaser-label {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}

.teaser-value {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  transition: color 0.3s ease;
}

.next-vol-teaser:hover .teaser-value {
  color: var(--color-text-primary);
}

/* ── Scroll Cue ── */
.scroll-cue {
  position: absolute;
  bottom: var(--spacing-24);
  left: calc(50% + 220px); /* Offset to not overlap text */
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.scroll-line {
  width: 1px;
  height: 80px;
  background: linear-gradient(to bottom, var(--color-accent) 0%, transparent 100%);
  animation: scroll-fade 2.5s infinite;
}

@keyframes scroll-fade {
  0% { transform: translateY(-100%); opacity: 0; }
  50% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}

.volume-indicator {
  display: inline-flex;
  align-items: baseline;
  gap: var(--spacing-2);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
  font-family: var(--font-ui);
}

.volume-current {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Chart sections ── */
.chart-section {
  position: relative;
  border-top: var(--border-subtle);
}

/* ── Section labels ── */
.section-header {
  padding-top: var(--spacing-16);
  margin-bottom: var(--spacing-12);
}

.section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: var(--text-3xl);
  color: var(--color-text-primary);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.section-title em {
  font-style: normal;
  color: var(--color-accent);
}

.control-label {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-dim);
}

.donut-total-value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}

.donut-total-label {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
  margin-top: 0.5rem;
}

.insight-text-bold {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  font-style: italic;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  max-width: 60ch;
  margin-top: var(--spacing-4);
}

/* ── Chart card ── */
.chart-card {
  background: var(--color-surface-elevated);
  border-radius: 1rem;
  border: var(--border-subtle-bright);
  backdrop-filter: blur(20px);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 8px 32px oklch(0% 0 0 / 0.35);
  position: relative;
  overflow: hidden;
}

.chart-card:hover {
  border-color: oklch(75% 0.14 85 / 0.2);
  box-shadow: 0 16px 48px oklch(0% 0 0 / 0.5);
}

.chart-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.chart-grid-lines {
  position: absolute;
  inset: 0;
  left: 170px; /* Match label width */
  background-image: linear-gradient(to right, var(--color-surface-divider) 1px, transparent 1px);
  background-size: 20% 100%; /* 5 grid lines */
  opacity: 0.4;
  pointer-events: none;
}

/* ── Narrative copy ── */
.narrative-content {
  max-width: 65ch;
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

.narrative-content p {
  margin-bottom: var(--spacing-8);
}

/* ── Legend ── */
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: oklch(100% 0 0 / 0.06);
  border: 1px solid oklch(100% 0 0 / 0.12);
  border-radius: 5px;
  transition: border-color 0.2s ease, color 0.2s ease;
  user-select: none;
  cursor: default;
}

.legend-item:hover {
  border-color: oklch(100% 0 0 / 0.14);
  color: var(--color-text-primary);
}

/* ── Insight pills ── */
.insight-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--border-radius-sm);
  background: var(--color-accent-soft);
  border: var(--border-gold-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-accent);
  letter-spacing: 0.03em;
  transition: all 0.3s ease;
}

/* ── Legend Minimal ── */
.legend-item-minimal {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dash-marker {
  width: 20px;
}

.legend-label {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-dim);
}

.insight-pill:hover {
  border-color: oklch(75% 0.14 85 / 0.3);
  color: var(--color-text-secondary);
}

/* ── Scroll-reveal ── */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity  0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transition: opacity 1s ease;
}

.fade-in.visible {
  opacity: 1;
}

/* ── Playback Controls ── */
.race-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.race-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border: var(--border-gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.race-btn:hover {
  background: var(--color-accent-mid);
  border-color: oklch(75% 0.14 85 / 0.35);
  transform: scale(1.05);
}

.race-btn.active {
  background: var(--color-accent);
  color: var(--color-surface-sunken);
  border-color: transparent;
}

.race-slider {
  flex: 1;
  min-width: 100px;
  appearance: none;
  -webkit-appearance: none;
  background: oklch(100% 0 0 / 0.07);
  border-radius: 3px;
  height: 4px;
  outline: none;
  cursor: pointer;
}

.race-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-surface-base);
  box-shadow: 0 0 8px var(--color-accent-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.race-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.race-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-surface-base);
  box-shadow: 0 0 8px var(--color-accent-glow);
  cursor: pointer;
}

.speed-btn {
  background: oklch(100% 0 0 / 0.06);
  border: 1px solid oklch(100% 0 0 / 0.12);
  color: var(--color-text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.speed-btn:hover {
  border-color: oklch(75% 0.14 85 / 0.3);
  color: var(--color-text-secondary);
}

.speed-btn.active {
  background: var(--color-accent-soft);
  border-color: oklch(75% 0.14 85 / 0.35);
  color: var(--color-accent);
}

.chapter-display {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  min-width: 90px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.chapter-display strong {
  color: var(--color-accent);
  font-size: var(--text-md);
  font-weight: 600;
  font-family: var(--font-ui);
}

.chapter-total {
  font-size: var(--text-xs);
  opacity: 0.35;
}

/* ── Bar Chart Race ── */
.race-chart {
  position: relative;
  width: 100%;
  min-height: 480px;
  margin-top: var(--spacing-8);
  overflow: visible;
}

.race-bar-wrapper {
  position: absolute;
  left: 0;
  width: 100%;
  height: 32px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
  display: flex;
  align-items: center;
}

.race-bar-label {
  width: 160px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: left;
  padding-left: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  order: 1;
}

.race-bar-outer {
  flex: 1;
  height: 24px;
  position: relative;
  display: flex;
  align-items: center;
  order: 2;
}

.race-bar-inner {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
  position: relative;
  min-width: 4px; /* Ensure tiny values are visible */
}

.race-bar-value {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* X-axis */
.race-axis {
  position: absolute;
  top: -30px;
  left: 130px;
  right: 60px;
  height: 100%;
  pointer-events: none;
  border-left: 1px solid oklch(100% 0 0 / 0.15);
}

.race-axis-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid oklch(100% 0 0 / 0.12);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.race-axis-label {
  transform: translateX(-50%);
  margin-top: -20px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--color-text-dim);
}

/* ── Funnel ── */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 380px;
  margin: 0 auto;
}

.funnel-connector {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  color: var(--color-text-dim);
}

.animate-funnel .funnel-connector { opacity: 1; }
.animate-funnel .funnel-connector:nth-child(2) { transition-delay: 0.2s; }

.funnel-stage {
  padding: 2.5rem 1.5rem;
  background: var(--color-surface-card);
  border: 1px solid oklch(100% 0 0 / 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateX(-30px);
}

.animate-funnel .funnel-stage {
  opacity: 1;
  transform: translateX(0);
}

/* Dramatic 4:1 Taper */
.stage-1 { 
  width: 100%;
  clip-path: polygon(0% 0%, 100% 0%, 80% 100%, 20% 100%); 
}
.stage-3 { 
  width: 25%;
  margin-left: 37.5%; /* Destination box */
  transition-delay: 0.25s;
  background: oklch(100% 0 0 / 0.06);
  border-radius: var(--border-radius-md);
  border: 1px solid oklch(78% 0.16 85 / 0.3);
}

.stage-3.highlight {
  background: linear-gradient(180deg, oklch(20% 0.05 85), oklch(15% 0.02 85));
  box-shadow: 0 0 40px oklch(78% 0.16 85 / 0.1);
}

.funnel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 2;
}

.funnel-num {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stage-3.highlight .funnel-num {
  color: var(--color-accent);
  text-shadow: 0 0 20px oklch(78% 0.16 85 / 0.4);
}

.funnel-label {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-secondary); /* Better contrast */
}

.filter-line {
  width: 2px; /* Stronger line */
  height: 100%;
  background: linear-gradient(to bottom, var(--color-accent), transparent);
  opacity: 0.4;
}

.funnel-meta {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-dim);
}

.donut-total-value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}

.donut-total-label {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
  margin-top: 0.5rem;
}

.insight-text-bold {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  font-style: italic;
  letter-spacing: -0.01em;
}

.donut-count {
  color: var(--color-accent);
}

/* ── Misc utility ── */
.font-tech {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ── Footer ── */
footer {
  border-top: var(--border-subtle);
}

/* ── Insight Area ── */
.insight-area {
  border-top: 1px solid var(--color-surface-divider);
}

.insight-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: 1.8;
}

.stat-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-4) var(--spacing-6);
  background: oklch(100% 0 0 / 0.03);
  border: 1px solid oklch(100% 0 0 / 0.06);
  border-radius: var(--border-radius-md);
}

.pill-label {
  font-family: var(--font-ui);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
}

.pill-value {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .chart-grid-lines {
    left: 170px;
  }
}

@media (max-width: 768px) {
  nav {
    background: var(--color-surface-base);
  }

  .hero-section {
    padding-top: clamp(5rem, 12vw, 7rem);
  }

  .hero-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--spacing-8);
  }

  .hero-subtitle {
    font-size: var(--text-xl);
  }

  .section-title {
    font-size: var(--text-2xl);
  }

  .race-controls-container {
    gap: var(--spacing-4);
  }

  .chart-grid-lines {
    display: none;
  }

  .race-bar-label {
    width: 100px;
    font-size: 10px;
  }

  .race-controls {
    justify-content: flex-start;
    gap: 8px;
  }

  .race-slider {
    width: 100%;
    order: 10;
    margin-top: 8px;
  }

  .chapter-display {
    text-align: left;
    min-width: unset;
  }
}