/* Tema Navidad — solo CSS + SVG propios. Animaciones únicamente con transform/opacity
   (compositor), sin librerías ni canvas. Todo se apaga con prefers-reduced-motion. */

/* 1) Paleta: la tienda usa Tailwind v4, cuyos colores son variables CSS; reasignar
      "sky" a rojo y "cyan" a verde recolorea botones, enlaces y acentos sin tocar vistas. */
:root[data-store-theme="christmas"][data-theme-palette="1"] {
    --color-sky-50: #fff1f2;
    --color-sky-100: #ffe0e3;
    --color-sky-200: #ffc7cd;
    --color-sky-300: #ff9ea8;
    --color-sky-400: #f56b79;
    --color-sky-500: #e23b4d;
    --color-sky-600: #c8283a;
    --color-sky-700: #a51f30;
    --color-sky-800: #861d2c;
    --color-sky-900: #701c29;
    --color-sky-950: #3d0b13;
    --color-cyan-300: #6ee7b7;
    --color-cyan-400: #34d399;
    --color-cyan-500: #10b981;
}

/* 2) Nieve: N <span> creados una vez por JS; cada uno cae con una animación de transform. */
.xm-snow {
    position: fixed;
    inset: 0;
    z-index: 30;
    overflow: hidden;
    pointer-events: none;
    contain: strict;
}
.xm-flake {
    position: absolute;
    top: -12px;
    left: var(--x);
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: #e3f1ff;
    opacity: var(--o);
    box-shadow: 0 0 0 1px rgba(55, 115, 190, .55), 0 1px 5px rgba(55, 115, 190, .45);
    animation: xm-fall var(--d) linear var(--w) infinite, xm-sway var(--sd) ease-in-out var(--w) infinite alternate;
}
.dark .xm-flake { background: #fff; box-shadow: 0 0 4px rgba(255, 255, 255, .7); }
@keyframes xm-fall { to { transform: translate3d(0, calc(100vh + 24px), 0); } }
@keyframes xm-sway { from { translate: 0 0; } to { translate: var(--sw) 0; } }
.xm-paused .xm-flake, .xm-paused .xm-sleigh, .xm-paused .xm-sleigh img,
.xm-paused .xm-lights::before, .xm-paused .xm-lights::after { animation-play-state: paused; }

/* 3) Luces: cable con focos tenues + dos capas brillantes que parpadean en alternancia. */
.xm-lights {
    position: relative;
    z-index: 35;
    height: 0;
    pointer-events: none;
}
.xm-lights > i,
.xm-lights::before,
.xm-lights::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 26px;
    background: url("img/lights-base.svg") repeat-x 0 0 / 160px 26px;
}
.xm-lights::before {
    background-image: url("img/lights-a.svg");
    animation: xm-twinkle 1.5s ease-in-out infinite alternate;
}
.xm-lights::after {
    background-image: url("img/lights-b.svg");
    animation: xm-twinkle 1.5s ease-in-out infinite alternate-reverse;
}
@keyframes xm-twinkle { from { opacity: .15; } to { opacity: 1; } }

/* 4) Decoración estática (solo si la opción "scene" está activa). */
[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="logo"] { position: relative; }
[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="logo"]::after {
    content: "";
    position: absolute;
    left: -9px;
    top: -12px;
    width: 28px;
    height: 24px;
    background: url("img/hat.svg") center / contain no-repeat;
    transform: rotate(-18deg);
    pointer-events: none;
}

[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="hero"]::before,
[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="hero"]::after {
    content: "";
    display: none;
    position: absolute;
    bottom: 0;
    z-index: 1;
    width: 15vw;
    max-width: 240px;
    aspect-ratio: 220 / 150;
    background: center bottom / contain no-repeat;
    pointer-events: none;
}
[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="hero"]::before { left: 1.5vw; background-image: url("img/scene-left.svg"); }
[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="hero"]::after { right: 1.5vw; background-image: url("img/scene-right.svg"); }
@media (min-width: 1100px) {
    [data-store-theme="christmas"][data-theme-scene="1"] [data-slot="hero"]::before,
    [data-store-theme="christmas"][data-theme-scene="1"] [data-slot="hero"]::after { display: block; }
}

[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="footer"] { position: relative; margin-top: 18px; }
[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="footer"]::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% - 1px);
    height: 22px;
    background: url("img/drift.svg") repeat-x 0 0 / 160px 22px;
    pointer-events: none;
}
.dark[data-store-theme="christmas"][data-theme-scene="1"] [data-slot="footer"]::before { filter: brightness(.78); }

/* 5) Trineo: una sola pasada (~11 s) y luego reposo hasta completar el ciclo de 90 s. */
.xm-sleigh {
    position: fixed;
    top: 92px;
    left: 0;
    z-index: 29;
    width: clamp(190px, 24vw, 340px);
    pointer-events: none;
    transform: translate3d(-110%, 0, 0);
    animation: xm-fly 90s linear 8s infinite;
    contain: layout paint;
}
.xm-sleigh img { display: block; width: 100%; height: auto; animation: xm-bob 1.4s ease-in-out infinite alternate; }
@keyframes xm-fly {
    0% { transform: translate3d(-110%, 0, 0); }
    13% { transform: translate3d(calc(100vw + 10%), 0, 0); }
    100% { transform: translate3d(calc(100vw + 10%), 0, 0); }
}
@keyframes xm-bob { from { transform: translateY(-4px) rotate(-1.5deg); } to { transform: translateY(5px) rotate(1deg); } }

@media (prefers-reduced-motion: reduce) {
    .xm-snow, .xm-sleigh { display: none; }
    .xm-lights::before, .xm-lights::after { animation: none; }
    .xm-lights::before { opacity: 1; }
    .xm-lights::after { opacity: .6; }
}
