/* Winter mode: snow canvas and the visitor's on/off button. Loaded only while the admin switch is on.
   Stacking: header 1000, menu 990, menu backdrop 980, back-to-top 99. The snow sits at 90 and never takes
   pointer events; the button sits at 98 so it stays clickable above the snow and below the back-to-top button. */
.winter-snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 90;
    pointer-events: none;
}

.winter-snow[hidden],
.winter-snow-toggle[hidden],
.winter-bank canvas[hidden] {
    display: none;
}

/* Settled snow at the end of the page: a zero-height anchor after the footer, so it adds nothing to the layout;
   the canvas hangs up from the last pixel of the document and scrolls with the page. */
.winter-bank {
    position: relative;
    z-index: 2;
    height: 0;
    pointer-events: none;
}

.winter-bank canvas {
    position: absolute;
    left: 0;
    bottom: 0;
    display: block;
    width: 100%;
    pointer-events: none;
}

/* Only while the bank is showing: room under the copyright line so the snow never covers the text or links. */
@media (min-width: 700px) {
    html.winter-bank-on body .site-footer {
        padding-bottom: 62px;
    }
}

.winter-snow-toggle {
    position: fixed;
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 98;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #5f87ad;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(100, 130, 165, 0.35);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* The home hero has its own pause/mute buttons in this corner on narrower screens: sit above them there. */
@media (max-width: 1399px) {
    body:has(.home-motion-control) .winter-snow-toggle {
        bottom: calc(92px + env(safe-area-inset-bottom));
    }
}

html.dark .winter-snow-toggle {
    color: #cfe3f7;
    background: rgba(15, 23, 42, 0.78);
    border-color: rgba(148, 163, 184, 0.34);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.winter-snow-toggle:hover {
    opacity: 1;
    transform: scale(1.06);
}

.winter-snow-toggle:focus-visible {
    opacity: 1;
    outline: 2px solid #38bdf8;
    outline-offset: 3px;
}

.winter-snow-toggle svg {
    width: 22px;
    height: 22px;
}

/* Snow is off: dim the flake and strike it through. */
.winter-snow-toggle.is-off svg {
    opacity: 0.55;
}

.winter-snow-toggle.is-off::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    content: "";
    transform: translate(-50%, -50%) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
    .winter-snow-toggle { transition: none; }
}

@media print {
    .winter-snow,
    .winter-bank,
    .winter-snow-toggle {
        display: none !important;
    }
}
