/* ============================================================
   FocusFlow — animations.css
   All motion respects prefers-reduced-motion (see bottom).
   ============================================================ */

@keyframes ff-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ff-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes ff-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ff-toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ff-bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  70%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}
@keyframes ff-task-complete {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1) translateX(16px); opacity: 0; }
}
@keyframes ff-float-up {
  0%   { opacity: 0; transform: translateY(6px); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-28px); }
}
@keyframes ff-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-strong) 50%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-strong) 0%, transparent); }
}
@keyframes ff-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes ff-spin { to { transform: rotate(360deg); } }

/* Route transition */
.route-enter { animation: ff-fade-in var(--dur-base) var(--ease-out); }

.anim-bounce { animation: ff-bounce 420ms var(--ease-out); }
.anim-complete { animation: ff-task-complete 360ms var(--ease-out) forwards; }
.anim-pulse { animation: ff-pulse 1.8s ease-in-out infinite; }

.modal-backdrop { animation: ff-backdrop-in var(--dur-base) ease-out; }
.modal { animation: ff-slide-up var(--dur-slow) var(--ease-out); }
.toast { animation: ff-toast-in var(--dur-base) var(--ease-out); }

.xp-float {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--badge-success-fg);   /* the soft success fill is too pale for words */
  pointer-events: none;
  animation: ff-float-up 1.1s var(--ease-out) forwards;
}

/* Button ripple */
@keyframes ff-ripple { to { transform: scale(2.2); opacity: 0; } }
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  opacity: 0.6;
  pointer-events: none;
  animation: ff-ripple 0.6s var(--ease-out) forwards;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-surface-alt) 25%,
    color-mix(in srgb, var(--color-border) 60%, var(--color-surface-alt)) 37%,
    var(--color-surface-alt) 63%);
  background-size: 200% 100%;
  animation: ff-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--accent-mark);
  border-radius: 50%;
  animation: ff-spin 0.7s linear infinite;
}

/* Confetti pieces are created/animated in JS but use this base */
.confetti-piece {
  position: fixed;
  width: 8px; height: 12px;
  top: -16px;
  z-index: 120;
  pointer-events: none;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 50ms !important;
  }
  .route-enter { animation: none; }
  .confetti-piece { display: none !important; }
}

/* Manual override from Settings → Animations: Off */
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
