/* ============================================
   INNATEENGINE - ANIMATIONS
   Keyframes, Transitions, Scroll Animations
   ============================================ */

/* ==========================================
   FADE ANIMATIONS
   ========================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeLeft {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================
   SCALE ANIMATIONS
   ========================================== */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleDown {
  from {
    opacity: 0;
    transform: scale(1.1);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  70% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================
   SLIDE ANIMATIONS
   ========================================== */
@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideLeft {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ==========================================
   PULSE & GLOW ANIMATIONS
   ========================================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
  }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 
      0 0 20px rgba(139, 92, 246, 0.2),
      0 0 40px rgba(139, 92, 246, 0.1);
  }
  50% {
    box-shadow: 
      0 0 30px rgba(139, 92, 246, 0.4),
      0 0 60px rgba(139, 92, 246, 0.2);
  }
}

/* ==========================================
   FLOAT ANIMATIONS
   ========================================== */
@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(1deg);
  }
  50% {
    transform: translateY(-5px) rotate(-1deg);
  }
  75% {
    transform: translateY(-15px) rotate(1deg);
  }
}

@keyframes floatSlow {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(20px, -20px) scale(1.05);
  }
  50% {
    transform: translate(-10px, 10px) scale(0.95);
  }
  75% {
    transform: translate(15px, 15px) scale(1.02);
  }
}

@keyframes floatRotate {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-20px) rotate(360deg);
  }
}

/* ==========================================
   GRADIENT ANIMATIONS
   ========================================== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes gradientRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================
   SHIMMER ANIMATION
   ========================================== */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite linear;
}

/* ==========================================
   BOUNCE ANIMATIONS
   ========================================== */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================
   SCROLL INDICATOR
   ========================================== */
@keyframes scrollDown {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.scroll-arrow {
  width: 24px;
  height: 40px;
  border: 2px solid var(--border-default);
  border-radius: 12px;
  position: relative;
}

.scroll-arrow::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  background: var(--text-tertiary);
  border-radius: 2px;
  transform: translateX(-50%);
  animation: scrollDown 1.5s ease-in-out infinite;
}

/* ==========================================
   TYPING ANIMATION
   ========================================== */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

.typing-text {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--brand-primary);
  animation: 
    typing 3s steps(40) 1s forwards,
    blink 0.75s step-end infinite;
}

/* ==========================================
   COUNTER ANIMATION
   ========================================== */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   WAVE ANIMATION
   ========================================== */
@keyframes wave {
  0%, 100% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-5px);
  }
  50% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(5px);
  }
}

/* ==========================================
   ROTATE ANIMATIONS
   ========================================== */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateReverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

/* ==========================================
   ANIMATION UTILITY CLASSES
   ========================================== */

/* Apply Animations */
.animate-fade-in { animation: fadeIn var(--duration-500) ease-out forwards; }
.animate-fade-up { animation: fadeUp var(--duration-500) ease-out forwards; }
.animate-fade-down { animation: fadeDown var(--duration-500) ease-out forwards; }
.animate-fade-left { animation: fadeLeft var(--duration-500) ease-out forwards; }
.animate-fade-right { animation: fadeRight var(--duration-500) ease-out forwards; }
.animate-scale-in { animation: scaleIn var(--duration-500) ease-out forwards; }
.animate-scale-up { animation: scaleUp var(--duration-500) ease-out forwards; }
.animate-pop-in { animation: popIn var(--duration-500) cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-glow { animation: glow 2s infinite; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-spin { animation: rotate 1s linear infinite; }

/* Animation Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }
.delay-900 { animation-delay: 900ms; }
.delay-1000 { animation-delay: 1000ms; }

/* Animation Durations */
.duration-150 { animation-duration: 150ms; }
.duration-300 { animation-duration: 300ms; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }
.duration-1000 { animation-duration: 1000ms; }

/* ==========================================
   SCROLL-TRIGGERED ANIMATIONS
   Elements with [data-animate] are hidden by default
   and revealed when they enter the viewport
   ========================================== */
[data-animate] {
  opacity: 0;
}

[data-animate].animate-visible {
  opacity: 1;
}

[data-animate="fade-up"] {
  transform: translateY(40px);
  transition: 
    opacity var(--duration-700) ease-out,
    transform var(--duration-700) ease-out;
}

[data-animate="fade-up"].animate-visible {
  transform: translateY(0);
}

[data-animate="fade-down"] {
  transform: translateY(-40px);
  transition: 
    opacity var(--duration-700) ease-out,
    transform var(--duration-700) ease-out;
}

[data-animate="fade-down"].animate-visible {
  transform: translateY(0);
}

[data-animate="fade-left"] {
  transform: translateX(40px);
  transition: 
    opacity var(--duration-700) ease-out,
    transform var(--duration-700) ease-out;
}

[data-animate="fade-left"].animate-visible {
  transform: translateX(0);
}

[data-animate="fade-right"] {
  transform: translateX(-40px);
  transition: 
    opacity var(--duration-700) ease-out,
    transform var(--duration-700) ease-out;
}

[data-animate="fade-right"].animate-visible {
  transform: translateX(0);
}

[data-animate="scale-in"] {
  transform: scale(0.9);
  transition: 
    opacity var(--duration-700) ease-out,
    transform var(--duration-700) cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-animate="scale-in"].animate-visible {
  transform: scale(1);
}

[data-animate="fade-in"] {
  transition: opacity var(--duration-700) ease-out;
}

/* Stagger children - applied via JavaScript */
[data-stagger] {
  opacity: 0;
  transform: translateY(20px);
  transition: 
    opacity var(--duration-500) ease-out,
    transform var(--duration-500) ease-out;
}

[data-stagger].animate-visible {
  opacity: 1;
  transform: translateY(0);
}

/* No animation class for reduced motion */
.no-animation {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* ==========================================
   HOVER TRANSITIONS
   ========================================== */
.hover-lift {
  transition: transform var(--transition-base);
}

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

.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.02);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

/* ==========================================
   PAGE TRANSITIONS
   ========================================== */
.page-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: 
    opacity var(--duration-500) ease-out,
    transform var(--duration-500) ease-out;
}

.page-exit {
  opacity: 1;
}

.page-exit-active {
  opacity: 0;
  transition: opacity var(--duration-300) ease-in;
}

/* ==========================================
   SKELETON LOADER
   ========================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-button {
  height: 44px;
  width: 120px;
}

/* ==========================================
   REDUCED MOTION - Override all animations
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .scroll-arrow::before {
    animation: none;
  }
}
