/* sertelet.fr — galerie : accueil, séries plein écran, détails, menu, projection. */
:root {
  --encre: #ece8df;
  --doux: #a39e93;
  --pale: #6f6b62;
  --nuit: #0b0b0a;
  --filet: rgba(236, 232, 223, .10);
  --g: clamp(16px, 4vw, 56px);
  --bas: 4.6rem;
  --panneau: 400px;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --courbe: cubic-bezier(.2, .7, .2, 1);
  /* Marges des surimpressions : jamais collées au bord, encoches comprises. */
  --mh: max(var(--g), 24px, env(safe-area-inset-top));
  --md: max(var(--g), 24px, env(safe-area-inset-right));
  --mb: max(var(--g), 24px, env(safe-area-inset-bottom));
  --mg: max(var(--g), 24px, env(safe-area-inset-left));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--nuit); color: var(--encre); -webkit-font-smoothing: antialiased; scrollbar-width: none; }
html.js { scroll-snap-type: y mandatory; }
html::-webkit-scrollbar { display: none; }
body { font-family: var(--sans); font-weight: 300; background: var(--nuit); }
button { font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.petit { font-size: .68rem; letter-spacing: .28em; text-transform: uppercase; }
.serif { font-family: var(--serif); }

/* ================= Contenu de secours (sans JavaScript, ou données injoignables) ================= */
.statique { max-width: 1100px; margin: 0 auto; padding: calc(var(--mh) + 3rem) var(--mg) var(--mb); }
.js .statique { display: none; }
.statique h1 { margin-bottom: 2rem; }
.statique ul { list-style: none; display: grid; gap: 1rem; }
.statique figure { margin: 0 0 3rem; }
.statique figure img { width: 100%; height: auto; display: block; }
.statique figcaption { margin-top: .8rem; color: var(--doux); font-family: var(--serif); font-style: italic; font-size: 1.2rem; }
.statique nav { display: flex; justify-content: space-between; gap: 1rem; color: var(--doux); margin-top: 2rem; }

/* ================= Pages ================= */
.page {
  position: relative; height: 100vh; height: 100svh; overflow: hidden;
  scroll-snap-align: start; scroll-snap-stop: always;
  background: var(--fond, var(--nuit)); transition: background-color 1s ease;
}
@keyframes monte { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- Accueil ---- */
.accueil .fond { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.8s ease, transform 30s ease-out; transform: scale(1.06); }
.accueil .fond.visible { opacity: 1; transform: scale(1); }
.accueil::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(5,5,5,.72), rgba(5,5,5,0) 55%), linear-gradient(to bottom, rgba(5,5,5,.35), rgba(5,5,5,0) 22%); }
.accueil .nom { position: absolute; left: var(--mg); bottom: var(--mb); z-index: 2; animation: monte 1.6s .3s var(--courbe) both; }
h1 { font-family: var(--serif); font-weight: 300; font-size: clamp(2.7rem, 7.2vw, 6.4rem); line-height: .92; letter-spacing: -.012em; }
.accueil .nom .petit { color: var(--doux); margin-top: 1.2rem; }
.accueil .credit { position: absolute; top: var(--mh); right: var(--md); z-index: 2; color: var(--doux); transition: opacity .8s; }
.accueil .series { position: absolute; right: var(--md); bottom: var(--mb); z-index: 2; text-align: right; animation: monte 1.6s .7s var(--courbe) both; }
.accueil .series .petit { color: var(--doux); margin-bottom: 1rem; }
.accueil .series ul { list-style: none; }
.accueil .series li a {
  display: inline-flex; align-items: baseline; gap: .7em; text-decoration: none;
  font-family: var(--serif); font-weight: 300; font-size: clamp(1.7rem, 2.7vw, 2.5rem); line-height: 1.25;
  opacity: .72; transition: opacity .4s;
}
.accueil .series li a:hover, .accueil .series li a:focus-visible { opacity: 1; }
.accueil .series li a .petit { font-family: var(--sans); font-size: .6rem; margin: 0; }
.accueil .liens { margin-top: 1.4rem; display: flex; gap: 2.2rem; justify-content: flex-end; flex-wrap: wrap; }
.accueil .liens > * { color: var(--doux); text-decoration: none; }
.accueil .liens > *:hover { color: var(--encre); }

