/* ==========================================================================
   Animations — @keyframes + Animation Utilities for Dcodz Theme
   ========================================================================== */

/* -----------------------------------------------------------------------
   @keyframes Definitions
   ----------------------------------------------------------------------- */

/* Fade Up — Elements sliding up into view */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In — Simple opacity transition */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide In Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In — Pop-in effect */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Float — Gentle Y oscillation for blobs/decorative elements */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Pulse — Glowing elements */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* Pulse Glow — Box shadow pulsing */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(1, 112, 185, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(1, 112, 185, 0.6), 0 0 40px rgba(1, 112, 185, 0.2);
  }
}

/* Morph Blob — Clip-path morphing for organic shapes */
@keyframes morphBlob {
  0% {
    clip-path: polygon(50% 0%, 80% 10%, 100% 35%, 95% 65%, 75% 90%, 40% 100%, 10% 80%, 0% 50%, 15% 20%);
  }
  25% {
    clip-path: polygon(40% 5%, 75% 0%, 95% 30%, 100% 60%, 80% 95%, 50% 100%, 15% 85%, 5% 55%, 20% 15%);
  }
  50% {
    clip-path: polygon(55% 5%, 90% 15%, 100% 45%, 90% 75%, 70% 100%, 35% 95%, 5% 75%, 0% 40%, 25% 10%);
  }
  75% {
    clip-path: polygon(45% 0%, 85% 5%, 100% 40%, 95% 70%, 75% 95%, 45% 100%, 10% 85%, 0% 50%, 10% 15%);
  }
  100% {
    clip-path: polygon(50% 0%, 80% 10%, 100% 35%, 95% 65%, 75% 90%, 40% 100%, 10% 80%, 0% 50%, 15% 20%);
  }
}

/* Draw Stroke — SVG stroke animation */
@keyframes drawStroke {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Bounce — For floating action buttons */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

/* Gradient Shift — Background position animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Typewriter Cursor — Blink */
@keyframes typewriterCursor {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Spin — Loading / rotation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Shake — Error / attention */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Counter Up — Number counting effect helper */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ripple — Button click effect */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* -----------------------------------------------------------------------
   Reveal System — Scroll-triggered Animations
   ----------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Reveal variants */
.reveal--left {
  opacity: 0;
  transform: translateX(-40px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}

.reveal--left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal--right {
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}

.reveal--right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal--scale {
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}

.reveal--scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays for child elements */
.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }
.reveal--delay-5 { transition-delay: 0.5s; }
.reveal--delay-6 { transition-delay: 0.6s; }

/* -----------------------------------------------------------------------
   Animation Utility Classes
   ----------------------------------------------------------------------- */
.animate-fadeUp { animation: fadeUp 0.6s var(--ease-out-expo) forwards; }
.animate-fadeIn { animation: fadeIn 0.6s ease forwards; }
.animate-slideInLeft { animation: slideInLeft 0.6s var(--ease-out-expo) forwards; }
.animate-slideInRight { animation: slideInRight 0.6s var(--ease-out-expo) forwards; }
.animate-scaleIn { animation: scaleIn 0.5s var(--ease-out-expo) forwards; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-pulseGlow { animation: pulseGlow 2s ease-in-out infinite; }
.animate-bounce { animation: bounce 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-gradientShift {
  background-size: 200% 200%;
  animation: gradientShift 20s ease infinite;
}

/* -----------------------------------------------------------------------
   Prefers Reduced Motion — Disable ALL animations
   ----------------------------------------------------------------------- */
@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,
  .reveal--left,
  .reveal--right,
  .reveal--scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__blob {
    animation: none;
  }
}
