/**
 * ═══════════════════════════════════════════════════════════════════
 *  TRYB ŚWIĄTECZNY (motyw 1.32.0) — inc/swieta.php, assets/js/swieta.js
 *
 *  Ładuje się tylko przy włączonym trybie. Klasy „sw-”. Dekoracje nie
 *  przyjmują kliknięć (poza osiedlem i przyciskiem śniegu), żeby nie
 *  zasłaniały menu ani treści. Wariant „ogranicz ruch” i druk na końcu.
 * ═══════════════════════════════════════════════════════════════════ */

/* ═══════════ CZAPKA NA LOGO ═══════════ */
.sw-z-czapka { position: relative; overflow: visible; }
.sw-czapka {
    position: absolute; z-index: 2; line-height: 0; pointer-events: none;
    --sw-kat: -14deg;
    transform: rotate(var(--sw-kat)); transform-origin: 30% 90%;
}
.sw-czapka svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 2px 1.6px rgba(0, 0, 0, .42)); }
/* logo-obrazek (nagłówek 2026): litera D zajmuje lewe ~22 px przy wysokości 30 px */
.sw-czapka--obraz { left: -5px; top: -15px; width: 31px; }
/* logo tekstowe (stare podstrony): czapka na literze D */
.sw-czapka--tekst { left: -8px; top: -6px; width: 28px; --sw-kat: -16deg; }
@media (max-width: 420px) { .sw-czapka--obraz { left: -4px; top: -13px; width: 27px; } }

.sw-czapka__pompon { transform-box: view-box; transform-origin: 53px 19px; animation: sw-pompon 3.2s ease-in-out infinite alternate; }
@keyframes sw-pompon { from { transform: rotate(-7deg); } to { transform: rotate(6deg); } }

/* Pierwsze wejście w sesji: czapka spada na logo i przysiada */
.sw-czapka.is-spada { animation: sw-czapka-spada 1100ms cubic-bezier(.22, 1, .36, 1) 400ms both; }
@keyframes sw-czapka-spada {
    0%   { opacity: 0; transform: translateY(-48px) rotate(-40deg); }
    42%  { opacity: 1; transform: translateY(2px) rotate(calc(var(--sw-kat) + 6deg)) scale(1.05, .88); }
    62%  { transform: translateY(-6px) rotate(calc(var(--sw-kat) - 5deg)) scale(.98, 1.03); }
    80%  { transform: translateY(0) rotate(calc(var(--sw-kat) + 2deg)) scale(1.02, .97); }
    100% { opacity: 1; transform: rotate(var(--sw-kat)); }
}
@media (hover: hover) and (pointer: fine) {
    .sw-z-czapka:hover .sw-czapka svg { animation: sw-czapka-hop 650ms cubic-bezier(.34, 1.56, .64, 1); }
}
@keyframes sw-czapka-hop {
    0%   { transform: none; }
    35%  { transform: translateY(-5px) rotate(-7deg); }
    70%  { transform: translateY(1px) rotate(3deg); }
    100% { transform: none; }
}

/* Czapa śniegu na „Kup wtyczkę” w menu */
.dcp-swieta .sg-nav__cta { overflow: visible; }
.dcp-swieta .sg-nav__cta::after {
    content: ""; position: absolute; left: 8px; right: 10px; top: -5px; height: 10px; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath fill='%23f6faff' d='M0 12C2 6 6 5 10 6.5 13 2 20 1 24 4.2 28 1 36 0 41 3.2 46 0 55 .8 59 4 63 1.6 71 1.2 75 4.2 79 2 88 2.4 91 6.2 95 5.4 99 7.6 100 12Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 50, 70, .28));
}