/* ---- Chapitre ---- */
.chapitre { display: grid; place-items: center; text-align: center; }
.chapitre .flou { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); object-fit: cover; filter: blur(30px) brightness(.4) saturate(1.1); }
.chapitre .contenu { position: relative; }
.chapitre h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(3rem, 9vw, 7.5rem); line-height: 1; }
.chapitre .petit { color: var(--doux); margin-top: 1.4rem; }
.chapitre .indice { position: absolute; bottom: var(--mb); left: 0; right: 0; color: var(--doux); }

/* ---- Photo ---- */
.photo { display: flex; flex-direction: column; padding: var(--g) var(--g) 0; transition: padding .7s var(--courbe), background-color 1s ease; }
.cadre { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
/* Taille calculée depuis le format de la photo (--r = largeur / hauteur), jamais depuis les pixels
   du fichier reçu : un CDN peut servir une version plus petite que celle annoncée dans srcset. */
.cadre img {
  --h: calc(100svh - var(--g) - var(--bas));
  display: block; aspect-ratio: var(--r, 1.5); height: auto; max-width: 100%;
  width: min(100%, calc(var(--h) * var(--r, 1.5)));
  max-height: var(--h);
  opacity: 0; transform: scale(1.012);
  transition: opacity 1.2s ease, transform 1.8s var(--courbe), max-height .7s var(--courbe), width .7s var(--courbe);
  box-shadow: 0 40px 90px -40px rgba(0,0,0,.7);
}
.page.vue .cadre img { opacity: 1; transform: none; }
.legende { height: var(--bas); display: flex; align-items: center; justify-content: space-between; gap: 1rem; opacity: 0; transition: opacity 1.2s .6s ease; }
.page.vue .legende { opacity: 1; }
.ou { text-align: left; }
.ou .l1 { font-family: var(--serif); font-style: italic; font-size: clamp(1.15rem, 1.5vw, 1.4rem); line-height: 1.1; display: block; }
.ou .l2 { color: var(--doux); display: block; margin-top: .4rem; }
button.ou:hover .l1, button.ou:focus-visible .l1 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; }
.droite { display: flex; align-items: center; gap: 1.6rem; color: var(--pale); }
.droite button { color: var(--doux); }
.droite button:hover { color: var(--encre); }
.numero { font-variant-numeric: tabular-nums; }

/* ---- Fin de série ---- */
.fin { display: grid; grid-template-rows: auto 1fr auto; padding: calc(var(--g) * 1.6) var(--g) var(--g); }
.fin .petit.doux { color: var(--doux); }
.fin h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(2rem, 4.5vw, 3.6rem); margin-top: .5rem; }
.fin .milieu { min-height: 0; padding: 2rem 0; }
.fin .pied { display: flex; justify-content: space-between; gap: 1rem; color: var(--doux); flex-wrap: wrap; }
.fin .pied a { text-decoration: none; }
.fin .pied a:hover, .fin .pied button:hover { color: var(--encre); }
.planche { height: 100%; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: clamp(8px, 1.4vw, 20px); }
.planche a { display: block; height: clamp(90px, 22svh, 220px); }
.planche img { height: 100%; width: auto; display: block; opacity: .82; transition: opacity .4s; }
.planche a:hover img { opacity: 1; }

