/* 
 * Machina Lore Website - Animations
 * Visual effects and transitions inspired by The Smashing Pumpkins' Machina albums
 */

/* ===== Fade In Animation ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

/* Staggered fade-in for multiple elements */
.fade-in-group > * {
  opacity: 0;
}

.fade-in-group > *:nth-child(1) { animation: fadeIn 0.8s ease forwards 0.1s; }
.fade-in-group > *:nth-child(2) { animation: fadeIn 0.8s ease forwards 0.2s; }
.fade-in-group > *:nth-child(3) { animation: fadeIn 0.8s ease forwards 0.3s; }
.fade-in-group > *:nth-child(4) { animation: fadeIn 0.8s ease forwards 0.4s; }
.fade-in-group > *:nth-child(5) { animation: fadeIn 0.8s ease forwards 0.5s; }
.fade-in-group > *:nth-child(6) { animation: fadeIn 0.8s ease forwards 0.6s; }
.fade-in-group > *:nth-child(7) { animation: fadeIn 0.8s ease forwards 0.7s; }
.fade-in-group > *:nth-child(8) { animation: fadeIn 0.8s ease forwards 0.8s; }
.fade-in-group > *:nth-child(9) { animation: fadeIn 0.8s ease forwards 0.9s; }
.fade-in-group > *:nth-child(10) { animation: fadeIn 0.8s ease forwards 1s; }

/* ===== Glow Effect Animation ===== */
@keyframes glow {
  0% {
    box-shadow: 0 0 5px rgba(123, 104, 238, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(123, 104, 238, 0.6);
  }
  100% {
    box-shadow: 0 0 5px rgba(123, 104, 238, 0.3);
  }
}

.glow-effect {
  animation: glow 3s infinite;
}

/* ===== Pulse Animation ===== */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

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

/* ===== Floating Animation ===== */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

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

/* ===== Text Reveal Animation ===== */
@keyframes revealText {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

.reveal-text {
  position: relative;
  animation: revealText 1s cubic-bezier(0.77, 0, 0.175, 1) forwards;
  animation-delay: 0.5s;
  clip-path: inset(0 100% 0 0);
}

/* ===== Gradient Text Animation ===== */
@keyframes gradientText {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-text {
  background: linear-gradient(90deg, var(--color-accent), var(--color-light), var(--color-accent-alt), var(--color-accent));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-fill-color: transparent;
  animation: gradientText 8s ease infinite;
}

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

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
  pointer-events: none;
}

/* ===== Rotate Animation ===== */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

.rotate-slow {
  animation: rotate 40s linear infinite;
}

/* ===== Page Transition Animation ===== */
@keyframes pageTransition {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-transition {
  animation: pageTransition 0.6s ease-out;
}

/* ===== Hover Effects ===== */

/* Link hover effect */
a.hover-underline {
  position: relative;
  text-decoration: none;
}

a.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-accent);
  transition: width 0.3s ease;
}

a.hover-underline:hover::after {
  width: 100%;
}

/* Button hover effect */
.btn.hover-expand {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn.hover-expand::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.7s ease;
  z-index: -1;
}

.btn.hover-expand:hover::before {
  left: 100%;
}

/* Card hover effect */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(123, 104, 238, 0.3);
}

/* Image hover zoom effect */
.hover-zoom {
  overflow: hidden;
}

.hover-zoom img {
  transition: transform 0.5s ease;
}

.hover-zoom:hover img {
  transform: scale(1.05);
}

/* ===== Timeline Animations ===== */
.timeline-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered timeline animation */
.timeline-item:nth-child(1).visible { transition-delay: 0.1s; }
.timeline-item:nth-child(2).visible { transition-delay: 0.2s; }
.timeline-item:nth-child(3).visible { transition-delay: 0.3s; }
.timeline-item:nth-child(4).visible { transition-delay: 0.4s; }
.timeline-item:nth-child(5).visible { transition-delay: 0.5s; }
.timeline-item:nth-child(6).visible { transition-delay: 0.6s; }
.timeline-item:nth-child(7).visible { transition-delay: 0.7s; }
.timeline-item:nth-child(8).visible { transition-delay: 0.8s; }

/* ===== Gallery Image Zoom Animation ===== */
.gallery-zoom {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(5, 5, 8, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gallery-zoom.active {
  opacity: 1;
  pointer-events: all;
}

.gallery-zoom-image {
  max-width: 90%;
  max-height: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.gallery-zoom.active .gallery-zoom-image {
  transform: scale(1);
}

.gallery-zoom-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--color-light);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.gallery-zoom-close:hover {
  color: var(--color-accent);
}

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

/* ===== Loading Animation ===== */
@keyframes loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(123, 104, 238, 0.3);
  border-radius: 50%;
  border-top-color: var(--color-accent);
  animation: loading 1s ease-in-out infinite;
}

/* ===== Text Typing Animation ===== */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

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

.typing-text {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--color-accent);
  width: 0;
  animation: 
    typing 3.5s steps(40, end) forwards,
    blink 1s step-end infinite;
}

/* ===== Scroll Indicator Animation ===== */
@keyframes scrollIndicator {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.5;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 50px;
  border: 2px solid var(--color-light);
  border-radius: 15px;
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.scroll-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: var(--color-light);
  border-radius: 50%;
  animation: scrollIndicator 2s infinite;
}

/* ===== Background Particles Animation ===== */
.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background-color: var(--color-accent);
  border-radius: 50%;
  opacity: 0.3;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Apply particle animations with JavaScript */