/* Elfie crosses the chocolate counter once, then peeks out. */
#find-elfie .choc:has(.elfie-stage) { padding-bottom:0; }
.elfie-stage {
 --elf-height:76px;
 --elf-width:calc(var(--elf-height) * 2 / 3);
 --boxes:134px;
 position:relative; isolation:isolate; overflow:clip; container-type:inline-size;
 height:110px; max-width:1050px; margin:8px auto 0; pointer-events:none;
}
.elfie-stage::before {
 content:""; position:absolute; inset:auto 0 1px; height:1px;
 background:linear-gradient(90deg,transparent,#cdb99b 12%,#cdb99b 88%,transparent);
}
.elfie-travel {
 position:absolute; bottom:2px; left:0;
 --hide-x:calc(100cqw - var(--boxes) / 2 - var(--elf-width) / 2);
 width:var(--elf-width);
 height:var(--elf-height);
 transform:translateX(calc(var(--hide-x) - var(--boxes) * .5));
}
.elfie-doll {
 width:var(--elf-width); height:var(--elf-height);
 background:url(../images/find-elfie/elfie-character.webp?v=2) 0 100% / 800% 200% no-repeat;
}
.elfie-stage .elfie-boxes { position:absolute; bottom:2px; right:0; width:var(--boxes); height:auto; }
@media(max-width:760px) {
 .elfie-stage { --elf-height:64px; --boxes:112px; height:90px; margin-top:10px; }
}
@media(prefers-reduced-motion:no-preference) {
 .elfie-stage[data-ready] .elfie-travel { transform:translateX(calc(-1 * var(--elf-width))); }
 .elfie-stage.is-playing { --walk-time:3.8s; --hide-time:calc(var(--walk-time) + .55s); }
 .elfie-stage.is-playing .elfie-travel {
  animation:var(--cross-animation, elfie-cross) var(--walk-time) linear both, elfie-peek-from-box 3.25s var(--hide-time) ease-in-out forwards;
 }
 .elfie-stage.is-playing .elfie-doll {
  transform-origin:50% 94%;
  animation:elfie-walk-cycle .56s steps(8,jump-none) infinite, elfie-footfall .28s ease-in-out infinite;
 }
 /* The desktop crossing lasts eight seconds. The glance occupies 24–43%
    and the hop occupies 64–74% of the travel timeline below. */
 .elfie-stage.is-desktop-journey {
  --walk-time:8s;
  --cross-animation:elfie-desktop-cross;
 }
 .elfie-stage.is-desktop-journey.is-playing:not(.is-waving) .elfie-doll {
  animation:
   elfie-walk-cycle .56s steps(8,jump-none) infinite,
   elfie-footfall .28s ease-in-out infinite,
   elfie-glance 1.52s 1.92s ease-in-out,
   elfie-counter-hop .8s 5.12s ease-in-out;
 }
 .elfie-stage.is-waving .elfie-doll {
  animation:elfie-wave-cycle .84s .86s steps(8,jump-none) 3, elfie-look-out 3.25s .55s ease-in-out both;
 }
}
@keyframes elfie-cross {
 from { transform:translateX(calc(-1 * var(--elf-width))); }
 to { transform:translateX(var(--hide-x)); }
}
@keyframes elfie-peek-from-box {
 0%,100% { transform:translateX(var(--hide-x)); }
 14% { transform:translateX(calc(var(--hide-x) - var(--boxes) * .40)); }
 21% { transform:translateX(calc(var(--hide-x) - var(--boxes) * .37)); }
 33%,78% { transform:translateX(calc(var(--hide-x) - var(--boxes) * .57)); }
}
@keyframes elfie-walk-cycle {
 from { background-position:0% 0%; }
 to { background-position:100% 0%; }
}
@keyframes elfie-wave-cycle {
 from { background-position:0% 100%; }
 to { background-position:100% 100%; }
}
@keyframes elfie-footfall {
 0%,100% { transform:translateY(0) rotate(.5deg); }
 50% { transform:translateY(-1.4px) rotate(-.6deg); }
}
@keyframes elfie-look-out {
 0%,100% { transform:rotate(0); }
 22% { transform:rotate(-5deg); }
 38%,76% { transform:rotate(-9deg); }
}

@keyframes elfie-desktop-cross {
 0% { transform:translateX(calc(-1 * var(--elf-width))); }
 24%,43% { transform:translateX(calc(var(--hide-x) * .30)); }
 64%,66% { transform:translateX(calc(var(--hide-x) * .60)); }
 72%,74% { transform:translateX(calc(var(--hide-x) * .68)); }
 100% { transform:translateX(var(--hide-x)); }
}
@keyframes elfie-glance {
 0%,100% { background-position:0 100%; transform:rotate(0); }
 24%,42% { background-position:0 100%; transform:rotate(-8deg); }
 70%,85% { background-position:0 100%; transform:rotate(5deg); }
}
@keyframes elfie-counter-hop {
 0%,100% { transform:none; }
 20% { transform:scale(1.04,.90); }
 48% { transform:translateY(-18px) rotate(5deg); }
 80% { transform:scale(1.05,.91); }
}
