/* ==========================================================================
   ALU PORTAIL DESIGN - Gallery & Lightbox
   ========================================================================== */

/* ---------- Filter Buttons ---------- */
.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.gallery-filter {
    padding: 8px 24px;
    background-color: var(--color-bg-light);
    color: var(--color-text-muted);
    border: 1px solid var(--color-bg-lighter);
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-main);
    transition: all var(--transition);
}

.gallery-filter:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.gallery-filter.is-active {
    background-color: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

/* ---------- Gallery Grid ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    image-rendering: auto;
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-item__label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    z-index: 2;
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 500;
    transform: translateY(10px);
    opacity: 0;
    transition: all var(--transition);
}

.gallery-item:hover .gallery-item__label {
    transform: translateY(0);
    opacity: 1;
}

/* Hidden items (filtered out) */
.gallery-item.is-hidden {
    display: none;
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox__image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius);
    image-rendering: auto;
}

.lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition);
    z-index: 10001;
}

.lightbox__close:hover {
    color: var(--color-accent);
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(200, 169, 110, 0.2);
    border: none;
    color: var(--color-white);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition);
}

.lightbox__nav:hover {
    background: rgba(200, 169, 110, 0.5);
}

.lightbox__prev {
    left: 20px;
}

.lightbox__next {
    right: 20px;
}

.lightbox__caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    text-align: center;
    max-width: 80%;
}

.lightbox__counter {
    position: absolute;
    top: 25px;
    left: 25px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ---------- Gallery Responsive ---------- */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .lightbox__prev {
        left: 10px;
    }

    .lightbox__next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-filters {
        gap: 0.3rem;
    }

    .gallery-filter {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
}
