/* ==========================================================================
   Domain 29 — Micro-Animations
   ========================================================================== */

/* --- Card Reveal (staggered fade-slide-up) --- */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeSlideUp 0.4s var(--ease-out) both;
}

.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 80ms; }
.animate-in:nth-child(3) { animation-delay: 160ms; }
.animate-in:nth-child(4) { animation-delay: 240ms; }
.animate-in:nth-child(5) { animation-delay: 320ms; }
.animate-in:nth-child(6) { animation-delay: 400ms; }

/* --- Page Fade --- */
@keyframes pageFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-enter {
  animation: pageFade 0.35s var(--ease-out) both;
}

/* --- Lattice Node Pulse --- */
@keyframes nodePulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

/* --- Glow Border --- */
@keyframes glowBorder {
  0%, 100% {
    border-color: var(--accent-cyan-border);
    box-shadow: 0 0 0 0 var(--accent-cyan-glow);
  }
  50% {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px 2px var(--accent-cyan-glow);
  }
}

.glow-border {
  animation: glowBorder 3s ease-in-out infinite;
}

/* --- SVG Path Drawing --- */
@keyframes drawLine {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.provenance-line {
  stroke: var(--accent-emerald);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 1.2s var(--ease-out) forwards;
}

/* --- Data Flow along SVG path --- */
@keyframes flowDash {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.provenance-flow {
  stroke: var(--accent-emerald-light);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 8 16;
  animation: flowDash 0.8s linear infinite;
  opacity: 0.6;
}

/* --- Query Processing --- */
@keyframes processingPulse {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.processing-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-surface-2) 25%,
    var(--bg-surface-3) 50%,
    var(--bg-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: processingPulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* --- Counter Animation Helper --- */
.counter-animate {
  display: inline-block;
  transition: all 0.6s var(--ease-out);
}

/* --- Hover Lift --- */
.hover-lift {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

/* --- Fade Cascade (for sequential reveals) --- */
.fade-cascade > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease-out),
              transform 0.3s var(--ease-out);
}

.fade-cascade.visible > * {
  opacity: 1;
  transform: translateY(0);
}

.fade-cascade.visible > *:nth-child(1) { transition-delay: 0ms; }
.fade-cascade.visible > *:nth-child(2) { transition-delay: 60ms; }
.fade-cascade.visible > *:nth-child(3) { transition-delay: 120ms; }
.fade-cascade.visible > *:nth-child(4) { transition-delay: 180ms; }
.fade-cascade.visible > *:nth-child(5) { transition-delay: 240ms; }
.fade-cascade.visible > *:nth-child(6) { transition-delay: 300ms; }
.fade-cascade.visible > *:nth-child(7) { transition-delay: 360ms; }
.fade-cascade.visible > *:nth-child(8) { transition-delay: 420ms; }

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