/* ==========================================================================
   RESONATE LABS - Animations
   Keyframes, transitions, and motion effects
   ========================================================================== */

/* ===== Keyframe Animations ===== */

/* Pulse - for orb/sphere breathing */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* Glow pulse - for neon effects */
@keyframes glow {
  0%, 100% {
    opacity: 0.4;
    filter: blur(20px);
  }
  50% {
    opacity: 0.7;
    filter: blur(30px);
  }
}

/* Rotate - for edge lighting and spinning elements */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Float - for plasma blobs */
@keyframes float {
  0%, 100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(30px, -20px);
  }
  50% {
    transform: translate(-20px, 30px);
  }
  75% {
    transform: translate(-30px, -10px);
  }
}

/* Fade in */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide up - for scroll reveals */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in scale */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Color cycle - brainwave colors */
@keyframes colorCycle {
  0% { color: var(--neon-delta); }
  20% { color: var(--neon-theta); }
  40% { color: var(--neon-alpha); }
  60% { color: var(--neon-beta); }
  80% { color: var(--neon-gamma); }
  100% { color: var(--neon-delta); }
}

/* Background color cycle */
@keyframes bgColorCycle {
  0% { background-color: var(--neon-delta); }
  20% { background-color: var(--neon-theta); }
  40% { background-color: var(--neon-alpha); }
  60% { background-color: var(--neon-beta); }
  80% { background-color: var(--neon-gamma); }
  100% { background-color: var(--neon-delta); }
}

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

.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-rotate-slow {
  animation: rotate 40s linear infinite;
}

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

.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out forwards;
}

.animate-color-cycle {
  animation: colorCycle 10s linear infinite;
}

/* ===== Scroll Reveal Animations ===== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

.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;
}

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.stagger-children.revealed > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children.revealed > *:nth-child(2) { transition-delay: 100ms; }
.stagger-children.revealed > *:nth-child(3) { transition-delay: 200ms; }
.stagger-children.revealed > *:nth-child(4) { transition-delay: 300ms; }
.stagger-children.revealed > *:nth-child(5) { transition-delay: 400ms; }

.stagger-children.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Loading Animations ===== */

.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--glass-light) 0%,
    var(--glass-medium) 50%,
    var(--glass-light) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.loading-dots {
  display: flex;
  gap: var(--space-xs);
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--neon-alpha);
  border-radius: var(--radius-full);
  animation: pulse 1.4s ease-in-out infinite;
}

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

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ===== Plasma Background ===== */

.plasma {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.plasma__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(var(--blur-plasma));
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
  will-change: transform;
}

.plasma__blob--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--neon-delta), transparent 70%);
  top: -10%;
  left: -10%;
  animation-duration: 25s;
}

.plasma__blob--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--neon-theta), transparent 70%);
  top: 30%;
  right: -10%;
  animation-duration: 30s;
  animation-delay: -5s;
}

.plasma__blob--3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--neon-alpha), transparent 70%);
  bottom: -10%;
  left: 20%;
  animation-duration: 22s;
  animation-delay: -10s;
}

.plasma__blob--4 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--neon-beta), transparent 70%);
  top: 50%;
  left: 50%;
  animation-duration: 28s;
  animation-delay: -15s;
}

/* ===== Visualizer Glow ===== */

.visualizer-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--current-color, var(--neon-alpha)) 0%,
    transparent 70%
  );
  opacity: 0.3;
  animation: glow 2s ease-in-out infinite;
  pointer-events: none;
}

/* ===== Neon Pulse Line ===== */

.neon-line {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--neon-alpha),
    transparent
  );
  opacity: 0.5;
}

.neon-line--animated {
  animation: pulse 1s ease-in-out infinite;
}

/* ===== Hero Scroll Hint ===== */

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

/* ===== Spin (for icons) ===== */

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

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ===== Scale pulse (for buttons) ===== */

@keyframes scalePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

/* ===== Reduced Motion ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-pulse,
  .animate-glow,
  .animate-rotate,
  .animate-rotate-slow,
  .animate-float,
  .animate-color-cycle,
  .animate-spin,
  .animate-scale-pulse {
    animation: none;
  }

  .plasma__blob {
    animation: none;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stagger-children > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .loading-shimmer {
    animation: none;
  }

  .loading-dots span {
    animation: none;
  }

  .visualizer-glow {
    animation: none;
    opacity: 0.2;
  }
}

/* ===== Mobile Performance ===== */

@media (max-width: 768px) {
  .plasma__blob {
    filter: blur(var(--blur-xl));
    opacity: 0.25;
  }

  /* Hide extra blobs on mobile for performance */
  .plasma__blob--3,
  .plasma__blob--4 {
    display: none;
  }

  .visualizer-glow {
    filter: blur(var(--blur-lg));
  }

  /* Reduce animation complexity on mobile */
  .animate-float {
    animation-duration: 30s;
  }

  .animate-rotate,
  .animate-rotate-slow {
    animation-duration: 60s;
  }
}

/* ===== High Performance Mode ===== */

@media (prefers-reduced-data: reduce) {
  .plasma__blob {
    display: none;
  }

  .visualizer-glow {
    display: none;
  }
}
