/*
 * Funtime – Christmas seasonal theme
 * Standalone stylesheet. Every class is prefixed with .xmas- so nothing here
 * touches the site's own styles. Decorative layers never take clicks
 * (pointer-events: none) and never change the page layout (fixed/absolute).
 */

.xmas-root {
    --xmas-red: #d62828;
    --xmas-green: #1b7f4b;
    --xmas-gold: #f4c542;
    --xmas-blue: #1788e5;
    --xmas-ink: #1f2940;
    --xmas-z: 2147480000;
    /* height of any fixed bar at the bottom of the site (e.g. cookie bar), set by JS */
    --xmas-offset: 0px;
}

/* ---------- Snow ---------- */
.xmas-snow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--xmas-z);
    transition: opacity .6s ease;
}

.xmas-snow.is-off {
    opacity: 0;
}

/* ---------- Fairy lights (top of page, scroll away with it) ---------- */
.xmas-lights {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    z-index: calc(var(--xmas-z) - 2);
}

.xmas-lights li {
    position: relative;
    flex: 0 0 46px;
    height: 30px;
}

/* wire segment */
.xmas-lights li::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    width: 46px;
    height: 16px;
    border-bottom: 2px solid #2b2b2b;
    border-radius: 50%;
}

/* bulb */
.xmas-lights li::after {
    content: "";
    position: absolute;
    top: 6px;
    left: 19px;
    width: 9px;
    height: 15px;
    border-radius: 50%;
    border-top: 3px solid #444;
    background: var(--xmas-bulb, var(--xmas-red));
    box-shadow: 0 2px 12px 2px var(--xmas-bulb, var(--xmas-red));
    animation: xmas-twinkle 2.2s ease-in-out infinite;
    animation-delay: var(--xmas-delay, 0s);
}

.xmas-lights li:nth-child(4n + 1) { --xmas-bulb: var(--xmas-red); }
.xmas-lights li:nth-child(4n + 2) { --xmas-bulb: var(--xmas-gold); }
.xmas-lights li:nth-child(4n + 3) { --xmas-bulb: #2ecc71; }
.xmas-lights li:nth-child(4n + 4) { --xmas-bulb: var(--xmas-blue); }

@keyframes xmas-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; box-shadow: 0 2px 4px 0 var(--xmas-bulb, var(--xmas-red)); }
}

/* ---------- Santa fly-by ---------- */
.xmas-santa {
    position: fixed;
    bottom: calc(8px + var(--xmas-offset));
    left: 0;
    width: clamp(220px, 34vw, 430px);
    pointer-events: none;
    z-index: calc(var(--xmas-z) + 1);
    transform: translateX(100vw);
    visibility: hidden;
}

.xmas-santa.is-flying {
    visibility: visible;
    animation: xmas-fly 9s linear forwards;
}

.xmas-santa__bob {
    position: relative;
    animation: xmas-bob 1.6s ease-in-out infinite;
}

.xmas-santa__img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25));
}

/* sparkle trail behind the sleigh (sleigh flies right-to-left) */
.xmas-santa__trail {
    position: absolute;
    top: 55%;
    left: 92%;
    width: 70%;
    height: 40px;
    background-image:
        radial-gradient(circle, var(--xmas-gold) 0 2px, transparent 3px),
        radial-gradient(circle, #fff 0 1.5px, transparent 2.5px);
    background-size: 22px 18px, 30px 26px;
    background-position: 0 0, 11px 9px;
    -webkit-mask-image: linear-gradient(to right, #000, transparent);
    mask-image: linear-gradient(to right, #000, transparent);
    animation: xmas-sparkle .5s steps(2) infinite;
}

@keyframes xmas-fly {
    from { transform: translateX(100vw); }
    to { transform: translateX(calc(-100% - 40vw)); }
}

@keyframes xmas-bob {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-14px) rotate(1deg); }
}

@keyframes xmas-sparkle {
    from { opacity: 1; }
    to { opacity: .45; }
}

/* ---------- Greeting card ---------- */
.xmas-toast {
    position: fixed;
    left: 16px;
    bottom: calc(76px + var(--xmas-offset));
    max-width: calc(100vw - 32px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff;
    color: var(--xmas-ink);
    border-top: 4px solid var(--xmas-red);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    font-family: inherit;
    z-index: calc(var(--xmas-z) + 2);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .4s ease, transform .4s ease, bottom .3s ease;
    pointer-events: none;
}

.xmas-toast[hidden] {
    display: none;
}

.xmas-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.xmas-toast__icon {
    font-size: 30px;
    line-height: 1;
}

.xmas-toast__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--xmas-red);
}

.xmas-toast__text {
    margin: 2px 0 0;
    font-size: 14px;
}

.xmas-toast__close {
    align-self: flex-start;
    border: 0;
    background: none;
    color: #888;
    font-size: 22px;
    line-height: 1;
    padding: 0 0 0 4px;
    cursor: pointer;
}

.xmas-toast__close:hover,
.xmas-toast__close:focus-visible {
    color: var(--xmas-ink);
}

/* ---------- Snow on/off button ---------- */
.xmas-toggle {
    position: fixed;
    left: 16px;
    bottom: calc(16px + var(--xmas-offset));
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--xmas-blue);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
    z-index: calc(var(--xmas-z) + 2);
    transition: transform .2s ease, background-color .2s ease, bottom .3s ease;
}

.xmas-toggle:hover {
    transform: scale(1.08);
}

.xmas-toggle:focus-visible {
    outline: 3px solid var(--xmas-gold);
    outline-offset: 2px;
}

.xmas-toggle[aria-pressed="false"] {
    background: #8a94a6;
}

.xmas-toggle[aria-pressed="false"]::after {
    content: "";
    position: absolute;
    width: 26px;
    height: 2px;
    background: #fff;
    transform: rotate(-45deg);
}

/* ---------- Respect users who prefer less motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .xmas-snow,
    .xmas-santa,
    .xmas-toggle {
        display: none;
    }

    .xmas-lights li::after {
        animation: none;
    }

    .xmas-toast {
        transition: none;
    }
}
