/* ============================================
   GALERIE PAGE STYLES — Cinestesia Film
   Inspiré du portfolio de Jeremy Condamine
   ============================================ */

/* ── Page Header ── */
.page-header {
    padding: 140px 0 60px;
    text-align: center;
    background: var(--cin-black);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 168, 76, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.page-title {
    font-family: var(--cin-font-display);
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 1rem;
    color: var(--cin-white);
}

.page-subtitle {
    font-family: var(--cin-font-body);
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--cin-text-muted);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Page Header Stats ── */
.page-header-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 32px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-num {
    font-family: var(--cin-font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--cin-gold);
}

.stat-label {
    font-family: var(--cin-font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--cin-text-muted);
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--cin-border);
}

/* ── Filter Section ── */
.filter-section {
    padding: 20px 0;
    background: var(--cin-black);
    border-bottom: 1px solid var(--cin-border);
    position: sticky;
    top: 70px;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    font-family: var(--cin-font-body);
    font-size: 0.82rem;
    font-weight: 400;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--cin-border);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--cin-text-muted);
}

.filter-btn:hover {
    border-color: var(--cin-gold);
    color: var(--cin-gold);
}

.filter-btn.active {
    background: var(--cin-gold);
    border-color: var(--cin-gold);
    color: var(--cin-black);
    box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
}

/* ── Toolbar Right ── */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gallery-count-badge {
    font-family: var(--cin-font-body);
    font-size: 0.78rem;
    color: var(--cin-text-muted);
    white-space: nowrap;
}

/* ── Layout Switcher ── */
.layout-switcher {
    display: flex;
    gap: 4px;
}

.layout-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--cin-border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cin-text-muted);
    transition: all 0.2s;
}

.layout-btn:hover {
    border-color: var(--cin-gold);
    color: var(--cin-gold);
}

.layout-btn.active {
    background: var(--cin-gold);
    border-color: var(--cin-gold);
    color: var(--cin-black);
}

.layout-btn svg {
    width: 16px;
    height: 16px;
}

/* ── Gallery Section ── */
.gallery-section {
    padding: 40px 0 80px;
    background: var(--cin-black);
}

/* ── Gallery Grid Layouts ── */
.gallery-grid {
    display: grid;
    gap: 16px;
    transition: opacity 0.3s ease;
}

/* Layout: 3 colonnes (défaut) */
.gallery-grid.layout-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* Layout: Masonry */
.gallery-grid.layout-masonry {
    display: block;
    column-count: 3;
    column-gap: 16px;
}

.gallery-grid.layout-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 16px;
    aspect-ratio: unset;
}

.gallery-grid.layout-masonry .gallery-item .gallery-image {
    height: auto;
}

.gallery-grid.layout-masonry .gallery-item .gallery-image img {
    height: auto;
    aspect-ratio: unset;
}

/* Layout: Wide (2 colonnes) */
.gallery-grid.layout-wide {
    grid-template-columns: repeat(2, 1fr);
}

/* ── Gallery Item ── */
.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: var(--cin-dark-card);
    border: 1px solid var(--cin-border);
    transition: all 0.3s ease;
}

.gallery-item:hover {
    border-color: var(--cin-border-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(201, 168, 76, 0.05);
}

.gallery-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-image img {
    transform: scale(1.05);
}

/* ── Caption ── */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 16px;
    background: linear-gradient(to top, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.6) 60%, transparent 100%);
    color: var(--cin-white);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

.gallery-category {
    font-family: var(--cin-font-body);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    opacity: 0.75;
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--cin-gold);
}

.gallery-title {
    font-family: var(--cin-font-display);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
}

.gallery-subcategory {
    font-family: var(--cin-font-body);
    font-size: 0.75rem;
    color: var(--cin-text-muted);
    margin-top: 4px;
}

/* ── Gallery Empty State ── */
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--cin-text-muted);
}

.gallery-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.gallery-empty p {
    font-family: var(--cin-font-body);
    font-size: 1rem;
}

/* ── Load More ── */
.gallery-load-more {
    text-align: center;
    margin-top: 48px;
}

.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--cin-border);
    border-radius: 100px;
    cursor: pointer;
    font-family: var(--cin-font-body);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--cin-text);
    transition: all 0.2s ease;
}

.btn-load-more:hover {
    background: var(--cin-gold);
    color: var(--cin-black);
    border-color: var(--cin-gold);
}

.btn-load-more-count {
    font-size: 0.75rem;
    opacity: 0.6;
}

.btn-load-more-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.btn-load-more:hover .btn-load-more-icon {
    transform: translateY(2px);
}

/* ── Lightbox ── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Counter */
.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--cin-font-body);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 100px;
    letter-spacing: 0.05em;
    z-index: 10;
}

/* Download button */
.lightbox-download {
    position: absolute;
    top: 16px;
    right: 70px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s;
    z-index: 10;
}

.lightbox-download:hover {
    background: var(--cin-gold);
    border-color: var(--cin-gold);
    color: var(--cin-black);
}

.lightbox-download svg {
    width: 20px;
    height: 20px;
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
}

/* Nav buttons */
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-nav svg {
    width: 22px;
    height: 22px;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Stage */
.lightbox-stage {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 92vh;
}

.lightbox-img-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

#lightbox-image {
    max-width: 80vw;
    max-height: 78vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.lightbox-img-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

.lightbox-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--cin-gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Caption */
.lightbox-info {
    margin-top: 14px;
    text-align: center;
}

.lightbox-caption {
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--cin-font-body);
    font-size: 0.9rem;
    line-height: 1.5;
}

.lightbox-caption strong {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--cin-gold);
    margin-bottom: 2px;
}

/* Thumbnail strip */
.lightbox-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    max-width: 80vw;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
}

.lightbox-thumbs::-webkit-scrollbar {
    display: none;
}

.lightbox-thumb {
    width: 52px;
    height: 38px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.45;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
}

.lightbox-thumb:hover {
    opacity: 0.75;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: var(--cin-gold);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Subcategory Filter ── */
.subcategory-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--cin-border);
}

.subcategory-btn {
    font-family: var(--cin-font-body);
    font-size: 0.75rem;
    font-weight: 400;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--cin-border);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--cin-text-muted);
}

.subcategory-btn:hover {
    border-color: var(--cin-gold);
    color: var(--cin-gold);
}

.subcategory-btn.active {
    background: rgba(201, 168, 76, 0.15);
    border-color: var(--cin-gold);
    color: var(--cin-gold);
}

/* ── Responsive ── */
@media (max-width: 1024px) {

    .gallery-grid.layout-grid,
    .gallery-grid.layout-masonry {
        grid-template-columns: repeat(2, 1fr);
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 100px 0 40px;
    }

    .filter-section {
        top: 60px;
    }

    .filter-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-buttons {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .gallery-grid.layout-grid,
    .gallery-grid.layout-wide {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-grid.layout-masonry {
        column-count: 2;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }

    .lightbox-download {
        right: 60px;
        width: 36px;
        height: 36px;
    }

    .lightbox-close {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {

    .gallery-grid.layout-grid,
    .gallery-grid.layout-wide,
    .gallery-grid.layout-masonry {
        grid-template-columns: 1fr;
        column-count: 1;
    }

    .filter-btn {
        padding: 6px 14px;
        font-size: 0.75rem;
    }

    .gallery-caption {
        transform: translateY(0);
    }

    .lightbox-thumbs {
        display: none;
    }

    .page-header-stats {
        gap: 16px;
    }
}