/* ==========================================================================
   RACONTINO — livret-preview.css
   Lecteur "livret qui tourne les pages" synchronisé avec l'audio.
   Dépend des variables de couleur définies dans base.css.
   ========================================================================== */

.apercu{
  background:var(--ink);
  border-radius:28px;
  padding:34px 30px 30px;
  margin:44px 0;
}

.apercu-entete{text-align:center;margin-bottom:22px}
.apercu-etiquette{
  display:inline-block;
  background:var(--sun);color:var(--ink);
  font-family:var(--display);font-weight:800;
  font-size:13px;letter-spacing:.08em;text-transform:uppercase;
  padding:6px 16px;border-radius:100px;
  border:3px solid var(--ink);
  margin-bottom:14px;
}
.apercu-entete h2{color:var(--cream);margin:0 0 8px}
.apercu-entete p{color:#B9AFD4;font-size:16px;margin:0}

/* --- le lecteur audio --- */
.apercu-audio{
  width:100%;
  margin:0 auto 22px;
  display:block;
  border-radius:100px;
}

/* --- colonne centrée : sur grand écran le livret ne doit pas s'étirer --- */
.livret,
.livret-commandes,
.livret-suivi,
.apercu-fin{
  max-width:620px;
  margin-left:auto;
  margin-right:auto;
}

/* --- le livret --- */
.livret{
  background:var(--cream);
  border:4px solid var(--ink);
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 10px 0 rgba(0,0,0,.25);
}

.livret-scene{
  position:relative;
  aspect-ratio:4/3;
  background:var(--cream);
  overflow:hidden;
  cursor:pointer;
  user-select:none;
  perspective:1700px;
}

/* chaque page est une feuille indépendante, empilée dans la scène */
.livret-page{
  position:absolute;
  inset:0;
  transform-style:preserve-3d;
  will-change:transform;
}

/* les deux faces d'une feuille : l'illustration devant, le papier derrière */
.livret-face{
  position:absolute;
  inset:0;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  overflow:hidden;
  display:flex;align-items:center;justify-content:center;
}
.livret-face--avant{transform:rotateY(0deg)}
.livret-face--arriere{
  transform:rotateY(180deg);
  background:
    linear-gradient(90deg, rgba(0,0,0,.16), rgba(0,0,0,0) 32%),
    repeating-linear-gradient(45deg,#FBF3E4,#FBF3E4 14px,#F5EBD8 14px,#F5EBD8 28px);
}

.livret-face img{
  width:100%;height:100%;
  object-fit:cover;
  display:block;
}

/* l'ombre qui balaie la feuille pendant la rotation, pour donner le relief */
.livret-face--avant::after{
  content:"";
  position:absolute;inset:0;
  background:linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,0) 45%);
  opacity:0;
  pointer-events:none;
}
.livret-page.tourne-avant .livret-face--avant::after{animation:ombrePage .62s ease-in forwards}
.livret-page.tourne-arriere .livret-face--avant::after{animation:ombrePageRetour .62s ease-out forwards}

@keyframes ombrePage{
  0%{opacity:0}
  60%{opacity:1}
  100%{opacity:1}
}
@keyframes ombrePageRetour{
  0%{opacity:1}
  100%{opacity:0}
}

/* la page en cours s'efface vers la gauche, en pivotant sur son bord interne */
.livret-page.tourne-avant{
  transform-origin:left center;
  animation:tourneAvant .62s cubic-bezier(.44,.02,.28,1) forwards;
  box-shadow:14px 0 26px rgba(36,27,71,.34);
}
@keyframes tourneAvant{
  from{transform:rotateY(0deg)}
  to{transform:rotateY(-178deg)}
}

/* retour en arrière : la page précédente se rabat depuis la gauche */
.livret-page.tourne-arriere{
  transform-origin:left center;
  animation:tourneArriere .62s cubic-bezier(.44,.02,.28,1) forwards;
  box-shadow:14px 0 26px rgba(36,27,71,.34);
}
@keyframes tourneArriere{
  from{transform:rotateY(-178deg)}
  to{transform:rotateY(0deg)}
}


