/* Gallery Grid */
.gallery-grid {
    columns: 3;
    column-gap: 1rem;
}

@media (max-width: 1024px) {
    .gallery-grid {
        columns: 2;
    }
}

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

/* Gallery Item */
.gallery-item {
    break-inside: avoid;
    margin-bottom: 1rem;
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #e5e5e5;
    opacity: 0;
    animation: galleryFadeIn 0.4s ease forwards;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    display: block;
    border-radius: 1rem;
    transition: transform 0.5s ease;
    background: #e5e5e5;
}

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.03);
}

/* Video play icon overlay */
.gallery-item-video::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    pointer-events: none;
    transition: background 0.3s ease;
}

.gallery-item-video:hover::after {
    background: rgba(0, 0, 0, 0.35);
}

.gallery-item-video .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
}

.gallery-item-video:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background: #fff;
}

.play-icon svg {
    width: 24px;
    height: 24px;
    margin-left: 3px;
}

/* Fade in items */
@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Desktop tabs - wrapping pills */
.gallery-tabs-desktop {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gallery-tab {
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.gallery-tab:hover {
    border-color: #111827;
    color: #111827;
}

.gallery-tab.active {
    background: #111827;
    color: white;
    border-color: #111827;
}

/* Mobile dropdown */
.gallery-tabs-mobile {
    display: none;
}

.gallery-dropdown {
    position: relative;
}

.gallery-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #111827;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.gallery-dropdown-btn:hover,
.gallery-dropdown-btn:focus {
    border-color: #111827;
    outline: none;
}

.gallery-dropdown-btn svg {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.gallery-dropdown.open .gallery-dropdown-btn svg {
    transform: rotate(180deg);
}

.gallery-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    z-index: 20;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.gallery-dropdown.open .gallery-dropdown-menu {
    max-height: 60vh;
    overflow-y: auto;
    opacity: 1;
}

.gallery-dropdown-option {
    display: block;
    width: 100%;
    padding: 0.875rem 1.25rem;
    text-align: left;
    font-size: 0.9375rem;
    font-family: 'Inter', sans-serif;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.gallery-dropdown-option:first-child {
    border-radius: 1rem 1rem 0 0;
}

.gallery-dropdown-option:last-child {
    border-radius: 0 0 1rem 1rem;
}

.gallery-dropdown-option:hover {
    background: #f3f4f6;
}

.gallery-dropdown-option.active {
    background: #111827;
    color: white;
}

/* Show/hide based on breakpoint */
@media (max-width: 768px) {
    .gallery-tabs-desktop {
        display: none;
    }

    .gallery-tabs-mobile {
        display: block;
    }

    .gallery-grid {
        columns: 2;
    }
}

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

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 102;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

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

.lightbox-prev {
    left: 1.5rem;
}

.lightbox-next {
    right: 1.5rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-content {
    position: relative;
    z-index: 101;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.5rem;
    background: transparent;
}

.lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 0.5rem;
    background: #000;
}

.lightbox-caption {
    position: absolute;
    bottom: 3.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 102;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9375rem;
    font-family: 'Inter', sans-serif;
    text-align: center;
    max-width: 600px;
    padding: 0 1rem;
    line-height: 1.4;
}

.lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 102;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

/* Mobile lightbox adjustments */
@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 0.75rem;
    }

    .lightbox-next {
        right: 0.75rem;
    }

    .lightbox-prev svg,
    .lightbox-next svg {
        width: 24px;
        height: 24px;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}
