/* ==========================================================================
   Pyek AI — Stats Slider
   The AI Adoption Gap · 2026 — auto-rotating stat slides styled to match the
   PF_AI marketing deck. Drop-in section, dark theme.
   ========================================================================== */

.stats-section {
  display: none;
  background: #070B12;
  color: #E2E8F0;
  padding: var(--space-12) 0;
  overflow: hidden;
}
@media (min-width: 768px) {
  .stats-section { display: block; padding: var(--space-16) 0; }
}

.stats-section-title {
  text-align: center;
  color: #FFFFFF;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 auto var(--space-6);
  max-width: 720px;
}

.stats-slider {
  position: relative;
  background: #0B1119;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  width: 100%;
  min-height: 480px;
}
@media (min-width: 768px) {
  .stats-slider { min-height: 440px; }
}
@media (min-width: 1024px) {
  .stats-slider {
    min-height: 440px;
    aspect-ratio: 5 / 2;
  }
}
@media (min-width: 1280px) {
  .stats-slider { min-height: 480px; }
}

/* Track holds all slides, each absolutely positioned so transitions cross-fade. */
.stats-track {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0;
}

.stats-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-5) var(--space-10);
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease, visibility 600ms ease;
  pointer-events: none;
}
.stats-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
@media (min-width: 768px) {
  .stats-slide { padding: var(--space-8) var(--space-10) var(--space-10); }
}
@media (min-width: 1280px) {
  .stats-slide { padding: var(--space-10) var(--space-12) var(--space-12); }
}

/* Slide chrome */
.stats-eyebrow {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7DD3FC;
  margin-bottom: var(--space-3);
}
.stats-title {
  color: #FFFFFF;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 var(--space-4);
  font-size: clamp(1.25rem, 2.4vw, 1.875rem);
  max-width: 22ch;
}
.stats-title .accent { color: #7DD3FC; }
/* Wide variant: lift the 22ch cap so headlines that comfortably fit the slide width stay on one line. */
.stats-title.stats-title-wide { max-width: none; }

.stats-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: center;
}
.stats-body > * { min-height: 0; min-width: 0; }
@media (min-width: 900px) {
  .stats-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-8);
  }
}