/* accessibilité : pas d'animation pour qui préfère s'en passer */
@media (prefers-reduced-motion: reduce){
  .livret-page.tourne-avant,
  .livret-page.tourne-arriere{animation-duration:.01ms}
  .livret-page.tourne-avant .livret-face--avant::after,
  .livret-page.tourne-arriere .livret-face--avant::after{animation-duration:.01ms}

}
/* repli quand l'illustration n'est pas encore déposée */
.livret-repli{
  width:100%;height:100%;
  display:flex;flex-direction:column;
  align-items:center;justify-content:center;
  gap:10px;
  background:repeating-linear-gradient(45deg,#FFF6E9,#FFF6E9 14px,#F7ECDA 14px,#F7ECDA 28px);
}
.livret-repli span{font-size:64px;line-height:1}
.livret-repli small{
  font-family:var(--display);font-weight:700;
  font-size:13px;color:#9A8FB8;
  letter-spacing:.04em;
}

/* numéro de planche, coin haut droit */
.livret-numero{
  position:absolute;top:12px;right:12px;
  background:var(--ink);color:var(--cream);
  font-family:var(--display);font-weight:800;font-size:13px;
  padding:5px 12px;border-radius:100px;
  pointer-events:none;
}



/* --- commandes --- */
.livret-commandes{
  display:flex;align-items:center;justify-content:space-between;
  gap:14px;margin-top:16px;
}
.livret-fleche{
  flex:0 0 auto;
  width:52px;height:52px;
  border-radius:50%;
  border:3px solid var(--ink);
  background:var(--sun);
  color:var(--ink);
  font-size:22px;line-height:1;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:transform .15s ease;
}
.livret-fleche:hover:not(:disabled){transform:scale(1.08)}
.livret-fleche:disabled{opacity:.3;cursor:default}

.livret-points{
  display:flex;gap:9px;justify-content:center;flex:1 1 auto;
}
.livret-point{
  width:11px;height:11px;border-radius:50%;
  border:2px solid var(--cream);
  background:transparent;
  cursor:pointer;padding:0;
  transition:transform .15s ease,background .15s ease;
}
.livret-point[aria-current="true"]{background:var(--sun);border-color:var(--sun);transform:scale(1.35)}

/* --- suivi automatique --- */
.livret-suivi{
  text-align:center;margin-top:14px;
  min-height:26px;
}
.livret-suivi button{
  background:transparent;
  border:2px solid #6B5F94;
  color:#B9AFD4;
  font-family:var(--body);font-weight:700;font-size:13px;
  padding:6px 16px;border-radius:100px;
  cursor:pointer;
}
.livret-suivi button:hover{border-color:var(--sun);color:var(--sun)}
.livret-suivi[data-actif="true"] button{display:none}
.livret-suivi-info{
  color:#8478A8;font-size:13px;font-style:italic;
}
.livret-suivi[data-actif="false"] .livret-suivi-info{display:none}

/* --- fin de l'extrait --- */
.apercu-fin{
  margin-top:24px;
  background:var(--sun);
  border:3px solid var(--ink);
  border-radius:18px;
  padding:20px 24px;
  text-align:center;
}
.apercu-fin p{
  font-family:var(--display);font-weight:700;
  font-size:18px;color:var(--ink);margin:0 0 14px;
}

@media(max-width:640px){
  .apercu{padding:26px 18px 22px;border-radius:22px}
  .livret-fleche{width:46px;height:46px;font-size:19px}
}


/* ==========================================================================
   BOUTON D'AGRANDISSEMENT, posé sur le cadre du livret
   ========================================================================== */
.livret{position:relative}

.livret-outil{
  position:absolute;top:12px;left:12px;z-index:3;
  width:40px;height:40px;
  border-radius:50%;
  border:3px solid var(--ink);
  background:rgba(255,246,233,.94);
  color:var(--ink);
  cursor:pointer;padding:0;
  display:flex;align-items:center;justify-content:center;
  transition:transform .15s ease,background .15s ease;
}
.livret-outil:hover{transform:scale(1.08);background:var(--sun)}
.livret-outil svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2.4;
                  stroke-linecap:round;stroke-linejoin:round}

/* ==========================================================================
   BOUTON LECTURE dans les commandes
   ========================================================================== */
.livret-lecture{background:var(--mint)}
.livret-lecture svg{width:19px;height:19px;fill:currentColor;stroke:none}

/* ==========================================================================
   AFFICHAGE PLEIN ÉCRAN
   Construit par le script : rien à ajouter dans le HTML.
   ========================================================================== */
body.livret-plein-actif{overflow:hidden}

.livret-plein{
  position:fixed;inset:0;z-index:9999;
  background:var(--ink-deep, #150E30);
  display:none;
  flex-direction:column;
  padding:14px 14px 20px;
  gap:12px;
}
.livret-plein.ouvert{display:flex}

.livret-plein-barre{
  flex:0 0 auto;
  display:flex;align-items:center;justify-content:space-between;
}
.livret-plein-compteur{
  font-family:var(--display);font-weight:800;font-size:15px;
  color:var(--sun);
  background:rgba(255,255,255,.08);
  padding:7px 16px;border-radius:100px;
}
.livret-plein-fermer{
  width:44px;height:44px;border-radius:50%;
  border:3px solid var(--cream);
  background:transparent;color:var(--cream);
  cursor:pointer;padding:0;
  display:flex;align-items:center;justify-content:center;
  transition:transform .15s ease,background .15s ease;
}
.livret-plein-fermer:hover{background:var(--tangerine);border-color:var(--tangerine)}
.livret-plein-fermer svg{width:20px;height:20px;fill:none;stroke:currentColor;
                         stroke-width:2.6;stroke-linecap:round}

/* la scène occupe toute la place restante */
.livret-plein-scene{
  position:relative;
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
  perspective:2200px;
  cursor:pointer;
  user-select:none;
  border-radius:16px;
}

/* en plein écran, l'illustration est montrée entière et non recadrée */
.livret-page--plein img{object-fit:contain;background:transparent}
.livret-page--plein .livret-face--arriere{border-radius:16px}



.livret-plein-commandes{
  flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;gap:16px;
}

@media(max-width:640px){
  .livret-plein{padding:10px 10px 16px}
  
  .livret-outil{width:36px;height:36px;top:10px;left:10px}
}
