/* ======================
   GALLERY GRID
====================== */

.pgb-gallery-grid{
    display:grid;
    grid-template-columns:repeat(var(--pgb-columns),1fr);
    gap:var(--pgb-gap);
    margin-bottom:40px;
}

.pgb-figure{
    position:relative;
    overflow:hidden;
    border-radius:12px;
    box-shadow:0 4px 12px rgba(0,0,0,.08);
    aspect-ratio:4/3;
}

.pgb-figure img{
    width:100%;
    height:100%;
    object-fit:cover;
    transition:transform .4s ease;
}

.pgb-figure:hover img{
    transform:scale(1.08);
}

.pgb-figure figcaption{
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    padding:18px 14px;
    background:linear-gradient(to top, rgba(0,0,0,.75), transparent);
    color:#fff;
    text-align:center;
    font-style:italic;
    opacity:0;
    transition:.3s ease;
}

.pgb-figure:hover figcaption{
    opacity:1;
}


/* ======================
   LIGHTBOX
====================== */

#pgb-lightbox{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.65);
    backdrop-filter:blur(10px);
    z-index:99999;

    display:flex;
    align-items:center;
    justify-content:center;

    padding:40px 20px;

    opacity:0;
    visibility:hidden;
    transition:.3s ease;
}

#pgb-lightbox.active{
    opacity:1;
    visibility:visible;
}

.pgb-lb-inner{
    max-width:1000px;
    width:100%;
    max-height:90vh;
    overflow:auto;
    position:relative;
}
@media(max-width:768px){

    .pgb-lb-prev,
    .pgb-lb-next{
        width:40px;
        height:40px;
        font-size:18px;
    }

    .pgb-lb-prev{ left:15px; }
    .pgb-lb-next{ right:15px; }

}
.pgb-lb-image-wrapper{
    position:relative;
}

.pgb-lb-image-wrapper img{
    width:100%;
    height:auto;
    border-radius:10px;
    transition:opacity .3s ease;
}

.pgb-lb-image-wrapper img.fade-out{
    opacity:0;
}

/* Caption overlay */
/* ======================
   LIGHTBOX CAPTION OUTSIDE
====================== */

.pgb-lb-caption{
    margin-top:20px;
    padding:16px 20px;
    font-size:16px;
    line-height:1.6;
    color:#fff;
    text-align:center;
    max-width:800px;
    margin-left:auto;
    margin-right:auto;
    opacity:.9;
}
.pgb-lb-inner{
    text-align:center;
}
/* Counter */
.pgb-lb-counter{
    position:fixed;
    bottom:25px;
    left:50%;
    transform:translateX(-50%);
    color:#fff;
    font-size:14px;
    letter-spacing:1px;
    opacity:.85;
}

/* Close button */
.pgb-lb-close{
    position:fixed;
    top:25px;
    right:35px;
    font-size:42px;
    color:#fff;
    cursor:pointer;
    transition:.2s ease;
}

.pgb-lb-close:hover{
    opacity:.7;
}

/* Mobile */
/* ======================
   MOBILE FIX FINAL
====================== */

@media(max-width:768px){

    #pgb-lightbox{
        align-items:flex-start;   /* 🔥 bukan center */
        overflow-y:auto;
        padding-top:60px;
        padding-bottom:60px;
    }

    .pgb-lb-inner{
        max-height:none;          /* 🔥 hilangkan batas tinggi */
    }

}
/* ======================
   ARROW DESKTOP
====================== */

.pgb-lb-prev,
.pgb-lb-next{
    position:fixed;
    top:50%;
    transform:translateY(-50%);
    width:48px;
    height:48px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    color:#fff;
    cursor:pointer;
    border-radius:50%;
    background:rgba(255,255,255,.15);
    backdrop-filter:blur(6px);
    transition:.25s ease;
    user-select:none;
    z-index:100000;
}

.pgb-lb-prev{ left:40px; }
.pgb-lb-next{ right:40px; }

.pgb-lb-prev:hover,
.pgb-lb-next:hover{
    background:rgba(255,255,255,.35);
}


/* ======================
   MOBILE FIX
====================== */

@media(max-width:768px){

    .pgb-lb-prev,
    .pgb-lb-next{
        position:absolute;        /* 🔥 bukan fixed lagi */
        top:50%;
        transform:translateY(-50%);
        width:40px;
        height:40px;
        font-size:18px;
        background:rgba(0,0,0,.45);
        backdrop-filter:none;
    }

    .pgb-lb-prev{
        left:10px;
    }

    .pgb-lb-next{
        right:10px;
    }

}
/* ======================
   LIGHTBOX ZOOM
====================== */