.stats-text { color: #CBD5E1; max-width: 46ch; font-size: 0.9rem; }
.stats-text p { color: #CBD5E1; margin: 0 0 var(--space-3); line-height: 1.55; font-size: 0.9rem; }
.stats-text p:last-child { margin-bottom: 0; }
.stats-text strong { color: #FFFFFF; font-weight: 700; }
.stats-text em { font-style: normal; color: #7DD3FC; font-weight: 600; }

.stats-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}
.stats-visual svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
/* Square-ish visuals (dot grid, donut) — cap so they don't dominate */
.stats-slide[data-shape="square"] .stats-visual svg { max-width: min(100%, 220px); }
/* Wider charts can use a bit more horizontal room */
.stats-slide[data-shape="wide"] .stats-visual svg { max-width: min(100%, 340px); }

/* Footer row — source citation + deck label */
.stats-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  margin-top: var(--space-4);
  font-size: 0.7rem;
  color: #64748B;
  letter-spacing: 0.04em;
}
.stats-meta .stats-deck {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #475569;
  white-space: nowrap;
  margin-left: auto; /* keep right-aligned even when source span is omitted */
}

/* Push slide 1's bignum + caption right of the prev arrow (which sits at left:16, width:44). */
.stats-text-col { padding-left: var(--space-6); }

/* ---------- Slide 1: 88% adoption — big number + dot grid ---------- */
.stats-bignum {
  display: inline-flex;
  align-items: flex-start;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 800;
  line-height: 0.9;
  color: #7DD3FC;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-3);
}
.stats-bignum small {
  font-size: 0.45em;
  font-weight: 700;
  margin-top: 0.15em;
  margin-left: 0.05em;
  color: #7DD3FC;
}

/* ---------- Slide 2 / 3: Bar charts ---------- */
.stats-callout {
  border-left: 3px solid #7DD3FC;
  background: rgba(125, 211, 252, 0.05);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: var(--space-4);
  max-width: 360px;
}
.stats-callout .label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #94A3B8;
  margin-bottom: var(--space-2);
}
.stats-callout .figure {
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: var(--space-1);
}
.stats-callout .figure .arrow { color: #7DD3FC; margin: 0 0.25em; }
.stats-callout .sub { font-size: 0.8rem; color: #94A3B8; margin: 0; }

/* Compact bar chart (used in slide 3) */
.bar-pair-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #94A3B8;
  margin-top: var(--space-6);
  margin-bottom: var(--space-1);
  text-align: center;
}

/* ---------- Slide 3: Side stats ---------- */
.side-stats { display: grid; gap: var(--space-4); }
.side-stat .num {
  display: block;
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-1);
}
.side-stat p {
  color: #CBD5E1;
  margin: 0 0 var(--space-1);
  font-size: 0.85rem;
  line-height: 1.45;
}
.side-stat .src {
  color: #64748B;
  font-size: 0.75rem;
  margin: 0;
}
.side-stat + .side-stat {
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Slide 4: Maturity gap progress bar ---------- */
.maturity-bar {
  position: relative;
  width: 100%;
  height: 24px;
  background: #1E293B;
  border-radius: 4px;
  overflow: hidden;
}
.maturity-bar .mature {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1%;
  background: #EF4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}
.maturity-legend {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: 0.78rem;
  color: #94A3B8;
}

.stats-title-xl {
  font-size: clamp(1.25rem, 2.6vw, 1.875rem);
  line-height: 1.15;
  max-width: 22ch;
}

/* ---------- Slide 5: Donut chart + legend ---------- */
.legend { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}
.legend li:last-child { border-bottom: 0; }
.legend .key { display: flex; align-items: center; gap: var(--space-3); color: #FFFFFF; font-weight: 600; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend .swatch.cyan { background: #7DD3FC; }
.legend .swatch.gray { background: #CBD5E1; }
.legend .value { color: #94A3B8; font-weight: 500; }
.legend li.is-primary .value { color: #7DD3FC; font-weight: 700; }

.stats-callout-quote {
  border-left: 3px solid #7DD3FC;
  background: rgba(125, 211, 252, 0.05);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #CBD5E1;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

/* ---------- Controls ---------- */
.stats-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
  z-index: 3;
}
.stats-arrow:hover { background: rgba(125, 211, 252, 0.15); border-color: rgba(125, 211, 252, 0.4); }
.stats-arrow:focus-visible { outline: 2px solid #7DD3FC; outline-offset: 2px; }
.stats-arrow svg { width: 20px; height: 20px; }
.stats-arrow.prev { left: var(--space-4); }
.stats-arrow.next { right: var(--space-4); }
@media (max-width: 639px) {
  .stats-arrow { display: none; }
}

.stats-controls {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 2;
}
@media (min-width: 768px) {
  .stats-controls { bottom: var(--space-6); }
}

.stats-dots {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.stats-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: background 180ms ease, width 180ms ease;
}
.stats-dot:hover { background: rgba(255, 255, 255, 0.4); }
.stats-dot.is-active { background: #7DD3FC; width: 28px; border-radius: 4px; }
.stats-dot:focus-visible { outline: 2px solid #7DD3FC; outline-offset: 2px; }

.stats-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.4), #7DD3FC);
  z-index: 2;
  transition: width 80ms linear;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .stats-slide { transition: none; }
  .stats-progress { display: none; }
}

/* Mobile tweaks — let content breathe */
@media (max-width: 639px) {
  .stats-slide { padding: var(--space-6) var(--space-5) var(--space-12); }
  .stats-controls { bottom: var(--space-4); }
  .stats-meta { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .stats-visual svg { max-width: 280px; }
  .stats-bignum { font-size: clamp(4.5rem, 22vw, 7rem); }
}
