#galerie-main {
    background: var(--trois);
    padding-top: 100px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.carte {
    --cut: 18px;

    width: 80%;
    height: 500px;
    margin-top: 30px;
    position: relative;

    /* Bordure fine bronze au lieu du bleu marine brut */
    border: 1px solid rgba(157, 145, 113, 0.4);
    border-bottom: none;

    overflow: hidden;
    transition: none;

    clip-path: polygon(0 0,
            100% 0,
            100% calc(100% - var(--cut)),
            calc(100% - var(--cut)) calc(100% - var(--cut)),
            var(--cut) calc(100% - var(--cut)),
            0 calc(100% - var(--cut)));
}


[data-theme="dark"] .carte {
    border: 1px solid rgba(157, 145, 113, 0.4);
}

/* ── Leaflet UI : restyle complet pour s'intégrer au site ── */

/* Zoom controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.leaflet-control-zoom a {
    background: rgba(10, 10, 10, 0.82) !important;
    color: var(--quatre) !important;
    border: none !important;
    border-bottom: 1px solid rgba(157, 145, 113, 0.15) !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    font-size: 16px !important;
    font-weight: 200 !important;
    backdrop-filter: blur(8px);
    transition: background 0.25s ease, color 0.25s ease;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: var(--quatre) !important;
    color: #000 !important;
}

/* Attribution */
.leaflet-control-attribution {
    background: rgba(5, 5, 5, 0.65) !important;
    color: rgba(255, 255, 255, 0.35) !important;
    font-size: 9px !important;
    padding: 3px 8px !important;
    backdrop-filter: blur(4px);
    border-radius: 0 !important;
}

.leaflet-control-attribution a {
    color: var(--quatre) !important;
}

/* Markers custom : point bronze */
.leaflet-marker-icon {
    filter: hue-rotate(185deg) saturate(0.6) brightness(1.2);
}

/* Tiles : léger filtre pour harmoniser avec le dark mode */
[data-theme="dark"] .leaflet-tile {
    filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.7);
}

.sans-pub {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 20px;
    background-color: var(--trois);
    border-top: var(--un) 2px solid;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    text-align: center;
}

[data-theme="dark"] .sans-pub {
    background-color: var(--quatre);
    border-top: none;
}

/* --- Popups Leaflet S-CULTURE --- */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    /* Fond sombre semi-transparent pour laisser deviner la carte dessous */
    background: rgba(10, 10, 10, 0.95) !important;
    color: var(--trois) !important;

    /* Bordure fine en bronze pour le côté précieux */
    border: 1px solid var(--quatre) !important;
    border-radius: 0px !important;

    /* Ombre plus diffuse et élégante */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8) !important;

    /* Lissage du texte */
    backdrop-filter: blur(4px);
    -webkit-font-smoothing: antialiased;
}

/* Ajustement du contenu interne */
.leaflet-popup-content {
    margin: 12px 15px !important;
    line-height: 1.4;
    font-family: 'JetBrains Mono', monospace;
    /* Si tu l'utilises, sinon sans-serif */
}

/* Bouton de fermeture personnalisé */
.leaflet-container a.leaflet-popup-close-button {
    color: var(--quatre) !important;
    padding: 8px 8px 0 0 !important;
    font-size: 16px !important;
    transition: color 0.3s ease, transform 0.3s ease;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: var(--trois) !important;
    transform: scale(1.1);
    background: transparent !important;
}

/* Correction de la pointe (le triangle sous le popup) */
.leaflet-popup-tip-container {
    width: 20px;
    height: 10px;
}



/* Le Rideau */
.map-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 5, 0.85);
    /* Noir profond */
    backdrop-filter: blur(8px);
    /* Cache la carte derrière */
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1);
}

.overlay-content {
    text-align: center;
}

.overlay-text {
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 12px;
    display: block;
    margin-bottom: 25px;
    opacity: 0.7;
}

/* Le Bouton S-CULTURE */
.map-btn {
    background: transparent;
    border: 1px solid var(--quatre);
    color: var(--quatre);
    padding: 12px 25px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.4s ease;
    border-radius: 0;
    /* Garder l'aspect minimaliste */
}

.map-btn:hover {
    background: var(--quatre);
    color: #000;
    box-shadow: 0 0 20px rgba(157, 145, 113, 0.3);
}

/* État masqué : le rideau s'efface et monte légèrement */
.map-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
}






