/* ============================================================
   NEXTGEN DIGITAL ACADEMY
   Animation Keyframes & Classes
   ============================================================
   Naming convention:
     @keyframes  → camelCase  (float, slideUp, glowPulse …)
     .anim-*     → one-shot entry animations (forwards fill)
     .animate-*  → looping ambient animations
     .gsap-*     → targets controlled exclusively by GSAP
   ============================================================ */


/* ============================================================
   KEYFRAMES
   ============================================================ */

/* Floating / levitation */
@keyframes float {
  0%, 100% { transform: translateY(0px);   }
  50%       { transform: translateY(-22px); }
}

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

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

/* Pulsing */
@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%       { opacity: 0.5; transform: scale(0.88); }
}

@keyframes pulseOrange {
  0%, 100% { box-shadow: 0 0 12px rgba(255,102,0,0.22); }
  50%       { box-shadow: 0 0 40px rgba(255,102,0,0.72); }
}

@keyframes pulseBorder {
  0%, 100% { border-color: rgba(255,102,0,0.25); }
  50%       { border-color: rgba(255,102,0,0.80); }
}

/* Glow orb breathe */
@keyframes glowPulse {
  0%, 100% { opacity: 0.32; filter: blur(42px); }
  50%       { opacity: 0.78; filter: blur(28px); }
}

/* Shimmer (loading skeleton / text highlight) */
@keyframes shimmer {
  0%   { background-position: -250% center; }
  100% { background-position:  250% center; }
}

/* Rotation */
@keyframes rotateCW {
  from { transform: rotate(0deg);    }
  to   { transform: rotate(360deg);  }
}

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

/* Entry — slide directions */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(55px); }
  to   { opacity: 1; transform: translateY(0);    }
}

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

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes scaleInBounce {
  0%   { opacity: 0; transform: scale(0.55); }
  70%  {             transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1);    }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Draw line (horizontal) */
@keyframes drawLine {
  from { transform: scaleX(0); transform-origin: left center; }
  to   { transform: scaleX(1); transform-origin: left center; }
}

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

@keyframes blink {
  0%, 100% { border-color: #FF6600;     }
  50%       { border-color: transparent; }
}

/* Bounce (custom, slower than Tailwind default) */
@keyframes bounceSlow {
  0%, 100% { transform: translateY(0px);   }
  50%       { transform: translateY(-14px); }
}

/* Particle drift (decorative) */
@keyframes drift {
  0%   { transform: translateY(0)    translateX(0)    scale(1);    opacity: 0.8; }
  33%  { transform: translateY(-28px) translateX(14px)  scale(0.92); opacity: 0.5; }
  66%  { transform: translateY(-12px) translateX(-10px) scale(1.08); opacity: 0.7; }
  100% { transform: translateY(0)    translateX(0)    scale(1);    opacity: 0.8; }
}

/* Scan line sweep (hero decoration) */
@keyframes scanLine {
  0%   { transform: translateY(-110%); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(110vh); opacity: 0; }
}

/* Waveform bar (audio/AI visual) */
@keyframes waveform {
  0%, 100% { transform: scaleY(0.28); }
  50%       { transform: scaleY(1);   }
}

/* Circuit trace draw */
@keyframes traceDraw {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0;    }
}

