/* ==========================================================================
   SECTION: IMAGE GALLERY (LƯỚI ẢNH & LIGHTBOX PHÓNG TO)
   Path: template-parts/sections/image-gallery/style.css
   ========================================================================== */

.image-gallery {
    position: relative;
    width: 100%;
    padding: 85px 0 95px 0;
    background-color: #FFFFFF;
    box-sizing: border-box;
    overflow: hidden;
}

.image-gallery__container {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
    text-align: center;
}

/* TIÊU ĐỀ SECTION */
.image-gallery__title {
    font-family: var(--font-heading, 'Cormorant SC', serif);
    font-size: var(--fs-h2, 36px);
    font-weight: 500;
    color: var(--text-title, #456967);
    margin: 0 0 45px 0;
    letter-spacing: 0.8px;
}

.image-gallery__desc {
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-size: var(--fs-body-m, 18px);
    color: var(--text-primary, #333333);
    max-width: 800px;
    margin: -25px auto 40px auto;
    line-height: 1.6;
}

/* ==========================================================================
   LƯỚI ẢNH (GRID 3 CỘT x 3 HÀNG)
   ========================================================================== */
.image-gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    margin: 0 auto;
}

.image-gallery__item {
    position: relative;
    cursor: default;
    overflow: hidden;
    border-radius: 4px;
    background-color: #F0F4F4;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-gallery--has-lightbox .image-gallery__item {
    cursor: pointer;
}

.image-gallery__item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.image-gallery__thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.image-gallery__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.image-gallery__item:hover .image-gallery__thumb {
    transform: scale(1.05);
}

/* Lớp phủ khi hover */
.image-gallery__overlay {
    position: absolute;
    inset: 0;
    background: rgba(69, 105, 103, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-gallery__item:hover .image-gallery__overlay {
    opacity: 1;
}

.image-gallery__zoom-icon {
    color: #FFFFFF;
    font-size: 26px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.image-gallery__item:hover .image-gallery__zoom-icon {
    transform: scale(1.1);
}

/* ==========================================================================
   LIGHTBOX MODAL PHÓNG TO ẢNH (ZOOM & SWIPE)
   ========================================================================== */
.image-gallery__lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    user-select: none;
}

.image-gallery__lightbox.is-active {
    opacity: 1;
    visibility: visible;
}

.image-gallery__lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.image-gallery__lightbox-container {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 30px;
    box-sizing: border-box;
    pointer-events: none;
}

.image-gallery__lightbox-content {
    position: relative;
    width: 82vw;
    max-width: 1050px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.image-gallery__lightbox-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: calc(100% - 36px);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.65);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.image-gallery__lightbox-counter {
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-align: center;
}

/* CÁC NÚT ĐIỀU HƯỚNG VÀ ĐÓNG */
.image-gallery__lightbox-btn {
    position: absolute;
    z-index: 10;
    background: rgba(30, 30, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    font-size: 22px;
    line-height: 1;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
    pointer-events: auto;
}

.image-gallery__lightbox-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.image-gallery__lightbox-close {
    top: 24px;
    right: 24px;
    font-size: 32px;
}

.image-gallery__lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}
.image-gallery__lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.image-gallery__lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}
.image-gallery__lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* ==========================================================================
   RESPONSIVE TABLET & MOBILE (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .image-gallery {
        padding: 50px 0 60px 0;
    }

    .image-gallery__container {
        padding: 0 16px;
    }

    .image-gallery__title {
        font-size: 26px;
        margin-bottom: 25px;
    }

    /* Trên Mobile hiển thị lưới 3 cột nhỏ gọn như ảnh thiết kế */
    .image-gallery__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .image-gallery__thumb-wrapper {
        aspect-ratio: 1 / 1; /* Hình vuông trên mobile cho đều đẹp */
    }

    .image-gallery__lightbox-prev {
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.4);
    }

    .image-gallery__lightbox-next {
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.4);
    }

    .image-gallery__lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 26px;
        background: rgba(0, 0, 0, 0.4);
    }

    .image-gallery__lightbox-content {
        width: 92vw;
        max-width: 100%;
        height: 75vh;
    }

    .image-gallery__lightbox-img {
        max-height: calc(100% - 30px);
    }
}
