/**
 * Soonflow Animations
 * Special animations and visual effects for stunning design
 */

/* ========== Hero Gradient Animation ========== */
.hero-gradient {
  position: relative;
  background: var(--gradient-hero);
  overflow: hidden;
}

.hero-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 20% 50%,
    rgba(99, 102, 241, 0.3) 0%,
    transparent 50%
  );
  animation: gradientMove 8s ease-in-out infinite alternate;
}

.hero-gradient::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 80% 50%,
    rgba(139, 92, 246, 0.3) 0%,
    transparent 50%
  );
  animation: gradientMove 10s ease-in-out infinite alternate-reverse;
}

@keyframes gradientMove {
  0% {
    transform: translateX(-10%) translateY(-10%) scale(1);
  }
  100% {
    transform: translateX(10%) translateY(10%) scale(1.1);
  }
}

/* ========== Floating Elements ========== */
.float {
  animation: float 6s ease-in-out infinite;
}

.float-delayed {
  animation: float 6s ease-in-out infinite;
  animation-delay: -3s;
}

/* ========== Glow Effect ========== */
.glow {
  animation: glow 2s ease-in-out infinite;
}

.glow-text {
  text-shadow: 0 0 20px var(--accent-glow);
}

/* ========== Shimmer Effect ========== */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmerSlide 2s infinite;
}

@keyframes shimmerSlide {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* ========== Reveal on Scroll ========== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-from-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-from-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ========== Typing Effect ========== */
.typing {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent-primary);
  animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
  width: 0;
}

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

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

/* ========== Bounce ========== */
.bounce {
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-25%);
  }
}

/* ========== Shake ========== */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ========== Morphing Shape ========== */
.morph {
  animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
  0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

/* ========== Particle Effect ========== */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.3;
  animation: particleFloat 15s linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100%) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ========== Wave Animation ========== */
.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23FEFEFE' fill-opacity='1' d='M0,96L48,112C96,128 192,160 288,160C384,160 480,128 576,122.7C672,117 768,139 864,154.7C960,171 1056,181 1152,165.3C1248,149 1344,107 1392,85.3L1440,64L1440,320L1392,320C1344,320 1248,320 1152,320C1056,320 960,320 864,320C768,320 672,320 576,320C480,320 384,320 288,320C192,320 96,320 48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") no-repeat bottom;
  background-size: cover;
  animation: wave 10s linear infinite;
}

[data-theme="dark"] .wave {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%230F0E19' fill-opacity='1' d='M0,96L48,112C96,128 192,160 288,160C384,160 480,128 576,122.7C672,117 768,139 864,154.7C960,171 1056,181 1152,165.3C1248,149 1344,107 1392,85.3L1440,64L1440,320L1392,320C1344,320 1248,320 1152,320C1056,320 960,320 864,320C768,320 672,320 576,320C480,320 384,320 288,320C192,320 96,320 48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") no-repeat bottom;
  background-size: cover;
}

@keyframes wave {
  0% { background-position-x: 0; }
  100% { background-position-x: 1440px; }
}

/* ========== Line Animation ========== */
.line-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: lineDraw 3s ease forwards;
}

@keyframes lineDraw {
  to { stroke-dashoffset: 0; }
}

/* ========== Stagger Children Animation ========== */
.stagger > * {
  opacity: 0;
  animation: slideUp 0.5s ease forwards;
}

/* ========== Spotlight Effect ========== */
.spotlight {
  position: relative;
}

.spotlight::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--x, 50%) var(--y, 50%),
    rgba(99, 102, 241, 0.15) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.spotlight:hover::before {
  opacity: 1;
}

/* ========== Marquee ========== */
.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: inline-block;
  animation: marquee 20s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ========== Counter Animation ========== */
.counter {
  font-variant-numeric: tabular-nums;
}

/* ========== Ring Animation ========== */
.ring {
  display: inline-block;
  position: relative;
}

.ring::before,
.ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid transparent;
  border-radius: inherit;
}

.ring::before {
  border-top-color: var(--accent-primary);
  animation: ringSpin 2s linear infinite;
}

.ring::after {
  border-bottom-color: var(--accent-primary);
  animation: ringSpin 2s linear infinite reverse;
}

@keyframes ringSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== Text Gradient ========== */
.text-gradient {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== Card Hover Effects ========== */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.card-3d:hover {
  transform: perspective(1000px) rotateY(5deg) rotateX(5deg);
}

/* ========== Magnetic Button Effect ========== */
.magnetic {
  transition: transform 0.3s ease;
}

/* ========== Loading Dots ========== */
.loading-dots {
  display: inline-flex;
  gap: 0.25rem;
}

.loading-dots span {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: loadingDot 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingDot {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
