.andes-life {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  container-type: inline-size;
}
.andes-depth {
  position: absolute;
  inset: 0;
  background: url("andes-life/scene.webp") center / 100% 100% no-repeat;
}
.andes-ridge {
  clip-path: polygon(0 100%, 0 12%, 5% 6%, 10% 10%, 14% 17%, 18% 18%, 20% 14%,
    24% 8%, 27% 13%, 30% 16%, 33% 12%, 38% 17%, 43% 20%, 47% 22%, 51% 28%,
    56% 26%, 63% 20%, 67% 17%, 71% 22%, 75% 18%, 81% 8%, 85% 13%, 90% 19%,
    96% 9%, 100% 11%, 100% 100%);
}
.andes-porch {
  clip-path: polygon(38% 67%, 39% 65%, 42.1% 65.3%, 43.5% 67.3%, 44.1% 70%, 43.9% 73.4%,
    41.1% 75.5%, 37.2% 74.8%, 37.3% 70%);
}
.andes-wall {
  clip-path: polygon(0 100%, 0 82%, 7% 80.8%, 12% 80.9%, 18.2% 81%, 19.6% 78.4%,
    20% 76%, 22.4% 75.7%, 24.3% 77.3%, 25.2% 79.5%, 27.8% 79.5%, 30% 79.2%,
    31.5% 80%, 33% 79%, 35% 79%, 36.5% 78.6%, 38% 78.2%, 38.3% 76%, 39.6% 75.4%,
    40.9% 77%, 41.1% 81.7%, 38% 86.5%, 32% 90%, 24% 97%, 24% 100%);
}
.andes-evergreen {
  clip-path: polygon(0 64%, 3% 61%, 7% 63%, 10% 63.5%, 9% 66%, 12.5% 66.5%,
    11% 69%, 13.3% 70%, 11.5% 74.5%, 9% 77%, 0 81%);
}
.andes-door-interior,
.andes-door-panel {
  position: absolute;
  inset: 0;
  --door-outline: polygon(46.85% 69.5%, 46.85% 60.8%, 47.15% 58.2%, 48.15% 55.7%,
    49.15% 54.3%, 50.1% 53.9%, 51.15% 54.5%, 52.2% 56.4%, 52.9% 58.8%, 53.15% 61.3%,
    53.15% 69.6%, 52.6% 70.1%, 47.4% 70.1%);
  clip-path: var(--door-outline);
  opacity: 0;
}
.andes-door-interior {
  background: radial-gradient(ellipse 3.4% 13% at 50% 57%, #663515, #261322 68%, #150a18);
}
.andes-door-panel { transform-origin: 46.85% 69.5%; }
.andes-delivering .andes-door-interior { animation: andes-door-interior 9s step-end both; }
.andes-delivering .andes-door-panel { animation: andes-door-open 9s ease-in-out both; }

@keyframes andes-door-interior {
  0%, 42%, 100% { opacity: 0 }
  1% { opacity: 1 }
}
@keyframes andes-door-open {
  0%, 1% { opacity: 1; scale: 1 1 }
  12%, 32% { opacity: 1; scale: .14 1 }
  41% { opacity: 1; scale: 1 1 }
  42%, 100% { opacity: 0; scale: 1 1 }
}

/* The entrance and the two residents have separate walkable lanes.
   Feet in the entrance lane are behind both residents and the foreground props. */
.andes-entry-lane {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 100%, 0 70%, 46.85% 70%, 46.85% 60.8%, 47.15% 58.2%, 48.15% 55.7%,
    49.15% 54.3%, 50.1% 53.9%, 51.15% 54.5%, 52.2% 56.4%, 52.9% 58.8%, 53.15% 61.3%,
    53.15% 70%, 100% 70%, 100% 100%);
}
.andes-llama {
  --size: 6.3cqw;
  --sprite: url("andes-life/llama.webp");
  --frames: 8;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  aspect-ratio: 1.08;
  transform: translate(-50%, -98%);
}
.andes-llama::before {
  content: "";
  position: absolute;
  inset: auto 11% -5% 11%;
  height: 17%;
  background: radial-gradient(ellipse, #291a3e80, #38244530 46%, transparent 73%);
}
.andes-llama i, .andes-llama b, .andes-condor i {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: var(--sprite) 0 0 / calc(var(--frames) * 100%) 100% no-repeat;
}
.andes-visitor { --size: 10.4cqw; --x: 49.9%; --y: 69.6%; opacity: 0; }
.andes-delivering .andes-visitor { animation: andes-visitor-walk 9s linear both; }
.andes-delivering .andes-visitor i { animation: andes-visitor-gait 9s linear both; }

@keyframes andes-visitor-walk {
  0%, 10% { left: 49.9%; top: 69.6%; width: calc(var(--size) * .62); opacity: 0 }
  15% { left: 50.1%; top: 70.6%; width: calc(var(--size) * .67); opacity: 1 }
  29% { left: 51.1%; top: 75.4%; width: calc(var(--size) * .82) }
  44%, 61% { left: 52.2%; top: 78.5%; width: calc(var(--size) * .92) }
  86% { left: 55.4%; top: 81%; width: calc(var(--size) * 1); opacity: 1 }
  100% { left: 56.1%; top: 81.4%; width: calc(var(--size) * 1); opacity: 0 }
}
/* Advance each sheet only while its actor is moving, then plant the feet. */
@keyframes andes-visitor-gait {
  10%, 20%, 30%, 38%, 61%, 72%, 83%, 93% { background-position-x: 0; animation-timing-function: steps(8, jump-none) }
  19.99%, 29.99%, 37.99%, 43.99%, 71.99%, 82.99%, 92.99%, 99% {
    background-position-x: 100%; animation-timing-function: step-end;
  }
  0%, 44%, 100% { background-position-x: 0; animation-timing-function: step-end }
}

.andes-resident {
  --x: 61.5%;
  --y: 95.6%;
  --size: 9cqw;
  animation: andes-resident-stroll 16s linear infinite;
}
.andes-resident i {
  filter: sepia(.1) saturate(.87) hue-rotate(-20deg);
  animation: andes-resident-gait 16s linear infinite, andes-resident-turn 16s step-end infinite;
  transform: scaleX(-1);
}
@keyframes andes-resident-stroll {
  0%, 22%, 87%, 100% { left: 61.5%; top: 95.6% }
  43%, 65% { left: 55.9%; top: 94% }
}
@keyframes andes-resident-turn {
  0%, 94%, 100% { transform: scaleX(-1) }
  62% { transform: scaleX(1) }
}
@keyframes andes-resident-gait {
  22%, 29%, 36%, 65%, 72%, 79% { background-position-x: 0; animation-timing-function: steps(8, jump-none) }
  28.99%, 35.99%, 42.99%, 71.99%, 78.99%, 86.99% {
    background-position-x: 100%; animation-timing-function: step-end;
  }
  0%, 43%, 87%, 100% { background-position-x: 0; animation-timing-function: step-end }
}

.andes-young {
  --x: 41.5%;
  --y: 93%;
  --size: 7.4cqw;
  --sprite: url("andes-life/baby.webp");
  --frames: 6;
  animation: andes-young-stroll 14s -3s linear infinite;
}
.andes-young i {
  animation: andes-young-gait 14s -3s linear infinite, andes-young-turn 14s -3s step-end infinite,
    andes-young-walk-visibility 14s -3s step-end infinite;
}
.andes-young b {
  --sprite: url("andes-life/sniff.webp");
  --frames: 2;
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: andes-young-sniff 14s -3s step-end infinite;
}
@keyframes andes-young-stroll {
  0%, 13%, 79%, 100% { left: 41.5%; top: 93% }
  31%, 61% { left: 46%; top: 91.5% }
}
@keyframes andes-young-turn {
  0%, 92%, 100% { transform: scaleX(1) }
  55% { transform: scaleX(-1) }
}
@keyframes andes-young-gait {
  13%, 22%, 61%, 70% { background-position-x: 0; animation-timing-function: steps(6, jump-none) }
  21.99%, 30.99%, 69.99%, 78.99% { background-position-x: 100%; animation-timing-function: step-end }
  0%, 31%, 79%, 100% { background-position-x: 0; animation-timing-function: step-end }
}
@keyframes andes-young-walk-visibility {
  0%, 56%, 100% { visibility: visible }
  34% { visibility: hidden }
}
@keyframes andes-young-sniff {
  0%, 56%, 100% { opacity: 0 }
  34%, 49% { opacity: 1; background-position-x: 0 }
  40% { opacity: 1; background-position-x: 100% }
}
@keyframes andes-steps { to { background-position-x: 100% } }

/* The painted stone and sills stay in front of the window occupants. */
.andes-window {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--width);
  height: var(--height);
  overflow: hidden;
  isolation: isolate;
  clip-path: var(--window-shape);
  opacity: 0;
  animation: andes-window-show 31s var(--window-cue) step-end infinite;
}
.andes-window-room, .andes-window-pane {
  position: absolute;
  inset: 0;
}
.andes-window-room {
  background: radial-gradient(ellipse at 54% 38%, #814426, #382028 69%, #170e20);
  box-shadow: inset 0 1px 3px #160c15cc;
}
.andes-window-visitor {
  position: absolute;
  inset: 3% 3% -14%;
  background: var(--window-visitor) center bottom / contain no-repeat;
  opacity: 0;
  transform: translateY(95%);
  animation: andes-window-look 31s var(--window-cue) ease-in-out infinite;
}
.andes-window-santa { --window-visitor: url("andes-life/window-santa.webp"); }
.andes-window-west-elf { --window-visitor: url("andes-life/window-west-elf.webp"); }
.andes-window-east-elf { --window-visitor: url("andes-life/window-east-elf.webp"); }
.andes-window-pane {
  background: url("andes-life/scene.webp") var(--panes-position) / var(--panes-size) no-repeat;
  animation: andes-window-swing 31s var(--window-cue) ease-in-out infinite;
}
.andes-window-pane-left {
  --window-turn: -83deg;
  clip-path: inset(0 50% 0 0);
  transform-origin: left center;
}
.andes-window-pane-right {
  --window-turn: 83deg;
  clip-path: inset(0 0 0 50%);
  transform-origin: right center;
}
@keyframes andes-window-show {
  0%, 19%, 100% { opacity: 0 }
  1% { opacity: 1 }
}
@keyframes andes-window-swing {
  0%, 1%, 18.8%, 100% { transform: perspective(110px) rotateY(0) }
  3.6%, 16.2% { transform: perspective(110px) rotateY(var(--window-turn)) }
}
@keyframes andes-window-look {
  0%, 3%, 17%, 100% { opacity: 0; transform: translateY(95%) }
  5.8% { opacity: 1; transform: translate(-7%, 3%) rotate(-5deg) }
  8% { opacity: 1; transform: translate(-7%, 0) rotate(-5deg) }
  12%, 14% { opacity: 1; transform: translate(7%, 0) rotate(5deg) }
}

.andes-string-star {
  --glow: #ffba3875;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 4.3cqw;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #fff5c9d9 4%, var(--glow) 32%, transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
  animation: andes-star-twinkle 4.8s var(--twinkle) infinite;
}
.andes-string-star-red { --glow: #ff536c96; }
@keyframes andes-star-twinkle { to { opacity: 1 } }

.andes-lantern {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 4.2cqw;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #ffe3a6b3 0%, #ffb65562 28%, #ffc76b1a 49%, transparent 67%);
  opacity: .26;
  animation: andes-twinkle 4.2s var(--phase) ease-in-out infinite;
}
.andes-delivering .andes-lantern:nth-last-child(n+9) { animation: andes-relay 3.2s var(--relay) ease-in-out both; }
@keyframes andes-twinkle { 50% {opacity:.72} }
@keyframes andes-relay { 0%,100% {opacity:.26} 30%,60% {opacity:1} }

.andes-condor {
  --sprite: url("andes-life/condor.webp");
  --frames: 8;
  position: absolute;
  width: 11cqw;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: andes-flyover 52s -12s linear infinite;
}
.andes-condor i { animation: andes-steps 2.3s steps(8, jump-none) infinite; }
.andes-condor-shadow {
  position: absolute;
  width: 6cqw;
  height: 1.4cqw;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, #15133666, transparent 68%);
  opacity: 0;
  animation: andes-shadow 52s -12s linear infinite;
}
@keyframes andes-flyover {
  0%, 15% {left:110%;top:23%;opacity:0}
  18% {opacity:1}
  22% {left:80%;top:7.5%}
  31% {left:50%;top:8.5%}
  38% {left:26%;top:12%}
  48%,100% {left:-10%;top:25%;opacity:1}
}
@keyframes andes-shadow {
  0%, 19% {left:100%;top:78%;opacity:0}
  23% {opacity:.4}
  38% {left:20%;top:89%;opacity:.26}
  43%,100% {left:0;top:95%;opacity:0}
}
.andes-bell.town-snow-toggle { right: calc(clamp(8px, 2vw, 18px) + 44px); }
.andes-bell[aria-disabled="true"] span { opacity: .64; }
@media (prefers-reduced-motion: reduce) {
  .andes-life * { animation: none !important; }
  .andes-delivering .andes-visitor { opacity: 1; left: 53%; top: 80%; }
  .andes-delivering .andes-lantern { opacity: .78; }
}


[data-town="andes"] .town-signpost {
  left: 22%;
  bottom: 0;
  z-index: 2;
  min-height: clamp(51px, 6vw, 73px);
  color: #fff4d6;
}
[data-town="andes"] .town-signpost::before {
  inset: 10% auto 0 20%;
  width: 10px;
  background: repeating-linear-gradient(145deg,#aa3840 0 7px,#f4dfc4 8px 14px);
  box-shadow: inset -3px 0 #492d3c65;
}
[data-town="andes"] .town-signpost span {
  padding: .54em 1.4em .6em .78em;
  background: linear-gradient(#b95a4a 4%,#ebc280 9%,#842e42 16% 84%,#e0af70 90%,#4d2937 96%);
  text-shadow: 0 1px #451f33;
}
