/* Animations CSS */

/* Custom Animations */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

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

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

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

@keyframes morph {
  0%, 100% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  }
  25% {
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
  }
  50% {
    border-radius: 30% 30% 70% 70% / 70% 30% 30% 70%;
  }
  75% {
    border-radius: 70% 70% 30% 30% / 30% 70% 70% 30%;
  }
}

@keyframes artMorph {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(5deg) scale(1.05);
  }
  50% {
    transform: rotate(0deg) scale(1.1);
  }
  75% {
    transform: rotate(-5deg) scale(1.05);
  }
}

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

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

@keyframes paintStroke {
  0% {
    stroke-dashoffset: 1000;
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 1s ease forwards;
}

.slide-in-left {
  animation: slideInLeft 1s ease forwards;
}

.slide-in-right {
  animation: slideInRight 1s ease forwards;
}

.scale-in {
  animation: scaleIn 1s ease forwards;
}

.appear {
  animation: appear 1s ease forwards;
}

/* Staggered Animations */
.stagger-item:nth-child(1) {
  animation-delay: 0.1s;
}

.stagger-item:nth-child(2) {
  animation-delay: 0.3s;
}

.stagger-item:nth-child(3) {
  animation-delay: 0.5s;
}

.stagger-item:nth-child(4) {
  animation-delay: 0.7s;
}

.stagger-item:nth-child(5) {
  animation-delay: 0.9s;
}

.stagger-item:nth-child(6) {
  animation-delay: 1.1s;
}

/* Cursor Follower Animation */
@media (pointer: fine) {
  .cursor-follower {
    display: block;
  }
}

/* Paint Brush Stroke Animation */
.paint-stroke {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: paintStroke 2s ease forwards;
}

/* Gradient Text Animation */
.gradient-text {
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent), var(--purple), var(--primary));
  background-size: 400% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientFlow 8s ease infinite;
}

/* Ripple Effect */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1);
  animation: ripple 1s;
}

/* Button Hover Effects */
.btn-hover-effect {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-hover-effect: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: all 0.5s ease;
}

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

/* Parallax Effect */
.parallax {
  transition: transform 0.2s ease-out;
}

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

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  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;
}

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

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

.shimmer:after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  animation: shimmerEffect 3s infinite;
}

@keyframes shimmerEffect {
  from {
    transform: rotate(30deg) translateX(-100%);
  }
  to {
    transform: rotate(30deg) translateX(100%);
  }
}

/* Neon Glow Effect */
.neon-glow {
  position: relative;
}

.neon-glow:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary), 0 0 30px var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.neon-glow:hover:before {
  opacity: 1;
}

/* Typing Animation */
.typing {
  overflow: hidden;
  border-right: 0.15em solid var(--primary);
  white-space: nowrap;
  margin: 0 auto;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--primary);
  }
}

/* Perspective Tilt */
.tilt-effect {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

/* Initialize animations on scroll */
document.addEventListener('DOMContentLoaded', function() {
  const scrollAnimElements = document.querySelectorAll('.scroll-anim');
  
  function checkScrollAnim() {
    scrollAnimElements.forEach(element => {
      const elementTop = element.getBoundingClientRect().top;
      const windowHeight = window.innerHeight;
      
      if (elementTop < windowHeight * 0.8) {
        element.classList.add('animate');
      }
    });
  }
  
  window.addEventListener('scroll', checkScrollAnim);
  checkScrollAnim(); // Check on initial load
});