/* ============================================================
   Threat Forge — Animations & Keyframes
   ============================================================ */

/* ── fadeInUp ────────────────────────────────────────────────── */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── fadeInDown ───────────────────────────────────────────────── */
@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── fadeIn ───────────────────────────────────────────────────── */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* ── fadeInLeft ───────────────────────────────────────────────── */
@keyframes fadeInLeft {
  0% {
    opacity: 0;
    transform: translateX(-30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── fadeInRight ──────────────────────────────────────────────── */
@keyframes fadeInRight {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Float (subtle up-down) ──────────────────────────────────── */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

/* ── Pulse (scale) ───────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.85;
  }
}

/* ── Pulse Dot ───────────────────────────────────────────────── */
@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(0, 240, 255, 0);
  }
}

/* ── Glow (alternating intensity) ────────────────────────────── */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.10),
                0 0 40px rgba(0, 240, 255, 0.05);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.20),
                0 0 60px rgba(0, 240, 255, 0.10);
  }
}

/* ── Text Glow ───────────────────────────────────────────────── */
@keyframes textGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.3),
                 0 0 30px rgba(0, 240, 255, 0.1);
  }
  50% {
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.5),
                 0 0 50px rgba(0, 240, 255, 0.2);
  }
}

/* ── Marquee (horizontal scroll) ─────────────────────────────── */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ── Bounce (for scroll indicator) ───────────────────────────── */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0) translateX(-50%);
  }
  40% {
    transform: translateY(-8px) translateX(-50%);
  }
  60% {
    transform: translateY(-4px) translateX(-50%);
  }
}

/* ── Typing Cursor Blink ─────────────────────────────────────── */
@keyframes typingCursor {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ── Gradient Shift (moving gradient bg) ─────────────────────── */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ── Rotate ──────────────────────────────────────────────────── */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ── Scale In ────────────────────────────────────────────────── */
@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Shimmer ─────────────────────────────────────────────────── */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ── Border Glow Sweep ───────────────────────────────────────── */
@keyframes borderGlow {
  0% {
    border-color: rgba(0, 240, 255, 0.15);
  }
  50% {
    border-color: rgba(0, 240, 255, 0.35);
  }
  100% {
    border-color: rgba(0, 240, 255, 0.15);
  }
}

/* ── Ripple ──────────────────────────────────────────────────── */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ── Line Grow ───────────────────────────────────────────────── */
@keyframes lineGrow {
  0% {
    height: 0;
  }
  100% {
    height: 100%;
  }
}

/* ============================================================
   Scroll-triggered Animation Utilities
   ============================================================ */

/* Initial hidden state — elements start invisible and shifted down */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out),
              transform 0.7s var(--ease-out);
  will-change: opacity, transform;
}

/* Visible state (toggled by Intersection Observer in JS) */
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for child elements */
.animate-on-scroll.delay-1 { transition-delay: 100ms; }
.animate-on-scroll.delay-2 { transition-delay: 200ms; }
.animate-on-scroll.delay-3 { transition-delay: 300ms; }
.animate-on-scroll.delay-4 { transition-delay: 400ms; }
.animate-on-scroll.delay-5 { transition-delay: 500ms; }
.animate-on-scroll.delay-6 { transition-delay: 600ms; }

/* Directional variants */
.animate-on-scroll.from-left {
  transform: translateX(-30px);
}
.animate-on-scroll.from-left.visible {
  transform: translateX(0);
}

.animate-on-scroll.from-right {
  transform: translateX(30px);
}
.animate-on-scroll.from-right.visible {
  transform: translateX(0);
}

.animate-on-scroll.from-scale {
  transform: scale(0.95);
}
.animate-on-scroll.from-scale.visible {
  transform: scale(1);
}

/* ============================================================
   Animation Utility Classes
   ============================================================ */

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

.animate-rotate {
  animation: rotate 20s linear infinite;
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

/* ============================================================
   Reduced Motion — Respect user preferences
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .animate-float,
  .animate-pulse,
  .animate-glow,
  .animate-rotate,
  .animate-shimmer {
    animation: none;
  }

  .animate-on-scroll.visible {
    transform: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
