:root {
  --mer: #1F4E5F;
  --mer-clair: #2E6E83;
  --sable: #F6F0E6;
  --sable-fonce: #E8DCC7;
  --terre: #B5653A;
  --encre: #22292C;
  --doux: #6B7376;
  --carte: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sable); color: var(--encre);
  font-family: "Nunito Sans", system-ui, -apple-system, sans-serif; font-size: 16px;
}
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; }

/* Porte */
.porte { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 24px 16px;
  background: linear-gradient(180deg, var(--mer) 0%, var(--mer-clair) 100%); color: #fff; }
.porte h1 { font-size: clamp(48px, 12vw, 84px); margin: 0; line-height: 1; }
.porte .sous { color: #F3E6CF; }
.porte form { margin: 28px auto 0; width: min(320px, 100%); display: grid; gap: 10px; text-align: left; }
.porte label { font-size: 14px; color: #E9F1F3; }
.porte input { font: inherit; padding: 12px 14px; border-radius: 10px; border: 0; }
.porte button { font: inherit; font-weight: 700; padding: 12px; border: 0; border-radius: 10px; background: var(--terre); color: #fff; cursor: pointer; }
.msg { min-height: 1.2em; margin: 0; color: #FFD7C2; font-size: 14px; }

/* En-têtes */
.entete { text-align: center; padding: 30px 16px 18px; background: var(--mer); color: #fff; position: relative; }
.entete h1 { font-size: clamp(40px, 10vw, 68px); margin: 0; line-height: 1.05; }
.sous { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 20px; margin: 4px 0 0; color: #F3E6CF; }
.compte { font-size: 14px; margin: 8px 0 0; color: #CFE0E5; }
.badge { display: inline-block; margin: 12px 0 0; padding: 4px 12px; border-radius: 999px; background: var(--terre); font-size: 13px; font-weight: 700; }
.entete-album { background-size: cover; background-position: center; padding-top: 52px; }
.entete-album::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,45,55,.55), rgba(20,45,55,.8)); }
.entete-album > * { position: relative; }
.retour { position: absolute; top: 12px; left: 12px; border: 0; background: rgba(255,255,255,.18); color: #fff;
  font: inherit; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.filtres { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.filtres button { border: 0; border-radius: 999px; padding: 7px 16px; font: inherit; font-weight: 600; font-size: 14px;
  background: rgba(255,255,255,.18); color: #fff; cursor: pointer; }
.filtres button[aria-pressed="true"] { background: #fff; color: var(--mer); }

.onglets { display: inline-flex; gap: 4px; margin-top: 16px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.16); }
.onglets button { border: 0; border-radius: 999px; padding: 9px 20px; font: inherit; font-weight: 700; font-size: 15px;
  background: none; color: #fff; cursor: pointer; }
.onglets button[aria-pressed="true"] { background: var(--terre); }

/* Livre feuilleté */
.livre { margin-top: 18px; }
.livre-barre { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-bottom: 16px; }
.livre-barre .bouton { padding: 8px 16px; text-decoration: none; }
#l-prec, #l-suiv { font-size: 20px; line-height: 1; padding: 6px 16px; }
.livre-num { min-width: 120px; text-align: center; font-weight: 600; color: var(--doux); }
.livre-scene { margin: 0 auto; width: 100%; }
.livre-scene .page { background: #FAF8F4; overflow: hidden; }
.livre-scene .page img { width: 100%; height: 100%; display: block; object-fit: cover; }
.livre-scene .stf__parent { margin: 0 auto; }
.qr-clic { position: absolute; display: block; border-radius: 4px; }
.qr-clic:hover, .qr-clic:focus-visible { outline: 3px solid var(--terre); outline-offset: 2px; }
.livre-aide { text-align: center; color: var(--doux); font-size: 13px; margin: 14px 0 0; }
.livre.livre-plein { position: fixed; inset: 0; z-index: 40; margin: 0; background: #1B2224; overflow: auto;
  padding: env(safe-area-inset-top) 6px env(safe-area-inset-bottom);
  display: flex; flex-direction: column; justify-content: center; }
/* plein écran : rien que le livre, une croix pour sortir et deux flèches discrètes */
.livre-plein .livre-barre { margin: 0; }
.livre-plein .livre-aide, .livre-plein #l-page, .livre-plein #l-pdf { display: none; }
.livre-plein #l-plein { position: fixed; z-index: 45; top: calc(8px + env(safe-area-inset-top)); right: 10px;
  width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 44px;
  background: rgba(255,255,255,.16); color: #fff; }
.livre-plein #l-prec, .livre-plein #l-suiv { position: fixed; z-index: 45; top: 50%; transform: translateY(-50%);
  width: 38px; height: 64px; padding: 0; border-radius: 10px; background: rgba(20,26,28,.55); color: #fff; font-size: 26px; }
.livre-plein #l-prec { left: 4px; } .livre-plein #l-suiv { right: 4px; }
.livre-plein #l-prec:disabled, .livre-plein #l-suiv:disabled { display: none; }

.contenu { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.vide { text-align: center; color: var(--doux); }

/* Voyages */
.voyages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.voyage { display: block; border: 0; padding: 0; text-align: left; background: var(--carte); border-radius: 14px;
  overflow: hidden; box-shadow: 0 2px 10px rgba(31,78,95,.12); cursor: pointer; font: inherit; color: inherit; }
.voyage-img { aspect-ratio: 4 / 3; background: var(--sable-fonce) center / cover no-repeat; }
.voyage-txt { padding: 12px 14px 14px; }
.voyage-txt h2 { margin: 0; font-size: 26px; line-height: 1.1; color: var(--mer); }
.voyage-txt p { margin: 4px 0 0; color: var(--doux); font-size: 14px; }

/* Boutons */
.actions-admin { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0 6px; }
.bouton { display: inline-block; font: inherit; font-weight: 700; padding: 10px 18px; border: 0; border-radius: 999px;
  background: var(--terre); color: #fff; cursor: pointer; }
.bouton.discret { background: var(--sable-fonce); color: var(--encre); }

/* Envoi */
.envoi { background: var(--carte); border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; }
.envoi p { margin: 0 0 8px; font-size: 14px; }
.envoi progress { width: 100%; height: 10px; accent-color: var(--terre); }

/* Jours et grille */
.jour h2 { font-size: 28px; margin: 26px 0 10px; color: var(--mer); }
.jour h2 small { font-family: "Nunito Sans", sans-serif; font-size: 13px; color: var(--doux); font-weight: 400; margin-left: 8px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
@media (max-width: 520px) { .grille { grid-template-columns: repeat(3, 1fr); gap: 3px; } }
.case { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: var(--sable-fonce); cursor: pointer; overflow: hidden; }
.case img { width: 100%; height: 100%; object-fit: cover; display: block; }
.case .duree { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px;
  padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.case .bulle { position: absolute; left: 6px; bottom: 6px; background: rgba(255,255,255,.85); border-radius: 999px;
  font-size: 12px; padding: 1px 6px; }

/* Visionneuse */
.vis { position: fixed; inset: 0; background: #0E1416; z-index: 50; display: flex; flex-direction: column; }
.v-scene { flex: 1; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 48px 8px 0; }
.v-scene img, .v-scene video { max-width: 100%; max-height: calc(100% - 60px); object-fit: contain; }
.v-legende { color: #F3E6CF; font-family: "Cormorant Garamond", Georgia, serif; font-size: 20px; font-style: italic;
  text-align: center; max-width: 780px; padding: 10px 16px 0; min-height: 1em; }
.v-fermer { position: absolute; top: 8px; right: 12px; z-index: 2; border: 0; background: none; color: #fff; font-size: 38px; cursor: pointer; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; border: 0; background: rgba(255,255,255,.12);
  color: #fff; font-size: 34px; width: 46px; height: 64px; border-radius: 10px; cursor: pointer; }
.v-prec { left: 8px; } .v-suiv { right: 8px; }
@media (max-width: 640px) { .v-nav { display: none; } }
.v-barre { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); color: #CFD8DA; font-size: 14px; }
.v-outils { display: flex; flex-wrap: wrap; gap: 6px; }
.v-btn { border: 0; background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: 14px; padding: 7px 12px;
  border-radius: 999px; cursor: pointer; text-decoration: none; }
.v-btn.danger { background: rgba(181,101,58,.55); }

/* Fenêtre */
.fen { position: fixed; inset: 0; z-index: 60; background: rgba(14,20,22,.6); display: grid; place-items: center; padding: 16px; }
.fen-boite { background: var(--carte); border-radius: 14px; padding: 18px 18px 14px; width: min(520px, 100%); max-height: 92vh; overflow: auto; }
.fen-boite h2 { margin: 0 0 12px; font-size: 28px; color: var(--mer); }
.fen-boite label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0 4px; }
.fen-boite input, .fen-boite textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #CDBFA8; border-radius: 8px; }
.fen-boite textarea { min-height: 120px; resize: vertical; }
.fen-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 16px 0 0; }
.qr-grand { display: block; margin: 0 auto; width: 240px; height: 240px; image-rendering: pixelated; }
.qr-lien { word-break: break-all; text-align: center; font-size: 14px; }
.qr-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.qr-liste figure { margin: 0; text-align: center; font-size: 12px; }
.qr-liste img { width: 100%; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; background: var(--encre); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); }

/* Tri : case « Supprimer » en haut à droite de chaque vignette, barre de confirmation */
.bouton.danger { background: #A8322D; color: #fff; }
.bouton:disabled { opacity: .45; cursor: default; }
.case-ouvrir { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.case .coche { position: absolute; top: 0; right: 0; z-index: 2; width: 44px; height: 44px; border: 0; padding: 0;
  background: none; cursor: pointer; display: flex; align-items: flex-start; justify-content: flex-end; }
.case .coche span { margin: 6px 6px 0 0; width: 26px; height: 26px; border-radius: 6px; border: 2px solid #fff;
  background: rgba(0,0,0,.3); color: transparent; font-weight: 700; font-size: 17px; line-height: 22px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.45); }
.case .coche:hover span, .case .coche:focus-visible span { background: rgba(0,0,0,.55); }
.case .coche-txt { position: absolute; left: 0; right: 0; top: 0; z-index: 1; padding: 0 40px 0 6px; line-height: 38px;
  font-size: 11px; font-weight: 700; color: #fff; background: #A8322D; display: none; pointer-events: none; }
.case.cochee img { opacity: .45; filter: grayscale(.6); }
.case.cochee { box-shadow: inset 0 0 0 3px #A8322D; }
.case.cochee .coche span { background: #A8322D; border-color: #A8322D; color: #fff; }
.case.cochee .coche-txt { display: block; }
.tri-jour { margin-left: 12px; font: 600 13px "Nunito Sans", sans-serif; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--doux); background: transparent; color: var(--encre); cursor: pointer; vertical-align: middle; }
.tri { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: center; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--carte); box-shadow: 0 -2px 12px rgba(0,0,0,.15); }
.tri-nb { font-weight: 700; margin-right: auto; }
.en-tri .contenu { padding-bottom: 90px; }
@media (max-width: 520px) { .tri-nb { width: 100%; text-align: center; margin: 0; } }

/* Case « Supprimer » dans la vue en grand */
.v-coche { position: absolute; top: 10px; left: 12px; z-index: 2; display: flex; align-items: center; gap: 8px; border: 0;
  padding: 7px 14px 7px 8px; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; font: 700 14px "Nunito Sans", sans-serif; cursor: pointer; }
.v-coche-case { width: 24px; height: 24px; border: 2px solid #fff; border-radius: 6px; color: transparent;
  display: flex; align-items: center; justify-content: center; font-size: 16px; }
.v-coche.on { background: #A8322D; }
.v-coche.on .v-coche-case { background: #fff; color: #A8322D; }

/* Coups de cœur */
.case .coeur-badge { position: absolute; left: 6px; top: 6px; color: #E0475B; font-size: 20px; line-height: 1;
  text-shadow: 0 0 3px #fff, 0 1px 4px rgba(0,0,0,.4); pointer-events: none; }
.v-coeur { position: absolute; top: 8px; right: 64px; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: rgba(0,0,0,.5); color: #fff; font-size: 24px; line-height: 44px; cursor: pointer; }
.v-coeur.on { color: #FF5A6E; background: rgba(255,255,255,.92); }

/* Diaporama */
.filtres { flex-wrap: wrap; }
.filtres .diapo-btn { font: inherit; font-weight: 700; padding: 6px 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--terre); color: #fff; }
.d-barre { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 3; display: flex; gap: 8px; align-items: center; }
.d-barre select.v-btn { appearance: auto; }
.d-pos { color: #fff; font-weight: 700; font-size: 14px; opacity: .85; }
.vis.diapo .v-barre, .vis.diapo .v-coche, .vis.diapo .v-coeur { display: none; }
.vis.diapo:not(.actif) { cursor: none; }
.vis.diapo:not(.actif) .v-nav, .vis.diapo:not(.actif) .v-fermer, .vis.diapo:not(.actif) .d-barre { opacity: 0; pointer-events: none; }
.vis.diapo .v-nav, .vis.diapo .v-fermer, .vis.diapo .d-barre { transition: opacity .4s; }
.vis.diapo #v-img { animation: fondu .7s ease; }
@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }
.vis.diapo .v-legende { font-size: 18px; }

/* Carte du voyage */
.carte { height: min(72vh, 760px); border-radius: 12px; overflow: hidden; background: var(--sable-fonce); }
.carte .leaflet-tooltip img { display: block; border-radius: 4px; margin-bottom: 4px; }

/* Doublons comparés côte à côte */
.fen-boite:has(.comparer) { width: min(1100px, 100%); }
.comparer { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.cmp { position: relative; border: 0; padding: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: #000;
  box-shadow: 0 0 0 4px #A8322D; aspect-ratio: 4 / 3; }
.cmp img { width: 100%; height: 100%; object-fit: contain; display: block; opacity: .55; }
.cmp span { position: absolute; left: 8px; top: 8px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: #A8322D; color: #fff; }
.cmp.garde { box-shadow: 0 0 0 4px #2E8B57; }
.cmp.garde img { opacity: 1; }
.cmp.garde span { background: #2E8B57; }
.cmp-aide { margin-top: 0; }

/* Clic droit : mettre en page principale */
.menu-ctx { position: fixed; z-index: 80; background: var(--carte); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.3); padding: 4px; }
.menu-ctx[hidden] { display: none; }
.menu-ctx button { border: 0; background: none; color: var(--encre); font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.menu-ctx button:hover:not(:disabled) { background: var(--sable); }
.menu-ctx button:disabled { color: var(--doux); cursor: default; }
.case .principale-badge { position: absolute; left: 6px; bottom: 34px; background: var(--mer); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