/* Conteneur de livres */
.organiserlivres {
    max-width: 80%;
    display: flex;
    /* Utilise Flexbox pour aligner */
    flex-direction: row;
    /* Organise les boutons en ligne*/

    /* Espace entre  */
    position: relative;
    white-space: normal;
    /* Permet le retour à la ligne */
    flex-wrap: wrap;
    /* Permet de passer à la ligne suivante */
    justify-content: center;
    /* Centre les éléments horizontalement */
}

.livre {
    width: 183px;
    height: 153px;
    background-size: cover;
    background-position: center;
    display: block;
    margin: 30px auto;
    text-decoration: none;
    text-indent: -9999px;
    position: relative;



    /* 3D discrète et élégante */
    transform: perspective(1200px) rotateY(-8deg) translateY(0);

    /* La transition "Spring" (ressort) ultra fluide */
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Ombre "Flottante" (très diffuse et colorée selon l'image) */
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

/* --- Reliure moderne (une simple ligne de lumière) --- */
.livre::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* On crée une légère courbure sur la gauche sans dégradé noir sale */
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(0, 0, 0, 0.1) 2%,
            transparent 5%);
    z-index: 2;
}

/* --- Reflet "Liquid Glass" --- */
.livre::after {
    content: "";
    position: absolute;
    inset: 0;
    /* Un voile blanc très léger qui donne un aspect satiné */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* --- HOVER : L'EFFET 2025 --- */
.livre:hover {
    /* Le livre s'élève et se redresse légèrement, sans aplatir la 3D */
    transform: perspective(1200px) rotateY(-2deg) translateY(-12px) scale(1.08);

    /* L'ombre s'étire et devient plus floue (effet de hauteur) */
    box-shadow: 0 40px 50px -15px rgba(0, 0, 0, 0.25);
}

.livre:hover::after {
    opacity: 1;
}

/* --- ÉLÉMENT BONUS : La surbrillance sur les bords --- */
.livre:hover {
    outline: 1px solid rgba(255, 255, 255, 0.4);
    outline-offset: -1px;
}


#livre1 {
    background-image: url("../images/livres/seville.png");
}

#livre2 {
    background-image: url("../images/livres/milan.png");
}

#livre3 {
    background-image: url("../images/livres/paris.png");
}

#livre4 {
    background-image: url("../images/livres/marseille.png");
}

#livre5 {
    background-image: url("../images/livres/lyon.png");
}

#livre6 {
    background-image: url("../images/livres/annecy.png");
}

#livre7 {
    background-image: url("../images/livres/normandie.png");
}


/* Galerie */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    cursor: pointer;

    /* On force l'image à être brute et nette */
    filter: none;

    /* Bordure fine style plan d'architecte */
    border: 1px solid rgba(157, 145, 113, 0.2);

    /* On prépare un décalage interne sans zoom */
    padding: 0;
    background: var(--quatre);

    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
}

.gallery img:hover {
    /* L'image se rétracte légèrement à l'intérieur de son propre cadre */
    /* Cela crée une bordure bronze épaisse sans changer la taille de l'item */
    padding: 8px;

    /* La bordure devient solide */
    border: 1px solid var(--quatre);

    /* Petit effet de soulèvement sans zoom */
    transform: translateY(-5px);

    /* Ombre portée nette (pas de flou baveux) */
    box-shadow: 0 10px 0px -2px rgba(157, 145, 113, 0.1);
}

/* Optionnel : un effet de brillance "scan" qui passe une seule fois au hover */
.gallery img:hover {
    animation: scan-light 0.8s ease;
}

@keyframes scan-light {
    0% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }

    100% {
        filter: brightness(1);
    }
}




/* =====================================================================
   MODALE — desktop
   ===================================================================== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px) grayscale(0.06);
    -webkit-backdrop-filter: blur(6px) grayscale(0.06);
    padding: 20px;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Transitions de swipe ── */
.modal-content {
    max-width: min(1100px, 96vw);
    max-height: min(86vh, 920px);
    display: flex;
    overflow: hidden;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.75);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                opacity  0.22s ease;
}

.modal-content.swipe-left        { transform: translateX(-8%);  opacity: 0; }
.modal-content.swipe-right       { transform: translateX( 8%);  opacity: 0; }
.modal-content.swipe-enter-left  { transform: translateX( 8%);  opacity: 0; transition: none; }
.modal-content.swipe-enter-right { transform: translateX(-8%);  opacity: 0; transition: none; }
.modal-content.swipe-in          { transform: translateX(0);    opacity: 1; }