/* ---- Carte (tracé du voyage) ---- */
.carte svg { width: 100%; height: 100%; display: block; overflow: visible; }
.carte .trace { fill: none; stroke: var(--doux); stroke-width: 1; stroke-opacity: .55; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.carte .point { fill: var(--doux); }
.carte .ici-anneau { fill: none; stroke: var(--encre); stroke-width: 1.2; vector-effect: non-scaling-stroke; animation: pulse 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { from { opacity: .9; transform: scale(.6); } to { opacity: 0; transform: scale(2.2); } }
.carte .ici-point { fill: var(--encre); }
.carte .ici { transition: transform .8s var(--courbe); }
.carte a text { fill: var(--doux); font-family: var(--sans); }
.carte a:hover text { fill: var(--encre); }
.carte a:hover .point { fill: var(--encre); }

/* ================= En-tête ================= */
.entete {
  position: fixed; inset: 0 0 auto 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: calc(var(--g) * .42) var(--g); color: var(--doux); transition: opacity .6s ease;
}
.entete a { text-decoration: none; }
.entete a:hover, .entete button:hover { color: var(--encre); }
.entete nav { display: flex; gap: 1.8rem; align-items: center; }
.entete .titre-serie { position: absolute; left: 50%; transform: translateX(-50%); color: var(--pale); pointer-events: none; }
.court { display: none; }
body.vue-accueil .entete { display: none; }

/* ================= Panneau « Détails » ================= */
/* Le calque masque le panneau tant qu'il est hors champ : sans lui, la page s'élargirait d'autant. */
.calque { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; }
.panneau {
  position: absolute; top: 0; right: 0; height: 100%; width: min(var(--panneau), 100vw); overflow-y: auto; pointer-events: auto;
  padding: var(--mh) var(--md) var(--mb) calc(var(--g) * .9);
  display: flex; flex-direction: column; gap: 2rem;
  background: rgba(13, 13, 12, .9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-left: 1px solid var(--filet);
  transform: translateX(101%); transition: transform .7s var(--courbe);
}
body.carte-ouverte .panneau { transform: none; }
.panneau .haut { display: flex; justify-content: space-between; align-items: center; color: var(--doux); }
.panneau .haut button { font-size: 1.5rem; line-height: 1; color: var(--doux); padding: .2rem .4rem; letter-spacing: 0; }
.panneau .haut button:hover { color: var(--encre); }
.panneau .rubrique { color: var(--pale); margin-bottom: .7rem; }
.panneau .grand { font-family: var(--serif); font-weight: 300; font-size: clamp(1.9rem, 2.6vw, 2.4rem); line-height: 1.02; }
.panneau .latin { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--doux); margin-top: .35rem; }
.panneau .sous { color: var(--doux); margin-top: .7rem; }
.panneau .lien { display: inline-block; margin-top: 1rem; color: var(--doux); text-decoration: none; border-bottom: 1px solid var(--filet); padding-bottom: .2rem; }
.panneau .lien:hover { color: var(--encre); border-color: var(--doux); }
.panneau .carte { aspect-ratio: 1.45; margin: 1.2rem -.4rem .4rem; }
.panneau .coord { color: var(--pale); font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; margin-top: 1rem; }
.panneau .coord .liens { display: flex; gap: 1.2rem; }
.panneau .coord a { color: var(--doux); text-decoration: none; }
.panneau .coord a:hover { color: var(--encre); }
.panneau .approx { font-family: var(--serif); font-style: italic; color: var(--doux); margin-top: .6rem; font-size: 1rem; }

/* ================= Menu des séries ================= */
.menu {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto;
  padding: var(--mh) var(--md) var(--mb) var(--mg);
  display: flex; flex-direction: column; gap: 2rem;
  background: rgba(9, 9, 8, .95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transition: opacity .5s ease;
}
body.menu-ouvert .menu { opacity: 1; pointer-events: auto; }
.menu .haut { display: flex; justify-content: space-between; align-items: center; color: var(--doux); }
.menu .haut a { text-decoration: none; }
.menu .haut a:hover, .menu .haut button:hover { color: var(--encre); }
.menu .haut button { font-size: 1.5rem; line-height: 1; letter-spacing: 0; color: var(--doux); }
.menu .grille { margin: auto 0; }
.menu li.actuelle .t::after { content: " ·"; color: var(--doux); }
.menu .bas { display: flex; gap: 1rem 2rem; color: var(--doux); flex-wrap: wrap; }
.menu .bas a { text-decoration: none; }
.menu .bas a:hover, .menu .bas button:hover { color: var(--encre); }

/* ================= Grilles de vignettes : menu des séries, index des espèces ================= */
.grille { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: clamp(18px, 3vw, 44px); }
.grille li a { display: block; text-decoration: none; }
.grille .vignette { overflow: hidden; aspect-ratio: 3 / 2; }
.grille img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .8; transition: opacity .5s, transform 1.2s var(--courbe); }
.grille li a:hover img, .grille li a:focus-visible img { opacity: 1; transform: scale(1.03); }
.grille .t { font-family: var(--serif); font-weight: 300; font-size: 1.9rem; margin-top: .8rem; display: block; }
.grille .latin { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--doux); display: block; margin: .1rem 0 .5rem; }
.grille .petit { color: var(--doux); }

/* ---- Nouveautés : photos de la dernière publication ---- */
.nouveau { color: var(--encre); }
.accueil .series li a .nouveau { opacity: .9; }

/* ---- Index des espèces : page qui défile librement, sans pages plein écran ---- */
html.js.libre { scroll-snap-type: none; }
html.libre .entete { background: linear-gradient(to bottom, rgba(11, 11, 10, .94) 40%, rgba(11, 11, 10, 0)); }
.index { min-height: 100svh; padding: calc(var(--mh) + 3.4rem) var(--md) var(--mb) var(--mg); display: flex; flex-direction: column; gap: clamp(2rem, 6vh, 3.6rem); }
.index h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(2.6rem, 6vw, 5rem); line-height: 1; }
.index header .petit { color: var(--doux); margin-top: 1rem; }
.index .grille { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.index .pied { margin-top: auto; display: flex; gap: 2rem; color: var(--doux); }
.index .pied a { text-decoration: none; }
.index .pied a:hover { color: var(--encre); }
.chapitre .retour { display: inline-block; margin-top: 2.2rem; color: var(--doux); text-decoration: none; border-bottom: 1px solid var(--filet); padding-bottom: .2rem; }
.chapitre .retour:hover, .chapitre .retour:focus-visible { color: var(--encre); border-color: var(--doux); }
.entete .titre-serie a { pointer-events: auto; text-decoration: none; color: var(--doux); }
.entete .titre-serie a:hover { color: var(--encre); }
.chapitre .latin { font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 2.2vw, 1.7rem); color: var(--doux); margin-top: .6rem; }

