/* =============================================
   Animations — Keyframes, transitions, entrance
   ============================================= */

/* ── Keyframes ── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

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

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

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

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-100%) scale(0.95);
  }
}

/* ── Animation classes ── */
.animate-fade-in {
  animation: fadeIn var(--duration-base) var(--ease-out) both;
}

.animate-fade-out {
  animation: fadeOut var(--duration-base) var(--ease-out) both;
}

.animate-slide-up {
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.animate-slide-down {
  animation: slideDown var(--duration-slow) var(--ease-out) both;
}

.animate-slide-right {
  animation: slideInRight var(--duration-slow) var(--ease-out) both;
}

.animate-slide-left {
  animation: slideInLeft var(--duration-slow) var(--ease-out) both;
}

.animate-scale-in {
  animation: scaleIn var(--duration-slow) var(--ease-out) both;
}

.animate-bounce-in {
  animation: bounceIn 500ms var(--ease-spring) both;
}

.animate-pulse {
  animation: pulse 2s var(--ease-in-out) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-modal-in {
  animation: modalIn var(--duration-slow) var(--ease-spring) both;
}

.animate-toast-in {
  animation: toastIn var(--duration-slow) var(--ease-spring) both;
}

.animate-toast-out {
  animation: toastOut var(--duration-base) var(--ease-out) both;
}

/* ── Staggered entrance delays ── */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }
.stagger-7 { animation-delay: 350ms; }
.stagger-8 { animation-delay: 400ms; }

/* ── Transition utilities ── */
.transition-all {
  transition: all var(--transition-base);
}

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

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

.transition-opacity {
  transition: opacity var(--transition-base);
}

/* ── Hover / Active states ── */
.hover-lift {
  transition: transform var(--transition-base),
    box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hover-lift:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.press-scale {
  transition: transform var(--transition-fast);
}

.press-scale:active {
  transform: scale(0.97);
}

.press-opacity {
  transition: opacity var(--transition-fast);
}

.press-opacity:active {
  opacity: 0.7;
}

/* ── Reduced motion — accessibility ── */
@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-fade-in,
  .animate-fade-out,
  .animate-slide-up,
  .animate-slide-down,
  .animate-slide-right,
  .animate-slide-left,
  .animate-scale-in,
  .animate-bounce-in,
  .animate-pulse,
  .animate-spin,
  .animate-float,
  .animate-modal-in,
  .animate-toast-in,
  .animate-toast-out {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .hover-lift:hover {
    transform: none;
  }

  .press-scale:active {
    transform: none;
  }
}
