/* ═══════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════ */

/* ── Page load ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.fade-in   { animation: fadeIn  0.28s var(--ease) both; }
.slide-in  { animation: slideIn 0.28s var(--ease) both; }
.scale-in  { animation: scaleIn 0.28s var(--spring) both; }

/* ── Stagger helpers ── */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }

/* ── Spinning loader ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Blinking cursor ── */
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0; } }
.blink { animation: blink 1s step-end infinite; }

/* ── Pulse ring (for play btn) ── */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--accent-purple-glow); }
  70%  { box-shadow: 0 0 0 10px rgba(99,102,241,0); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}
.pulse { animation: pulse-ring 1.5s infinite; }

/* ── Glow ── */
@keyframes glow-pulse {
  0%,100% { opacity: 0.4; }
  50%     { opacity: 0.8; }
}

/* ── Sort bar pop ── */
@keyframes barPop {
  0%  { transform: scaleY(1); }
  50% { transform: scaleY(1.04); }
  100%{ transform: scaleY(1); }
}

/* ── Node appear ── */
@keyframes nodeAppear {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
