/* Each measured contour (or whole cell) keeps the legacy cutout's foot anchor.
   Its exact ratio prevents neighbouring visitors from leaking into the crop. */
.best-person-sprite.matrix-visitor-frame{width:auto;aspect-ratio:var(--visitor-cell-aspect,2/3);overflow:hidden}
.matrix-visitor-atlas,.matrix-visitor-fallback{position:absolute;max-width:none;max-height:none;margin:0;padding:0;border:0;pointer-events:none}
.matrix-visitor-fallback{object-fit:contain;object-position:center bottom}
.best-person.is-walking .best-person-sprite{animation-delay:var(--visitor-walk-phase,0s);animation-duration:var(--visitor-walk-duration,.5s)}

/* The shared motion controller samples a collision-safe path each frame. CSS
   interpolation would cut its corners; a clock-driven walk loop would glide. */
.best-person.has-safe-motion{transition:none}
.best-person.has-safe-motion .best-person-sprite,.best-person.has-safe-motion.is-walking .best-person-sprite{animation:none;transform:translateX(-50%) translateY(var(--visitor-bob,0%)) rotate(var(--visitor-sway,0deg))}
@media(prefers-reduced-motion:reduce){.best-person.has-safe-motion .best-person-sprite{transform:translateX(-50%)}}

/* Gait rig (24-sep-2026): torso + two legs cut from the same visitor image.
   The rig takes the sprite's anchor; its children fill it and are clipped. The
   hip line sits at 56% of the normalized full-body contour. */
.best-person .visitor-rig{position:absolute;left:50%;bottom:0;height:100%;aspect-ratio:var(--visitor-rig-aspect,2/3);transform:translateX(-50%) translateY(var(--visitor-bob,0%)) rotate(var(--visitor-sway,0deg));transform-origin:50% 100%}
.best-person .visitor-rig>*{position:absolute!important;inset:0;left:0!important;bottom:0;width:100%!important;height:100%!important;transform:none!important;animation:none!important}
.best-person .visitor-rig>:nth-child(1){z-index:2;clip-path:inset(0 0 39% 0)}
.best-person .visitor-rig>:nth-child(2),.best-person .visitor-rig>:nth-child(3){z-index:1;transform-origin:50% 57%!important}
.best-person .visitor-rig>:nth-child(2){clip-path:inset(58% 50% 0 0);transform:translateY(var(--visitor-lift-l,0%)) rotate(var(--visitor-leg-l,0deg))!important}
.best-person .visitor-rig>:nth-child(3){clip-path:inset(58% 0 0 50%);transform:translateY(var(--visitor-lift-r,0%)) rotate(var(--visitor-leg-r,0deg))!important}
.best-person.has-safe-motion .best-person-shadow{opacity:.9;transform:scaleX(calc(1 + var(--visitor-step,0) * .35));transition:none}
@media(prefers-reduced-motion:reduce){.best-person .visitor-rig{transform:translateX(-50%)}.best-person .visitor-rig>:nth-child(n+2){transform:none!important}}

/* Baked walk sheets (24-sep-2026): 9 x 2 frames per visitor, chosen per frame
   from the distance-driven gait phase and on-screen direction. The sheet frame
   has a 6% pad above and below the body, so it is drawn 112% tall and lowered
   6% to keep the feet exactly on the floor anchor. The gait already carries its
   own bob, so the synthetic bob/sway is not applied. */
.best-person .matrix-walk-sprite,.best-person.has-safe-motion .matrix-walk-sprite,.best-person.has-safe-motion.is-walking .matrix-walk-sprite{display:block;height:112%;bottom:-6%;width:auto;aspect-ratio:2/3;background-repeat:no-repeat;background-size:900% 200%;background-position:100% 0%;transform:translateX(-50%)}
