/* Visual and motion pass (Wave 6, docs/design/MOTION_AND_VISUALS.md).
   Rules (checked by check-motion.cjs): only transform and opacity are animated or transitioned; decorations are
   pseudo-elements or absolutely positioned (no layout shift); prefers-reduced-motion turns every animation off. */

/* ── Wavy, organic header behind the Home greeting ── */
.greeting{position:relative;isolation:isolate;padding:18px 18px 26px;margin:-8px -8px 12px;border-radius:22px;overflow:hidden;
  background:linear-gradient(135deg,var(--color-mint-soft) 0%,transparent 70%)}
.greeting::after{content:"";position:absolute;z-index:-1;left:-25%;right:-25%;bottom:-2px;height:46px;pointer-events:none;opacity:.55;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath d='M0 30 C 150 0 300 60 450 30 S 750 0 900 30 S 1200 60 1200 30 V60 H0Z' fill='%2337b37e' fill-opacity='.35'/%3E%3C/svg%3E") repeat-x 0 0/50% 100%;
  animation:fin-wave 18s linear infinite;will-change:transform}
@keyframes fin-wave{from{transform:translateX(0)}to{transform:translateX(-25%)}}
.wave-divider{position:relative;height:18px;margin:6px 0;opacity:.5;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9 Q 50 0 100 9 T 200 9 T 300 9 T 400 9' stroke='%2337b37e' stroke-width='2' fill='none'/%3E%3C/svg%3E") repeat-x 0 50%/200px 18px}
.card{border-radius:18px}

/* ── Press feedback ── */
button,.chip,.avatar-choice{transition:transform .12s ease,opacity .12s ease}
button:active:not([disabled]){transform:scale(.97)}
@media (hover:hover){button:not([class]):not([data-view]):not([role=menuitem]):not([role=tab]):not(nav button):not(.space-bar button):not(.chips button):hover:not(:disabled),button.secondary:hover:not(:disabled){transform:translateY(-1px)}}
button:not([class]):not([data-view]):not([role=menuitem]):not([role=tab]):not(nav button):not(.space-bar button):not(.chips button):active:not(:disabled),button.secondary:active:not(:disabled){transform:scale(.97)}
button[aria-busy="true"]::after{animation:fin-spin .7s linear infinite}

/* ── Entering a screen: cards rise and fade in, a little apart ── */
.motion-enter>.card,.motion-enter>.stats>.card,.motion-enter>.greeting{animation:fin-rise .32s cubic-bezier(.2,.7,.2,1) both}
.motion-enter>*:nth-child(2){animation-delay:.04s}.motion-enter>*:nth-child(3){animation-delay:.08s}.motion-enter>*:nth-child(4){animation-delay:.12s}.motion-enter>*:nth-child(n+5){animation-delay:.16s}
@keyframes fin-rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.value{font-variant-numeric:tabular-nums}

/* ── Skeleton shimmer ── */
.skeleton-line{position:relative;overflow:hidden;height:14px;border-radius:8px;background:var(--color-line);margin:10px 0}
.skeleton-line::after{content:"";position:absolute;inset:0;transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);animation:fin-shimmer 1.3s ease-in-out infinite}
@keyframes fin-shimmer{to{transform:translateX(100%)}}

/* ── Moni's presence: tied to real states (motion.js sets data-moni) ── */
.assistant-card .avatar{transition:transform .2s ease}
[data-moni="asking"] .avatar{animation:fin-bob 2.4s ease-in-out infinite}
[data-moni="thinking"] .avatar{animation:fin-pulse 1.4s ease-in-out infinite}
[data-moni="celebrating"] .avatar{animation:fin-pop .6s cubic-bezier(.2,1.6,.4,1) 2}
@keyframes fin-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}
@keyframes fin-pulse{0%,100%{opacity:1}50%{opacity:.45}}
@keyframes fin-pop{0%{transform:scale(1)}40%{transform:scale(1.25) rotate(-6deg)}100%{transform:scale(1)}}

/* ── Saved: a check that pops, then fades ── */
.success-burst{position:fixed;left:50%;top:38%;z-index:60;width:84px;height:84px;margin:-42px 0 0 -42px;border-radius:50%;pointer-events:none;
  display:grid;place-items:center;font-size:40px;color:#fff;background:var(--color-brand);animation:fin-burst .9s ease forwards}
@keyframes fin-burst{0%{opacity:0;transform:scale(.4)}25%{opacity:1;transform:scale(1.08)}45%{transform:scale(1)}80%{opacity:1}100%{opacity:0;transform:scale(1.15)}}

/* ── Pull to refresh ── */
.pull-indicator{position:fixed;left:50%;top:10px;z-index:40;width:36px;height:36px;margin-left:-18px;border-radius:50%;pointer-events:none;
  display:grid;place-items:center;background:var(--color-surface,#fff);color:var(--color-brand);box-shadow:0 4px 14px #0002;opacity:0;transform:translateY(-40px)}
.pull-indicator.spinning span{animation:fin-spin .8s linear infinite;display:inline-block}
@keyframes fin-spin{to{transform:rotate(360deg)}}

/* ── Swipe a waiting transaction to classify it ── */
.swipe-row{touch-action:pan-y;transition:transform .18s ease}
.swipe-row.swiping{transition:none}
.swipe-hint{position:absolute;right:16px;top:50%;transform:translateY(-50%);opacity:0;color:var(--color-brand);font-weight:700;pointer-events:none}

/* ── Empty states get a small illustration ── */
.empty{position:relative;padding-top:86px}
.empty::before{content:"";position:absolute;left:50%;top:14px;width:64px;height:64px;margin-left:-32px;opacity:.8;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='30' fill='%23e3f5ec'/%3E%3Cpath d='M20 34h24M20 26h16M20 42h10' stroke='%2337b37e' stroke-width='3' stroke-linecap='round'/%3E%3Ccircle cx='46' cy='42' r='6' fill='none' stroke='%2337b37e' stroke-width='3'/%3E%3C/svg%3E") center/contain no-repeat}

/* ── Reduced motion: everything still, nothing moves ── */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation:none!important;transition:none!important}
  .success-burst{opacity:0}
}
