/* Two alternating pose layers hide sprite swaps and soften each transition. */
body.idle-motion-on.idle-explorer-ready .adventure-character .outfit-explorer .adventure-sprite{--idle-sheet:url('./game-art/idle-explorer.webp');--idle-cycle:3.5s;background-image:none;animation:character-idle-breathe 3.2s cubic-bezier(.45,0,.55,1) infinite;transform-origin:50% 98%;isolation:isolate;position:relative}
body.idle-motion-on.idle-gardener-ready .adventure-character .outfit-gardener .adventure-sprite{--idle-sheet:url('./game-art/idle-gardener.webp');--idle-cycle:3.8s;background-image:none;animation:character-idle-breathe 3.2s cubic-bezier(.45,0,.55,1) infinite;transform-origin:50% 98%;isolation:isolate;position:relative}
body.idle-motion-on.idle-guardian-ready .adventure-character .outfit-guardian .adventure-sprite{--idle-sheet:url('./game-art/idle-guardian.webp');--idle-cycle:4s;background-image:none;animation:character-idle-breathe 3.2s cubic-bezier(.45,0,.55,1) infinite;transform-origin:50% 98%;isolation:isolate;position:relative}
body.idle-motion-on .adventure-character .adventure-sprite[aria-hidden]::before,body.idle-motion-on .adventure-character .adventure-sprite[aria-hidden]::after{content:'';position:absolute;inset:0;background-image:var(--idle-sheet);background-size:400% 200%;background-repeat:no-repeat;pointer-events:none}
body.idle-motion-on .adventure-character .adventure-sprite[aria-hidden]::before{animation:idle-pose-a var(--idle-cycle,3.5s) steps(1,end) infinite,idle-fade-a var(--idle-cycle,3.5s) cubic-bezier(.45,0,.55,1) infinite}
body.idle-motion-on .adventure-character .adventure-sprite[aria-hidden]::after{animation:idle-pose-b var(--idle-cycle,3.5s) steps(1,end) infinite,idle-fade-b var(--idle-cycle,3.5s) cubic-bezier(.45,0,.55,1) infinite}
/* At each pose swap the affected layer is fully transparent. Background-position
   remains discrete: interpolating it would slide the whole sheet through the crop. */
@keyframes idle-pose-a{
  0%,47.99%{background-position:0 0}
  48%,57.49%{background-position:66.666667% 0}
  57.5%,77.99%{background-position:0 100%}
  78%,97.99%{background-position:66.666667% 100%}
  98%,100%{background-position:0 0}
}
@keyframes idle-pose-b{
  0%,22.99%{background-position:100% 100%}
  23%,52.99%{background-position:33.333333% 0}
  53%,59.99%{background-position:100% 0}
  60%,87.99%{background-position:33.333333% 100%}
  88%,100%{background-position:100% 100%}
}
/* The Guardian's reversed pose is omitted, keeping its gaze and outfit consistent. */
body.idle-motion-on .adventure-character .outfit-guardian .adventure-sprite[aria-hidden]::after{animation-name:idle-guardian-pose-b,idle-fade-b}
@keyframes idle-guardian-pose-b{
  0%,22.99%{background-position:100% 100%}
  23%,52.99%{background-position:33.333333% 0}
  53%,59.99%{background-position:100% 0}
  60%,87.99%{background-position:66.666667% 100%}
  88%,100%{background-position:100% 100%}
}
/* Movement blends for 210–240ms; eye transitions stay quick at 70–80ms.
   Layer positions change only while that layer is fully hidden. */
@keyframes idle-fade-a{
  0%,31%,50%,57%,58%,72%,80%,96%,100%{opacity:0}
  6%,25%,52%,55%,60%,66%,86%,90%{opacity:1}
}
@keyframes idle-fade-b{
  0%,31%,50%,57%,58%,72%,80%,96%,100%{opacity:1}
  6%,25%,52%,55%,60%,66%,86%,90%{opacity:0}
}
/* Add the fading layers within their isolated sprite to avoid dimming the
   overlapping artwork midway through a blend. Older browsers keep normal blending. */
@supports(mix-blend-mode:plus-lighter){
  body.idle-motion-on .adventure-character .adventure-sprite[aria-hidden]::before,
  body.idle-motion-on .adventure-character .adventure-sprite[aria-hidden]::after{mix-blend-mode:plus-lighter}
}
body.idle-motion-on #defaultDashboard:not(.checkin-celebrate) .adventure-character>.hub-avatar,
body.idle-motion-on #gamePlay .adventure-character>.hub-avatar{animation:character-idle-sway 6.4s cubic-bezier(.45,0,.55,1) infinite;transform-origin:50% 98%}
/* Breathing and weight shifts have different periods, so every blink does not
   coincide with the same body pose. Feet stay close to their ground anchor. */
@keyframes character-idle-breathe{
  0%,100%{transform:scale(1,1)}
  50%{transform:scale(1.003,1.012)}
}
@keyframes character-idle-sway{
  0%,100%{transform:translateX(-.6px) rotate(-.22deg)}
  50%{transform:translateX(.6px) rotate(.22deg)}
}
body.idle-motion-paused .adventure-character>.hub-avatar,body.idle-motion-paused .adventure-character .adventure-sprite,body.idle-motion-paused .adventure-character .adventure-sprite::before,body.idle-motion-paused .adventure-character .adventure-sprite::after,body.idle-motion-paused .illustrated-avatar .avatar-companion{animation-play-state:paused!important}
@media(prefers-reduced-motion:reduce){
  body.idle-motion-on .adventure-character>.hub-avatar,body.idle-motion-on .adventure-character .adventure-sprite,body.idle-motion-on .adventure-character .adventure-sprite::before,body.idle-motion-on .adventure-character .adventure-sprite::after{animation:none!important}
  body.idle-motion-on .adventure-character .adventure-sprite::before{opacity:1;background-position:0 0}
  body.idle-motion-on .adventure-character .adventure-sprite::after{opacity:0}
}
