/* ═══════════════════════════════════════════════════════════════
   MG Gallery — Product Image Gallery + Lightbox
   ═══════════════════════════════════════════════════════════════ */

/* Gallery section */
.mg-gallery {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid #2A2C3A;
}

.mg-gallery__title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #E8E9ED;
    margin-bottom: 1.5rem;
}

/* Responsive grid */
.mg-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    align-items: start;
}

/* Individual thumbnail */
.mg-gallery__item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.mg-gallery__item:hover {
    border-color: #D63A1A;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(214, 58, 26, 0.2);
}

.mg-gallery__item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease;
}

.mg-gallery__item:hover img {
    transform: scale(1.08);
}

/* Caption overlay */
.mg-gallery__caption {
    display: none;
}

.mg-gallery__item:hover .mg-gallery__caption {
    display: none;
}

/* ═══ Lightbox ═══ */
.mg-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}

.mg-lightbox.is-open {
    display: flex;
}

/* Content container */
.mg-lightbox__content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Main image */
.mg-lightbox__img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: mgLightboxFadeIn 0.3s ease;
}

@keyframes mgLightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Caption below image — hidden */
.mg-lightbox__caption {
    display: none;
}

/* Counter (e.g. "3 / 12") */
.mg-lightbox__counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #8B8D97;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Close button */
.mg-lightbox__close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: none;
    border: none;
    color: #E8E9ED;
    font-size: 2.5rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.mg-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #D63A1A;
}

/* Navigation arrows */
.mg-lightbox__prev,
.mg-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #E8E9ED;
    font-size: 1.6rem;
    cursor: pointer;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.mg-lightbox__prev {
    left: 1.5rem;
}

.mg-lightbox__next {
    right: 1.5rem;
}

.mg-lightbox__prev:hover,
.mg-lightbox__next:hover {
    background: rgba(214, 58, 26, 0.3);
    border-color: #D63A1A;
    color: #fff;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .mg-gallery__grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .mg-lightbox__prev,
    .mg-lightbox__next {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .mg-lightbox__prev {
        left: 0.5rem;
    }

    .mg-lightbox__next {
        right: 0.5rem;
    }

    .mg-lightbox__close {
        top: 0.5rem;
        right: 0.5rem;
    }
}