.christmas-snow, .christmas-snow-control { display: none; }

@media screen and (prefers-reduced-motion: no-preference) {
    .christmas-snow:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        overflow: hidden;
        pointer-events: none;
        z-index: 1000;
    }
    .christmas-snow i {
        position: absolute;
        top: -24px;
        width: var(--size);
        height: var(--size);
        animation: christmas-fall var(--period) linear var(--offset) infinite;
    }
    .christmas-snow .snow-grain {
        background: rgba(255, 255, 255, .67);
        border-radius: 50%;
        box-shadow: 0 0 3px rgba(211, 236, 249, .4);
    }
    .christmas-snow .snow-crystal {
        background: url('../images/snow-crystal.svg') center / contain no-repeat;
        opacity: .8;
    }
    .christmas-snow-control {
        position: relative;
        z-index: 1;
        display: inline-block;
        margin: .5rem;
        padding: .4rem .85rem;
        border: 1px solid currentColor;
        border-radius: 1rem;
        color: #17445c;
        background: #fff;
        cursor: pointer;
    }
    .christmas-snow-control::after { content: ' off'; }
    .christmas-snow-control[aria-pressed="true"]::after { content: ' on'; }
}
@media (max-width: 767px) {
    .christmas-snow i:nth-child(n+18) { display: none; }
}
@keyframes christmas-fall {
    from { transform: translate(0, 0) rotate(-24deg); }
    50% { transform: translate(var(--drift), calc(50vh + 16px)) rotate(14deg); }
    to { transform: translate(0, calc(100vh + 32px)) rotate(52deg); }
}
@media print {
    .christmas-snow, .christmas-snow-control { display: none !important; }
}

@media screen {
    .christmas-lights::before {
        content: "";
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        height: 42px;
        background: url('../images/christmas-light-trail.svg') center top / auto 100% repeat-x;
        filter: drop-shadow(0 0 3px rgba(255, 181, 69, .85));
        pointer-events: none;
        z-index: -1;
    }
    .christmas-lights.scrolled::before { display: none; }
}
@media screen and (max-width: 1199px) {
    .christmas-lights::before { height: 24px; }
}
.christmas-flight { display: none; }
@media screen and (prefers-reduced-motion: no-preference) {
    .christmas-lights .christmas-flight {
        --sleigh-width: clamp(128px, 17vw, 260px);
        display: block;
        position: absolute;
        inset: 100% 0 auto;
        height: clamp(138px, 20vw, 245px);
        overflow: hidden;
        pointer-events: none;
        z-index: -1;
    }
    .christmas-flight::before {
        content: "";
        position: absolute;
        width: var(--sleigh-width);
        aspect-ratio: 2 / 1;
        background: url('../images/moonlit-sleigh-flight.webp?v=2') center / contain no-repeat;
        filter: contrast(.88) brightness(1.32) saturate(1.55)
            drop-shadow(0 -1px 1px rgba(255, 225, 174, .65));
        animation: christmas-sleigh-flight 12s .7s linear infinite both;
    }
    .christmas-lights.scrolled .christmas-flight { visibility: hidden; }
}
/* The header edge clips the climb and masks the switch to the return path. */
@keyframes christmas-sleigh-flight {
    0%   { transform: translate(100vw, 83%) rotate(7deg) scale(1); }
    22%  { transform: translate(76vw, 29%) rotate(10deg) scale(.88); }
    46%  { transform: translate(52vw, -115%) rotate(13deg) scale(.62); }
    58%  { transform: translate(22vw, -115%) rotate(-10deg) scale(.62); }
    79%  { transform: translate(9vw, 28%) rotate(-12deg) scale(.82); }
    100% { transform: translate(calc(-1 * var(--sleigh-width) - 24px), 90%) rotate(-7deg) scale(1.02); }
}