.pgb-lb-image-wrapper{
    overflow:hidden;
    cursor:zoom-in;
}

.pgb-lb-image-wrapper img{
    transition:transform .25s ease;
    transform-origin:center center;
}

.pgb-lb-image-wrapper.zoomed{
    cursor:grab;
}

.pgb-lb-image-wrapper.zoomed img{
    cursor:grab;
}
/* ======================
   MOBILE PERFECT CENTER
====================== */
@media(max-width:768px){

    #pgb-lightbox{
        display:flex;
        justify-content:center !important;   /* 🔥 center horizontal */
        align-items:flex-start !important;   /* tetap mulai dari atas */
        overflow-y:auto;
        padding-top:70px;
        padding-bottom:60px;
    }

    .pgb-lb-inner{
        width:100%;
        max-width:92%;
        margin:0 auto;          /* 🔥 paksa center */
        text-align:center;
    }

    .pgb-lb-image-wrapper{
        display:flex;
        justify-content:center; /* 🔥 center gambar */
    }

    .pgb-lb-image-wrapper img{
        max-width:100%;
        height:auto;
    }

}
/* ===== FORCE OVERRIDE NO HOVER ===== */

.pgb-figure figcaption{
    position:relative !important;
    bottom:auto !important;
    left:auto !important;
    right:auto !important;

    opacity:1 !important;
    transform:none !important;

    background:#fff !important;
    color:#222 !important;

    padding:8px 12px !important;
    font-size:11px !important;
    font-weight:500 !important;
    line-height:1.35 !important;

    display:-webkit-box !important;
    -webkit-line-clamp:2 !important;
    -webkit-box-orient:vertical !important;
    overflow:hidden !important;
}

/* Matikan efek hover caption lama */
.pgb-figure:hover figcaption{
    opacity:1 !important;
    transform:none !important;
}

/* Matikan ratio lama */
.pgb-figure{
    aspect-ratio:auto !important;
}

/* Pastikan gambar normal */
.pgb-figure img{
    height:auto !important;
    object-fit:unset !important;
}
/* FORCE RATIO POSTER */

.pgb-gallery-grid .pgb-figure img{
    width:100% !important;
    height:100% !important;
    object-fit:cover !important;
}
/* CARD */
.pgb-figure{
    background:#fff;
    border-radius:12px;
    overflow:hidden;
    box-shadow:0 4px 12px rgba(0,0,0,.05);
}

/* WRAPPER GAMBAR YANG DIKUNCI RATIO */
.pgb-image-wrap{
    aspect-ratio:4/5;
    overflow:hidden;
}

.pgb-image-wrap img{
    width:100%;
    height:100%;
    object-fit:cover;
}

/* CAPTION */
.pgb-figure figcaption{
    padding:8px 12px;
    font-size:11px;
    line-height:1.35;
}
/* =================================================
   FINAL OVERRIDE SYSTEM - STABLE & CLEAN
================================================= */

/* CARD CONTAINER */
.pgb-gallery-grid .pgb-figure{
    position:relative;
    background:#fff;
    border-radius:12px;
    overflow:hidden;
    box-shadow:0 4px 12px rgba(0,0,0,.06);
    aspect-ratio:auto !important; /* matikan ratio lama */
}

/* HAPUS HOVER GAMBAR */
.pgb-gallery-grid .pgb-figure:hover img{
    transform:none !important;
}

/* MATIKAN OVERLAY CAPTION LAMA */
.pgb-gallery-grid .pgb-figure figcaption{
    position:relative !important;
    left:auto !important;
    right:auto !important;
    bottom:auto !important;

    opacity:1 !important;
    transform:none !important;

    background:#fff !important;
    color:#222 !important;

    padding:8px 12px !important;
    margin:0 !important;

    font-size:11px !important;
    font-weight:500 !important;
    line-height:1.35 !important;
    text-align:left !important;

    display:-webkit-box !important;
    -webkit-line-clamp:2 !important;
    -webkit-box-orient:vertical !important;
    overflow:hidden !important;
}

/* MATIKAN HOVER CAPTION */
.pgb-gallery-grid .pgb-figure:hover figcaption{
    opacity:1 !important;
}

/* SISTEM RATIO BARU (POSTER 4:5) */
.pgb-gallery-grid .pgb-figure > a{
    display:block;
    aspect-ratio:4/5;
    overflow:hidden;
}

.pgb-gallery-grid .pgb-figure > a img{
    width:100% !important;
    height:100% !important;
    object-fit:cover !important;
    display:block;
}