/* Motion: timings and easing for the whole app. Loaded last so it wins over
   the per-screen files. Source: the motion audit in motion-audits/. */
/* ---------- motion (audit 2026-11-17, motion-audits/superzol-2026-11-17.html) ---------- */
/* custom easing instead of the browser defaults */
.bcard, .lcard .chip-btn, .chip-btn, .tile, a.item, .w-chip:not(.static), .pw-plan, .icon-btn, .nav a { transition: transform .12s var(--ease-out); }
.btn { transition: transform .12s var(--ease-out), background-color .18s var(--ease-out); }
.toast { transition: opacity .2s var(--ease-out), transform .25s var(--ease-out); }
/* tabs and screens: a quick crossfade, no slide (screens change several times a minute) */
.screen { animation: screen-in .14s var(--ease-out); }
@keyframes screen-in { from { opacity: .55; } to { opacity: 1; } }
/* the list summary opening: the lines materialize */
.dock-list.enter { animation: dock-in .22s var(--ease-out); }
@keyframes dock-in { from { opacity: 0; transform: translateY(8px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
/* compare: only the winner card materializes; the rest of the list just appears (no stagger) */
.offer, .offer:nth-child(2), .offer:nth-child(3) { animation: none; }
.offer.best { animation: win-in .22s var(--ease-out); }
@keyframes win-in { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
.app[data-redraw="true"] .offer.best { animation: none; }
.offer-lines { animation: lines-in .2s var(--ease-out); }
.offer .expand svg, .btn-quiet svg, .dock-edit .chev svg { transition: transform .18s var(--ease-out); }
/* the list count: a nudge, not a jump (adding happens dozens of times) */
.bump { animation: bump .16s var(--ease-out); }
@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.06); } 100% { transform: scale(1); } }
/* switches: the knob moves with transform, not position */
.toggle .sw { transition: background-color .18s var(--ease-out); }
.toggle .sw::after { inset-inline-start: 2px; transition: transform .18s var(--ease-out); }
.toggle[aria-checked="true"] .sw::after { inset-inline-start: 2px; transform: translateX(14px); }
[dir="rtl"] .toggle[aria-checked="true"] .sw::after { transform: translateX(-14px); }
/* progress bar: scaleX from the start edge (shop.js sets the scale) */
.shop-progress .bar span { width: 100%; transform-origin: right center; transition: transform .24s var(--ease-out); }
[dir="ltr"] .shop-progress .bar span { transform-origin: left center; }
/* onboarding dots: no width animation */
.w-dots span { transition: background-color .2s var(--ease-out); }
/* dialogs: in without overshoot, out subtly */
.sheet { animation: sheet-up .26s var(--ease-sheet); }
.sheet-backdrop.closing { animation: fade-out .16s var(--ease-out) forwards; }
.sheet-backdrop.closing .sheet { animation: sheet-down .16s var(--ease-out) forwards; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-down { to { opacity: 0; transform: translateY(18px); } }
/* small polish: chosen sizes ease in; the add button presses like everything else */
.pcard .size, .choice-row .size { transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out), color .15s var(--ease-out); }
.add-btn { transition: transform .12s var(--ease-out); }
.add-btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- the mascot's three moments (rare, so a little delight is allowed) ---------- */
/* 1. first comparison after onboarding: the cart drives in to the answer */
.verdict svg.mascot.drive-in { animation: drive-in .7s var(--ease-out) both; }
@keyframes drive-in {
  0% { transform: translateX(calc(var(--dir, 1) * -140px)) rotate(0); opacity: 0; }
  60% { transform: translateX(calc(var(--dir, 1) * 6px)) rotate(calc(var(--dir, 1) * 4deg)); opacity: 1; }
  80% { transform: translateX(calc(var(--dir, 1) * -2px)) rotate(calc(var(--dir, 1) * -2deg)); }
  100% { transform: none; }
}
[dir="rtl"] .verdict svg.mascot.drive-in { --dir: -1; }
/* 3. shopping mode: everything ticked */
.shop-win { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; border-radius: var(--r);
  background: var(--mint-50); box-shadow: inset 0 0 0 2px var(--mint); padding: 12px 16px; }
.shop-win svg.mascot { width: 62px; height: 52px; flex: none; }
.shop-win b { display: block; font-size: var(--t-lg); font-family: var(--font-num, inherit); }
.shop-win span:not(.coin) { font-size: var(--t-md); color: var(--ink-2); }
.shop-win .coin { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center;
  font-size: var(--t-xs); font-weight: 800; color: #7A5800; inset-inline-start: 28px; top: 10px; opacity: 0; }
.shop-win .coin.c2 { inset-inline-start: 50px; top: 4px; }
.shop-win.celebrate svg.mascot { animation: hop .5s var(--ease-out); }
.shop-win.celebrate .coin { animation: coin-up .8s var(--ease-out) .1s; }
.shop-win.celebrate .coin.c2 { animation-delay: .2s; }
@keyframes hop { 0%, 100% { transform: none; } 40% { transform: translateY(-8px) rotate(-4deg); } }
@keyframes coin-up { 0% { opacity: 0; transform: translateY(18px) scale(.9); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- moving between screens ---------- */
/* View Transitions (Chrome, Edge, Safari 18+): the old screen's snapshot gives
   way to the new one. Deeper screens push in from the end of the reading
   direction (from the left in Hebrew and Arabic), going back reverses it, and
   tabs crossfade. The tab bar and the side panel are their own layers, so they
   stay still. Without the API: the same idea on the new screen only. */
html { --vt-sign: 1; }
html[dir="rtl"] { --vt-sign: -1; }
#nav { view-transition-name: tabbar; }
#desk { view-transition-name: deskpanel; }
::view-transition-group(tabbar), ::view-transition-group(deskpanel) { animation-duration: .2s; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; animation-timing-function: var(--ease-sheet); animation-fill-mode: both; }
html[data-nav="forward"]::view-transition-old(root) { animation-name: vt-old-push; }
html[data-nav="forward"]::view-transition-new(root) { animation-name: vt-new-push; }
html[data-nav="back"]::view-transition-old(root) { animation-name: vt-old-pop; }
html[data-nav="back"]::view-transition-new(root) { animation-name: vt-new-pop; }
html[data-nav="tab"]::view-transition-old(root) { animation: vt-fade-out .18s var(--ease-out) both; }
html[data-nav="tab"]::view-transition-new(root) { animation: vt-fade-in .2s var(--ease-out) both; }
@keyframes vt-new-push { from { opacity: 0; transform: translateX(calc(var(--vt-sign) * 40px)); } }
@keyframes vt-old-push { to { opacity: 0; transform: translateX(calc(var(--vt-sign) * -20px)); } }
@keyframes vt-new-pop { from { opacity: 0; transform: translateX(calc(var(--vt-sign) * -40px)); } }
@keyframes vt-old-pop { to { opacity: 0; transform: translateX(calc(var(--vt-sign) * 20px)); } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes vt-fade-out { to { opacity: 0; } }
/* while the API animates, the screen's own entrance is off (no double motion) */
html.vt-on .screen, html.vt-on .offer.best { animation: none; }
/* no API: the new screen enters with the same direction */
html[data-nav="forward"]:not(.vt-on) .app[data-redraw="false"] .screen { animation: screen-push .26s var(--ease-sheet); }
html[data-nav="back"]:not(.vt-on) .app[data-redraw="false"] .screen { animation: screen-pop .26s var(--ease-sheet); }
@keyframes screen-push { from { opacity: 0; transform: translateX(calc(var(--vt-sign) * 28px)); } }
@keyframes screen-pop { from { opacity: 0; transform: translateX(calc(var(--vt-sign) * -28px)); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
