/* ========================================
   MGPS PPF Gallery Section v3.0
   Sıfırdan yazıldı — Elementor-Proof

   TEMEL PRENSİP:
   aspect-ratio KULLANILMIYOR.
   Hem desktop hem mobilde padding-bottom trick.
   Tüm kritik kurallar !important.
   ======================================== */

/* ── Reset: box-sizing kilidi ── */
.mgps-gallery,
.mgps-gallery *,
.mgps-gallery *::before,
.mgps-gallery *::after {
    box-sizing: border-box !important;
}

/* ── Section ── */
.mgps-gallery {
    overflow: hidden !important;
    max-width: 100% !important;
    padding: 80px 0 !important;
    border-radius: 16px;
}

/* ── Header ── */
.mgps-gallery .mgps-heading {
    text-align: center !important;
    margin-bottom: 8px !important;
}

.mgps-gallery .mgps-subheading {
    text-align: center !important;
    margin-bottom: 0 !important;
}

/* ── Gallery Wrapper ── */
.mgps-gal {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-top: 48px !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

/* ========================================
   ANA GÖRSEL — padding-bottom trick

   width: 100%  → parent genişliğine uyar
   height: 0    → kendi yüksekliği yok
   padding-bottom: 100% → parent genişliğinin %100'ü
   Sonuç: genişlik = yükseklik = KARE

   img: position absolute → padding alanını doldurur
   object-fit: cover → kırparak kare yapar
   ======================================== */

.mgps-gal-main {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 100% !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    background: #1a1a24 !important;
    cursor: pointer !important;
}

@media (min-width: 1025px) {
    .mgps-gal-main {
        height: 100% !important;
        padding-bottom: 0 !important;
    }
}

.mgps-gal-img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: opacity 0.35s ease !important;
    /* aspect-ratio override — img tag'ındaki width/height attribute'ını ez */
    aspect-ratio: unset !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.mgps-gal-img.mgps-gal-fade {
    opacity: 0 !important;
}

/* ── Sol / Sağ Oklar ── */
.mgps-gal-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    transition: opacity 0.25s ease !important;
    padding: 0 !important;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.mgps-gal-arrow--prev {
    left: 12px !important;
}

.mgps-gal-arrow--next {
    right: 12px !important;
}

.mgps-gal-main:hover .mgps-gal-arrow {
    opacity: 1 !important;
}

.mgps-gal-arrow:hover {
    background: rgba(0, 0, 0, 0.75) !important;
}

/* ── Thumbnail Strip ── */
.mgps-gal-strip {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    align-content: start !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

/* ── Thumbnail — padding-bottom trick ── */
.mgps-gal-thumb {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 100% !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    background: #1e1e2a !important;
    cursor: pointer !important;
    border: 2px solid transparent !important;
    transition: border-color 0.25s ease, transform 0.25s ease !important;
    -webkit-tap-highlight-color: transparent !important;
}

.mgps-gal-thumb img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    aspect-ratio: unset !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
}

.mgps-gal-thumb:hover {
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.03) !important;
}

.mgps-gal-thumb--active {
    border-color: #C41E3A !important;
}

.mgps-gal-thumb:focus-visible {
    border-color: #C41E3A !important;
    outline: 2px solid #C41E3A !important;
    outline-offset: 2px !important;
}

/* ========================================
   RESPONSIVE — Tablet & Mobil (≤1024px)
   Grid → tek sütun, thumbnail'ler yatay strip
   ======================================== */

@media (max-width: 1024px) {

    .mgps-gallery {
        padding: 48px 0 !important;
    }

    .mgps-gallery .mgps-container {
        padding: 0 16px !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .mgps-gal {
        display: block !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Ana görsel — padding-bottom trick devam ediyor */
    .mgps-gal-main {
        width: 100% !important;
        height: 0 !important;
        padding-bottom: 100% !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }

    /* Oklar mobilde her zaman görünür */
    .mgps-gal-arrow {
        opacity: 1 !important;
        width: 36px !important;
        height: 36px !important;
    }

    .mgps-gal-arrow--prev {
        left: 8px !important;
    }

    .mgps-gal-arrow--next {
        right: 8px !important;
    }

    /* Thumbnail strip — yatay kaydırmalı */
    .mgps-gal-strip {
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 8px !important;
        scrollbar-width: none !important;
        max-width: 100% !important;
        padding-bottom: 4px !important;
    }

    .mgps-gal-strip::-webkit-scrollbar {
        display: none !important;
    }

    /* Thumbnail — sabit boyut (padding-bottom trick yerine) */
    .mgps-gal-thumb {
        min-width: 80px !important;
        max-width: 80px !important;
        height: 80px !important;
        padding-bottom: 0 !important;
        flex-shrink: 0 !important;
        scroll-snap-align: center !important;
    }
}

@media (max-width: 480px) {
    .mgps-gal-thumb {
        min-width: 68px !important;
        max-width: 68px !important;
        height: 68px !important;
    }

    .mgps-gal-arrow {
        width: 32px !important;
        height: 32px !important;
    }

    .mgps-gal-arrow--prev {
        left: 6px !important;
    }

    .mgps-gal-arrow--next {
        right: 6px !important;
    }
}

/* ========================================
   Elementor Override Koruma
   Tüm olası parent selector'lar
   ======================================== */

.elementor-shortcode .mgps-gallery,
.elementor-widget-container .mgps-gallery,
.e-con .mgps-gallery,
.elementor .mgps-gallery {
    max-width: 100% !important;
    overflow: hidden !important;
}

@media (min-width: 1025px) {
    .elementor-shortcode .mgps-gal-main,
    .elementor-widget-container .mgps-gal-main,
    .e-con .mgps-gal-main,
    .elementor .mgps-gal-main {
        width: 100% !important;
        height: 100% !important;
        padding-bottom: 0 !important;
    }
}

.elementor-shortcode .mgps-gal-img,
.elementor-widget-container .mgps-gal-img,
.e-con .mgps-gal-img,
.elementor .mgps-gal-img,
.elementor-shortcode .mgps-gal-main img,
.elementor-widget-container .mgps-gal-main img,
.e-con .mgps-gal-main img,
.elementor .mgps-gal-main img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    aspect-ratio: unset !important;
    max-width: none !important;
    max-height: none !important;
}

/* LiteSpeed Lazy Load uyumluluğu */
.mgps-gal-main img[data-lazyloaded],
.mgps-gal-main img.litespeed-loaded,
.mgps-gal-main img.lazyloaded,
.mgps-gal-main img.ls-is-cached {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    aspect-ratio: unset !important;
}

.mgps-gal-thumb img[data-lazyloaded],
.mgps-gal-thumb img.litespeed-loaded,
.mgps-gal-thumb img.lazyloaded,
.mgps-gal-thumb img.ls-is-cached {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    aspect-ratio: unset !important;
}
