/* Lecteur des fiches de partition (28/11/2026) : des pages qui tournent, jamais de défilement.
   Consigne de Corentin du 28/11 : chaque page entière dans l'écran, en-tête et commandes à leur
   propre place (jamais sur la page), fondu court au changement de page, repère discret de la
   mesure jouée en « Partition animée ». Noir #0a0a0a et crème #f6f4ee, Petrona et Hanken
   Grotesk du site (fonts/da). Détail du fonctionnement : editions/partition-animee.js. */

/* Sur la fiche : la couverture, rien d'autre (la couverture seule est chargée). */
.pa-bloc { background: #0a0a0a; color: #f6f4ee; border-radius: 2px; padding: clamp(28px, 5vw, 48px) 16px clamp(20px, 4vw, 32px); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pa-ferme { position: relative; display: block; width: min(260px, 62vw); border: 0; padding: 0; background: none; cursor: pointer; box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .9); border-radius: 0; }
.pa-ferme img { display: block; width: 100%; height: auto; }
.pa-ferme::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 7%; background: linear-gradient(90deg, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0)); pointer-events: none; }
.pa-bloc .pa-invite { margin: 0; font-family: "Hanken Grotesk", system-ui, sans-serif; font-size: 14px; letter-spacing: .08em; opacity: .25; animation: pa-respire 3s ease-in-out 1.5s infinite; }
.pa-ferme:focus-visible { outline: 2px solid #f6f4ee; outline-offset: 6px; }
@keyframes pa-respire { 0%, 100% { opacity: .25; } 50% { opacity: .8; } }

/* Le lecteur ouvert, plein écran : en-tête, scène (la page), commandes, chacun à sa place. */
html.pa-ouverte { overflow: hidden; }
.pa { --encre: #0a0a0a; --papier: #f6f4ee; --pw: 300px; --ph: 425px;
  position: fixed; inset: 0; z-index: 1000; background: var(--encre); color: var(--papier); font-family: "Hanken Grotesk", system-ui, sans-serif;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "tete" "scene" "cmd";
  overflow: hidden; -webkit-tap-highlight-color: transparent; opacity: 0; transition: opacity .3s ease; }
.pa.ouvert { opacity: 1; }
.pa * { box-sizing: border-box; }

.pa .tete { grid-area: tete; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 8px 10px 4px 16px; min-width: 0; }
.pa .ident { flex: 1 1 200px; min-width: 0; display: flex; align-items: baseline; gap: 12px; overflow: hidden; }
.pa .ident .titre { font-family: Petrona, serif; font-style: italic; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pa .ident .auteur { font-size: 12px; opacity: .6; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pa .choix { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: center; }
.pa .modes, .pa .sources { display: flex; gap: 2px; }
.pa .sources { padding-left: 14px; border-left: 1px solid rgba(246, 244, 238, .18); }
.pa .modes button, .pa .sources button { background: none; border: 0; border-bottom: 1px solid transparent; color: inherit; font: inherit; font-size: 13px; opacity: .55; padding: 8px 8px; min-height: 36px; cursor: pointer; white-space: nowrap; }
.pa .modes button[aria-pressed="true"], .pa .sources button[aria-pressed="true"] { opacity: 1; border-bottom-color: var(--papier); }
.pa .fermer { width: 44px; height: 44px; flex: none; border: 1px solid rgba(246, 244, 238, .35); border-radius: 2px; background: none; color: inherit; font: inherit; font-size: 24px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }

/* La scène : la page (ou la double page) entière, centrée, jamais de défilement. */
.pa .scene { grid-area: scene; position: relative; overflow: hidden; min-height: 0; min-width: 0; display: grid; place-items: center; }
.pa .planche { grid-area: 1 / 1; display: flex; opacity: 0; transition: opacity .38s ease; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .9); }
.pa .planche.visible { opacity: 1; }
.pa .planche.sortante { opacity: 1; }
.pa .page { position: relative; margin: 0; padding: 0; border: 0; flex: none; width: var(--pw); height: var(--ph); background: #fff; overflow: hidden; }
.pa .page img { display: block; width: var(--pw); height: var(--ph); max-width: none; object-fit: contain; }
.pa.double .planche .page:first-child::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 5%; background: linear-gradient(270deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, 0)); pointer-events: none; }
.pa.double .planche .page + .page::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 5%; background: linear-gradient(90deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, 0)); pointer-events: none; }
/* La mesure jouée : un voile à peine visible, comme dans les vidéos (30/11/2026 : plus de trait
   dessous) ; il va d'une barre de mesure à l'autre, du haut de la première portée au bas de la
   dernière (calage.json, vérifié par outils/partition-animee/recaler_reperes.py --verifier). */