/* Number count-up flash */
@keyframes countFlash {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* Arrow chevron bounce */
@keyframes chevronBounce {
  0%, 100% { transform: translateY(0);  }
  50%       { transform: translateY(6px); }
}

/* Spin badge ring */
@keyframes spinRing {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}


/* ============================================================
   LOOPING AMBIENT ANIMATION CLASSES
   ============================================================ */

.animate-float        { animation: float      6s ease-in-out infinite; }
.animate-float-sm     { animation: floatSm    4s ease-in-out infinite; }
.animate-float-lg     { animation: floatLg    8s ease-in-out infinite; }
.animate-pulse-dot    { animation: pulse      2s ease-in-out infinite; }
.animate-pulse-orange { animation: pulseOrange 2.5s ease-in-out infinite; }
.animate-pulse-border { animation: pulseBorder 2.5s ease-in-out infinite; }
.animate-glow-pulse   { animation: glowPulse  4s ease-in-out infinite; }
.animate-shimmer      { animation: shimmer    2.2s linear infinite; }
.animate-spin-slow    { animation: rotateCW   14s linear  infinite; }
.animate-spin-ccw     { animation: rotateCCW  14s linear  infinite; }
.animate-bounce-slow  { animation: bounceSlow  3s ease-in-out infinite; }
.animate-drift        { animation: drift      8s ease-in-out infinite; }
.animate-scan         { animation: scanLine   5s linear infinite; }
.animate-chevron      { animation: chevronBounce 1.6s ease-in-out infinite; }

/* Stagger ambient delays */
.animate-delay-100  { animation-delay: 100ms; }
.animate-delay-200  { animation-delay: 200ms; }
.animate-delay-300  { animation-delay: 300ms; }
.animate-delay-400  { animation-delay: 400ms; }
.animate-delay-500  { animation-delay: 500ms; }
.animate-delay-700  { animation-delay: 700ms; }
.animate-delay-1000 { animation-delay: 1000ms; }
.animate-delay-1500 { animation-delay: 1500ms; }


/* ============================================================
   ONE-SHOT ENTRY ANIMATION CLASSES
   (applied by JS / scroll trigger / classList)
   ============================================================ */

.anim-slide-up,
.anim-slide-down,
.anim-slide-left,
.anim-slide-right,
.anim-fade-in,
.anim-scale-in,
.anim-scale-bounce,
.anim-fade-slide {
  opacity: 0;   /* hidden before trigger */
}

.anim-slide-up     { animation: slideUp     0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim-slide-down   { animation: slideDown   0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim-slide-left   { animation: slideLeft   0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim-slide-right  { animation: slideRight  0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim-fade-in      { animation: fadeIn      0.85s ease-out forwards; }
.anim-scale-in     { animation: scaleIn     0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.anim-scale-bounce { animation: scaleInBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.anim-fade-slide   { animation: fadeSlideUp 0.8s  cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Delay steps for staggered groups */
.anim-d-0   { animation-delay: 0ms;   }
.anim-d-100 { animation-delay: 100ms; }
.anim-d-150 { animation-delay: 150ms; }
.anim-d-200 { animation-delay: 200ms; }
.anim-d-250 { animation-delay: 250ms; }
.anim-d-300 { animation-delay: 300ms; }
.anim-d-400 { animation-delay: 400ms; }
.anim-d-500 { animation-delay: 500ms; }
.anim-d-600 { animation-delay: 600ms; }
.anim-d-700 { animation-delay: 700ms; }
.anim-d-800 { animation-delay: 800ms; }


/* ============================================================
   GSAP-MANAGED TARGETS
   (GSAP sets visibility: visible after animating in)
   ============================================================ */

.gsap-reveal   { visibility: hidden; }
.gsap-stagger  { visibility: hidden; }
.gsap-parallax { will-change: transform; }
.gsap-magnetic { will-change: transform; cursor: pointer; }
.gsap-counter  { /* managed by countTo() factory */ }


/* ============================================================
   CSS-ONLY REVEAL (IntersectionObserver fallback)
   ============================================================ */

.reveal-up {
  opacity: 0;
  transform: translateY(45px);
  transition:
    opacity   0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-45px);
  transition:
    opacity   0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right {
  opacity: 0;
  transform: translateX(45px);
  transition:
    opacity   0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.90);
  transition:
    opacity   0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.revealed {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Stagger transition-delay for sibling reveals */
.reveal-d-1 { transition-delay: 80ms;  }
.reveal-d-2 { transition-delay: 160ms; }
.reveal-d-3 { transition-delay: 240ms; }
.reveal-d-4 { transition-delay: 320ms; }
.reveal-d-5 { transition-delay: 400ms; }
.reveal-d-6 { transition-delay: 480ms; }


/* ============================================================
   SPECIAL EFFECTS
   ============================================================ */

/* Shimmer text highlight */
.shimmer-text {
  background: linear-gradient(
    90deg,
    #FF9A3C 0%,
    #ffffff 40%,
    #FF6600 60%,
    #FF9A3C 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* Skeleton loading bone */
.skeleton {
  background: linear-gradient(
    90deg,
    #111111 25%,
    #1C1C1C 50%,
    #111111 75%
  );
  background-size: 250% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: 4px;
}

/* Typewriter container */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  display: inline-block;
  border-right: 2px solid #FF6600;
  animation:
    typewriter 3.5s steps(44, end) forwards,
    blink 0.75s step-end infinite;
}

/* Waveform bars (AI / audio indicator) */
.waveform {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}

.waveform-bar {
  width: 3px;
  height: 100%;
  background: #FF6600;
  border-radius: 2px;
  transform-origin: bottom center;
}

.waveform-bar:nth-child(1) { animation: waveform 1.1s ease-in-out 0.00s infinite; }
.waveform-bar:nth-child(2) { animation: waveform 1.1s ease-in-out 0.10s infinite; }
.waveform-bar:nth-child(3) { animation: waveform 1.1s ease-in-out 0.20s infinite; }
.waveform-bar:nth-child(4) { animation: waveform 1.1s ease-in-out 0.30s infinite; }
.waveform-bar:nth-child(5) { animation: waveform 1.1s ease-in-out 0.40s infinite; }
.waveform-bar:nth-child(6) { animation: waveform 1.1s ease-in-out 0.20s infinite; }

/* Circuit SVG trace animation target */
.svg-trace {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: traceDraw 2.5s ease-out forwards;
}

/* Spinning badge ring */
.spin-ring {
  position: relative;
}

.spin-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #FF6600;
  border-right-color: rgba(255,102,0,0.3);
  animation: spinRing 2s linear infinite;
}

/* Gradient border shimmer */
.border-shimmer {
  position: relative;
  border: none;
  isolation: isolate;
}

.border-shimmer::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    #FF6600,
    #FF9A3C,
    rgba(255,102,0,0.1),
    #FF6600
  );
  background-size: 300% 300%;
  animation: shimmer 3s linear infinite;
  z-index: -1;
}

.border-shimmer::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: calc(inherit - 1px);
  background: #111111;
  z-index: -1;
}


/* ============================================================
   PERFORMANCE / 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;
  }

  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity:   1;
    transform: none;
    transition: none;
  }

  .gsap-reveal,
  .gsap-stagger {
    visibility: visible;
    opacity:    1;
  }
}
