/* --- MOBILE PERFORMANCE & UX ---
 * Wyłącza kosztowne efekty na małych ekranach i poprawia obsługę dotyku.
 * Ładowany na wszystkich stronach, działa tylko przez media queries.
 */

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
    width: 100%;
}

@media (max-width: 768px) {

    /* Wyłącz ciężkie dekoracyjne tło — biggest GPU win */
    body::before { display: none; }

    /* Header: solid color zamiast backdrop-filter blur, bezpieczny overflow */
    header.wp-block-template-part {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgb(250, 249, 246);
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Slider: wyłącz Ken Burns (6s GPU animation na tle) */
    .wyraj-hero-bg {
        transform: none !important;
        transition: none !important;
    }
    .wyraj-hero-slide.is-active .wyraj-hero-bg {
        transform: none !important;
    }

    /* Slider: strzałki bez backdrop-filter */
    .wyraj-hero-arrow {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(0, 0, 0, 0.4);
        border-color: rgba(255, 255, 255, 0.2);
    }

    /* Modals: bez backdrop-filter */
    .klgw-modal-wrap {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(0, 0, 0, 0.82);
    }

    /* Karty: wyłącz hover efekty (dotyk nie ma :hover) */
    .klgw-s-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    }
    .klgw-s-card:hover .klgw-s-img { transform: none; }
    .wp-block-post-template li:hover { transform: none; }
    .wyraj-blog-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        border-color: var(--color-border-light);
    }
    .wyraj-blog-card:hover .wyraj-blog-card-img img { transform: none; }
    .klgw-cat-toggle:hover,
    .klgw-budget-pill:hover,
    .w404-btn-home:hover,
    .w404-btn-search:hover,
    .w404-sug-item:hover { transform: none; }

    /* Nav strip w nagłówku — płynny horyzontalny scroll bez łamania słów */
    .wyraj-topbar .wyraj-nav-strip {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
    }
    .wyraj-topbar .wyraj-nav-strip::-webkit-scrollbar {
        display: none;
    }
    .wyraj-nav-items {
        flex-wrap: nowrap !important;
        justify-content: flex-start;
        padding: 6px 0;
    }
    .wyraj-nav-items li a {
        padding: 8px 14px;
        font-size: 12px;
        white-space: nowrap !important;
    }

    /* Back-to-top: bliżej krawędzi ekranu */
    #wyraj-back-top {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    /* Touch targets min 44px */
    .klgw-cat-toggle,
    .klgw-budget-pill,
    .klgw-filter-toggle {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .klgw-macro-btn { min-height: 44px; }

    /* Mniejsze marginesy boczne — więcej miejsca na treść */
    .klgw-s-scope, .klgw-cur-scope { width: calc(100% - 24px); }

    /* Single event: mapy mniejsze na telefonie */
    .klgw-mini-map { height: 160px !important; }
    .klgw-big-map  { height: 260px !important; }

    /* Opis eventu: mniej paddingu */
    .klgw-description-card { padding: 20px; }

    /* ── SINGLE EVENT — MOBILE LAYOUT ────────────────────────────── */

    body .klgw-single-container {
        width: 100% !important;
        max-width: 100vw !important;
        padding: 12px 14px 40px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Grid → kolumna */
    body .klgw-event-grid {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    body .klgw-col-left,
    body .klgw-col-right {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Prawa kolumna (data/cena/miejsce) PRZED lewą (zdjęcie+opis) */
    body .klgw-col-right { order: -1; }
    body .klgw-col-left  { order:  0; }

    /* Ukryj QR — na telefonie nie ma sensu */
    .klgw-qr-box { display: none !important; }

    /* Info-boxy w prawej kolumnie: bardziej kompaktowe */
    body .klgw-sb-box { padding: 14px 16px; gap: 12px; }
    body .klgw-sb-icon { width: 38px; height: 38px; font-size: 17px; }
    body .klgw-sb-data strong { font-size: 14px; }

    /* Zdjęcie eventu: cover z proporcją 4:3 (nie contain z pasami) */
    body .klgw-hero-img-wrap img {
        aspect-ratio: 4 / 3;
        object-fit: cover;
        height: auto;
    }

    /* Margines między info a zdjęciem */
    body .klgw-col-right { margin-bottom: 16px; }

    /* Padding dołu strony gdy jest sticky CTA */
    body.klgw-has-cta { padding-bottom: 80px; }

    /* Separator dni: mniej odstępu */
    .klgw-s-sep { margin: 28px 0 12px; }

    /* Filtr kategorii — pigułki zawijają się normalnie */
    .klgw-cats-grid { flex-wrap: wrap; }

    /* Blog hero image: nie za wysoka */
    .klgw-blog-hero img { max-height: 260px; object-fit: cover; }
}

/* ── STICKY KUP BILET ────────────────────────────────────────────── */
#klgw-sticky-cta {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 10px 16px 14px;
    background: rgba(250, 249, 246, 0.97);
    border-top: 2px solid var(--color-moss);
    z-index: 9998;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}
#klgw-sticky-cta.is-visible { transform: translateY(0); }

@media (max-width: 768px) {
    #klgw-sticky-cta { display: block; }
}

#klgw-sticky-cta a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--wp--preset--color--veles) 0%, var(--color-moss) 100%);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    font-size: 14px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 77, 64, 0.3);
}

/* Naprawdę wąskie ekrany (≤480px) */
@media (max-width: 480px) {
    /* Nagłówek eventu: mniejszy font */
    body .klgw-main-title {
        font-size: clamp(20px, 7vw, 28px);
    }

    /* Header: cieńszy padding */
    header.wp-block-template-part { padding: 8px 14px; }

    /* Karty: 2 kolumny zamiast 1 do ~360px, potem 1 */
    @media (min-width: 361px) {
        .klgw-s-grid { grid-template-columns: repeat(2, 1fr); }
        .klgw-s-img-w { height: 120px; }
        .klgw-s-cont  { padding: 10px; }
        .klgw-s-h3    { font-size: 13px; }
    }
}
