#home.portal-home-hero {
  position: relative;
  isolation: isolate;
}

.home-christmas-decor,
.home-christmas-snow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.home-christmas-decor {
  z-index: 2;
  background:
    radial-gradient(ellipse at top left, rgb(152 29 43 / 23%), transparent 46%),
    radial-gradient(ellipse at top right, rgb(22 115 76 / 24%), transparent 46%);
  box-shadow: inset 0 1px rgb(255 218 128 / 38%), inset 0 -1px rgb(255 218 128 / 28%);
}

.home-christmas-decor::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: radial-gradient(circle at 3px 3px, #ffe4a8 1px, rgb(255 188 65 / 35%) 2px, transparent 3px) 0 0 / 26px 7px repeat-x;
}

.home-christmas-snow {
  container-type: size;
  z-index: 4;
}

.home-christmas-snow i {
  position: absolute;
  top: -8px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #fff9ed;
  animation: home-christmas-fall var(--time) var(--delay) linear infinite;
}

@keyframes home-christmas-fall {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  12%, 82% { opacity: .77; }
  100% { transform: translate3d(var(--drift), calc(100cqh + 12px), 0); opacity: 0; }
}

.home-christmas-flight {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.home-christmas-sleigh {
  position: absolute;
  left: min(-32%, -220px);
  top: 9%;
  width: clamp(200px, 31vw, 420px);
  animation: home-christmas-flight 27s -4s linear infinite;
}

/* The sleigh's transform mirrors its trail on the return flight. */
.home-christmas-sleigh::before,
.home-christmas-sleigh::after {
  content: "";
  position: absolute;
  right: 91%;
  top: 64%;
  width: 57%;
  height: 24%;
  pointer-events: none;
  transform-origin: right center;
  background: radial-gradient(ellipse at 78% 47%, rgb(255 218 136 / 54%), rgb(213 139 35 / 22%) 40%, transparent 73%);
  animation: home-christmas-trail 2.4s ease-out infinite;
}

.home-christmas-sleigh::after {
  top: 70%;
  height: 16%;
  animation-delay: -1.2s;
}

@keyframes home-christmas-trail {
  from { opacity: 0; transform: translateX(8%) scale(.65); }
  28% { opacity: .8; }
  to { opacity: 0; transform: translateX(-25%) scale(1.3, 1.65); }
}

/* Each leg layer shares the body image's scale and pivots near the joints. */
.home-christmas-rig {
  position: relative;
  transform-origin: 34% 59%;
  animation: home-christmas-tow 3.2s ease-in-out infinite;
}

.home-christmas-rig img {
  display: block;
  width: 100%;
  height: auto;
  clip-path: polygon(0 0, 100% 0, 100% 46%, 88% 52%, 75% 61%, 59% 67%, 44% 72%, 34% 71%, 34% 100%, 0 100%);
}

.home-christmas-legs {
  position: absolute;
  inset: 0;
  background: url('/assets/images/home-christmas-santa.webp') center / 100% 100% no-repeat;
  animation: home-christmas-stride 1.45s ease-in-out infinite;
}

.home-christmas-legs-back {
  clip-path: polygon(34% 68%, 44% 69%, 59% 64%, 59% 100%, 34% 100%);
  transform-origin: 46% 67%;
}

.home-christmas-legs-middle {
  clip-path: polygon(58.6% 64%, 75% 58%, 88% 49%, 88% 100%, 58.6% 100%);
  transform-origin: 72% 59%;
  animation-delay: -.48s;
}

.home-christmas-legs-front {
  clip-path: polygon(87.6% 49%, 100% 43%, 100% 100%, 87.6% 100%);
  transform-origin: 94% 48%;
  animation-delay: -.96s;
}

@keyframes home-christmas-stride {
  0%, 100% { transform: skewX(14deg) scaleY(1); }
  30% { transform: skewX(3deg) scaleY(1.04); }
  58% { transform: skewX(-19deg) scaleY(.89); }
  79% { transform: skewX(-6deg) scaleY(.91); }
}

@keyframes home-christmas-tow {
  0%, 100% { transform: translateY(1.5%) rotate(1deg); }
  48% { transform: translateY(-3%) rotate(-2deg); }
}


.home-christmas-gift {
  position: absolute;
  left: 12%;
  top: 52%;
  font-size: clamp(12px, 2vw, 25px);
  opacity: 0;
  animation: home-christmas-gift 4.8s linear infinite;
}

.home-christmas-gift:nth-of-type(2) { animation-delay: 1.6s; }
.home-christmas-gift:nth-of-type(3) { animation-delay: 3.2s; }

@keyframes home-christmas-flight {
  0% { left: min(-32%, -220px); top: 20%; transform: scaleX(1) rotate(-5deg); }
  24% { left: 38%; top: 3%; transform: scaleX(1) rotate(-5deg); }
  48% { left: 102%; top: 14%; transform: scaleX(1); }
  49%, 50% { left: 102%; top: 28%; transform: scaleX(-1); }
  74% { left: 38%; top: 19%; transform: scaleX(-1) rotate(5deg); }
  98%, 99% { left: min(-42%, -220px); top: 12%; transform: scaleX(-1); }
  100% { left: min(-32%, -220px); top: 20%; transform: scaleX(1) rotate(-5deg); }
}

@keyframes home-christmas-gift {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  8% { opacity: 1; }
  48%, 100% { opacity: 0; transform: translate(-80px, 130px) rotate(-48deg); }
}

#home.home-christmas-away .home-christmas-snow i,
#home.home-christmas-away .home-christmas-sleigh,
#home.home-christmas-away .home-christmas-rig,
#home.home-christmas-away .home-christmas-legs,
#home.home-christmas-away .home-christmas-sleigh::before,
#home.home-christmas-away .home-christmas-sleigh::after,
#home.home-christmas-away .home-christmas-gift { animation-play-state: paused; }

@media (max-width: 640px) {
  .home-christmas-snow i:nth-child(n + 29) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .home-christmas-snow,
  .home-christmas-flight { display: none; }
}

.home-christmas-music {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: .75rem;
  padding: .45rem .85rem;
  border: 1px solid rgb(255 218 128 / 45%);
  border-radius: 999px;
  background: #15110b;
  color: #fff0cc;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}

.home-christmas-music[hidden] { display: none; }

.home-christmas-music:focus-visible {
  outline: 2px solid #fff0cc;
  outline-offset: 3px;
}
