/* Animations CSS for UPF Website */

/* Energy Wave Animation */
@keyframes waveFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes waveOpacity {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 0.2;
  }
}

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

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* Animation Classes */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Floating Particles */
.floating-particle {
  position: absolute;
  opacity: 0.2;
  pointer-events: none;
  animation: float 15s ease infinite;
}

.floating-particle:nth-child(1) {
  top: 10%;
  left: 10%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
  border-radius: 50%;
  animation-duration: 20s;
}

.floating-particle:nth-child(2) {
  top: 60%;
  right: 15%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--secondary-color) 0%, transparent 70%);
  border-radius: 50%;
  animation-duration: 25s;
  animation-delay: 2s;
}

.floating-particle:nth-child(3) {
  bottom: 20%;
  left: 20%;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
  border-radius: 50%;
  animation-duration: 18s;
  animation-delay: 1s;
}

/* Energy Wave Specific Styles */
.energy-wave {
  background: linear-gradient(45deg, 
    rgba(126, 87, 194, 0.3), 
    rgba(0, 229, 255, 0.3), 
    rgba(118, 255, 3, 0.3), 
    rgba(126, 87, 194, 0.3));
  background-size: 400% 400%;
  animation: 
    waveFlow 15s ease infinite,
    waveOpacity 10s ease infinite,
    waveScale 20s ease infinite;
}

.energy-wave::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255, 255, 255, 0.1)" stroke-width="1"/></svg>') center/300px repeat,
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><circle cx="100" cy="100" r="80" fill="none" stroke="rgba(255, 255, 255, 0.05)" stroke-width="1"/></svg>') center/500px repeat;
  opacity: 0.3;
  z-index: -1;
}

/* Scroll-triggered animations */
.scroll-animate {
  opacity: 0;
  transition: all 0.8s ease;
}

.scroll-animate.from-bottom {
  transform: translateY(50px);
}

.scroll-animate.from-left {
  transform: translateX(-50px);
}

.scroll-animate.from-right {
  transform: translateX(50px);
}

.scroll-animate.visible {
  opacity: 1;
  transform: translate(0);
}

/* Pulse effect for interactive elements */
.pulse-effect {
  animation: pulse 2s infinite ease-in-out;
}

/* Glow effects */
.glow-text {
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.7);
}

.glow-box {
  box-shadow: 0 0 15px rgba(126, 87, 194, 0.7);
}

/* Particle collapse animation for equation demonstrations */
@keyframes particleCollapse {
  0% {
    transform: scale(1.5);
    opacity: 0.3;
    filter: blur(10px);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

.particle-collapse {
  animation: particleCollapse 0.5s forwards ease-out;
}

/* Particle expansion animation for equation demonstrations */
@keyframes particleExpand {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: scale(1.5);
    opacity: 0.3;
    filter: blur(10px);
  }
}

.particle-expand {
  animation: particleExpand 0.5s forwards ease-out;
}

/* Wave ripple effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 1s linear;
  background-color: rgba(255, 255, 255, 0.3);
}

/* Loading animation */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--secondary-color);
  animation: spin 1s ease-in-out infinite;
  margin: 20px auto;
}

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

/* Parallax effect */
.parallax {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Typing animation for text */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

.typing-animation {
  overflow: hidden;
  white-space: nowrap;
  animation: typing 3.5s steps(40, end);
}

/* Blinking cursor animation */
@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--secondary-color); }
}

.cursor-animation {
  border-right: .15em solid var(--secondary-color);
  animation: blink-caret .75s step-end infinite;
}
