/* ==============================
   POST GALLERY – FRONTEND
   Elementor-safe styles
   ============================== */

.post-gallery {
    display: grid;
    gap: 15px;
    margin: 20px 0;
}

/* GRID COLUMNS */
.post-gallery[data-columns="1"] { grid-template-columns: 1fr; }
.post-gallery[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.post-gallery[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.post-gallery[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }
.post-gallery[data-columns="5"] { grid-template-columns: repeat(5, 1fr); }

/* ==============================
   GALLERY ITEM
   ============================== */

.post-gallery .gallery-item {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.post-gallery .gallery-item:hover {
    transform: scale(1.03);
}

/* ==============================
   IMAGE – FORCE RADIUS
   ============================== */

.post-gallery .gallery-item img,
.post-gallery .gallery-item a img,
.elementor .post-gallery .gallery-item img,
.elementor .post-gallery .gallery-item a img,
.elementor-widget-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 30px !important;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

/* HOVER EFFECT */
.post-gallery .gallery-item:hover img {
    opacity: 0.9;
}

/* ==============================
   SINGLE IMAGE – popis1 / popis2
   ============================== */

.post-gallery.single-image {
    display: flex !important;
    justify-content: center !important;
}

.post-gallery.single-image .gallery-item {
    width: 100%;
}

/* ==============================
   RESPONSIVE
   ============================== */

/* TABLET */
@media (max-width: 1024px) {
    .post-gallery[data-columns="4"],
    .post-gallery[data-columns="5"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* MOBILE */
@media (max-width: 768px) {
    .post-gallery[data-columns="3"],
    .post-gallery[data-columns="4"],
    .post-gallery[data-columns="5"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==============================
   MOBILE CENTER – ELEMENTOR-FIX
   ===================================== */

@media (max-width: 480px) {

    /* přepsání rodičů Elementor widgetu */
    .elementor .elementor-widget-shortcode,
    .elementor .elementor-widget-shortcode .elementor-widget-container,
    .elementor .elementor-shortcode {
        display: grid !important;          /* přepíše flex rodiče */
        justify-content: center !important;
        justify-items: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* galerie uvnitř shortcode */
    .elementor .elementor-shortcode .post-gallery {
        width: 100%;
        justify-items: center !important;
    }

    /* jednotlivé položky */
    .elementor .elementor-shortcode .gallery-item {
        max-width: 90%;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* SINGLE IMAGE – popis1 / popis2 */
    .elementor .elementor-shortcode .post-gallery.single-image .gallery-item {
        max-width: 90%;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* ==============================
   SINGLE IMAGE FIX
   ============================== */

/* popis1 / popis2 vždy jedna fotka */
.post-gallery.single-image[data-columns] {
    grid-template-columns: 1fr !important;
}

.post-gallery.single-image .gallery-item img {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
}

/* LIGHTBOX – zachování pro single-image */
.post-gallery.single-image .gallery-item a[data-lightbox] {
    display: inline-block;
    width: auto;
}
