/* ==========================================================================
   SCROLLYTELLING — Sticky side-by-side narrative pattern
   Used on the evidence page for the visual overview section.
   ========================================================================== */

/* Side-by-side scrollytelling pattern — lives inside the evidence
   content column alongside the TOC sidebar. */
.scrolly {
  position: relative;
  display: flex;
  padding: 1rem 0 2rem;
  border-bottom: none;
}

.scrolly__graphic {
  position: sticky;
  top: var(--nav-height, 5rem); /* keep in sync with .site-nav height */
  align-self: flex-start;
  width: 45%;
  height: calc(100vh - 6rem);
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
}

.scrolly__text {
  width: 55%;
  padding-right: 2rem;
  order: 1;
}

/* Steps are fully visible by default (no-JS baseline) */
.scrolly__step {
  min-height: 60vh;
  display: flex;
  align-items: center;
  padding: 2rem 0;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Only dim inactive steps after JS has initialized successfully */
.scrolly--initialized .scrolly__step {
  opacity: 0.25;
}

.scrolly--initialized .scrolly__step.is-active,
.scrolly__step:focus-within {
  opacity: 1;
}

/* --- Step content --- */

.step__content h3 {
  font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.step__content p {
  font-family: var(--font-body, 'Source Serif 4', Georgia, serif);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

/* --- Visualization panel --- */

.scrolly__viz {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Single-container viz inner layout (replaces multi-layer approach) */
.scrolly__viz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.viz-stat {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.viz-stat--accent {
  color: var(--accent, #1a5276);
}

.viz-stat--danger {
  color: var(--color-danger, #B91C1C);
}

/* Thin rule between stat number and subtitle */
.viz-separator {
  width: 3rem;
  border: none;
  border-top: 1px solid var(--border-light, #e2e2e2);
  margin: 0.75rem auto;
}

.viz-subtitle {
  font-family: var(--font-sans, 'Inter', -apple-system, sans-serif);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 24ch;
  margin: 0;
}

/* --- Dark mode --- */

[data-theme="dark"] .viz-stat--accent {
  color: #5dade2; /* lighter blue for dark bg contrast */
}

[data-theme="dark"] .viz-stat--danger {
  color: #EF4444; /* lighter red for dark bg contrast */
}

/* --- Mobile: stacked layout --- */

@media (max-width: 768px) {
  .scrolly {
    flex-direction: column;
  }

  .scrolly__graphic {
    position: relative; /* NOT sticky on mobile */
    top: auto;
    width: 100%;
    height: 50vh;
    order: 1;
    margin-bottom: 1rem;
  }

  .scrolly__text {
    width: 100%;
    padding-right: 0;
    order: 2;
  }

  .scrolly__step {
    min-height: 40vh;
  }

  .step__content h3 {
    font-size: 1.2rem;
  }

  .viz-stat {
    font-size: clamp(2.5rem, 10vw, 3.5rem);
  }
}

/* --- Reduced motion: no transitions, all steps fully visible --- */

@media (prefers-reduced-motion: reduce) {
  .scrolly__step {
    transition: none;
    opacity: 1;
  }

  .viz-stat,
  .viz-subtitle {
    transition: none;
  }
}
