/**
 * mycoyouco Landing Page - Animations
 * Scroll-triggered animations and transitions
 */

/* ============================================
   Reduced Motion Support
   ============================================ */
@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 {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================
   Scroll Animation Base States
   ============================================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Fade In Up */
.fade-in-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Fade In Left */
.fade-in-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.animate-in {
  opacity: 1;
  transform: translateX(0);
}

/* Fade In Right */
.fade-in-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.animate-in {
  opacity: 1;
  transform: translateX(0);
}

/* Scale In */
.scale-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ============================================
   Staggered Animation Delays
   ============================================ */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }

/* ============================================
   Hero Animations
   ============================================ */
.hero-content > * {
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s ease forwards;
}

.hero-content > *:nth-child(1) { animation-delay: 0.1s; }
.hero-content > *:nth-child(2) { animation-delay: 0.2s; }
.hero-content > *:nth-child(3) { animation-delay: 0.3s; }
.hero-content > *:nth-child(4) { animation-delay: 0.4s; }
.hero-content > *:nth-child(5) { animation-delay: 0.5s; }

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero Background - Animation removed for performance
   The gradient at 10% opacity is barely visible, no need to animate */

/* ============================================
   Entity Cards Hover Effects
   ============================================ */
.entity-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.entity-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px var(--color-shadow-lg);
}

.entity-icon {
  transition: transform 0.3s ease;
}

.entity-card:hover .entity-icon {
  transform: scale(1.1);
}

/* ============================================
   Feature Cards Hover Effects
   ============================================ */
.feature-card {
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
}

.feature-icon {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover .feature-icon {
  transform: scale(1.05);
  box-shadow: 0 8px 24px var(--color-shadow-md);
}

/* ============================================
   Button Hover Effects
   ============================================ */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.btn:hover::after {
  width: 300px;
  height: 300px;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* ============================================
   Pricing Card Hover Effects
   ============================================ */
.pricing-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px var(--color-shadow-lg);
}

/* ============================================
   Link Underline Animation
   ============================================ */
.animated-link {
  position: relative;
  display: inline-block;
}

.animated-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.animated-link:hover::after {
  width: 100%;
}

/* ============================================
   Scroll Indicator Animation
   ============================================ */
.scroll-indicator {
  animation: scrollBounce 2s infinite;
}

@keyframes scrollBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.scroll-indicator svg {
  animation: scrollArrow 1.5s infinite;
}

@keyframes scrollArrow {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-surface-container);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================
   Pulse Animation - Disabled for performance
   ============================================ */
/* .pulse animation removed - was running infinitely on hero badge */

/* ============================================
   Diagram Animations
   ============================================ */
.diagram-node {
  transition: transform 0.3s ease, filter 0.3s ease;
}

.diagram-node:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 12px var(--color-shadow-md));
}

.diagram-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 2s ease forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

/* ============================================
   Carousel Scrolling Hint
   ============================================ */
.carousel-hint {
  animation: scrollHint 1.5s ease-in-out infinite;
}

@keyframes scrollHint {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(10px);
  }
}

/* ============================================
   Navigation Scroll Effects
   ============================================ */
.nav {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav.scrolled {
  box-shadow: 0 2px 20px var(--color-shadow);
}

/* ============================================
   Mobile Menu Transitions
   ============================================ */
.nav-mobile-menu {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.nav-mobile-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-mobile-menu li {
  opacity: 0;
  transform: translateX(-20px);
}

.nav-mobile-menu.open li {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* ============================================
   Floating Animation (for decorative elements)
   ============================================ */
.float {
  animation: float 6s ease-in-out infinite;
}

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

/* ============================================
   Typing Effect (optional for hero)
   ============================================ */
.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background-color: var(--color-primary);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
