/* Advanced Animations and Effects */

/* Loading animation */
.loading {
  position: relative;
  overflow: hidden;
}

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

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Staggered animations for feature cards */
.feature:nth-child(1) {
  animation-delay: 0.1s;
}

.feature:nth-child(2) {
  animation-delay: 0.2s;
}

.feature:nth-child(3) {
  animation-delay: 0.3s;
}

.feature:nth-child(4) {
  animation-delay: 0.4s;
}

/* Pulse animation for CTA buttons */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
  }
}

.btn--primary:hover {
  animation: pulse 2s infinite;
}

/* Typewriter effect for hero title */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

.hero__title.typewriter {
  overflow: hidden;
  border-right: 3px solid rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  animation: 
    typewriter 3s steps(40, end),
    blink 0.75s step-end infinite;
}

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

/* Smooth reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
}
.hero__image img {
  animation: none !important;
  transition: none !important;
  transform: none !important;
  will-change: auto !important;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s ease;
}

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

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s ease;
}

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

/* Scale animation for feature icons */
.feature__icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature:hover .feature__icon {
  transform: scale(1.1) rotate(5deg);
}

/* Progress bar animation */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 2px;
  animation: progress 2s ease-in-out forwards;
}

@keyframes progress {
  from {
    width: 0%;
  }
  to {
    width: var(--progress-width, 100%);
  }
}

/* Glowing effect for active navigation links */
.nav__link--active {
  position: relative;
}

.nav__link--active::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(
    circle,
    rgba(102, 126, 234, 0.3) 0%,
    transparent 70%
  );
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  z-index: -1;
}

.nav__link--active:hover::before {
  width: 100px;
  height: 100px;
}

/* Card flip animation */
.card-flip {
  perspective: 1000px;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
  transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius);
}

.card-flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Gradient text animation */
@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-text {
  background: linear-gradient(
    -45deg,
    var(--primary-color),
    var(--secondary-color),
    var(--accent-color),
    var(--primary-color)
  );
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient 3s ease infinite;
}

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

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 1.5rem;
  animation: bounce 2s infinite;
  cursor: pointer;
}

/* Morphing background shapes */
@keyframes morph {
  0%, 100% {
    border-radius: 40% 60% 70% 30% / 40% 40% 60% 50%;
  }
  34% {
    border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
  }
  67% {
    border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%;
  }
}

.morph-shape {
  position: absolute;
  width: 300px;
  height: 300px;
  background: linear-gradient(
    45deg,
    rgba(102, 126, 234, 0.1),
    rgba(118, 75, 162, 0.1)
  );
  animation: morph 8s ease-in-out infinite;
  z-index: -1;
}

/* Responsive animations */
@media (max-width: 768px) {
  .hero__title.typewriter {
    animation: none;
    border-right: none;
    white-space: normal;
  }
  
  .feature:hover .feature__icon {
    transform: scale(1.05);
  }
  
  .parallax {
    background-attachment: scroll;
  }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero__title.typewriter {
    animation: none;
    border-right: none;
  }
  
  .scroll-indicator {
    animation: none;
  }
}

