/*
 * IWonnaP — Animations
 * Reusable keyframes + utility classes for micro-interactions.
 * All animations respect prefers-reduced-motion.
 */

/* ─── Keyframes ──────────────────────────────────── */

@keyframes iwp-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes iwp-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes iwp-fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes iwp-scale-in {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes iwp-pop-up {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes iwp-slide-up {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes iwp-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40, 200, 210, .35); }
  50%      { box-shadow: 0 0 0 6px rgba(40, 200, 210, 0); }
}

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

@keyframes iwp-running-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

@keyframes iwp-sheen {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(120%); }
}

/* Right-sidebar running-event pulse (Phase 26) */
@keyframes rs-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  70%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* Edit-field auto-save success flash (Phase 27) */
@keyframes ef-flash {
  0%   { background: color-mix(in srgb, var(--success) 26%, transparent); }
  100% { background: transparent; }
}

/* Modal loading spinner (Phase 29) */
@keyframes modal-spin {
  to { transform: rotate(1turn); }
}

/* ─── Utility classes ────────────────────────────── */

.anim-fade-in   { animation: iwp-fade-in   var(--t-base) both; }
.anim-fade-up   { animation: iwp-fade-up   var(--t-base) both; }
.anim-fade-down { animation: iwp-fade-down var(--t-base) both; }
.anim-scale-in  { animation: iwp-scale-in  var(--t-base) both; }
.anim-pop-up    { animation: iwp-pop-up    var(--t-spring) both; }
.anim-slide-up  { animation: iwp-slide-up  var(--t-base) both; }

/* Stagger helpers for lists */
.anim-stagger > *               { animation: iwp-fade-up var(--t-base) both; }
.anim-stagger > *:nth-child(1)  { animation-delay:   0ms; }
.anim-stagger > *:nth-child(2)  { animation-delay:  40ms; }
.anim-stagger > *:nth-child(3)  { animation-delay:  80ms; }
.anim-stagger > *:nth-child(4)  { animation-delay: 120ms; }
.anim-stagger > *:nth-child(5)  { animation-delay: 160ms; }
.anim-stagger > *:nth-child(6)  { animation-delay: 200ms; }
.anim-stagger > *:nth-child(7)  { animation-delay: 240ms; }
.anim-stagger > *:nth-child(8)  { animation-delay: 280ms; }
.anim-stagger > *:nth-child(n+9) { animation-delay: 320ms; }

/* Hover lift — for cards */
.hover-lift {
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-strong);
}

/* Sheen on hover (subtle highlight pass) */
.hover-sheen { position: relative; overflow: hidden; }
.hover-sheen::after {
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.08) 50%, transparent 70%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  transform: translateX(-100%);
  transition: transform var(--t-slow);
}
.hover-sheen:hover::after { transform: translateX(120%); }

/* Pulsing dot for "running" indicator */
.pulse-dot {
  animation: iwp-pulse-glow 1.6s ease-in-out infinite;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  width: 8px;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-soft) 0%,
    var(--surface-elev) 50%,
    var(--surface-soft) 100%
  );
  background-size: 200% 100%;
  animation: iwp-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
  min-height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .modal-loading__spinner {
    animation: none;
    border-top-color: var(--accent);
  }
}

/* Reduced motion: kill all */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
