/* Gallery Styles */

/* Gallery Header */
.gallery-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.gallery-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.gallery-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Category Navigation */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.category-link {
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.category-link:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Gallery Section */
.gallery-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-primary);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-color);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    will-change: transform;
}

.gallery-item img.loaded {
    opacity: 1;
}

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

/* Loading placeholder */
.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        var(--bg-secondary) 0%, 
        var(--bg-tertiary) 50%, 
        var(--bg-secondary) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.gallery-item img.loaded::before {
    display: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2.5rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2001;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.lightbox-close:hover {
    color: var(--accent-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    padding: 1rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 2001;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: var(--accent-primary);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-title {
        font-size: 2rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .lightbox-content {
        max-width: 95vw;
        max-height: 80vh;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 1.5rem;
        width: 44px;
        height: 44px;
        padding: 0.75rem;
    }

    .lightbox-close {
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .gallery-title {
        font-size: 1.75rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .gallery-item {
        border-radius: 8px;
    }
}