/* ==========================================================================
   GTA Theme — Gallery Styles
   ========================================================================== */

/* ---- Gallery Grid ---- */

.gta-gallery {
    padding: var(--space-3xl) 0;
}

.gta-gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* ---- Gallery Items ---- */

.gta-gallery__item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius-lg);
    aspect-ratio: 3 / 4;
    cursor: pointer;
}

.gta-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gta-gallery__item:hover img,
.gta-gallery__item:focus-visible img {
    transform: scale(1.08);
}

/* ---- Hover Overlay ---- */

.gta-gallery__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(10, 10, 10, 0.5);
    opacity: 0;
    transition: opacity var(--transition-normal);
    color: var(--color-white);
}

.gta-gallery__item:hover .gta-gallery__overlay,
.gta-gallery__item:focus-visible .gta-gallery__overlay {
    opacity: 1;
}

/* ---- Homepage Gallery Preview ---- */

.gta-gallery-preview {
    padding: var(--space-3xl) 0;
}

.gta-gallery-preview__header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.gta-gallery-preview__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.gta-gallery-preview__item {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    aspect-ratio: 3 / 4;
}

.gta-gallery-preview__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gta-gallery-preview__item:hover img {
    transform: scale(1.08);
}

.gta-gallery-preview__cta {
    text-align: center;
}

/* ---- Lightbox ---- */

.gta-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gta-lightbox.is-active {
    opacity: 1;
    visibility: visible;
}

.gta-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.gta-lightbox__close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 2rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast);
}

.gta-lightbox__close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.gta-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 2.5rem;
    cursor: pointer;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast);
}

.gta-lightbox__nav:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.gta-lightbox__prev {
    left: var(--space-lg);
}

.gta-lightbox__next {
    right: var(--space-lg);
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
    .gta-gallery-preview__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Carousel scroll indicators ---- */

.gta-gallery-preview__scroll-hint {
    display: none;
    justify-content: center;
    gap: 8px;
    padding-top: var(--space-md);
}

.gta-gallery-preview__dot {
    width: 6px;
    height: 6px;
    min-width: 0;
    min-height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
    font-size: 0;
    line-height: 0;
    transition: background 0.3s ease, width 0.3s ease;
}

.gta-gallery-preview__dot.is-active {
    width: 18px;
    border-radius: 3px;
    background: var(--color-primary);
}

@media (max-width: 768px) {
    .gta-gallery__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    /* Gallery preview becomes a horizontal carousel */
    .gta-gallery-preview {
        overflow: hidden; /* prevent horizontal page scroll */
    }

    .gta-gallery-preview__grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: var(--space-md);
        padding-bottom: var(--space-sm);
        scrollbar-width: none; /* Firefox */
        overscroll-behavior-x: contain; /* stop swipe from scrolling the page */
    }

    .gta-gallery-preview__grid::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .gta-gallery-preview__item {
        flex: 0 0 75%;
        scroll-snap-align: center;
        aspect-ratio: 3 / 4;
    }

    .gta-gallery-preview__scroll-hint {
        display: flex;
    }

    .gta-lightbox__nav {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }

    .gta-lightbox__prev {
        left: var(--space-sm);
    }

    .gta-lightbox__next {
        right: var(--space-sm);
    }
}

@media (max-width: 480px) {
    .gta-gallery__grid {
        grid-template-columns: 1fr;
    }

    .gta-gallery__item {
        aspect-ratio: 4 / 5;
    }

    .gta-gallery-preview__item {
        flex: 0 0 85%;
    }
}
