/* ── Tab Panel Transitions ── */
.tab-panel {
  display: none;
  opacity: 0;
  padding: 2rem 0 3rem;
}
.tab-panel.active {
  display: block;
  animation: panelIn .35s ease forwards;
}
.tab-panel.exiting {
  display: block;
  animation: panelOut .2s ease forwards;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes panelOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ── Staggered Card Entrance ── */
.tab-panel.active .card,
.tab-panel.active .theme,
.tab-panel.active .gap,
.tab-panel.active .q-group,
.tab-panel.active .chart-wrap {
  animation: cardSlideUp .4s ease both;
}
.tab-panel.active > :nth-child(1) { animation-delay: .05s; }
.tab-panel.active > :nth-child(2) { animation-delay: .1s; }
.tab-panel.active > :nth-child(3) { animation-delay: .15s; }
.tab-panel.active > :nth-child(4) { animation-delay: .2s; }
.tab-panel.active > :nth-child(5) { animation-delay: .25s; }
.tab-panel.active > :nth-child(6) { animation-delay: .3s; }
.tab-panel.active > :nth-child(7) { animation-delay: .35s; }
.tab-panel.active > :nth-child(8) { animation-delay: .4s; }
.tab-panel.active > :nth-child(9) { animation-delay: .45s; }
.tab-panel.active > :nth-child(10) { animation-delay: .5s; }

/* Deep children stagger */
.tab-panel.active .card:nth-child(1) { animation-delay: .05s; }
.tab-panel.active .card:nth-child(2) { animation-delay: .1s; }
.tab-panel.active .card:nth-child(3) { animation-delay: .15s; }
.tab-panel.active .card:nth-child(4) { animation-delay: .2s; }
.tab-panel.active .card:nth-child(5) { animation-delay: .25s; }
.tab-panel.active .card:nth-child(6) { animation-delay: .3s; }
.tab-panel.active .card:nth-child(7) { animation-delay: .35s; }
.tab-panel.active .card:nth-child(8) { animation-delay: .4s; }
.tab-panel.active .card:nth-child(9) { animation-delay: .45s; }
.tab-panel.active .card:nth-child(10) { animation-delay: .5s; }

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stat Counter Pop ── */
.stat { animation: statPop .5s ease both; }
.stat:nth-child(1) { animation-delay: .1s; }
.stat:nth-child(2) { animation-delay: .15s; }
.stat:nth-child(3) { animation-delay: .2s; }
.stat:nth-child(4) { animation-delay: .25s; }
.stat:nth-child(5) { animation-delay: .3s; }
.stat:nth-child(6) { animation-delay: .35s; }

@keyframes statPop {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── SVG Chart Animations ── */
.chart-bar {
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.chart-bar.animate {
  /* width set via JS */
}

@keyframes drawLine {
  from { stroke-dashoffset: var(--dash-len); }
  to   { stroke-dashoffset: 0; }
}
.timeline-line {
  stroke-dasharray: var(--dash-len);
  stroke-dashoffset: var(--dash-len);
  animation: drawLine 1.2s ease forwards .3s;
}

@keyframes dotAppear {
  from { opacity: 0; r: 0; }
  to   { opacity: 1; }
}

/* ── Hover Glow on Cards ── */
.card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%),
    rgba(0,212,255,.04), transparent 40%);
}
.card:hover::after { opacity: 1; }
.card { position: relative; }

/* ── Reduce Motion ── */
@media (prefers-reduced-motion: reduce) {
  .tab-panel.active,
  .tab-panel.exiting,
  .tab-panel.active .card,
  .tab-panel.active .theme,
  .tab-panel.active .gap,
  .stat,
  .chart-bar,
  .timeline-line {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
