/* Gallery Section */

/* Gallery Grid Layout */
.section-gallery__item {
    position: relative;
    border-radius: var(--bs-border-radius, 0.375rem);
    background: var(--bs-light, #f8f9fa);
    overflow: hidden;
}

.section-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gallery Masonry Layout (CSS Columns) */
.gallery-masonry {
    column-count: var(--cols, 3);
    column-gap: 1rem;
}

.gallery-masonry__item {
    position: relative;
    break-inside: avoid;
    margin-bottom: 1rem;
    cursor: pointer;
    border-radius: var(--bs-border-radius, 0.375rem);
    overflow: hidden;
    background: var(--bs-light, #f8f9fa);
}

.gallery-masonry__item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--bs-border-radius, 0.375rem);
}

/* Overlay icon - works for both grid and masonry */
.section-gallery__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-size: 1.5rem;
    z-index: 2;
    border-radius: var(--bs-border-radius, 0.375rem);
}

.section-gallery__item:hover .section-gallery__overlay,
.gallery-masonry__item:hover .section-gallery__overlay {
    opacity: 1;
}

/* Product Card Gallery */
.product-card-gallery__main {
    aspect-ratio: 4/3;
    background: var(--bs-light, #f8f9fa);
    cursor: pointer;
    position: relative;
    border-radius: var(--bs-border-radius, 0.375rem);
    overflow: hidden;
}

.product-card-gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card-gallery__main:hover img {
    transform: scale(1.02);
}

.product-card-gallery__zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.product-card-gallery__main:hover .product-card-gallery__zoom {
    opacity: 1;
}

/* Thumbnails */
.product-card-gallery__thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border: 2px solid transparent;
    border-radius: var(--bs-border-radius, 0.375rem);
    overflow: hidden;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.product-card-gallery__thumb.active,
.product-card-gallery__thumb:hover {
    border-color: var(--bs-primary, #0d6efd);
}

.product-card-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Shared Lightbox Styles */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gallery-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gallery-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox__nav--prev {
    left: 1rem;
}

.gallery-lightbox__nav--next {
    right: 1rem;
}

.gallery-lightbox__content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-lightbox__image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.gallery-lightbox__counter {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* Alpine.js transition classes */
.transition {
    transition-property: all;
}

.ease-out {
    transition-timing-function: ease-out;
}

.ease-in {
    transition-timing-function: ease-in;
}

.duration-200 {
    transition-duration: 200ms;
}

.duration-150 {
    transition-duration: 150ms;
}

.opacity-0 {
    opacity: 0;
}

.opacity-100 {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .gallery-lightbox__nav {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }

    .gallery-lightbox__close {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }

    .product-card-gallery__thumb {
        width: 60px;
        height: 60px;
    }

    /* Masonry responsive: reduce columns on tablet */
    .gallery-masonry {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    /* Masonry responsive: single column on mobile */
    .gallery-masonry {
        column-count: 1;
    }
}
