/* ========================================
   GALERIE PHOTOS
   ======================================== */

/* La page est très haute : pas de défilement animé d'un bout à l'autre. */
html { scroll-behavior: auto; }

.page-photos {
    background: var(--navy);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-photos .nav-inner {
    max-width: 1680px;
    padding: 0 20px;
}

.page-photos .main-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.06);
}

/* ---- CONNEXION ---- */
.login {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + 48px) 20px 64px;
    background:
        radial-gradient(ellipse at 25% 85%, rgba(200,16,46,.16), transparent 60%),
        radial-gradient(ellipse at 75% 15%, rgba(200,16,46,.10), transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    color: var(--navy);
    border-radius: 12px;
    border-top: 4px solid var(--fire-red);
    padding: 40px 36px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
    text-align: center;
    animation: fadeUp .5s ease-out;
}

.login-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fire-red);
    background: rgba(200,16,46,.09);
}

.login-card h1 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.login-card p {
    color: var(--charcoal);
    font-size: .98rem;
    line-height: 1.5;
    margin-bottom: 22px;
}

.login-card label {
    display: block;
    text-align: left;
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--charcoal);
    margin-bottom: 6px;
}

.login-card input {
    width: 100%;
    font: inherit;
    font-size: 1.1rem;
    padding: 13px 14px;
    border: 2px solid #d9d4ce;
    border-radius: 6px;
    background: #fbfaf8;
    color: var(--navy);
    margin-bottom: 18px;
    transition: border-color .2s, box-shadow .2s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--fire-red);
    box-shadow: 0 0 0 4px rgba(200,16,46,.12);
}

.login-card .btn-primary { width: 100%; }

.login-card .login-error {
    background: rgba(200,16,46,.08);
    border-left: 4px solid var(--fire-red);
    border-radius: 4px;
    color: var(--fire-dark);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
}

/* ---- EN-TÊTE ---- */
.gallery-header {
    margin-top: var(--nav-height);
    padding: 40px 0 32px;
    position: relative;
    background: radial-gradient(ellipse at 80% 50%, rgba(200,16,46,.14), transparent 60%);
}

.gallery-header-inner,
.gallery-toolbar-inner,
.gallery {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.gallery-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px 32px;
}

.gallery-header h1 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.gallery-header h1 span { color: var(--fire-red); }

.gallery-header p {
    color: var(--silver);
    margin-top: 8px;
}

.gallery-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 22px;
}

.gallery-actions .btn-primary {
    padding: 13px 26px;
    font-size: .92rem;
}

.gallery-logout {
    color: var(--silver);
    font-size: .9rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.gallery-logout:hover { color: var(--white); }

/* ---- BARRE D'OUTILS ---- */
.gallery-toolbar {
    position: sticky;
    top: var(--nav-height);
    z-index: 500;
    background: rgba(13,27,42,.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.gallery-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.filters {
    display: flex;
    flex-shrink: 0;
    background: var(--navy-mid);
    border-radius: 6px;
    padding: 3px;
}

.filters button,
.timeline button {
    font-family: var(--font-display);
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--silver);
    background: none;
    border: none;
    border-radius: 4px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.filters button:hover,
.timeline button:hover {
    color: var(--white);
    background: rgba(255,255,255,.08);
}

.filters button[aria-pressed="true"] {
    color: var(--white);
    background: var(--fire-red);
}

.filters button small {
    font-family: var(--font-body);
    font-size: .78rem;
    letter-spacing: 0;
    opacity: .75;
    margin-left: 4px;
}

.timeline {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    padding-right: 28px;
}
.timeline::-webkit-scrollbar { display: none; }

.timeline-day {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-size: .74rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--fire-light);
    padding: 0 6px 0 12px;
}
.timeline-day:first-child { padding-left: 0; }

.timeline .timeline-unknown {
    margin-left: 10px;
    border: 1px dashed rgba(255,255,255,.28);
}

.timeline button.is-current {
    color: var(--white);
    background: rgba(255,255,255,.14);
}

.filters button:focus-visible,
.timeline button:focus-visible,
.cell:focus-visible,
.lb-btn:focus-visible,
.lb-nav:focus-visible,
.modal-close:focus-visible,
.archive-list a:focus-visible {
    outline: 3px solid var(--fire-light);
    outline-offset: 2px;
}

/* ---- GRILLE ---- */
.gallery {
    flex: 1;
    padding-top: 8px;
    padding-bottom: 72px;
}

.gallery-status {
    text-align: center;
    color: var(--silver);
    padding: 80px 20px;
}

.slot {
    scroll-margin-top: calc(var(--nav-height) + 62px);
    padding-top: 28px;
}

.slot-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
    margin-bottom: 12px;
}

.slot-title h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.slot-title h2 span { color: var(--fire-red); }

.slot-title small {
    color: var(--silver);
    font-size: .88rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 4px;
}

.cell {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 3px;
    background: var(--navy-light);
    color: var(--white);
    -webkit-tap-highlight-color: transparent;
}

.cell::before {
    content: '';
    display: block;
    padding-top: 100%;
}

.cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s, transform .3s;
}

