/*
 * Seasonal decorations (/assets/js/seasonal.js), loaded by app/views/layouts/_head.php only while a seasonal
 * theme is on. Everything sits in one fixed layer that ignores the pointer: above the page, below the top bar,
 * dropdowns and modals. Only the DEV team's bottom right corner takes a click, to pour a beer.
 */
.seasonal-layer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1020;
    overflow: hidden;
    pointer-events: none;
    color: rgba(43, 47, 58, 0.55);
    --seasonal-web: rgba(110, 118, 134, 0.4);
    --seasonal-snow: rgb(140, 168, 200);
    --seasonal-wire: rgba(52, 66, 56, 0.6);
}

html[data-theme="dark"] .seasonal-layer {
    color: rgba(200, 208, 220, 0.5);
    --seasonal-web: rgba(160, 170, 186, 0.3);
    --seasonal-snow: #ffffff;
    --seasonal-wire: rgba(176, 190, 180, 0.5);
}

/* Pictures standing in the bottom corners of the page */
.seasonal-corner {
    position: absolute;
    bottom: 4px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.seasonal-corner-right {
    right: 22px;
}

/* Next to the "do roboty" mascot (app/views/layouts/_do_roboty_maskotka.php), which would cover the corner */
body:has(#dr4-mascot) .seasonal-corner-right {
    right: 122px;
}

.seasonal-corner svg {
    display: block;
    overflow: visible;
}

/* The DEV team gets a beer for clicking the corner */
.seasonal-corner.is-pouring {
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.seasonal-corner.is-pouring:hover {
    transform: translateY(-2px);
}

.seasonal-beer {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transform-origin: 50% 100%;
    animation: seasonal-beer 3.4s ease-out forwards;
}

.seasonal-beer-toast {
    padding: 2px 9px;
    border: 1px solid rgba(43, 47, 58, 0.15);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    color: #3a3f51;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.seasonal-beer-picture {
    display: block;
    overflow: visible;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.seasonal-beer-bubble {
    animation: seasonal-bubble 1.2s ease-in infinite;
}

@keyframes seasonal-beer {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.3);
    }

    12% {
        opacity: 1;
        transform: translateY(-6px) scale(1.1);
    }

    20% {
        transform: translateY(0) scale(1);
    }

    30% {
        transform: rotate(-10deg);
    }

    40% {
        transform: rotate(8deg);
    }

    50%,
    85% {
        opacity: 1;
        transform: rotate(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-18px);
    }
}

@keyframes seasonal-bubble {
    from {
        opacity: 0.9;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-26px);
    }
}

@media (max-width: 767px) {
    .seasonal-corner-left,
    .seasonal-cobweb-bottom {
        display: none;
    }
}

/* ------------------------------------------------------------------ Halloween */

.seasonal-spider {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    opacity: 0;
    transition-property: transform, opacity;
    transition-timing-function: linear, ease;
    will-change: transform;
}

.seasonal-spider.is-placed {
    opacity: 1;
}

.seasonal-spider-body {
    width: 100%;
    height: 100%;
    transition: transform 0.35s ease-out;
}

.seasonal-spider-body svg,
.seasonal-dangler-spider svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.seasonal-legs-a,
.seasonal-legs-b {
    transform-origin: 12px 12px;
}

.seasonal-spider.is-walking .seasonal-legs-a {
    animation: seasonal-step 0.22s ease-in-out infinite alternate;
}

.seasonal-spider.is-walking .seasonal-legs-b {
    animation: seasonal-step 0.22s ease-in-out infinite alternate-reverse;
}

@keyframes seasonal-step {
    from {
        transform: rotate(-7deg);
    }

    to {
        transform: rotate(7deg);
    }
}

/* A spider lowering itself from the top bar; the container clips the thread at its upper edge */
.seasonal-dangler {
    position: absolute;
    width: 16px;
    overflow: hidden;
}

.seasonal-dangler-spider {
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    transform: translateY(-24px);
    animation: seasonal-dangle 16s ease-in-out forwards;
}

.seasonal-dangler-spider::before {
    content: '';
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 1px;
    height: 400px;
    background: currentColor;
    opacity: 0.7;
}

.seasonal-dangler-spider svg {
    transform: rotate(180deg);
    animation: seasonal-sway 2.6s ease-in-out infinite alternate;
}

@keyframes seasonal-dangle {
    0% {
        transform: translateY(-24px);
    }

    30%,
    70% {
        transform: translateY(var(--seasonal-drop, 100px));
    }

    100% {
        transform: translateY(-24px);
    }
}

@keyframes seasonal-sway {
    from {
        transform: rotate(172deg);
    }

    to {
        transform: rotate(188deg);
    }
}

.seasonal-cobweb {
    position: absolute;
    width: 120px;
    height: 120px;
    color: var(--seasonal-web);
}

.seasonal-cobweb-top {
    right: 0;
}

.seasonal-cobweb-bottom {
    bottom: 0;
    left: 0;
    width: 84px;
    height: 84px;
    transform: rotate(180deg);
}

.seasonal-pumpkin {
    filter: drop-shadow(0 0 3px rgba(255, 170, 60, 0.45));
}

.seasonal-pumpkin-face {
    animation: seasonal-flicker 3.4s ease-in-out infinite;
}

@keyframes seasonal-flicker {
    0%,
    100% {
        opacity: 1;
    }

    30% {
        opacity: 0.78;
    }

    45% {
        opacity: 0.95;
    }

    70% {
        opacity: 0.84;
    }
}

/* Witch hat on the robot of the sidebar logo */
.seasonal-halloween .app-aside .navbar-brand {
    position: relative;
}

