/* Smooth Animations and Transitions for Sparks Theme */

/* Base animation utilities */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced hover effects for post cards */
.post-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0); /* Force hardware acceleration */
}

.post-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.post-card:hover .post-image {
  transform: scale(1.05);
}

.post-card .post-image {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-title {
  color: #5755d9;
}

.post-card .post-title {
  transition: color 0.25s ease-out;
}

/* Dropdown animations are now handled by TailwindCSS Elements */

/* Mobile menu animations */
.mobile-menu-overlay {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.mobile-menu-overlay.show {
  opacity: 1;
}

.mobile-menu-panel {
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-panel.show {
  transform: translateX(0);
}

/* Mobile menu items stagger animation */
.mobile-menu-item {
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.3s ease-out;
}

.mobile-menu-panel.show .mobile-menu-item {
  opacity: 1;
  transform: translateX(0);
}

.mobile-menu-panel.show .mobile-menu-item:nth-child(1) { transition-delay: 0.1s; }
.mobile-menu-panel.show .mobile-menu-item:nth-child(2) { transition-delay: 0.15s; }
.mobile-menu-panel.show .mobile-menu-item:nth-child(3) { transition-delay: 0.2s; }
.mobile-menu-panel.show .mobile-menu-item:nth-child(4) { transition-delay: 0.25s; }
.mobile-menu-panel.show .mobile-menu-item:nth-child(5) { transition-delay: 0.3s; }

/* Button hover animations */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease-out;
}

.btn-primary::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.5s ease-out;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(87, 85, 217, 0.3);
}

/* Hero section animations */
.hero-title {
  animation: fadeInUp 0.8s ease-out;
}

.hero-description {
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-buttons {
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-social {
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

/* Loading animations */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #5755d9;
  animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Scroll-based animations */
.scroll-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.scroll-slide-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-slide-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger animations for grids */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-container.animate .stagger-item:nth-child(1) { 
  animation: fadeInUp 0.4s ease-out 0.1s both; 
}
.stagger-container.animate .stagger-item:nth-child(2) { 
  animation: fadeInUp 0.4s ease-out 0.2s both; 
}
.stagger-container.animate .stagger-item:nth-child(3) { 
  animation: fadeInUp 0.4s ease-out 0.3s both; 
}
.stagger-container.animate .stagger-item:nth-child(4) { 
  animation: fadeInUp 0.4s ease-out 0.4s both; 
}
.stagger-container.animate .stagger-item:nth-child(5) { 
  animation: fadeInUp 0.4s ease-out 0.5s both; 
}
.stagger-container.animate .stagger-item:nth-child(6) { 
  animation: fadeInUp 0.4s ease-out 0.6s both; 
}
.stagger-container.animate .stagger-item:nth-child(7) { 
  animation: fadeInUp 0.4s ease-out 0.7s both; 
}
.stagger-container.animate .stagger-item:nth-child(8) { 
  animation: fadeInUp 0.4s ease-out 0.8s both; 
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .animate-on-scroll,
  .scroll-fade-in,
  .scroll-slide-left,
  .scroll-slide-right,
  .scroll-scale-in {
    opacity: 1;
    transform: none;
  }
}

/* Performance optimizations */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Focus animations for accessibility */
.focus-ring {
  transition: box-shadow 0.2s ease-out;
}

.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(87, 85, 217, 0.3);
}

/* Micro-interactions */
.micro-bounce:active {
  transform: scale(0.95);
  transition: transform 0.1s ease-out;
}

.micro-pulse:hover {
  animation: pulseGentle 1s ease-in-out;
}

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

/* Custom easing functions */
.ease-spring {
  transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ease-smooth {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.ease-bounce {
  transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Keyframes for animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes loadingDots {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

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

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}