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

html.is-gift {
    --gift-red-dark: color-mix(in srgb, var(--gift-red) 72%, #000);
    --gift-gold-dark: color-mix(in srgb, var(--gift-gold) 70%, #000);
    --gift-gold-light: color-mix(in srgb, var(--gift-gold) 55%, #fff);
    --gift-topbar-height: 42px;
}

/* ---------- Kokarda (wspólna) ---------- */

.is-gift .gift-bow__main {
    fill: var(--gift-gold);
}

.is-gift .gift-bow__shade {
    fill: var(--gift-gold-dark);
}

.is-gift .gift-bow__knot {
    fill: var(--gift-gold-light);
}

.is-gift .gift-bow--red .gift-bow__main {
    fill: var(--gift-red);
}

.is-gift .gift-bow--red .gift-bow__shade {
    fill: var(--gift-red-dark);
}

.is-gift .gift-bow--red .gift-bow__knot {
    fill: var(--gift-gold);
}

/* ---------- Pasek: papier prezentowy z bilecikiem ---------- */

/*
 * 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-gift.gift-pasek body {
    position: relative;
    padding-top: var(--gift-topbar-height);
}

.is-gift .gift-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(--gift-topbar-height);
    padding: 0 110px;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            -45deg,
            transparent 0 12px,
            color-mix(in srgb, var(--gift-gold) 30%, transparent) 12px 14px
        ),
        var(--gift-red);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

/* Bilecik: wycięty z lewej, z dziurką i sznurkiem. */
.is-gift .gift-tag {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 28px;
    box-sizing: border-box;
    padding: 4px 18px 4px 30px;
    background: var(--gift-cream);
    color: var(--gift-red-dark);
    clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
    box-shadow: inset 0 0 0 1px var(--gift-gold);
}

.is-gift .gift-tag::before {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 7px;
    height: 7px;
    border: 2px solid var(--gift-gold);
    border-radius: 50%;
    background: var(--gift-red);
    content: "";
    transform: translateY(-50%);
}

.is-gift .gift-tag__text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.is-gift .gift-topbar__bow {
    position: absolute;
    top: 50%;
    width: 54px;
    height: auto;
    pointer-events: none;
    transform: translateY(-50%);
}

.is-gift .gift-topbar__bow--left {
    left: 28px;
}

.is-gift .gift-topbar__bow--right {
    right: 28px;
}

/* ---------- Wstążka z kokardą pod menu ---------- */

/*
 * Wstążka leży pod dolną krawędzią nagłówka. Miejsce na nią rezerwuje CSS.
 * .header1–.header3 to warianty nagłówka w tp-wordpress-theme.
 */
.is-gift.gift-wstazka :is(.header1, .header2, .header3, #masthead, .site-header) {
    margin-bottom: 22px;
}

.is-gift .gift-ribbon {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 40;
    height: 22px;
    pointer-events: none;
}

.is-gift .gift-ribbon::before {
    position: absolute;
    top: 6px;
    right: 0;
    left: 0;
    height: 10px;
    background: var(--gift-red);
    box-shadow:
        inset 0 2px 0 var(--gift-gold),
        inset 0 -2px 0 var(--gift-gold),
        0 2px 4px rgb(0 0 0 / 15%);
    content: "";
}

.is-gift .gift-ribbon__bow {
    position: absolute;
    top: -16px;
    left: 50%;
    width: 72px;
    height: auto;
    transform: translateX(-50%);
    filter: drop-shadow(0 2px 2px rgb(0 0 0 / 20%));
}

/* ---------- Złote iskierki przy logo ---------- */

.is-gift .gift-spark {
    position: absolute;
    z-index: 5;
    color: var(--gift-gold);
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
    animation: gift-twinkle 2.4s ease-in-out infinite;
}

.is-gift .gift-spark--1 {
    top: -10px;
    left: -12px;
}

.is-gift .gift-spark--2 {
    top: -12px;
    right: -14px;
    font-size: 11px;
    animation-delay: 0.8s;
}

.is-gift .gift-spark--3 {
    right: -20px;
    bottom: -6px;
    font-size: 9px;
    animation-delay: 1.6s;
}

@keyframes gift-twinkle {
    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.6) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.15) rotate(20deg);
    }
}

/* ---------- Konfetti ---------- */

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

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

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

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

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

/* Sekcja kontaktowa jak zapakowane pudełko: złote prążki na czerwieni. */
.is-gift.gift-motyw-tp .contactUs2 {
    background:
        repeating-linear-gradient(
            -45deg,
            transparent 0 18px,
            color-mix(in srgb, var(--gift-gold) 18%, transparent) 18px 20px
        ),
        var(--gift-red);
}

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

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

.is-gift.gift-motyw-tp footer a:hover {
    color: var(--gift-gold-light);
}

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

/* Papier prezentowy w odstępie między sekcją kontaktową a stopką: złote kropki, czerwona wstążka. */
.is-gift.gift-motyw-tp.gift-papier footer::before {
    position: absolute;
    right: 0;
    bottom: calc(100% + 3px);
    left: 0;
    height: 30px;
    background:
        linear-gradient(
            90deg,
            transparent calc(50% - 11px),
            var(--gift-red) calc(50% - 11px) calc(50% + 11px),
            transparent calc(50% + 11px)
        ),
        radial-gradient(circle, var(--gift-gold) 2px, transparent 2.5px) 0 0 / 16px 16px,
        var(--gift-green);
    content: "";
    pointer-events: none;
}

/* Kokarda na wstążce papieru (kształt z maski, kolor z ustawień). */
.is-gift.gift-motyw-tp.gift-papier footer::after {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    width: 64px;
    height: 40px;
    background: var(--gift-gold);
    content: "";
    pointer-events: none;
    transform: translateX(-50%);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 50'%3E%3Cpath d='M37 25 L25 47 L31 45 L34 49 L40 28Z M43 25 L55 47 L49 45 L46 49 L40 28Z M40 22 C28 3 5 5 9 19 C12 30 30 29 40 22Z M40 22 C52 3 75 5 71 19 C68 30 50 29 40 22Z'/%3E%3Cellipse cx='40' cy='23' rx='6.5' ry='5.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 50'%3E%3Cpath d='M37 25 L25 47 L31 45 L34 49 L40 28Z M43 25 L55 47 L49 45 L46 49 L40 28Z M40 22 C28 3 5 5 9 19 C12 30 30 29 40 22Z M40 22 C52 3 75 5 71 19 C68 30 50 29 40 22Z'/%3E%3Cellipse cx='40' cy='23' rx='6.5' ry='5.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

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

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

    .is-gift .gift-topbar {
        padding: 0 46px;
        font-size: 12px;
    }

    .is-gift .gift-tag {
        padding: 3px 12px 3px 26px;
        text-align: center;
    }

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

    .is-gift .gift-topbar__bow {
        width: 34px;
    }

    .is-gift .gift-topbar__bow--left {
        left: 6px;
    }

    .is-gift .gift-topbar__bow--right {
        right: 6px;
    }

    .is-gift .gift-ribbon__bow {
        width: 56px;
        top: -12px;
    }
}

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

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

    .is-gift #gift-confetti {
        display: none;
    }
}
