/*
 * FoundContext v4 Animations
 * Sacred animation system - maximum 0.5s duration enforced
 */

/* Performance Constraints */
:root {
  --max-animation-duration: 0.5s; /* Strategic requirement */
}

/* Card Animations */
.card-entrance {
  animation: cardSlideIn var(--max-animation-duration) var(--animation-easing);
}

.card-exit {
  animation: cardSlideOut var(--max-animation-duration) var(--animation-easing);
}

.card-flip {
  animation: cardFlip var(--max-animation-duration) var(--animation-easing);
}

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

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

@keyframes cardFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

/* Navigation Transitions */
.nav-slide-left {
  animation: slideLeft var(--animation-duration-normal) var(--animation-easing);
}

.nav-slide-right {
  animation: slideRight var(--animation-duration-normal) var(--animation-easing);
}

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

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

/* Micro-interactions */
.button-press {
  animation: buttonPress var(--animation-duration-fast) var(--animation-easing);
}

@keyframes buttonPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Loading Animations */
.fade-in {
  animation: fadeIn var(--animation-duration-normal) var(--animation-easing);
}

.fade-out {
  animation: fadeOut var(--animation-duration-normal) var(--animation-easing);
}

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

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

/* Drawer Animations */
.drawer-slide-in {
  animation: drawerSlideIn var(--animation-duration-normal) var(--animation-easing);
}

.drawer-slide-out {
  animation: drawerSlideOut var(--animation-duration-normal) var(--animation-easing);
}

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

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

/* Notification Animations */
.notification-enter {
  animation: notificationSlideUp var(--animation-duration-normal) var(--animation-easing);
}

.notification-exit {
  animation: notificationSlideDown var(--animation-duration-normal) var(--animation-easing);
}

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

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

/* Hover Effects */
.hover-lift {
  transition: transform var(--animation-duration-fast) var(--animation-easing);
}

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

.hover-scale {
  transition: transform var(--animation-duration-fast) var(--animation-easing);
}

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

/* Focus Effects */
.focus-ring {
  transition: box-shadow var(--animation-duration-fast) var(--animation-easing);
}

.focus-ring:focus {
  box-shadow: 0 0 0 3px var(--primary-color-alpha);
}

/* Theme Transition */
.theme-transition {
  transition: 
    background-color var(--animation-duration-normal) var(--animation-easing),
    color var(--animation-duration-normal) var(--animation-easing),
    border-color var(--animation-duration-normal) var(--animation-easing);
}

/* Mobile Touch Feedback */
@media (hover: none) and (pointer: coarse) {
  .touch-feedback {
    transition: background-color var(--animation-duration-fast) var(--animation-easing);
  }
  
  .touch-feedback:active {
    background-color: var(--primary-color-alpha);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  /* Disable all animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Remove transforms */
  .hover-lift:hover,
  .hover-scale:hover {
    transform: none;
  }
  
  /* Keep essential feedback */
  .focus-ring:focus {
    box-shadow: 0 0 0 3px var(--primary-color-alpha);
  }
  
  .touch-feedback:active {
    background-color: var(--primary-color-alpha);
  }
}

/* High Performance Mode */
.reduce-animations {
  animation: none !important;
  transition: none !important;
}

.reduce-animations *,
.reduce-animations *::before,
.reduce-animations *::after {
  animation: none !important;
  transition: none !important;
}

/* Animation Utils */
.animate-none {
  animation: none !important;
}

.transition-none {
  transition: none !important;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-bounce {
  animation: bounce 1s infinite;
}

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

/* Page Transitions */
.page-enter {
  animation: pageEnter var(--animation-duration-slow) var(--animation-easing);
}

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