/* ═══════════════════════════════════════════════════════
   ANIMATIONS — GSAP-enhanced + CSS keyframes
   ═══════════════════════════════════════════════════════ */

/* ─── Keyframe Animations ─── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideLeft {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideRight {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Reusable Classes ─── */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

.animate-pulse-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  animation: pulse-ring 1.5s ease-out infinite;
}

/* ─── Typewriter Effect ─── */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--cyan);
  animation: 
    typewriter 2s steps(40) forwards,
    blink 0.7s step-end infinite;
  width: 0;
  display: inline-block;
}

/* ─── Stagger children animation (visible at rest; animation is additive) ─── */
.reveal .stagger-in .card,
.reveal .stagger-in > * {
  opacity: 1;
}

.reveal .present .stagger-in .card,
.reveal .present .stagger-in > * {
  animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal .present .stagger-in > *:nth-child(1) { animation-delay: 0.1s; }
.reveal .present .stagger-in > *:nth-child(2) { animation-delay: 0.2s; }
.reveal .present .stagger-in > *:nth-child(3) { animation-delay: 0.3s; }
.reveal .present .stagger-in > *:nth-child(4) { animation-delay: 0.4s; }
.reveal .present .stagger-in > *:nth-child(5) { animation-delay: 0.5s; }
.reveal .present .stagger-in > *:nth-child(6) { animation-delay: 0.6s; }
.reveal .present .stagger-in > *:nth-child(7) { animation-delay: 0.7s; }
.reveal .present .stagger-in > *:nth-child(8) { animation-delay: 0.8s; }

/* ─── Slide transitions ─── */
.reveal .slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal .present .slide-in-left,
.reveal .slide-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal .slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal .present .slide-in-right,
.reveal .slide-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal .scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal .present .scale-in,
.reveal .scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* ─── Particle background (CSS only) ─── */
.particles-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particles-bg::before,
.particles-bg::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 8s ease-in-out infinite;
}

.particles-bg::before {
  background: var(--cyan);
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.particles-bg::after {
  background: var(--purple);
  bottom: 10%;
  right: 10%;
  animation-delay: 4s;
}

/* ─── Diagram Node Colors ─── */
.node-purple { background: rgba(167, 139, 250, 0.2); border: 1px solid rgba(167, 139, 250, 0.4); color: var(--purple); }
.node-cyan { background: rgba(34, 211, 238, 0.2); border: 1px solid rgba(34, 211, 238, 0.4); color: var(--cyan); }
.node-green { background: rgba(74, 222, 128, 0.2); border: 1px solid rgba(74, 222, 128, 0.4); color: var(--green); }
.node-amber { background: rgba(251, 191, 36, 0.2); border: 1px solid rgba(251, 191, 36, 0.4); color: var(--amber); }
.node-red { background: rgba(248, 113, 113, 0.2); border: 1px solid rgba(248, 113, 113, 0.4); color: var(--red); }

/* ─── Progress bar colors ─── */
.reveal .progress span {
  background: linear-gradient(90deg, var(--cyan), var(--purple)) !important;
}

/* ─── Counter animation ─── */
.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
