/* Liseuse des guides Y voir Claire : on tourne les pages comme un livre.
   Pensée pour les 55 ans et plus : gros boutons avec du texte, numéro de page toujours visible, bouton Agrandir. */
:root {
  --marine: #1F3461;
  --marine-nuit: #15233F;
  --ivoire: #FBF8F3;
  --beige: #F3ECE1;
  --dore: #B08D57;
  --dore-clair: #CDB083;
  --ratio: 0.7071; /* largeur / hauteur d'une page */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  color: #fff;
  background: radial-gradient(ellipse at 50% 40%, #2A4378 0%, var(--marine-nuit) 70%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Bandeau du haut */
.barre {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(10, 18, 36, .55);
  border-bottom: 1px solid rgba(205, 176, 131, .35);
  flex-wrap: wrap;
}
.barre .retour { color: #fff; text-decoration: none; font-size: .95rem; white-space: nowrap; }
.barre .retour:hover { color: var(--dore-clair); }
.barre .titre { flex: 1; min-width: 0; text-align: center; }
.barre .titre small { display: block; font-size: .7rem; letter-spacing: .22em; color: var(--dore-clair); }
.barre .titre strong { font-family: 'Playfair Display', Georgia, serif; font-weight: 400; font-size: 1.25rem; }
.barre .pdf {
  color: #fff; text-decoration: none; font-size: .85rem; letter-spacing: .08em;
  border: 1px solid var(--dore-clair); padding: 9px 16px; white-space: nowrap;
}
.barre .pdf:hover { background: var(--dore); border-color: var(--dore); }
.barre .note-courriel { font-size: .82rem; color: var(--dore-clair); white-space: nowrap; }

/* Scène et livre */
.scene {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 16px 8px;
  perspective: 2400px;
  touch-action: pan-y;
}
.livre {
  position: relative;
  width: var(--livre-l, 800px);
  height: var(--livre-h, 565px);
  transform-style: preserve-3d;
}
.moitie, .feuille .face {
  position: absolute; top: 0; height: 100%;
  width: 50%;
  background: transparent;
}
.moitie.g, .feuille.g { left: 0; }
.moitie.d, .feuille.d { left: 50%; }
.moitie img, .feuille img { width: 100%; height: 100%; display: block; object-fit: cover; }
.moitie .page, .feuille .face {
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  background: #fff;
}
.moitie .page, .feuille .face .page { position: relative; width: 100%; height: 100%; container-type: inline-size; }
.moitie.vide .page { display: none; }
/* Pli du milieu, discret */
.mode-double .moitie.g .page::after,
.mode-double .moitie.d .page::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 28px; pointer-events: none;
}
.mode-double .moitie.g .page::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.16), transparent); }
.mode-double .moitie.d .page::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.16), transparent); }

/* Une page à la fois (téléphone, ou Agrandir) */
.mode-simple .moitie.g { display: none; }
.mode-simple .moitie.d { left: 0; width: 100%; }
.mode-simple .moitie.d .page { transition: transform .32s ease, opacity .32s ease; }
.mode-simple .moitie.d.sortie-g .page { transform: translateX(-30px); opacity: 0; }
.mode-simple .moitie.d.sortie-d .page { transform: translateX(30px); opacity: 0; }

/* La feuille qui tourne */
.feuille {
  position: absolute; top: 0; height: 100%; width: 50%;
  transform-style: preserve-3d;
  transition: transform .75s cubic-bezier(.45, .05, .25, 1);
  z-index: 5;
}
.feuille.d { transform-origin: left center; }
.feuille.g { transform-origin: right center; }
.feuille .face {
  left: 0; width: 100%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.feuille .dos { transform: rotateY(180deg); }
.feuille.d.tourne { transform: rotateY(-180deg); }
.feuille.g.tourne { transform: rotateY(180deg); }
.feuille .face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,.18), transparent 30%, transparent 70%, rgba(0,0,0,.12));
}

