/* ===============================================
   ByteWebster Portfolio Animations
   Sliding and Swiping Animations
   =============================================== */

/* ===============================================
   Base Animation Classes
   =============================================== */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Top */
@keyframes slideInTop {
  from {
    opacity: 0;
    transform: translateY(-100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In From Bottom */
@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In Animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Rotate In Animation */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

/* Bounce In Animation */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Flip In Animation */
@keyframes flipInX {
  from {
    opacity: 0;
    transform: perspective(400px) rotateX(90deg);
  }
  40% {
    transform: perspective(400px) rotateX(-20deg);
  }
  60% {
    transform: perspective(400px) rotateX(10deg);
  }
  80% {
    transform: perspective(400px) rotateX(-5deg);
  }
  to {
    opacity: 1;
    transform: perspective(400px) rotateX(0deg);
  }
}

/* Zoom In Animation */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide and Fade Animation */
@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50px) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

/* ===============================================
   Animation Classes
   =============================================== */

/* Fade In */
.animate-fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

/* Slide Animations */
.animate-slide-left {
  opacity: 0;
  animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-right {
  opacity: 0;
  animation: slideInRight 0.8s ease-out forwards;
}

.animate-slide-top {
  opacity: 0;
  animation: slideInTop 0.8s ease-out forwards;
}

.animate-slide-bottom {
  opacity: 0;
  animation: slideInBottom 0.8s ease-out forwards;
}

/* Scale Animations */
.animate-scale-in {
  opacity: 0;
  animation: scaleIn 0.6s ease-out forwards;
}

/* Rotate Animations */
.animate-rotate-in {
  opacity: 0;
  animation: rotateIn 0.8s ease-out forwards;
}

/* Bounce Animations */
.animate-bounce-in {
  opacity: 0;
  animation: bounceIn 0.8s ease-out forwards;
}

/* Flip Animations */
.animate-flip-in {
  opacity: 0;
  animation: flipInX 0.8s ease-out forwards;
}

/* Zoom Animations */
.animate-zoom-in {
  opacity: 0;
  animation: zoomIn 0.6s ease-out forwards;
}

/* Slide and Fade */
.animate-slide-fade {
  opacity: 0;
  animation: slideFadeIn 0.8s ease-out forwards;
}

/* ===============================================
   Staggered Animations
   =============================================== */

.animate-stagger-1 {
  animation-delay: 0.1s;
}

.animate-stagger-2 {
  animation-delay: 0.2s;
}

.animate-stagger-3 {
  animation-delay: 0.3s;
}

.animate-stagger-4 {
  animation-delay: 0.4s;
}

.animate-stagger-5 {
  animation-delay: 0.5s;
}

.animate-stagger-6 {
  animation-delay: 0.6s;
}

/* ===============================================
   Hover Animations
   =============================================== */

/* Image Hover Effects */
.animate-hover-scale {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.animate-hover-scale:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Card Hover Effects */
.animate-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.animate-hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* Button Hover Effects */
.animate-hover-pulse {
  transition: transform 0.2s ease;
}

.animate-hover-pulse:hover {
  transform: scale(1.05);
}

/* ===============================================
   Continuous Animations
   =============================================== */

/* Floating Animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Rotate Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-rotate {
  animation: rotate 4s linear infinite;
}

/* ===============================================
   Scroll Triggered Animations
   =============================================== */

/* Intersection Observer Classes */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s ease-out;
}

.animate-on-scroll.animate-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Left Slide on Scroll */
.animate-slide-left-scroll {
  opacity: 0;
  transform: translateX(-100px);
  transition: all 0.8s ease-out;
}

.animate-slide-left-scroll.animate-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Right Slide on Scroll */
.animate-slide-right-scroll {
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.8s ease-out;
}

.animate-slide-right-scroll.animate-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale on Scroll */
.animate-scale-scroll {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s ease-out;
}

.animate-scale-scroll.animate-visible {
  opacity: 1;
  transform: scale(1);
}

/* ===============================================
   Portfolio Specific Animations
   =============================================== */

/* Portfolio Grid Animation */
.portfolio-item {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.portfolio-item.animate-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Service Card Animation */
.service-card {
  opacity: 0;
  transform: translateY(50px) scale(0.9);
  transition: all 0.8s ease-out;
}

.service-card.animate-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Counter Animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-counter {
  animation: countUp 0.8s ease-out forwards;
}

/* Testimonial Slide Animation */
.testimonial-slide {
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.8s ease-out;
}

.testimonial-slide.animate-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ===============================================
   Responsive Animation Adjustments
   =============================================== */

@media (max-width: 768px) {
  /* Reduce animation intensity on mobile */
  .animate-slide-left,
  .animate-slide-right,
  .animate-slide-left-scroll,
  .animate-slide-right-scroll {
    transform: translateX(0);
    animation: fadeIn 0.6s ease-out forwards;
  }
  
  .animate-slide-top,
  .animate-slide-bottom {
    transform: translateY(0);
    animation: fadeIn 0.6s ease-out forwards;
  }
  
  /* Disable continuous animations on mobile for performance */
  .animate-float,
  .animate-pulse,
  .animate-rotate {
    animation: none;
  }
}

/* ===============================================
   Performance Optimizations
   =============================================== */

/* Use GPU acceleration for smooth animations */
.animate-slide-left,
.animate-slide-right,
.animate-slide-top,
.animate-slide-bottom,
.animate-scale-in,
.animate-zoom-in,
.animate-hover-scale,
.animate-hover-lift {
  will-change: transform, opacity;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===============================================
   Custom Animation Utilities
   =============================================== */

/* Animation Duration Classes */
.animate-duration-fast {
  animation-duration: 0.3s !important;
}

.animate-duration-normal {
  animation-duration: 0.6s !important;
}

.animate-duration-slow {
  animation-duration: 1s !important;
}

/* Animation Timing Classes */
.animate-ease-in {
  animation-timing-function: ease-in !important;
}

.animate-ease-out {
  animation-timing-function: ease-out !important;
}

.animate-ease-in-out {
  animation-timing-function: ease-in-out !important;
}

/* Animation Fill Mode */
.animate-fill-forwards {
  animation-fill-mode: forwards !important;
}

.animate-fill-backwards {
  animation-fill-mode: backwards !important;
}

.animate-fill-both {
  animation-fill-mode: both !important;
}