/* ── Zone image ── */
.modal-left {
    flex: 0 1 auto;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.modal-left img {
    max-width: 100%;
    max-height: min(86vh, 920px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
}

/* ── Panneau info ── */
.modal-right {
    width: 320px;
    flex: 0 0 320px;
    background: rgb(22, 22, 25);
    color: #eee;
    display: flex;
    flex-direction: column;
    padding: 20px 18px;
    box-sizing: border-box;
    overflow-y: auto;
    border-left: 1px solid rgba(255,255,255,0.05);
}

.meta-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-image: url('../images/havane.jpeg');
    background-size: cover;
    flex: 0 0 40px;
}

.meta-top .author {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    letter-spacing: 0.02em;
}

.caption {
    padding: 0;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255,255,255,0.72);
}

.caption h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

/* ── Bouton fermer ── */
.close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 10010;
    font-size: 22px;
    line-height: 1;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.35);
    border: none;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s ease, color 0.2s ease;
}

.close:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ── Flèches de navigation — desktop ── */
.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10010;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0.75;
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.08);
    opacity: 1;
}

.modal-nav:active {
    transform: translateY(-50%) scale(0.94);
}

.modal-prev { left: 20px; }
.modal-next { right: 20px; }

.modal-nav svg { pointer-events: none; }

/* ── Compteur — masqué sur desktop, visible sur mobile via media query ── */
.modal-counter {
    display: none;
}

/* ── Hint swipe — masqué sur desktop ── */
.modal-swipe-hint {
    display: none;
}

/* Séparateur gallerie */


.gallery-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(35, 75, 94, 0.3);
    /* Ligne fine var(--un) */
    background: transparent;
}

.tab-btn {
    position: relative;
    background: transparent;
    border: none;
    padding: 15px 40px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--un);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
}

/* L'élément "Wow" : Un bloc qui monte du bas mais s'arrête à mi-hauteur */
.tab-btn::before {
    content: "";
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--un);
    z-index: -1;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--quatre);
}

.tab-btn.active::before {
    bottom: 0;
}

/* Effet de survol : juste une barre de soulignement épaisse qui "frappe" */
.tab-btn:hover:not(.active)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--quatre);
    animation: strike 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes strike {
    from {
        width: 0;
        left: 50%;
    }

    to {
        width: 100%;
        left: 0;
    }
}

.tab-content.active {
    display: block;
}


.tab-btn.active {
    opacity: 1;
    border-bottom: 2px solid var(--quatre);
}


.organiserlivres,
.gallery,
.carte {
    display: none;
}

.organiserlivres.active,
.carte.active {
    display: flex;
}

.gallery.active {
    display: grid;
}

/* ==========================================================================
   RESPONSIVE MOBILE — galerie.css
   ========================================================================== */

@media (max-width: 1024px) {
    #galerie-main { padding-top: 70px; }
    .carte { width: 92%; height: 410px; }
    .organiserlivres { max-width: 92%; }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 12px; }
    .gallery img { height: 225px; }
}

