/* Gather Effect Animation - Lighter and Simpler */
.gather-effect {
  animation: gather-in 0.4s ease-out backwards;
  animation-delay: var(--gather-delay, 0s);
}

@keyframes gather-in {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Content Loading States */
body.welcome-active .gather-effect {
  --gather-x: 0px;
  --gather-y: 0px;
}

/* Main content is visible by default */
main {
  opacity: 1;
  animation: content-fade-in 0.5s ease-out;
}

@keyframes content-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth Scroll Enhancements */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-padding-top: 80px;
  }
}

/* Parallax Elements */
[data-parallax] {
  will-change: transform;
  transition: transform 0.1s ease-out;
}

/* Scroll Fade Elements */
[data-scroll-fade] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-scroll-fade].scrolled-in {
  opacity: 1;
  transform: translateY(0);
}

/* Performance Optimization */
.animations-paused * {
  animation-play-state: paused !important;
  transition: none !important;
}

/* Improved Card Animations */
.card, .action-card, .stat-card {
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.card:hover, .action-card:hover, .stat-card:hover {
  transform: translateY(-8px) scale(1.02);
}

/* Stagger Effect for Lists */
.stagger-item {
  animation: stagger-fade-in 0.5s ease-out backwards;
}

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

@keyframes stagger-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Button Ripple Effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* Enhanced Hover Effects */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-lift:hover {
  transform: translateY(-5px);
}

/* Floating Animation for Icons */
.float-icon {
  animation: float-gentle 3s ease-in-out infinite;
}

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

/* Fade-In Up Animation */
.fade-in-up {
  animation: fade-in-up 0.6s ease-out;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In Animation */
.scale-in {
  animation: scale-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Rotate In Animation */
.rotate-in {
  animation: rotate-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rotate-in {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

/* Slide In From Sides */
.slide-in-left {
  animation: slide-in-left 0.5s ease-out;
}

.slide-in-right {
  animation: slide-in-right 0.5s ease-out;
}

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

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

/* Responsive Performance */
@media (max-width: 768px) {
  .gather-effect {
    animation-duration: 0.5s;
  }
  
  [data-scroll-fade] {
    transition-duration: 0.4s;
  }
}

/* Prefers Reduced Motion */
@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;
  }
  
  .gather-effect,
  [data-scroll-fade],
  .float-icon {
    animation: none !important;
    transition: none !important;
  }
}
