/* Mergify Design Standard v1 — motion.css
   Rules (non-negotiable):
   1. Animate transform + opacity ONLY (compositor-friendly, 60fps).
      Never animate width/height/top/left/margin in product UI.
   2. Every animation below is disabled by the prefers-reduced-motion block
      at the bottom. That block is part of the standard — never ship
      motion.css without it.
   3. Durations/easings come from tokens.css. No ad-hoc timings. */

.screen { animation: screen-in var(--dur-3) var(--ease-emph-decelerate) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.screen-exit { animation: screen-out var(--dur-2) var(--ease-emph-accelerate) both; }
@keyframes screen-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* Card / list item entrance (stagger by setting --i per item in JS/HTML) */
.rise { animation: rise var(--dur-3) var(--ease-emph-decelerate) both;
        animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* List item states used by the FLIP animator (transitions.js) */
.flip-item { transition: transform var(--dur-3) var(--ease-spring),
                        opacity  var(--dur-2) var(--ease-standard); }
.flip-enter { opacity: 0; transform: translateY(10px) scale(.98); }
.flip-leave { opacity: 0; transform: scale(.96); position: absolute; }

/* Press feedback: every tappable gets this class or is a .btn/.chip */
.pressable { transition: transform var(--dur-1) var(--ease-out),
                         opacity var(--dur-1) var(--ease-out); }
.pressable:active { transform: scale(.97); opacity: .88; }

/* Chip / toggle selection */
.chip { transition: background-color var(--dur-2) var(--ease-standard),
                    color var(--dur-2) var(--ease-standard),
                    transform var(--dur-1) var(--ease-out); }
.chip:active { transform: scale(.95); }

/* Progress / depletion bar: JS sets --val (0–100); width is set via
   transform scaleX so we never animate width. Bar element is full-width,
   transform-origin left. */
.bar-fill { transform-origin: left center;
            transition: transform var(--dur-4) var(--ease-spring),
                        background-color var(--dur-3) var(--ease-standard); }

/* Count-up numbers get a subtle pop when the value changes */
.pop { animation: pop var(--dur-3) var(--ease-spring) both; }
@keyframes pop {
  0% { transform: scale(1); } 40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Skeleton shimmer (loading placeholders). Transform-only shimmer:
   a highlight band translating across a muted block. */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2);
            border-radius: var(--r-md); min-height: 18px; }
.skeleton::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%,
    rgba(255,255,255,.08) 50%, transparent 70%);
  transform: translateX(-100%); animation: shimmer 1.3s var(--ease-in-out) infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Success check: draw-in circle + tick (SVG stroke-dashoffset is a paint
   property, used ONLY for this one signature mark — keep it small). */
.success-check { width: 56px; height: 56px; }
.success-check circle, .success-check path {
  fill: none; stroke: var(--success); stroke-width: 3; stroke-linecap: round;
  stroke-linejoin: round; }
.success-check circle { stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: draw var(--dur-4) var(--ease-out) forwards; }
.success-check path { stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: draw var(--dur-3) var(--dur-2) var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* View Transitions API (transitions.js uses document.startViewTransition).
   Same-document transitions are Baseline 2025 (Chrome 111+, Safari 18+,
   Firefox 144+). Fallback without the API = instant swap, still correct. */
::view-transition-old(root) { animation: vt-out var(--dur-2) var(--ease-emph-accelerate) both; }
::view-transition-new(root) { animation: vt-in var(--dur-3) var(--ease-emph-decelerate) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(10px); } }

/* Sheet entrance */
.sheet { animation: sheet-in var(--dur-4) var(--ease-spring) both; }
@keyframes sheet-in {
  from { opacity: .6; transform: translateY(48px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast { animation: toast-in var(--dur-3) var(--ease-spring) both; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- MANDATORY reduced-motion gate — do not remove ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
