/* Christmas theme for L. Knight book bingo, switched on with GeneralConfig:BingoTheme = "christmas".
   Its decorations are in Views/LKnight/BingoThemes/_christmas.cshtml.
   Decorations go in .bingo-deco__side (beside the card, wide screens) and .bingo-deco__strip
   (a row above the card, smaller screens) so they never cover the card or the page text. */

.bingo--christmas {
    --bingo-board-from: #c62828;
    --bingo-board-to: #1b5e20;
    --bingo-board-shadow: rgba(27, 94, 32, 0.35);
    --bingo-line-glow: #f6c343;
    --bingo-confetti: #c62828, #2e7d32, #f6c343, #ffffff, #8ec1e6, #e53935;
}

/* ---- Beside the card ---- */

.bingo--christmas .bingo-deco__side {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    /* Everything left (or right) of the card, less a gap. The card is at most 520px wide. */
    width: calc(50% - 284px);
    overflow: hidden; /* keeps the falling snow beside the card */
}

.bingo--christmas .bingo-deco__side--left {
    left: 0;
}

.bingo--christmas .bingo-deco__side--right {
    right: 0;
}

.bingo-deco__side > svg[class^="xm-"] {
    position: absolute;
}

/* Baubles hang from the top and swing. Their colour comes from currentColor. */
.bingo-deco__side .xm-bauble {
    top: 0;
    width: 36px;
    height: 99px;
    transform-origin: top center;
    animation: xm-swing 4s ease-in-out infinite;
}

.bingo-deco__side .xm-bauble--a { left: 12%; color: #d32f2f; }
.bingo-deco__side .xm-bauble--b { left: 36%; height: 72px; width: 26px; color: #f6c343; animation-delay: -1.5s; }
.bingo-deco__side .xm-bauble--c { right: 46%; height: 88px; width: 32px; color: #1e88e5; animation-delay: -0.7s; }

.bingo-deco__side .xm-sleigh {
    top: 30%;
    left: 50%;
    width: min(220px, 94%);
    margin-left: calc(min(220px, 94%) / -2);
    animation: xm-fly 7s ease-in-out infinite;
}

.bingo-deco__side .xm-star {
    width: 16px;
    animation: xm-twinkle 2.4s ease-in-out infinite;
}

.bingo-deco__side .xm-star--a { top: 20%; right: 14%; }
.bingo-deco__side .xm-star--b { top: 60%; left: 18%; width: 12px; animation-delay: -1s; }
.bingo-deco__side .xm-star--c { top: 50%; left: 22%; animation-delay: -0.5s; }

.bingo-deco__side .xm-tree {
    bottom: 3%;
    left: 8%;
    width: min(130px, 55%);
}

.bingo-deco__side .xm-present {
    width: min(58px, 26%);
}

.bingo-deco__side .xm-present--a {
    bottom: 3%;
    left: calc(8% + min(130px, 55%) - 10px);
    color: #c62828;
}

.bingo-deco__side .xm-holly {
    top: 18px;
    right: 10%;
    width: 96px;
}

.bingo-deco__side .xm-candy {
    top: 34%;
    right: 16%;
    width: 30px;
    transform: rotate(-12deg);
}

.bingo-deco__side .xm-snowman {
    bottom: 3%;
    right: 12%;
    width: min(104px, 46%);
}

.bingo-deco__side .xm-present--b {
    bottom: 3%;
    right: calc(12% + min(104px, 46%) - 6px);
    width: min(48px, 22%);
    color: #2e7d32;
}

/* Snow falls the full height beside the card, behind the other decorations. */
.bingo-deco__side .xm-snow {
    top: -5%;
    width: 16px;
    opacity: 0;
    z-index: -1;
    animation: xm-fall 11s linear infinite;
}

.bingo-deco__side .xm-snow--1 { left: 10%; animation-duration: 12s; }
.bingo-deco__side .xm-snow--2 { left: 42%; width: 12px; animation-delay: -4s; }
.bingo-deco__side .xm-snow--3 { left: 68%; animation-duration: 14s; animation-delay: -8s; }
.bingo-deco__side .xm-snow--4 { left: 86%; width: 11px; animation-delay: -2s; }
.bingo-deco__side .xm-snow--5 { left: 8%; animation-delay: -6s; }
.bingo-deco__side .xm-snow--6 { left: 30%; width: 12px; animation-duration: 13s; animation-delay: -1s; }
.bingo-deco__side .xm-snow--7 { left: 60%; animation-duration: 10s; animation-delay: -9s; }
.bingo-deco__side .xm-snow--8 { left: 82%; width: 13px; animation-delay: -3s; }

/* ---- Above the card, when there's no room beside it ---- */

.bingo--christmas .bingo-deco__strip {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    height: 56px;
    margin: 0 auto 10px;
}

.bingo-deco__strip svg {
    flex: 0 0 auto;
}

.bingo-deco__strip .xm-flake {
    width: 18px;
    height: 18px;
    align-self: center;
}

.bingo-deco__strip .xm-tree {
    width: 43px;
    height: 56px;
}

.bingo-deco__strip .xm-sleigh {
    width: 80px;
    height: 51px;
}

.bingo-deco__strip .xm-present {
    width: 32px;
    height: 30px;
    color: #c62828;
}

.bingo-deco__strip .xm-snowman {
    width: 36px;
    height: 52px;
}

@media (min-width: 992px) {
    .bingo--christmas .bingo-deco__side {
        display: block;
    }

    .bingo--christmas .bingo-deco__strip {
        display: none;
    }
}

/* ---- Movement ---- */

@keyframes xm-swing {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes xm-fly {
    0%, 100% { transform: translate(0, 0) rotate(-2deg); }
    50% { transform: translate(8px, -12px) rotate(1deg); }
}

@keyframes xm-twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.75); }
}

@keyframes xm-fall {
    0% { top: -5%; opacity: 0; transform: translateX(0) rotate(0deg); }
    10% { opacity: 0.9; }
    50% { transform: translateX(14px) rotate(180deg); }
    90% { opacity: 0.9; }
    100% { top: 100%; opacity: 0; transform: translateX(-6px) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .bingo-deco * {
        animation: none !important;
    }

    /* Without the fall the snow would stay invisible, so show it still. */
    .bingo-deco__side .xm-snow {
        opacity: 0.8;
    }

    .bingo-deco__side .xm-snow--1, .bingo-deco__side .xm-snow--5 { top: 30%; }
    .bingo-deco__side .xm-snow--2, .bingo-deco__side .xm-snow--6 { top: 55%; }
    .bingo-deco__side .xm-snow--3, .bingo-deco__side .xm-snow--7 { top: 12%; }
    .bingo-deco__side .xm-snow--4, .bingo-deco__side .xm-snow--8 { top: 72%; }
}