/* ═══════════ LAMPKI POD MENU ═══════════ */
.sw-lampki {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 1; height: 34px; margin-top: -3px;
    pointer-events: none; transition: opacity 200ms ease;
}
.sg-top.is-open .sw-lampki,
.navbar:has(.nav-links.active) .sw-lampki { opacity: 0; }
.sw-lampki__drut { position: absolute; left: 0; top: 0; overflow: visible; }
.sw-lampki__drut path { fill: none; stroke: #0e1d16; stroke-width: 1.7; stroke-linecap: round; }

.sw-zarowka {
    position: absolute; width: 10px; height: 19px; margin-left: -5px;
    transform: rotate(var(--kat, 0deg)); transform-origin: 50% 0;
}
/* oprawka */
.sw-zarowka::before {
    content: ""; position: absolute; left: 2px; top: 0; width: 6px; height: 6px; border-radius: 1.5px 1.5px 2px 2px;
    background: linear-gradient(90deg, #0b1812, #2c4c3c 45%, #0b1812);
}
/* zgaszone szkło */
.sw-zarowka i {
    position: absolute; left: .5px; top: 5px; width: 9px; height: 13px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .35) 0 12%, var(--c2) 62%);
}
/* zapalone szkło z poświatą (animowana jest tylko przezroczystość tej warstwy) */
.sw-zarowka i::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: radial-gradient(circle at 36% 28%, #fff 0 9%, var(--c) 40%, var(--c) 72%, var(--c2) 115%);
    box-shadow: 0 0 6px 1px var(--g), 0 0 18px 5px var(--g);
}
.sw-lampki[data-tryb="migotanie"] .sw-zarowka i::after { animation: sw-mig calc(1.6s + var(--r) * 2.4s) ease-in-out calc(var(--r) * -4s) infinite; }
.sw-lampki[data-tryb="fala"] .sw-zarowka i::after { animation: sw-fala 2.2s linear calc((var(--n) - var(--i)) * -.09s) infinite; }
.sw-lampki[data-tryb="naprzemian"] .sw-zarowka i::after { animation: sw-naprzemian 1.8s ease-in-out infinite; }
.sw-lampki[data-tryb="naprzemian"] .sw-zarowka:nth-child(odd) i::after { animation-delay: -.9s; }
.sw-lampki[data-tryb="stale"] .sw-zarowka i::after { animation: sw-oddech 3.6s ease-in-out infinite; }