@media (max-width: 768px) {
    #galerie-main { padding-top: 60px; }

    /* ── CARTE LEAFLET ── */
    .carte {
        width: 100% !important;
        height: 65svh !important;
        min-height: 340px;
        max-height: 520px;
        margin-top: 0 !important;
        clip-path: none !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        border-top: 1px solid rgba(157, 145, 113, 0.3) !important;
    }
    .carte > div:not(.map-overlay):not(.sans-pub) {
        width: 100% !important;
        height: 100% !important;
    }
    .sans-pub { height: 24px; font-size: 0; }

    /* ── ONGLETS ── */
    .gallery-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap; }
    .gallery-tabs::-webkit-scrollbar { display: none; }
    .tab-btn { padding: 12px 18px; font-size: 10px; letter-spacing: 2px; white-space: nowrap; flex-shrink: 0; }

    /* ── LIVRES ── */
    .organiserlivres { max-width: 100%; padding: 0 4%; justify-content: center; }
    .livre { width: 126px; height: 105px; margin: 14px 5px; transform: perspective(800px) rotateY(-5deg); }
    .livre:hover { transform: perspective(800px) rotateY(-1deg) translateY(-7px) scale(1.05); }

    /* ── GRILLE PHOTOS ── */
    .gallery { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 6px; }
    .gallery img { height: auto; aspect-ratio: 3/4; object-fit: cover; }
    .gallery img:hover { padding: 4px; transform: translateY(-3px); }

    .leaflet-popup-content-wrapper { max-width: 215px !important; }

    /* ── MODALE MOBILE — plein écran façon Instagram ── */
    .modal {
        padding: 0;
        align-items: stretch;
        background: #000;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .modal-content {
        flex-direction: column;
        width: 100vw;
        max-width: 100vw;
        height: 100svh;
        max-height: 100svh;
        border-radius: 0;
        box-shadow: none;
        background: #000;
        overflow: hidden;
    }

    /* Zone image — prend tout l'espace disponible */
    .modal-left {
        flex: 1 1 0;
        min-height: 0;
        background: #000;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        position: relative;
    }

    .modal-left img {
        width: 100%;
        height: 100%;
        max-height: none;
        max-width: 100%;
        object-fit: contain;
    }

    /* Panneau info — bottom sheet */
    .modal-right {
        width: 100%;
        flex: 0 0 auto;
        height: auto;
        max-height: 34svh;
        min-height: 80px;
        background: rgb(16, 16, 18);
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
        padding: 6px 16px 24px;
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Drag handle */
    .modal-right::before {
        content: '';
        display: block;
        width: 32px;
        height: 3px;
        background: rgba(255, 255, 255, 0.18);
        border-radius: 2px;
        margin: 8px auto 12px;
    }

    .meta-top {
        padding: 0 0 10px;
        margin-bottom: 8px;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .meta-top .author { font-size: 13px; }
    .avatar { width: 34px; height: 34px; flex: 0 0 34px; }
    .caption { font-size: 13px; line-height: 1.45; }
    .caption h3 { font-size: 14px; margin-bottom: 6px; }

    /* Bouton fermer — haut gauche, par-dessus l'image */
    .close {
        position: fixed;
        top: 14px;
        left: 14px;
        right: auto;
        font-size: 18px;
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.52);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border-radius: 50%;
        z-index: 10020;
        padding: 0;
    }

    /* Flèches — centrées dans la zone image (65% de hauteur) */
    .modal-nav {
        position: fixed;
        top: calc(50% - 17svh); /* Centre dans la zone image (≈65svh) */
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.42);
        border-color: rgba(255,255,255,0.08);
        border-radius: 50%;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        opacity: 0.9;
        z-index: 10015;
    }

    .modal-nav:hover { background: rgba(0,0,0,0.6); opacity: 1; }
    .modal-nav:active { transform: translateY(-50%) scale(0.92); opacity: 1; }
    .modal-prev { left: 10px; }
    .modal-next { right: 10px; }

    /* Compteur — coin haut droit, par-dessus l'image */
    .modal-counter {
        display: block;
        position: fixed;
        top: 18px;
        right: 16px;
        font-size: 11px;
        font-family: 'JetBrains Mono', monospace;
        color: rgba(255, 255, 255, 0.6);
        letter-spacing: 1px;
        z-index: 10020;
        pointer-events: none;
        background: rgba(0,0,0,0.38);
        padding: 3px 8px;
        border-radius: 20px;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    /* Hint swipe — centré dans la zone image */
    .modal-swipe-hint {
        display: flex;
        position: fixed;
        bottom: calc(34svh + 16px);
        left: 50%;
        transform: translateX(-50%);
        align-items: center;
        gap: 8px;
        z-index: 10016;
        pointer-events: none;
        opacity: 0.75;
        background: rgba(0,0,0,0.3);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        padding: 5px 12px;
        border-radius: 20px;
    }

    .modal-swipe-hint-arrow {
        width: 16px;
        height: 16px;
        stroke: rgba(255, 255, 255, 0.85);
        fill: none;
        stroke-width: 2.5;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .modal-swipe-hint span {
        font-size: 9px;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.75);
        font-family: 'JetBrains Mono', monospace;
    }
}

@media (max-width: 480px) {
    /* Carte */
    .carte { height: 55svh !important; min-height: 280px; }

    /* Onglets & livres */
    .tab-btn { padding: 10px 13px; font-size: 9px; letter-spacing: 1.5px; }
    .livre { width: 105px; height: 88px; margin: 11px 3px; }

    /* Grille */
    .gallery { gap: 4px; padding: 4px; }
    .gallery img { height: auto; aspect-ratio: 3/4; }

    /* Modale */
    .modal-right { max-height: 30svh; padding: 6px 13px 20px; }
    .caption { font-size: 12px; }
    .modal-nav {
        top: calc(50% - 15svh);
        width: 32px;
        height: 32px;
    }
    .modal-prev { left: 8px; }
    .modal-next { right: 8px; }
    .modal-counter { top: 14px; right: 12px; font-size: 10px; }
    .modal-swipe-hint { bottom: calc(30svh + 14px); }
}