/* Gallery Variables */
:root {
    --t-duration: 0.3s;
    --t-timing: ease;
}

/* Gallery specific styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

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

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--t-duration) var(--t-timing);
}

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

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    padding: 2rem;
    touch-action: none; /* Prevent browser handling of touch events */
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    will-change: transform, opacity;
}

.lightbox-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 2rem;
    height: 2rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--t-duration) var(--t-timing);
}

@media (max-width: 768px) {
    .lightbox-nav {
        opacity: 0.5;
    }
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

/* Touch feedback styles */
.lightbox-content img.swiping {
    transition: none !important;
}

.lightbox-content img.swipe-exit {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Gallery container styles */
#visitor-gallery .gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#visitor-gallery .aspect-container {
    width: 50%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

#visitor-gallery .aspect-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#visitor-gallery .gallery-item div {
    text-align: center;
    margin-top: 0.5rem;
}