/* Christmas theme decorations. Loaded only when the Christmas theme is on. Purely decorative: nothing here takes clicks. */

.xmas-layer {
    position: fixed;
    inset: 0;
    z-index: 60;
    overflow: hidden;
    pointer-events: none;
}

/* Falling snow */
.xmas-flake {
    position: absolute;
    top: -40px;
    color: #fff;
    line-height: 1;
    opacity: .85;
    text-shadow: 0 0 6px rgba(255, 255, 255, .6);
    animation: xmas-fall linear infinite;
    will-change: transform;
}

@keyframes xmas-fall {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); }
    25% { transform: translate3d(18px, 27vh, 0) rotate(90deg); }
    50% { transform: translate3d(-14px, 54vh, 0) rotate(180deg); }
    75% { transform: translate3d(16px, 81vh, 0) rotate(270deg); }
    100% { transform: translate3d(0, 110vh, 0) rotate(360deg); }
}

/* Snow drift along the bottom of the screen */
.xmas-drift {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    height: 26px;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60px 22px at 30px 26px, #fff 98%, transparent) 0 0 / 90px 26px repeat-x,
        radial-gradient(ellipse 80px 18px at 70px 26px, #eef6ff 98%, transparent) 0 0 / 140px 26px repeat-x;
    opacity: .9;
    filter: drop-shadow(0 -2px 6px rgba(255, 255, 255, .25));
}

/* Santa's sleigh and reindeer flying across the top of the page */
.xmas-sleigh {
    position: fixed;
    top: 96px;
    left: 100%;
    z-index: 62;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    font-size: 34px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45));
    animation: xmas-fly 16s linear forwards;
}

.xmas-sleigh .xmas-deer { display: inline-block; animation: xmas-gallop .5s ease-in-out infinite alternate; }
.xmas-sleigh .xmas-deer:nth-child(2) { animation-delay: .15s; }
.xmas-sleigh .xmas-deer:nth-child(3) { animation-delay: .3s; }
.xmas-sleigh .xmas-deer:nth-child(4) { animation-delay: .45s; }
.xmas-sleigh .xmas-rudolph { position: relative; }
.xmas-sleigh .xmas-rudolph::after {
    content: "";
    position: absolute;
    left: 1px;
    top: 13px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff2a2a;
    box-shadow: 0 0 8px 3px rgba(255, 40, 40, .85);
    animation: xmas-nose 1s ease-in-out infinite alternate;
}
.xmas-sleigh .xmas-santa {
    position: relative;
    display: inline-block;
    width: 1.5em;
    height: 1.3em;
    margin-left: 8px;
    font-size: 44px;
    animation: xmas-gallop .8s ease-in-out infinite alternate;
}
.xmas-sleigh .xmas-santa-rider { position: absolute; left: .28em; top: 0; font-size: .62em; }
.xmas-sleigh .xmas-santa-sled { position: absolute; left: 0; bottom: 0; transform: scaleX(-1); }
.xmas-sleigh .xmas-sparkle {
    font-size: 18px;
    opacity: .9;
    animation: xmas-twinkle .6s ease-in-out infinite alternate;
}

@keyframes xmas-fly {
    0% { transform: translate3d(0, 30px, 0); }
    25% { transform: translate3d(-35vw, 0, 0); }
    50% { transform: translate3d(-70vw, 40px, 0); }
    75% { transform: translate3d(-105vw, 5px, 0); }
    100% { transform: translate3d(calc(-100vw - 100% - 80px), 30px, 0); }
}

@keyframes xmas-gallop {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

@keyframes xmas-nose {
    from { opacity: .55; }
    to { opacity: 1; }
}

@keyframes xmas-twinkle {
    from { opacity: .3; transform: scale(.8); }
    to { opacity: 1; transform: scale(1.1); }
}

/* Candy canes hanging under the navigation */
.xmas-cane {
    position: fixed;
    top: 64px;
    z-index: 51;
    width: 34px;
    height: 64px;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 76'%3E%3Cpath d='M28 72V22a10 10 0 0 0-20 0v5' fill='none' stroke='%23fff' stroke-width='8' stroke-linecap='round'/%3E%3Cpath d='M28 72V22a10 10 0 0 0-20 0v5' fill='none' stroke='%23d6202f' stroke-width='8' stroke-dasharray='5 6' stroke-linecap='butt'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5));
    transform-origin: 70% 0;
    animation: xmas-swing 3.2s ease-in-out infinite alternate;
}
.xmas-cane.is-left { left: 14px; }
.xmas-cane.is-right { right: 18px; transform: scaleX(-1); animation-name: xmas-swing-flipped; }

@keyframes xmas-swing {
    from { transform: rotate(-6deg); }
    to { transform: rotate(6deg); }
}

@keyframes xmas-swing-flipped {
    from { transform: scaleX(-1) rotate(-6deg); }
    to { transform: scaleX(-1) rotate(6deg); }
}

/* Twinkling fairy lights along the bottom of the navigation */
.xmas-lights {
    position: fixed;
    top: 66px;
    left: 0;
    right: 0;
    z-index: 51;
    height: 22px;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    pointer-events: none;
    background: radial-gradient(ellipse 50% 14px at 50% 0, transparent 92%, rgba(40, 70, 45, .9) 93%, rgba(40, 70, 45, .9) 100%, transparent 101%) 0 -4px / 52px 18px repeat-x;
}
.xmas-lights i {
    width: 8px;
    height: 12px;
    margin-top: 6px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: var(--bulb);
    box-shadow: 0 0 10px 2px var(--bulb);
    animation: xmas-bulb 1.4s ease-in-out infinite alternate;
}
.xmas-lights i:nth-child(4n+1) { --bulb: #ff3b3b; }
.xmas-lights i:nth-child(4n+2) { --bulb: #ffd34d; animation-delay: .35s; }
.xmas-lights i:nth-child(4n+3) { --bulb: #3ee07a; animation-delay: .7s; }
.xmas-lights i:nth-child(4n+4) { --bulb: #4fb8ff; animation-delay: 1.05s; }

@keyframes xmas-bulb {
    from { opacity: .35; }
    to { opacity: 1; }
}

/* The sign-in page drops the nav decorations and moves the sleigh up */
body.page-auth .xmas-cane,
body.page-auth .xmas-lights { display: none; }
body.page-auth .xmas-sleigh { top: 40px; }

/* The navigation becomes a side drawer on smaller screens, so no lights or canes there */
@media (max-width: 980px) {
    .xmas-cane,
    .xmas-lights { display: none; }
    .xmas-sleigh { top: 70px; font-size: 26px; }
    .xmas-sleigh .xmas-santa { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    .xmas-flake,
    .xmas-sleigh { display: none; }
    .xmas-cane,
    .xmas-lights i { animation: none; }
}

@media print {
    .xmas-layer,
    .xmas-drift,
    .xmas-sleigh,
    .xmas-cane,
    .xmas-lights { display: none !important; }
}
