/* ========================================
   GALLERY PAGE
   (couleurs & typo : voir theme.css)
   ======================================== */

:root { --topbar-h: 66px; }

body {
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--paper);
}

/* ---- Barre supérieure (marque + univers + Infos) ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-h);
    padding: 0 24px;
    background-color: var(--paper);
    border-width: 0 0 3px;
    border-style: solid;
    border-image: var(--orange-grad) 1;   /* bande signature orange→ */
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-mark {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    /* aplat orange + barre bleue : même dessin que le favicon */
    background: linear-gradient(to bottom, var(--orange) 0 80%, var(--blue) 80%);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-1);
}

.brand-name {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.1;
    color: var(--ink);
    transition: color var(--t-fast);
}

.brand:hover .brand-name { color: var(--orange); }

/* Onglets de groupe : centrés dans la barre */
.group-tabs {
    display: flex;
    gap: 4px;
    margin: 0 auto;
    background-color: var(--paper-2);
    padding: 4px;
    border-radius: var(--radius);
}

.group-tabs:empty { display: none; }

.group-tab {
    flex: 0 0 auto;
    padding: 9px 22px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.group-tab:hover { color: var(--ink); }

.group-tab.active {
    background: var(--orange);
    color: #fff;
    box-shadow: var(--shadow-1);
}

/* Groupe vide (ex : Artistique à venir) : repère discret + bleu si actif */
.group-tab.is-empty { color: #aeb6c0; font-style: italic; }

.group-tab.is-empty.active {
    background: var(--blue);
    color: #fff;
    font-style: normal;
}

.topbar-links {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

.topbar-link {
    flex-shrink: 0;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: color var(--t-fast);
}

.topbar-link:hover { color: var(--orange); }

/* ---- Layout principal ---- */
.container {
    display: flex;
    flex-direction: row;
    width: 100%;
}

/* ---- Sidebar : uniquement les séries ---- */
.sidebar {
    width: 240px;
    min-width: 240px;
    padding: 26px 24px;
    background-color: var(--paper);
    box-sizing: border-box;
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.series-eyebrow {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    margin: 0 0 16px;
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.categories a {
    display: flex;
    align-items: baseline;
    gap: 12px;
    text-decoration: none;
    color: var(--muted);
    font-size: 15px;
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background var(--t-fast), color var(--t-fast);
}

.categories a::before {
    content: attr(data-num);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12px;
    color: #b7c0cb;
    min-width: 22px;
    font-feature-settings: "tnum";
    transition: color var(--t-fast);
}

.categories a:hover {
    background-color: var(--paper-2);
    color: var(--ink);
}

.categories a.active {
    background-color: var(--paper-2);
    color: var(--ink);
    font-weight: 600;
}

.categories a.active::before { color: var(--orange); }

/* ---- Grille (masonry) ---- */
.gallery {
    flex: 1;
    padding: 16px;
    column-count: 4;
    column-gap: 10px;
    background-color: var(--paper);
    overflow: hidden;
}

.gallery picture {
    display: block;
    position: relative;
    break-inside: avoid;
    margin-bottom: 10px;
    border-radius: 7px;
    overflow: hidden;
    background-color: var(--paper-2);
}

.gallery picture img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.5s ease;
}

.gallery picture img.lazy-loaded { opacity: 1; }

.gallery picture::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 7px;
    box-shadow: inset 0 0 0 0 var(--orange);
    pointer-events: none;
    transition: box-shadow var(--t);
}

.gallery picture:hover img { transform: scale(1.05); }
.gallery picture:hover::after { box-shadow: inset 0 0 0 3px var(--orange); }

/* État vide de la galerie */
.gallery-empty {
    column-span: all;
    margin: 72px 0;
    text-align: center;
    color: var(--muted);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 15px;
}

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.94);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 86vh;
    width: auto;
    height: auto;
    display: none;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: default;
    box-shadow: var(--shadow-2);
}

#lightbox-img.loaded { opacity: 1; }

/* Compteur "03 / 16" */
.lightbox-counter {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    font-family: var(--font-display);
    letter-spacing: 0.22em;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    opacity: 0.92;
    padding-top: 12px;
}

.lightbox-counter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 3px;
    background: var(--orange);
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 24px;
    font-size: 34px;
    color: #fff;
    cursor: pointer;
    z-index: 1002;
    background: none;
    border: none;
    font-family: inherit;
    line-height: 1;
    opacity: 0.75;
    transition: opacity var(--t-fast), color var(--t-fast);
}

.lightbox-close:hover { opacity: 1; color: var(--orange-amber); }

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    width: 52px;
    height: 80px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background var(--t-fast), opacity var(--t-fast);
    z-index: 1002;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.lightbox-nav:hover { background: var(--orange); }

.lightbox-nav:disabled { opacity: 0.15; cursor: default; }
.lightbox-nav:disabled:hover { background: rgba(255, 255, 255, 0.1); }

.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }

/* Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top: 3px solid var(--orange);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    animation: spin 0.8s linear infinite;
    display: none;
}

.lightbox.loading .spinner { display: block; }
.lightbox.loading #lightbox-img { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .gallery { column-count: 3; }
}

@media (max-width: 900px) {
    .gallery { column-count: 2; }
}

@media (max-width: 768px) {
    /* Barre supérieure repliable */
    .topbar {
        height: auto;
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .topbar-links { margin-left: auto; order: 2; gap: 14px; }

    .group-tabs {
        order: 3;
        width: 100%;
        margin: 0;
    }

    .group-tab { flex: 1; padding: 9px 6px; }

    /* La sidebar redevient une barre de filtres horizontale */
    .container { flex-direction: column; }

    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: relative;
        top: 0;
        padding: 14px 16px;
        border-right: none;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .series-eyebrow { width: 100%; margin: 0 0 4px; }

    .categories {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .categories a {
        padding: 7px 14px;
        font-size: 14px;
        background-color: var(--paper-2);
        border-radius: var(--radius-pill);
    }

    .categories a::before { display: none; }

    .categories a.active { background-color: var(--ink); color: var(--paper); }

    .gallery { column-count: 2; padding: 8px; }

    .lightbox-nav { width: 44px; height: 64px; font-size: 26px; }
    .lightbox-prev { left: 4px; }
    .lightbox-next { right: 4px; }
}

@media (max-width: 480px) {
    .gallery { column-count: 2; padding: 4px; column-gap: 5px; }
    .gallery picture { margin-bottom: 5px; }
    .brand-name { font-size: 15px; }
    .group-tab { padding: 8px 4px; letter-spacing: 0.04em; }
}