/* Les pages du lecteur portent la classe « page », comme la mise en page du site
   (editions.css : .page > * + * { margin-top: 28px }) : sans cette remise à zéro, le voile
   descendait de 28 px sous sa mesure (30/11/2026). */
.pa .page > * + * { margin-top: 0; }
.pa .repere { position: absolute; margin: 0; pointer-events: none; background: rgba(10, 10, 10, .045); border-radius: 1px; transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease; }
.pa.seule .repere { display: none; }

.pa .commandes { grid-area: cmd; width: 100%; max-width: 820px; margin: 0 auto; padding: 8px 20px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; }
.pa .lecture { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid rgba(246, 244, 238, .5); background: none; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 0; }
.pa .lecture svg { width: 16px; height: 16px; }
.pa .barre { flex: 1; min-width: 100px; height: 22px; display: flex; align-items: center; cursor: pointer; }
.pa .barre i { display: block; height: 1px; width: 100%; background: rgba(246, 244, 238, .25); position: relative; }
.pa .barre b { position: absolute; left: 0; top: -1px; height: 3px; background: var(--papier); width: 0; }
.pa .temps { font-size: 13px; opacity: .7; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.pa .credit { flex-basis: 100%; margin: 0; text-align: center; font-size: 12px; opacity: .6; }
.pa .credit[hidden] { display: none; }

/* Écran étroit : titre et croix sur une ligne, les choix dessous. */
@media (max-width: 719px) {
  .pa .tete { padding: 6px 8px 2px 14px; }
  .pa .ident { order: 1; flex-basis: 0; flex-grow: 1; }
  .pa .fermer { order: 2; }
  .pa .choix { order: 3; flex-basis: 100%; gap: 0 10px; }
  .pa .sources { padding-left: 10px; }
  .pa .modes button, .pa .sources button { padding: 6px 6px; font-size: 12.5px; }
  .pa .commandes { padding: 6px 14px calc(8px + env(safe-area-inset-bottom)); }
  .pa .ident .auteur { display: none; }
}
/* Téléphone en paysage : la hauteur manque, l'en-tête et les commandes passent sur le côté. */
@media (orientation: landscape) and (max-height: 560px) {
  .pa { grid-template-columns: minmax(0, 1fr) minmax(210px, 34%); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "scene tete" "scene cmd"; }
  .pa .tete { align-items: flex-start; padding: 8px 8px 0 4px; }
  .pa .ident { order: 1; flex: 1 1 0; flex-direction: column; gap: 0; }
  .pa .ident .titre { white-space: normal; }
  .pa .ident .auteur { display: block; }
  .pa .fermer { order: 2; }
  .pa .choix { order: 3; flex-basis: 100%; flex-direction: column; align-items: flex-start; gap: 0; }
  .pa .sources { padding-left: 0; border-left: 0; }
  .pa .modes button, .pa .sources button { padding: 4px 6px; min-height: 32px; font-size: 12.5px; }
  .pa .commandes { align-self: end; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)) 4px; gap: 4px 10px; }
  .pa .barre { flex-basis: 100%; order: 3; }
  .pa .temps { min-width: 0; }
  .pa .credit { order: 4; text-align: left; }
}

.pa .fin { position: absolute; inset: 0; z-index: 8; background: rgba(10, 10, 10, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; opacity: 0; visibility: hidden; transition: opacity 1.2s ease, visibility 0s 1.2s; }
.pa .fin.vue { opacity: 1; visibility: visible; transition: opacity 1.2s ease; }
.pa .fin p.grand { font-family: Petrona, serif; font-size: clamp(30px, 6vw, 56px); line-height: 1.15; margin: 0 0 12px; max-width: 16ch; }
.pa .fin p.petit { margin: 0 0 28px; opacity: .7; }
.pa .fin a { display: inline-block; background: var(--papier); color: var(--encre); text-decoration: none; font-weight: 600; padding: 15px 26px; border-radius: 2px; }
.pa .fin button { margin-top: 14px; background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; opacity: .7; cursor: pointer; padding: 10px; }
.pa :focus-visible { outline: 2px solid var(--papier); outline-offset: 3px; }
.pa .scene:focus-visible { outline: none; }

/* Animations réduites : rien ne bouge, le changement de page reste un fondu court. */
.pa.reduit .planche { transition-duration: .2s; }
.pa.reduit .repere { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .pa-bloc .pa-invite { animation: none; opacity: .7; }
  .pa, .pa .fin, .pa .fin.vue { transition-duration: .2s; }
  .pa .fin { transition: opacity .2s ease, visibility 0s .2s; }
}