.seasonal-halloween .app-aside .navbar-brand::after {
    content: '';
    position: absolute;
    top: 21%;
    left: 47.6%;
    width: 22%;
    height: 22%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke='%23e9e2f5' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M30 4 C35 12 39 24 42 40 L20 40 C24 24 26 12 30 4 Z' fill='%236d48a8'/%3E%3Cellipse cx='31' cy='42' rx='29' ry='6' fill='%236d48a8'/%3E%3C/g%3E%3Cpath d='M30 4 C33 3 37 5 40 9 C37 8 34 7 31 8 Z' fill='%236d48a8'/%3E%3Cpath d='M21.6 33 L40.8 33 L41.8 39 L20.4 39 Z' fill='%23f0892e'/%3E%3C/svg%3E") no-repeat center bottom / contain;
    transform: translate(-50%, -88%) rotate(-12deg);
    transform-origin: 50% 100%;
    pointer-events: none;
}

.seasonal-halloween .app-aside-folded .app-aside .navbar-brand::after {
    display: none;
}

/* ------------------------------------------------------------------ Falling pieces (snow, petals) */

.seasonal-falling {
    position: absolute;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.seasonal-fall {
    position: absolute;
    top: 0;
    animation: seasonal-fall linear infinite;
    will-change: transform;
}

.seasonal-drift {
    display: block;
    animation: seasonal-drift ease-in-out infinite alternate;
}

@keyframes seasonal-fall {
    from {
        transform: translateY(-12px);
    }

    to {
        transform: translateY(100vh);
    }
}

@keyframes seasonal-drift {
    from {
        transform: translateX(-12px);
    }

    to {
        transform: translateX(12px);
    }
}

/* ------------------------------------------------------------------ Christmas */

.seasonal-flake {
    border-radius: 50%;
    background: var(--seasonal-snow);
}

.seasonal-garland {
    position: absolute;
    right: 0;
    height: 24px;
    color: var(--seasonal-wire);
}

.seasonal-garland-wire {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
}

.seasonal-bulb {
    position: absolute;
    top: 7px;
    width: 7px;
    height: 10px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: currentColor;
    box-shadow: 0 0 6px 1px currentColor;
    transform-origin: 50% 0;
    animation: seasonal-twinkle 2.8s ease-in-out infinite alternate;
}

.seasonal-bulb:nth-child(3n) {
    animation-duration: 3.6s;
}

.seasonal-bulb::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 1.5px;
    width: 4px;
    height: 3px;
    border-radius: 1px;
    background: #6d7563;
}

@keyframes seasonal-twinkle {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.45;
    }
}

.seasonal-tree {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.seasonal-tree-star {
    filter: drop-shadow(0 0 2px rgba(245, 200, 76, 0.8));
}

/* ------------------------------------------------------------------ Easter */

/* The drift sways the petal, the picture inside spins */
.seasonal-petal {
    overflow: visible;
}

.seasonal-petal path {
    transform-origin: 6px 5px;
    animation: seasonal-spin var(--seasonal-spin, 9s) linear infinite;
}

@keyframes seasonal-spin {
    to {
        transform: rotate(360deg);
    }
}

/* A bunny crossing the bottom of the page: the outer box travels, the body hops */
.seasonal-bunny {
    position: absolute;
    bottom: 6px;
    width: 44px;
    height: 34px;
    animation: seasonal-bunny-travel linear forwards;
}

.seasonal-bunny.is-leftwards {
    animation-name: seasonal-bunny-travel-back;
}

.seasonal-bunny.is-leftwards .seasonal-bunny-picture {
    transform: scaleX(-1);
}

.seasonal-bunny-body {
    animation: seasonal-hop ease-in-out;
}

.seasonal-bunny-picture {
    display: block;
}

@keyframes seasonal-bunny-travel {
    from {
        transform: translateX(-44px);
    }

    to {
        transform: translateX(var(--seasonal-hop-distance, 600px));
    }
}

@keyframes seasonal-bunny-travel-back {
    from {
        transform: translateX(var(--seasonal-hop-distance, 600px));
    }

    to {
        transform: translateX(-44px);
    }
}

@keyframes seasonal-hop {
    0%,
    100% {
        transform: translateY(0);
    }

    45% {
        transform: translateY(-16px);
    }
}

.seasonal-egg,
.seasonal-chick {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Bunny ears on the robot of the sidebar logo */
.seasonal-easter .app-aside .navbar-brand {
    position: relative;
}

.seasonal-easter .app-aside .navbar-brand::after {
    content: '';
    position: absolute;
    top: 21%;
    left: 47.6%;
    width: 20%;
    height: 22%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke='%23d9c9b8' stroke-width='1.5'%3E%3Cellipse cx='22' cy='34' rx='8' ry='24' transform='rotate(-14 22 34)' fill='%23f3eee8'/%3E%3Cellipse cx='42' cy='34' rx='8' ry='24' transform='rotate(14 42 34)' fill='%23f3eee8'/%3E%3C/g%3E%3Cellipse cx='22' cy='35' rx='3.6' ry='17' transform='rotate(-14 22 35)' fill='%23f4b6c8'/%3E%3Cellipse cx='42' cy='35' rx='3.6' ry='17' transform='rotate(14 42 35)' fill='%23f4b6c8'/%3E%3C/svg%3E") no-repeat center bottom / contain;
    transform: translate(-50%, -80%);
    pointer-events: none;
}

.seasonal-easter .app-aside-folded .app-aside .navbar-brand::after {
    display: none;
}

.seasonal-still .seasonal-pumpkin-face,
.seasonal-still .seasonal-bulb,
.seasonal-still .seasonal-beer,
.seasonal-still .seasonal-beer-bubble {
    animation: none;
}

.seasonal-still .seasonal-corner.is-pouring:hover {
    transform: none;
}