/* ================= Plein écran : la photo seule, commandes en surimpression ================= */
.flottante { display: none; }
body.immersion .photo { padding: 0; }
body.immersion.carte-ouverte .photo { padding-right: 0; }
body.immersion .cadre img { --h: 100svh; box-shadow: none; }
body.immersion .legende { display: none; }
body.immersion .entete {
  padding: var(--mh) var(--md) calc(var(--g) * 1.6) var(--mg); color: var(--encre);
  background: linear-gradient(to bottom, rgba(0,0,0,.6), rgba(0,0,0,0));
  opacity: 0; pointer-events: none;
}
body.immersion .entete .titre-serie { color: var(--doux); }
body.immersion.eveil .entete { opacity: 1; pointer-events: auto; }
body.immersion .flottante {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  padding: calc(var(--g) * 1.8) var(--md) var(--mb) var(--mg);
  background: linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,0));
  opacity: 0; pointer-events: none; transition: opacity .6s ease;
}
body.immersion.eveil .flottante:not(.vide) { opacity: 1; pointer-events: auto; }
body.immersion:not(.eveil):not(.carte-ouverte):not(.menu-ouvert) { cursor: none; }

/* ================= Projection ================= */
.projection { position: fixed; inset: 0; z-index: 50; background: #000; display: none; }
body.en-projection .projection { display: block; }
body.en-projection:not(.eveil) { cursor: none; }
.diapo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 2.6s ease; }
.diapo.visible { opacity: 1; }
.proj-legende { position: absolute; left: var(--mg); bottom: var(--mb); opacity: 0; transition: opacity 1.6s ease; text-shadow: 0 1px 12px rgba(0,0,0,.6); }
.proj-legende.visible { opacity: .85; }
.proj-commandes {
  position: absolute; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: var(--mh) var(--md) calc(var(--g) * 1.6) var(--mg); color: var(--doux);
  background: linear-gradient(to bottom, rgba(0,0,0,.6), rgba(0,0,0,0));
  opacity: 0; pointer-events: none; transition: opacity .6s ease;
}
body.en-projection.eveil .proj-commandes { opacity: 1; pointer-events: auto; }
.proj-commandes div { display: flex; gap: 1.8rem; }
.proj-commandes button:hover { color: var(--encre); }

/* ================= Petits écrans ================= */
@media (min-width: 761px) {
  body.carte-ouverte:not(.immersion) .photo { padding-right: calc(var(--panneau) + var(--g)); }
}
@media (max-width: 760px) {
  :root { --bas: 5.2rem; }
  .petit { letter-spacing: .2em; }
  .long { display: none; }
  .court { display: inline; }
  .entete .titre-serie, .entete [data-action="projection"] { display: none; }
  .accueil .nom { top: var(--mh); bottom: auto; }
  .accueil::after { background: linear-gradient(to top, rgba(5,5,5,.75), rgba(5,5,5,0) 50%), linear-gradient(to bottom, rgba(5,5,5,.6), rgba(5,5,5,0) 38%); }
  .accueil .credit { display: none; }
  .accueil .series { left: var(--mg); right: auto; text-align: left; }
  .accueil .liens { justify-content: flex-start; gap: 1.4rem; }
  .panneau {
    top: auto; bottom: 0; height: auto; max-height: 78svh; width: 100vw;
    padding: 1.4rem var(--md) var(--mb) var(--mg);
    border-left: 0; border-top: 1px solid var(--filet); border-radius: 16px 16px 0 0;
    transform: translateY(101%);
  }
  .droite .details-bouton { display: none; }
  .proj-commandes { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cadre img, .accueil .fond.visible { opacity: 1; transform: none; }
  .legende { opacity: 1; }
}
