/*
 * Świąteczny wygląd — style ładowane tylko w okresie świątecznym.
 * Wszystkie reguły działają wyłącznie pod klasą html.is-xmas (na <html>, bo nie każdy motyw
 * wywołuje body_class()). Kolory (--xmas-red, --xmas-green, --xmas-cream) dopisuje wtyczka z ustawień.
 */

html.is-xmas {
    --xmas-gold: #d9a441;
    --xmas-red-dark: color-mix(in srgb, var(--xmas-red) 78%, #000);
    --xmas-wire: #2c3a2e;
    --xmas-topbar-height: 36px;
}

/* ---------- Pasek z życzeniami ---------- */

/*
 * Miejsce na pasek rezerwuje CSS (padding body), a sam pasek leży nad nim.
 * Dzięki temu nic nie przeskakuje, także gdy pasek wstawia skrypt (motyw bez wp_body_open()).
 */
html.is-xmas.xmas-pasek body {
    position: relative;
    padding-top: var(--xmas-topbar-height);
}

.is-xmas .xmas-topbar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: var(--xmas-topbar-height);
    padding: 0 130px;
    overflow: hidden;
    background: linear-gradient(90deg, var(--xmas-red-dark), var(--xmas-red) 50%, var(--xmas-red-dark));
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.is-xmas .xmas-topbar__text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.is-xmas .xmas-topbar__star {
    color: var(--xmas-gold);
}

.is-xmas .xmas-topbar__branch {
    position: absolute;
    top: -6px;
    width: 120px;
    height: auto;
    pointer-events: none;
}

.is-xmas .xmas-topbar__branch--left {
    left: -10px;
}

.is-xmas .xmas-topbar__branch--right {
    right: -10px;
    transform: scaleX(-1);
}

/* ---------- Girlanda lampek ---------- */

/*
 * Girlanda wisi pod dolną krawędzią nagłówka (pod menu).
 * Miejsce na nią rezerwuje CSS, więc nic nie przeskakuje po załadowaniu skryptu.
 * .header1–.header3 to warianty nagłówka w tp-wordpress-theme.
 */
.is-xmas.xmas-lampki :is(.header1, .header2, .header3, #masthead, .site-header) {
    margin-bottom: 26px;
}

.is-xmas .xmas-lights {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 40;
    height: 26px;
    overflow: hidden;
    pointer-events: none;
}

.is-xmas .xmas-lights__wire {
    position: absolute;
    top: 0;
    left: 0;
    height: 14px;
    fill: none;
    stroke: var(--xmas-wire);
    stroke-width: 1.5;
}

.is-xmas .xmas-lights__bulb {
    position: absolute;
    top: 8px;
    width: 9px;
    height: 14px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: currentColor;
    animation: xmas-glow 1.6s ease-in-out infinite alternate;
}

.is-xmas .xmas-lights__bulb::before {
    position: absolute;
    top: -4px;
    left: 2px;
    width: 5px;
    height: 5px;
    border-radius: 1px;
    background: #3b3b3b;
    content: "";
}

@keyframes xmas-glow {
    from {
        opacity: 0.45;
        filter: none;
    }

    to {
        opacity: 1;
        filter: drop-shadow(0 0 6px currentColor);
    }
}

/* ---------- Czapka na logo ---------- */

.is-xmas .xmas-hat {
    position: absolute;
    top: -13px;
    left: -4px;
    z-index: 5;
    width: 30px;
    height: auto;
    transform: rotate(-22deg);
    pointer-events: none;
}

/* ---------- Śnieg ---------- */

.is-xmas #xmas-snow {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

/* ---------- Motyw tp-wordpress-theme: kolory i elementy ---------- */

html.is-xmas.xmas-motyw-tp {
    --primary-color: var(--xmas-red);
    --secondary-color: var(--xmas-green);
    --tertiary-color: var(--xmas-cream);
}

.is-xmas.xmas-motyw-tp :is(.header1, .header2, .header3) {
    border-bottom: 3px solid var(--xmas-green);
}

.is-xmas.xmas-motyw-tp :is(.header1__logo, .header2__logo, .header3__logo) {
    position: relative;
    overflow: visible;
}

.is-xmas.xmas-motyw-tp .newsbar__label {
    background: var(--xmas-red);
    color: #fff;
}

.is-xmas.xmas-motyw-tp .newsbar {
    background: #fff8ee;
}

.is-xmas.xmas-motyw-tp footer {
    position: relative;
    border-top: 3px solid var(--xmas-gold);
    background: var(--xmas-green);
    color: #f3ebdd;
}

.is-xmas.xmas-motyw-tp footer :is(a, p, span, li, div, h2, h3, h4, h5, h6) {
    color: #f3ebdd;
}

.is-xmas.xmas-motyw-tp footer a:hover {
    color: #f6d28b;
}

.is-xmas.xmas-motyw-tp footer img {
    filter: brightness(0) invert(1);
}

/* Zaspa w odstępie między sekcją kontaktową a stopką. */
.is-xmas.xmas-motyw-tp.xmas-zaspa footer::before {
    position: absolute;
    right: 0;
    bottom: calc(100% + 3px);
    left: 0;
    height: 34px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 34'%3E%3Cpath d='M0 34V20Q25 4 50 18T100 18T150 18T200 20V34Z' fill='%23E6EDF3'/%3E%3Cpath d='M0 20Q25 4 50 18T100 18T150 18T200 20' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 0 100% / 200px 34px repeat-x;
    content: "";
    pointer-events: none;
}

/* ---------- Telefony ---------- */

@media (max-width: 768px) {
    html.is-xmas {
        --xmas-topbar-height: 44px;
    }

    .is-xmas .xmas-topbar {
        padding: 0 64px;
        font-size: 12px;
        text-align: center;
    }

    /* Na telefonie tekst w maksymalnie dwóch liniach, pasek ma stałą wysokość. */
    .is-xmas .xmas-topbar__text {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        white-space: normal;
    }

    .is-xmas .xmas-topbar__branch {
        width: 76px;
        top: -3px;
    }
}

/* ---------- Ograniczenie ruchu ---------- */

@media (prefers-reduced-motion: reduce) {
    .is-xmas .xmas-lights__bulb {
        opacity: 1;
        animation: none;
    }

    .is-xmas #xmas-snow {
        display: none;
    }
}
