.custom-gallery-container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 15px;
}

.main-image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.gallery-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 Column yang anda mahu */
    gap: 15px;
    margin-top: 20px;
}

.thumb-item {
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.3s;
}

.thumb-item img {
    width: 100%;
    height: auto;
    display: block;
}

.thumb-item.is-active {
    border-color: #0073aa; /* Warna highlight */
}

.thumb-item:hover {
    opacity: 0.8;
}
/* Susunan Grid 3x3 untuk Galeri di dalam Post */
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Jarak antara gambar */
    margin: 20px 0;
}

.gallery-item {
    flex: 0 0 calc(33.333% - 10px); /* Paksa 3 kolum */
    max-width: calc(33.333% - 10px);
    margin: 0 !important;
    padding: 0;
}

.gallery-item img {
    width: 100%;
    height: 180px; /* Anda boleh laras ketinggian ini */
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

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

/* Responsif untuk Mobile (Tukar jadi 2 kolum) */
@media (max-width: 600px) {
    .gallery-item {
        flex: 0 0 calc(50% - 5px);
        max-width: calc(50% - 5px);
    }
}

/* ============================================================
   COVER GALLERY — [cover_gallery] shortcode
   ============================================================ */

.cwg-grid {
    width: 100%;
    margin: 20px 0;
}

.cwg-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    /* Smooth zoom on hover */
    transition: filter 0.3s ease, transform 0.3s ease;
    background-color: #111; /* Fallback warna kalau imej lambat load */
}

/* Overlay gelap subtle — nampak lebih polished */
.cwg-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.cwg-item:hover::after {
    background: rgba(0, 0, 0, 0.15);
}

/* Zoom effect on hover */
.cwg-item:hover {
    background-size: cover; /* Kekal cover semasa hover */
    filter: brightness(1.05);
}

/* Mobile — 2 kolum */
@media (max-width: 640px) {
    .cwg-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .cwg-item {
        height: 140px !important;
    }
}

/* Extra small — 1 kolum */
@media (max-width: 400px) {
    .cwg-grid {
        grid-template-columns: 1fr !important;
    }
}