/* ===== Gallery Hero ===== */
.gallery-hero {
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    padding: 5rem 0 3.5rem;
    text-align: center;
}

/* Uses .section-title, .section-subtitle from styles.css */

/* ===== Filter Bar ===== */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2.5rem;
}

.filter-btn {
    padding: 0.55rem 1.25rem;
    border-radius: 100px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.filter-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #07070d;
    font-weight: 600;
}

body.light-mode .filter-btn.active,
body.light-mode .slider-arrow:hover,
body.light-mode .lightbox-close:hover,
body.light-mode .lightbox-prev:hover,
body.light-mode .lightbox-next:hover {
    color: #ffffff;
}

/* ===== Gallery Section ===== */
.gallery-section {
    padding: 5rem 0;
}

/* ===== Gallery Slider Viewport & Viewport Grid ===== */
.gallery-slider-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 2.5rem 0;
    perspective: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-grid {
    position: relative;
    width: 100%;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ===== Gallery Item ===== */
.gallery-item {
    position: absolute;
    width: 380px;
    max-width: 80vw;
    aspect-ratio: 4 / 3;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s, border-color 0.3s, box-shadow 0.3s;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gallery-item.active {
    border-color: rgba(91, 141, 239, 0.5);
    box-shadow: 0 20px 40px rgba(91, 141, 239, 0.15), 0 15px 30px rgba(0, 0, 0, 0.4);
}

.gallery-item:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===== Glassmorphic Navigation Arrows ===== */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 31, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--color-text);
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 20;
}

.slider-arrow:hover {
    background: var(--color-accent);
    color: #07070d;
    border-color: var(--color-accent);
    box-shadow: 0 0 15px var(--color-accent-glow);
}

.slider-arrow-prev {
    left: 2rem;
}

.slider-arrow-next {
    right: 2rem;
}

@media (max-width: 768px) {
    .gallery-grid {
        min-height: 350px;
    }
    .gallery-item {
        width: 320px;
    }
    .slider-arrow-prev {
        left: 1rem;
    }
    .slider-arrow-next {
        right: 1rem;
    }
}

@media (max-width: 599px) {
    .gallery-grid {
        min-height: 280px;
    }
    .gallery-item {
        width: 280px;
    }
    .slider-arrow {
        width: 40px;
        height: 40px;
    }
    .slider-arrow-prev {
        left: 0.5rem;
    }
    .slider-arrow-next {
        right: 0.5rem;
    }
}

/* ===== Gallery Thumb ===== */
.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
}

.gallery-item:hover .gallery-thumb,
.gallery-item:focus .gallery-thumb {
    transform: scale(1.08);
}

/* ===== Gallery Item Overlay ===== */
.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 1.25rem;
    background: rgba(7, 7, 13, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(10px) translateZ(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.gallery-item.active .gallery-item-overlay {
    opacity: 1;
    transform: translateY(0) translateZ(0);
}

/* ===== Gallery Item Tag ===== */
.gallery-item-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(91, 141, 239, 0.2);
    border: 1px solid rgba(91, 141, 239, 0.4);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent-2);
    margin-bottom: 0.5rem;
}

/* ===== Gallery Item Title ===== */
.gallery-item-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* ===== Image Error Fallback ===== */
.gallery-thumb[data-error="true"] {
    display: none;
}

.gallery-item.img-error {
    position: relative;
}

.gallery-item.img-error::after {
    content: 'Image unavailable';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-2);
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ===== No Results ===== */
.gallery-no-results {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
    font-size: 16px;
    grid-column: 1 / -1;
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox[hidden] {
    display: none;
}

/* ===== Lightbox Backdrop ===== */
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 7, 13, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ===== Lightbox Content ===== */
.lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 90vw;
}

/* ===== Lightbox Img Wrap ===== */
.lightbox-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ===== Lightbox Img ===== */
.lightbox-img {
    max-width: 85vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: block;
}

/* ===== Lightbox Spinner ===== */
.lightbox-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Lightbox Close ===== */
.lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.lightbox-close:hover {
    background: var(--color-accent);
    color: #07070d;
}

/* ===== Lightbox Prev / Next ===== */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 2;
}

.lightbox-prev {
    left: -3.5rem;
}

.lightbox-next {
    right: -3.5rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--color-accent);
    color: #07070d;
}

/* ===== Lightbox Caption ===== */
.lightbox-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.lightbox-caption-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

.lightbox-caption-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(91, 141, 239, 0.2);
    border: 1px solid rgba(91, 141, 239, 0.4);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent-2);
}

/* ===== Responsive — Lightbox nav on narrow screens ===== */
@media (max-width: 599px) {
    .lightbox-prev,
    .lightbox-next {
        position: static;
        transform: none;
        margin: 0 0.5rem;
    }

    /* Wrap prev/next and image in a flex row */
    .lightbox-img-wrap {
        order: 2;
    }

    .lightbox-prev {
        order: 1;
    }

    .lightbox-next {
        order: 3;
    }

    .lightbox-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
    }

    .lightbox-close {
        position: static;
        order: 0;
        align-self: flex-end;
        margin-bottom: 0.5rem;
        flex: 0 0 auto;
    }

    .lightbox-caption {
        order: 4;
        flex: 0 0 100%;
    }
}

/* ===== Video Gallery Section ===== */
.video-gallery-section {
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: 6.5rem 0;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1023px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 599px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

.video-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    border-color: rgba(91, 141, 239, 0.4);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    background: #000;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 0.5rem;
}

.video-body-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
    line-height: 1.3;
}

.video-body-description {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 599px) {
    .gallery-hero {
        padding: 3.5rem 0 2.75rem;
    }

    .filter-btn {
        min-height: 44px;
        padding: 0.7rem 1rem;
    }

    .gallery-filters {
        gap: 0.6rem;
        margin-bottom: 2rem;
    }

    .video-gallery-section {
        padding: 4rem 0;
    }

    .video-body-description {
        font-size: 15px;
        line-height: 1.65;
    }
}