.cell img.is-loaded { opacity: 1; }

@media (hover: hover) {
    .cell:hover img { transform: scale(1.05); }
}

.cell-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1;
    color: var(--white);
    background: rgba(0,0,0,.62);
    border-radius: 999px;
    padding: 5px 9px 5px 7px;
    pointer-events: none;
}

/* ---- VISIONNEUSE ---- */
.lb-open { overflow: hidden; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #05090f;
    color: var(--white);
    touch-action: pan-y pinch-zoom;
}

.lb-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 3;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 8px 0 18px;
    background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent);
}

.lb-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 14px;
    min-width: 0;
    line-height: 1.3;
}

.lb-counter {
    font-family: var(--font-display);
    font-size: .95rem;
    letter-spacing: 1.5px;
}

.lb-date {
    color: var(--silver);
    font-size: .9rem;
}

.lb-tools { display: flex; flex-shrink: 0; }

.lb-btn,
.lb-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    background: none;
    border: none;
    cursor: pointer;
    transition: background .2s;
}

.lb-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.lb-btn:hover,
.lb-nav:hover {
    color: var(--white);
    background: rgba(255,255,255,.14);
}

.lb-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 52px;
    height: 72px;
    margin-top: -36px;
    border-radius: 6px;
    background: rgba(0,0,0,.35);
}

.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-nav[disabled] { opacity: .25; cursor: default; }

.lb-stage {
    position: absolute;
    top: 60px; bottom: 16px;
    left: 72px; right: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-media {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 2px;
    opacity: 0;
    transition: opacity .25s;
}

.lb-media.is-loaded { opacity: 1; }

video.lb-media {
    width: 100%;
    height: 100%;
    background: #000;
}

.lb-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border: 3px solid rgba(255,255,255,.18);
    border-top-color: var(--fire-red);
    border-radius: 50%;
    animation: lbSpin .8s linear infinite;
}

.lb-error {
    color: var(--silver);
    text-align: center;
    padding: 20px;
}

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

/* ---- FENÊTRE « TOUT TÉLÉCHARGER » ---- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5,9,15,.8);
    overflow-y: auto;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 100%;
    overflow-y: auto;
    background: var(--white);
    color: var(--navy);
    border-radius: 12px;
    border-top: 4px solid var(--fire-red);
    padding: 34px 32px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: fadeUp .3s ease-out;
}

.modal-card h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    padding-right: 40px;
}

.modal-card p {
    color: var(--charcoal);
    font-size: .98rem;
    line-height: 1.5;
}

.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--charcoal);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}
.modal-close:hover { background: rgba(0,0,0,.07); }

.archive-list {
    list-style: none;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.archive-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid #e6e1db;
    border-radius: 8px;
    color: var(--navy);
    transition: border-color .2s, background .2s;
}

.archive-list a:hover {
    border-color: var(--fire-red);
    background: rgba(200,16,46,.04);
}

.archive-list svg {
    flex-shrink: 0;
    color: var(--fire-red);
}

.archive-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    line-height: 1.3;
}

.archive-name small {
    display: block;
    color: #6b6b6b;
    font-weight: 400;
    font-size: .86rem;
}

.archive-size {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-size: .95rem;
    letter-spacing: 1px;
    color: var(--charcoal);
}

.modal-card .modal-note {
    color: #6b6b6b;
    font-size: .86rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .gallery-header { padding: 28px 0 22px; }

    .page-photos .nav-inner,
    .gallery-header-inner,
    .gallery-toolbar-inner,
    .gallery {
        padding-left: 12px;
        padding-right: 12px;
    }

    .gallery-actions { width: 100%; justify-content: space-between; }

    .gallery-toolbar-inner { gap: 10px; }

    .filters button,
    .timeline button { padding: 7px 9px; font-size: .78rem; }

    .filters button small { display: none; }

    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
    }

    .cell { border-radius: 2px; }

    .slot { padding-top: 22px; }
    .slot-title h2 { font-size: 1.08rem; }

    .lb-stage { left: 0; right: 0; bottom: 0; }

    .lb-nav {
        width: 44px;
        height: 60px;
        margin-top: -30px;
    }
    .lb-prev { left: 4px; }
    .lb-next { right: 4px; }

    .login-card { padding: 34px 24px 28px; }
    .modal-card { padding: 30px 20px 22px; }
}