/* Retouches posées sur une page, à la police du guide (Jost) */
.retouche {
  position: absolute; z-index: 1; background: #FFFDF8;
  font-family: 'Jost', Arial, sans-serif; font-size: 2.1cqw; line-height: 1.45;
  padding-top: .3%;
}
.retouche.nom { font-weight: 600; color: #14264C; }
.retouche.contact { color: #2A2F38; }
.retouche a { color: #14264C; text-decoration: underline; text-decoration-color: #B08D57; text-underline-offset: 2px; position: relative; z-index: 3; }

/* Liens cliquables posés sur les pages */
.liens a {
  position: absolute; display: block; z-index: 2;
  border-radius: 3px;
}
.liens a:hover, .liens a:focus-visible { background: rgba(176, 141, 87, .22); outline: 2px solid rgba(176, 141, 87, .8); }

/* Zones de clic sur les bords (ordinateur) */
.bord { position: absolute; top: 0; bottom: 0; width: 14%; z-index: 3; cursor: pointer; background: transparent; border: 0; padding: 0; }
.bord.g { left: 0; }
.bord.d { right: 0; }
.bord:focus-visible { outline: 2px solid var(--dore-clair); }

/* Commandes du bas */
.commandes {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 16px 18px;
  flex-wrap: wrap;
}
.commandes button {
  font: inherit; font-size: 1rem; letter-spacing: .04em;
  min-height: 52px; padding: 0 22px;
  color: var(--marine); background: var(--ivoire);
  border: 2px solid var(--dore-clair); border-radius: 0;
  cursor: pointer;
}
.commandes button:hover:not(:disabled) { background: var(--dore-clair); }
.commandes button:disabled { opacity: .35; cursor: default; }
.commandes button.secondaire { background: transparent; color: #fff; }
.commandes button.secondaire:hover { background: rgba(255,255,255,.1); }
.compteur { min-width: 150px; text-align: center; font-size: 1.05rem; }
.compteur b { color: var(--dore-clair); font-weight: 400; }

/* Mode Agrandir : la page prend toute la largeur et on la fait défiler */
body.agrandi .scene { display: block; overflow: auto; perspective: none; }
body.agrandi .livre { margin: 0 auto; }

/* Zoom progressif : − 100 % + */
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom button { min-width: 52px; padding: 0 14px; font-size: 1.35rem; line-height: 1; }
.zoom .taille { min-width: 64px; text-align: center; font-size: 1rem; color: var(--dore-clair); }

/* Aide au premier affichage */
.astuce {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ivoire); color: var(--marine);
  padding: 10px 18px; font-size: .95rem; box-shadow: 0 8px 24px rgba(0,0,0,.35);
  transition: opacity .6s; z-index: 10; max-width: calc(100% - 32px); text-align: center;
}
.astuce.cache { opacity: 0; pointer-events: none; }

@media (max-width: 700px) {
  body { font-size: 17px; }
  .barre { padding: 8px 12px; gap: 10px; }
  .barre .titre { order: 3; flex-basis: 100%; }
  .barre .titre strong { font-size: 1.05rem; }
  .barre .titre small { display: none; }
  .barre .pdf { margin-left: auto; padding: 7px 12px; font-size: .8rem; }
  .barre .note-courriel { margin-left: auto; font-size: .72rem; white-space: normal; text-align: right; max-width: 55%; }
  .scene { padding: 10px 8px 4px; }
  .commandes { gap: 8px; padding: 8px 8px 14px; }
  .commandes button { min-height: 50px; padding: 0 14px; }
  .zoom button { min-width: 48px; padding: 0 10px; }
  .zoom .taille { min-width: 52px; font-size: .9rem; }
  .compteur { min-width: 0; flex-basis: 100%; order: -1; font-size: .95rem; }
  .commandes [data-action=sommaire] { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .feuille, .mode-simple .moitie.d .page { transition: none; }
}