@keyframes sw-mig { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes sw-fala { 0%, 100% { opacity: .16; } 12% { opacity: 1; } 34% { opacity: .16; } }
@keyframes sw-naprzemian { 0%, 38% { opacity: 1; } 50%, 88% { opacity: .14; } 100% { opacity: 1; } }
@keyframes sw-oddech { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }

/* ═══════════ ŚNIEG ═══════════ */
.sw-snieg-canvas { position: fixed; inset: 0; z-index: 890; display: block; pointer-events: none; }
.sw-snieg-canvas[hidden] { display: none; }

/* Przycisk „Wyłącz śnieg” (lewy dolny róg, obok okrągłego przycisku ustawień cookies 44 px z cookie-consent.css) */
.sw-cisza {
    position: fixed; z-index: 801;
    left: 74px; bottom: 21px;
    display: inline-flex; align-items: center; height: 42px; min-width: 42px; margin: 0; padding: 0 11px;
    border: 1px solid rgba(148, 163, 184, .28); border-radius: 999px;
    background: rgba(9, 14, 25, .8); color: #eaf6ff;
    font: 600 .8125rem/1 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .65);
    transition: color 200ms ease, border-color 200ms ease, transform 160ms cubic-bezier(.23, 1, .32, 1);
}
.sw-cisza[hidden] { display: none; }
@media (max-width: 640px) { .sw-cisza { left: 64px; bottom: 15px; height: 40px; min-width: 40px; padding: 0 10px; } }
.sw-cisza .sg-ico { width: 18px; height: 18px; flex: none; }
.sw-cisza::after { /* ukośna kreska przy wyłączonym śniegu */
    content: ""; position: absolute; left: 10px; top: 50%; width: 20px; height: 2px; margin-top: -1px; border-radius: 2px;
    background: currentColor; transform: rotate(-45deg) scaleX(0); transition: transform 200ms cubic-bezier(.23, 1, .32, 1);
}
.sw-cisza-on .sw-cisza { color: #8d9ab0; }
.sw-cisza-on .sw-cisza::after { transform: rotate(-45deg) scaleX(1); }
.sw-cisza__tekst {
    display: inline-block; max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0;
    transition: max-width 260ms cubic-bezier(.23, 1, .32, 1), opacity 180ms ease, margin-left 260ms cubic-bezier(.23, 1, .32, 1);
}
.sw-cisza:focus-visible { outline: 2px solid #00d4aa; outline-offset: 3px; }
.sw-cisza:focus-visible .sw-cisza__tekst { max-width: 150px; margin-left: 8px; opacity: 1; }
.sw-cisza:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) {
    .sw-cisza:hover { border-color: rgba(0, 212, 170, .5); }
    .sw-cisza:hover .sw-cisza__tekst { max-width: 150px; margin-left: 8px; opacity: 1; }
}

/* ═══════════ ZIMOWE OSIEDLE NAD STOPKĄ ═══════════ */
.sw-osiedle {
    position: relative; display: none; overflow: hidden; isolation: isolate;
    aspect-ratio: 1440 / 400; min-height: 320px; max-height: 520px;
    color: #e9eef6;
    background:
        radial-gradient(ellipse 55% 65% at 50% 100%, rgba(0, 212, 170, .11), transparent 70%),
        radial-gradient(ellipse 30% 40% at 86% 12%, rgba(255, 236, 190, .06), transparent 70%),
        linear-gradient(180deg, #03060c 0%, #061022 55%, #0c1a31 100%);
}
.sw-osiedle.is-gotowe { display: block; }
.sw-osiedle__scena { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.sw-osiedle__wrap {
    position: relative; z-index: 1; max-width: 1304px; margin: 0 auto;
    padding: clamp(28px, 3.6vw, 52px) clamp(16px, 4vw, 32px) 0; pointer-events: none;
}
.sw-osiedle__zyczenia { max-width: 440px; pointer-events: auto; }
.sw-osiedle__licznik {
    display: inline-flex; align-items: center; gap: 9px; margin: 0 0 14px; padding: 5px 12px 5px 10px;
    border: 1px solid rgba(255, 211, 77, .28); border-radius: 999px; background: rgba(255, 211, 77, .07);
    color: #ffe39a; font: 500 .75rem/1.2 "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    letter-spacing: .06em; text-transform: uppercase;
}
.sw-osiedle__licznik[hidden] { display: none; }
.sw-osiedle__licznik::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ffd34d; box-shadow: 0 0 8px #ffd34d; }
.sw-osiedle__tytul {
    margin: 0; font-family: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: clamp(2.1rem, 1.3rem + 2.5vw, 3.4rem); font-weight: 600; line-height: 1.06; letter-spacing: -.02em;
    background: linear-gradient(100deg, #fff6dc 0%, #ffd34d 28%, #fff6dc 50%, #ffc86b 72%, #fff6dc 100%) 0 50% / 220% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
    animation: sw-zloto 8s ease-in-out infinite; text-wrap: balance;
}
@keyframes sw-zloto { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.sw-osiedle__tekst {
    max-width: 38ch; margin: 12px 0 0; color: #c3cee0;
    font: 400 1rem/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; text-wrap: pretty;
}

@media (max-width: 819.98px) {
    .sw-osiedle { aspect-ratio: auto; min-height: 0; max-height: none; }
    .sw-osiedle.is-gotowe { display: flex; flex-direction: column; }
    .sw-osiedle__wrap { order: -1; width: 100%; padding-bottom: 6px; }
    /* scena wchodzi pod tekst: górna część to niebo z gwiazdami */
    .sw-osiedle__scena { position: relative; inset: auto; height: 270px; margin-top: -96px; flex: none; }
}

/* Elementy sceny (SVG) */
.sw-gw { fill: #fff; animation: sw-gwiazda-mig var(--t, 4s) ease-in-out var(--d, 0s) infinite; }
@keyframes sw-gwiazda-mig { 0%, 100% { opacity: .9; } 50% { opacity: .12; } }
.sw-dalekie rect { fill: #0b1527; }
.sw-dalekie .sw-dalekie__okno { fill: #2b3753; }
.sw-bud { fill: #121e35; }
.sw-dach { fill: #18253f; }
.sw-drzwi { fill: #0a1222; }
.sw-snieg { fill: #f3f8ff; }
.sw-snieg--choinka { fill: #eef5ff; opacity: .92; }
.sw-okno { fill: #1a2742; cursor: pointer; transition: fill 700ms ease; }
.sw-okno.is-on { fill: var(--sw-okno, #ffcf73); }
.sw-lancuch { fill: none; stroke: #e9c46a; stroke-width: 1.3; opacity: .75; }
.sw-lancuch--balkon { stroke: #24324c; stroke-width: 1; opacity: 1; }
.sw-cl, .sw-lk { animation: sw-mig var(--t, 2.6s) ease-in-out var(--d, 0s) infinite; }
.sw-lk--zuraw { animation-name: sw-fala; animation-duration: 2.4s; animation-timing-function: linear; }

.sw-choinka { cursor: pointer; }
.sw-choinka[data-tryb="1"] .sw-cl { animation: sw-fala 2s linear calc(var(--i) * -.08s) infinite; }
.sw-choinka[data-tryb="2"] .sw-cl { animation: sw-naprzemian 1.6s ease-in-out calc(var(--p, 0) * -.8s) infinite; }
.sw-gwiazda { fill: #ffd34d; transform-box: fill-box; transform-origin: center; animation: sw-gwiazda-puls 2.8s ease-in-out infinite; }
.sw-gwiazda--mala { animation-duration: 2.2s; }
@keyframes sw-gwiazda-puls { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.sw-choinka__blask { transform-box: fill-box; transform-origin: center; animation: sw-oddech 2.8s ease-in-out infinite; }
.sw-choinka.is-blysk .sw-gwiazda:not(.sw-gwiazda--mala) { animation: sw-gwiazda-blysk 900ms cubic-bezier(.23, 1, .32, 1); }
.sw-choinka.is-blysk .sw-choinka__blask { animation: sw-blask-blysk 900ms cubic-bezier(.23, 1, .32, 1); }
@keyframes sw-gwiazda-blysk { 0% { transform: scale(1) rotate(0); } 40% { transform: scale(1.7) rotate(36deg); } 100% { transform: scale(1) rotate(72deg); } }
@keyframes sw-blask-blysk { 0% { transform: scale(1); } 40% { transform: scale(2.3); } 100% { transform: scale(1); } }

.sw-kula { fill: #f2f6fb; stroke: #c4d2e3; stroke-width: 1; }
.sw-zuraw__krata { fill: none; stroke: #c99a3e; stroke-width: 1.6; stroke-linejoin: round; opacity: .88; }
.sw-zuraw__lina { fill: none; stroke: #6f7d92; stroke-width: .8; }
.sw-prezent { transform-box: view-box; transform-origin: 1290px 95px; animation: sw-wahadlo 4.2s ease-in-out infinite alternate; }
@keyframes sw-wahadlo { from { transform: rotate(-2.4deg); } to { transform: rotate(2.4deg); } }
.sw-dym { fill: #a3b1c5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: sw-dym 4.2s ease-out var(--d, 0s) infinite; }
@keyframes sw-dym { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 18% { opacity: .26; } 100% { opacity: 0; transform: translate(14px, -46px) scale(1.9); } }

/* Sanie: przelot co 30 s, nos renifera świeci */
.sw-sanie { transform: translate(-260px, 140px); animation: sw-sanie 30s linear 3s infinite; }
@keyframes sw-sanie {
    0%        { transform: translate(-260px, 140px); }
    44%       { transform: translate(1680px, 34px); }
    44.01%, 100% { transform: translate(1680px, 34px); }
}
.sw-sanie__lot { animation: sw-bujanie 1.5s ease-in-out infinite alternate; }
@keyframes sw-bujanie { from { transform: translateY(-4px) rotate(-5deg); } to { transform: translateY(4px) rotate(-2deg); } }
.sw-sanie__iskry circle { fill: #ffe7a1; animation: sw-mig .9s ease-in-out infinite; }
.sw-sanie__iskry circle:nth-child(2n) { animation-delay: -.45s; }
.sw-nos { animation: sw-oddech 1.1s ease-in-out infinite; filter: drop-shadow(0 0 2.5px #ff4b5c); }

/* Poza ekranem scena stoi */
.sw-osiedle:not(.is-widoczne) .sw-osiedle__scena *,
.sw-osiedle:not(.is-widoczne) .sw-osiedle__tytul { animation-play-state: paused; }

/* ═══════════ CISZA (przycisk gościa), OGRANICZ RUCH, DRUK ═══════════ */
.sw-cisza-on .sw-zarowka i::after,
.sw-cisza-on .sw-osiedle .sw-cl,
.sw-cisza-on .sw-osiedle .sw-lk,
.sw-cisza-on .sw-osiedle .sw-gw { animation: none; }

@media (prefers-reduced-motion: reduce) {
    .sw-czapka, .sw-czapka *, .sw-lampki *, .sw-zarowka i::after, .sw-osiedle * { animation: none !important; }
    .sw-sanie, .sw-dym { display: none; }
    .sw-okno { transition: none; }
    .sw-osiedle__tytul { background-position: 30% 50%; }
}

@media print {
    .sw-lampki, .sw-czapka, .sw-snieg-canvas, .sw-osiedle, .sw-cisza { display: none !important; }
}
