/**
 * Global Motion System
 * Micro-Interaction Design System for tiktokpaket.com
 * 
 * Purpose: Centralized design tokens for consistent, performant animations
 * Philosophy: Restrained premium - subtle, purposeful, accessible
 */

:root {
  /* ==================== */
  /* DURATION SCALE       */
  /* ==================== */
  
  /* Instant feedback - Active states, press feedback */
  --duration-instant: 50ms;
  
  /* Quick interactions - Hovers, simple state changes */
  --duration-fast: 150ms;
  
  /* Standard transitions - Default, most common */
  --duration-normal: 200ms;
  
  /* Deliberate movements - Entrance animations, page elements */
  --duration-slow: 250ms;
  
  /* Complex animations - Image zooms, complex entrances */
  --duration-slower: 400ms;

  /* ==================== */
  /* EASING PRESETS       */
  /* ==================== */
  
  /* Default - Most common, general purpose */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Entering viewport - System-initiated appearances */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  
  /* Exiting viewport - User-triggered actions */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  
  /* Sharp response - Quick responses, buttons */
  --ease-sharp: cubic-bezier(0.4, 0, 0.6, 1);
  
  /* Smooth deceleration - Graceful movements, cards */
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* ==================== */
  /* ELEVATION SCALE      */
  /* ==================== */
  
  /* Flat - No shadow */
  --shadow-0: none;
  
  /* Subtle depth - Minimal separation */
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.08);
  
  /* Resting cards - Default card state */
  --shadow-2: 0 1px 3px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
  
  /* Hover cards - Interactive elevation */
  --shadow-3: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  
  /* Modals, dropdowns - Floating elements */
  --shadow-4: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
  
  /* Maximum elevation - Modals, notifications */
  --shadow-5: 0 16px 48px rgba(0, 0, 0, 0.16), 0 8px 16px rgba(0, 0, 0, 0.12);

  /* ==================== */
  /* BORDER RADIUS SCALE  */
  /* ==================== */
  
  --radius-sm: 4px;      /* Badges, tags, small elements */
  --radius-md: 8px;      /* Buttons, inputs, standard elements */
  --radius-lg: 12px;     /* Cards, panels, larger containers */
  --radius-xl: 16px;     /* Large containers, hero sections */
  --radius-full: 9999px; /* Pills, avatars, circular elements */

  /* ==================== */
  /* SPACING SCALE        */
  /* ==================== */
  
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
}

/* ==================== */
/* REDUCED MOTION       */
/* ==================== */

/**
 * Accessibility: Respect user's motion preferences
 * Removes transforms, keeps opacity transitions
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Allow gentle opacity fades, no motion */
  .fade-in-section,
  .modern-product-card,
  .modern-info-card,
  .home-package-card {
    transform: none !important;
  }
}

/* ==================== */
/* BASE TRANSITIONS     */
/* ==================== */

/**
 * Common transition patterns for reuse
 */
.transition-transform {
  transition: transform var(--duration-normal) var(--ease-out);
}

.transition-opacity {
  transition: opacity var(--duration-fast) var(--ease-out);
}

.transition-shadow {
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.transition-colors {
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.transition-all-smooth {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

/* ==================== */
/* SCROLL ANIMATIONS    */
/* ==================== */

/**
 * Fade-in on scroll using IntersectionObserver
 * Applied via JavaScript: element.classList.add('fade-in-section')
 */
.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

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

/**
 * Staggered children animation
 * Applied to parent container
 */
.stagger-children > * {
  opacity: 0;
  transform: translateY(15px);
}

.stagger-children.visible > *:nth-child(1) {
  animation: fadeInUp var(--duration-slow) var(--ease-out) 0ms forwards;
}

.stagger-children.visible > *:nth-child(2) {
  animation: fadeInUp var(--duration-slow) var(--ease-out) 50ms forwards;
}

.stagger-children.visible > *:nth-child(3) {
  animation: fadeInUp var(--duration-slow) var(--ease-out) 100ms forwards;
}

.stagger-children.visible > *:nth-child(4) {
  animation: fadeInUp var(--duration-slow) var(--ease-out) 150ms forwards;
}

.stagger-children.visible > *:nth-child(5) {
  animation: fadeInUp var(--duration-slow) var(--ease-out) 200ms forwards;
}

.stagger-children.visible > *:nth-child(6) {
  animation: fadeInUp var(--duration-slow) var(--ease-out) 250ms forwards;
}

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

/* ==================== */
/* PERFORMANCE HINTS    */
/* ==================== */

/**
 * GPU acceleration for smooth animations
 * Use sparingly - only on elements that will definitely animate
 */
.will-animate {
  will-change: transform;
}

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

/* Remove will-change after animation completes to free resources */
.animation-complete {
  will-change: auto;
}
