/* lecteur2.css · lecteur à feuilleter, version 2 (pages dessinées depuis le PDF par pdf.js). Charger après jetons.css.
   Netteté au repos : aucune perspective, aucune rotation, aucun calque forcé sur la double page ; les canevas mesurent
   exactement leur taille en pixels physiques (lecteur2.js pose --W, --H, left et top). Le contexte 3D (.l2-tourne) existe
   le temps du tour. Survol : contour ; mouvement réduit : fondu simple. */
.lecteur2 { --page: #FFFFFF; --lect-bg: #E2DED3; --lect-fg: #0B0F13; --lect-doux: #3E434A; --lect-trait: rgba(11, 15, 19, 0.5); --lect-panneau: #F7F7F5; --fond-lect: #64104E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lecteur2 { --lect-bg: #12171C; --lect-fg: #F2F1EE; --lect-doux: rgba(242, 241, 238, 0.76); --lect-trait: rgba(242, 241, 238, 0.5); --lect-panneau: #1F252D; } }
:root[data-theme="dark"] .lecteur2 { --lect-bg: #12171C; --lect-fg: #F2F1EE; --lect-doux: rgba(242, 241, 238, 0.76); --lect-trait: rgba(242, 241, 238, 0.5); --lect-panneau: #1F252D; }
html:has(dialog.lecteur2[open]) { overflow: hidden; }
.lecteur2 { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden;
  background: var(--lect-bg); color: var(--lect-fg); font-family: var(--font-body, system-ui, sans-serif); overscroll-behavior: contain; }
.lecteur2::backdrop { background: rgba(7, 9, 12, 0.6); }
.lecteur2[open] { display: block; }
.lecteur2 :focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.lecteur2 h2, .lecteur2 h3, .lecteur2 p, .lecteur2 ol { margin: 0; }
.lecteur2 ol { padding: 0; list-style: none; }
.lecteur2 button { font: inherit; color: inherit; background: none; border: 0; }
.l2-cadre { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "tete langues liens fermer" "scene scene scene scene" "vignettes vignettes vignettes vignettes" "pied pied pied pied";
  grid-template-rows: auto minmax(0, 1fr) auto auto; column-gap: 1.25rem; height: 100%;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.l2-tete { grid-area: tete; min-width: 0; padding-block: 0.3rem 0.5rem; }
.l2-sur { font-size: var(--t-xs, 0.8125rem); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lect-doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l2-tete h2 { font: 600 clamp(1.05rem, 0.9rem + 0.6vw, 1.35rem)/1.25 var(--font-display, inherit); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#l2-fermer { grid-area: fermer; align-self: center; }
.l2-liens { grid-area: liens; display: flex; gap: 0.5rem 1.1rem; align-items: center; justify-content: flex-end; }
.l2-lien { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: var(--t-sm, 0.9375rem); font-weight: 600; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 1.5px; color: var(--lect-fg); white-space: nowrap; }
.l2-lien[hidden] { display: none; }
.l2-rond { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1.5px solid var(--lect-trait); color: var(--lect-fg); cursor: pointer; flex: none; }
.l2-rond:hover, .l2-rond[aria-expanded="true"] { border-color: var(--lect-fg); }
.l2-rond[aria-expanded="true"] { background: var(--lect-fg); color: var(--lect-bg); }
.l2-rond[aria-disabled="true"] { opacity: 0.35; cursor: default; }
.l2-rond[hidden] { display: none; }
.l2-rond svg { width: 1.2rem; height: 1.2rem; }
.l2-langues { grid-area: langues; display: inline-flex; align-self: center; border: 1.5px solid var(--lect-trait); border-radius: 999px; padding: 2px; }
.l2-langues button { min-width: 2.75rem; min-height: 2.5rem; padding: 0 0.8rem; border-radius: 999px; font: 600 var(--t-xs, 0.8125rem)/1 var(--font-body, inherit); letter-spacing: 0.08em; cursor: pointer; }
.l2-langues button:hover { box-shadow: inset 0 0 0 1px var(--lect-fg); }
.l2-langues button[aria-pressed="true"] { background: var(--lect-fg); color: var(--lect-bg); }
.l2-langues button[hidden] { display: none; }

/* La scène : à plat. Le livre est posé par left et top, au pixel physique. */
.l2-scene { grid-area: scene; position: relative; min-height: 0; overflow: hidden; touch-action: pan-y pinch-zoom; }
.l2-scene.zoome { overflow: auto; touch-action: pan-x pan-y pinch-zoom; cursor: grab; }
.l2-scene.deplace { cursor: grabbing; user-select: none; }
.l2-plateau { position: relative; min-width: 100%; min-height: 100%; }
.l2-livre { position: absolute; width: calc(var(--W) * 2); height: var(--H); }
.l2-livre.simple { width: var(--W); }
.l2-face { position: absolute; top: 0; left: 0; width: var(--W); height: var(--H); background: var(--page); overflow: hidden; }
.l2-face.d { left: var(--W); }
.simple .l2-face.d { left: 0; }
.l2-face.vide { background: none; }
.l2-face.f-couleur, .l2-bf.f-couleur { background: var(--fond-lect); }
.l2-face.sortant { z-index: 2; opacity: 1; transition: opacity 200ms linear; pointer-events: none; }
.l2-face.sortant.parti { opacity: 0; }
.l2-toile { display: block; width: 100%; height: 100%; }
.l2-fenetre { position: absolute; }
.l2-texte, .l2-liens-pdf { position: absolute; inset: 0; }
.l2-liens-pdf { pointer-events: none; }
.l2-lien-pdf { position: absolute; pointer-events: auto; cursor: pointer; border-radius: 2px; padding: 0; }
.l2-lien-pdf:hover { box-shadow: inset 0 -2px 0 rgba(11, 15, 19, 0.55); }
.tourne .l2-texte, .tourne .l2-liens-pdf, .tourne .l2-spots { visibility: hidden; }
/* Couche de texte de pdf.js : texte transparent, placé sur les glyphes dessinés (sélection, recherche, lecteurs d'écran). */
.textLayer { text-align: initial; overflow: clip; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(200, 16, 90, 0.28); color: transparent; }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }
/* Tranches, reliure et prises : décor en 2D, hors des pages (les prises couvrent les marges extérieures). */
.l2-pile { position: absolute; top: 3px; bottom: 3px; background: repeating-linear-gradient(90deg, #E9E6DF 0 1px, #C9C4B9 1px 2px); pointer-events: none; }
.l2-pile.g { right: 100%; width: var(--pile-g, 0px); }
.l2-pile.d { left: 100%; width: var(--pile-d, 0px); }
.ferme-d .l2-pile.g, .ferme-g .l2-pile.d { display: none; }
.ferme-d .l2-pile.d { left: 100%; }
.ferme-g .l2-pile.g { right: 50%; }
.l2-reliure { position: absolute; top: 0; height: 100%; left: calc(var(--W) - 4%); width: 8%; pointer-events: none; z-index: 3;
  background: linear-gradient(90deg, rgba(48, 32, 22, 0), rgba(48, 32, 22, 0.05) 36%, rgba(48, 32, 22, 0.16) 50%, rgba(48, 32, 22, 0.05) 64%, rgba(48, 32, 22, 0)); }
.ferme-d .l2-reliure, .ferme-g .l2-reliure { display: none; }
.l2-prise { position: absolute; top: 0; height: 100%; width: max(7%, 22px); z-index: 4; cursor: grab; touch-action: none; }
.l2-prise.g { left: 0; } .l2-prise.d { right: 0; }
.simple .l2-prise { width: max(9%, 28px); }
.ferme-d .l2-prise.g, .ferme-g .l2-prise.d { display: none; }
.ferme-d .l2-prise.d { right: 0; } .ferme-g .l2-prise.g { left: 0; }
.saisi .l2-prise { cursor: grabbing; }
.zoome .l2-prise { display: none; }
/* Le tour : contexte 3D le temps du mouvement, textures tirées des canevas. */
.l2-tourne { position: absolute; inset: 0; z-index: 5; perspective: 2200px; perspective-origin: 50% 50%; pointer-events: none; }
.simple .l2-tourne { perspective-origin: 0 50%; }
.l2-feuille { position: absolute; top: 0; left: var(--W); width: var(--W); height: var(--H); transform-style: preserve-3d; transform: translateZ(1px); }
.simple .l2-feuille { left: 0; }
.l2-bande { position: absolute; top: 0; left: 0; height: 100%; transform-origin: 0 50%; transform-style: preserve-3d; }
.l2-bf { position: absolute; inset: 0; backface-visibility: hidden; background: var(--page); overflow: hidden; outline: 1px solid transparent; }
.l2-bf.verso { transform: rotateY(180deg); }
.l2-bf canvas { display: block; width: 100%; height: 100%; }
.l2-lum { position: absolute; inset: 0; pointer-events: none; }
.l2-voile { position: absolute; top: 0; width: var(--W); height: var(--H); opacity: 0; pointer-events: none; }
.l2-voile.g { left: 0; } .l2-voile.d { left: var(--W); }
.simple .l2-voile.g { display: none; } .simple .l2-voile.d { left: 0; }
.l2-attente { position: absolute; inset: auto 0 45% 0; text-align: center; font-size: var(--t-sm, 0.9375rem); color: var(--lect-doux); padding-inline: 1rem; }
.l2-attente[hidden] { display: none; }

/* Vidéo et animations posées sur la page */
.l2-spots { position: absolute; inset: 0; pointer-events: none; }
.l2-video { position: absolute; display: grid; place-items: center; pointer-events: auto; cursor: pointer; border-radius: 4px; padding: 0; background: rgba(11, 15, 19, 0.16); }
.l2-video span { display: grid; place-items: center; width: clamp(2.75rem, 22%, 4.5rem); aspect-ratio: 1; border-radius: 50%; background: #0B0F13; color: #F7F7F5; border: 2px solid #F7F7F5; }
.l2-video:hover span { background: var(--magenta, #C8105A); }
.l2-video svg { width: 45%; fill: currentColor; margin-left: 6%; }
.l2-video b { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.4rem 0.6rem; background: #0B0F13; color: #F7F7F5; font: 600 0.75rem/1.3 var(--font-body, sans-serif); text-align: left; border-radius: 0 0 4px 4px; }
.l2-anim { position: absolute; pointer-events: none; }
.l2-anim > svg, .l2-anim > canvas { display: block; width: 100%; height: 100%; }
.l2-anim .l2-a-fondu { opacity: 0; transition: opacity 600ms var(--ease-out, ease-out); }
.l2-anim .l2-a-trace { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 900ms var(--ease-out, ease-out); }
.l2-anim .l2-a-monte { transform: scaleY(0); transform-box: fill-box; transform-origin: 50% 100%; transition: transform 700ms var(--ease-out, ease-out); }
.l2-anim.joue .l2-a-fondu { opacity: 1; } .l2-anim.joue .l2-a-trace { stroke-dashoffset: 0; } .l2-anim.joue .l2-a-monte { transform: none; }
.l2-anim .l2-a-2 { transition-delay: 150ms; } .l2-anim .l2-a-3 { transition-delay: 300ms; } .l2-anim .l2-a-4 { transition-delay: 450ms; }
.l2-ecran { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; background: rgba(7, 9, 12, 0); transition: background-color 280ms linear; padding: 3.5rem 1rem 1rem; }
.l2-ecran.ouvert { background: rgba(7, 9, 12, 0.72); }
.l2-ecran-cadre { position: relative; width: min(100%, 1280px, calc((100dvh - 9rem) * 16 / 9)); aspect-ratio: 16 / 9; background: #000; transform-origin: 0 0; }
.l2-ecran-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.l2-ecran-fermer { position: absolute; top: 0.5rem; right: 1rem; background: #0B0F13 !important; color: #F7F7F5 !important; border-color: #F7F7F5; }

/* Chapitres, vignettes, pied */
.l2-plan { position: absolute; z-index: 10; left: max(16px, env(safe-area-inset-left, 0px)); bottom: 5.4rem; width: min(24rem, calc(100% - 32px)); max-height: min(70%, 34rem); overflow: auto;
  padding: 1rem 0.5rem 0.75rem; background: var(--lect-panneau); border: 1.5px solid var(--lect-fg); border-radius: 12px; }
.l2-plan[hidden] { display: none; }
.l2-plan h3 { padding: 0 0.75rem 0.5rem; font: 600 var(--t-xs, 0.8125rem)/1.3 var(--font-body, inherit); letter-spacing: 0.12em; text-transform: uppercase; color: var(--lect-doux); }
.l2-plan button { display: flex; gap: 1rem; justify-content: space-between; align-items: baseline; width: 100%; min-height: 2.75rem; padding: 0.45rem 0.75rem; border-radius: 8px; text-align: left; font-size: var(--t-sm, 0.9375rem); line-height: 1.35; cursor: pointer; }
.l2-plan li.sous button { padding-left: 1.75rem; color: var(--lect-doux); }
.l2-plan button:hover { box-shadow: inset 0 0 0 1.5px var(--lect-trait); }
.l2-plan button[aria-current="true"] { font-weight: 700; color: var(--lect-fg); box-shadow: inset 3px 0 0 var(--magenta, #C8105A); }
.l2-plan .num { font-variant-numeric: tabular-nums; color: var(--lect-doux); }
.l2-vignettes { grid-area: vignettes; overflow-x: auto; overflow-y: hidden; padding: 0.5rem 0 0.25rem; scrollbar-width: thin; }
.l2-vignettes[hidden] { display: none; }
.l2-vignettes ol { display: flex; gap: 6px; width: max-content; padding-inline: 2px; }
.l2-vig { position: relative; display: block; width: 56px; height: var(--vig-h, 79px); padding: 0; background: var(--page) !important; outline: 1px solid var(--lect-trait); cursor: pointer; overflow: hidden; }
.l2-vig canvas { display: block; width: 100%; height: 100%; }
.l2-vig span { position: absolute; right: 0; bottom: 0; min-width: 1.4rem; padding: 1px 4px; background: #0B0F13; color: #F7F7F5; font: 600 0.6875rem/1.3 var(--font-body, inherit); font-variant-numeric: tabular-nums; text-align: center; }
.l2-vig:hover { outline: 2px solid var(--lect-fg); }
.l2-vig[aria-current="true"] { outline: 3px solid var(--magenta, #C8105A); }
.l2-pied { grid-area: pied; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-areas: "og prec curseur suiv od"; gap: 0.75rem; align-items: center; padding-top: 0.4rem; max-width: 1080px; width: 100%; justify-self: center; }
.l2-outils { display: flex; gap: 0.4rem; align-items: center; }
.l2-outils.g { grid-area: og; } .l2-outils.d { grid-area: od; }
#l2-prec { grid-area: prec; } #l2-suiv { grid-area: suiv; }
.l2-zoom { min-width: 3.2rem; text-align: center; font-size: var(--t-xs, 0.8125rem); font-weight: 600; font-variant-numeric: tabular-nums; }
.l2-curseur { grid-area: curseur; display: grid; gap: 0.1rem; justify-items: center; min-width: 0; }
.l2-etat { min-height: 1.3em; font-size: var(--t-xs, 0.8125rem); font-weight: 600; font-variant-numeric: tabular-nums; }
.l2-chap { max-width: 100%; font-size: var(--t-xs, 0.8125rem); color: var(--lect-doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.l2-curseur input { -webkit-appearance: none; appearance: none; width: 100%; height: 2rem; margin: 0; background: none; cursor: pointer; }
.l2-curseur input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--lect-trait) 0 1px, transparent 1px 3px); }
.l2-curseur input::-moz-range-track { height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--lect-trait) 0 1px, transparent 1px 3px); }
.l2-curseur input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 26px; margin-top: -11px; border: 0; background: var(--magenta, #C8105A); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.l2-curseur input::-moz-range-thumb { width: 12px; height: 26px; border: 0; border-radius: 0; background: var(--magenta, #C8105A); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.l2-annonce { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 720px) {
  .l2-cadre { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "tete langues fermer" "scene scene scene" "vignettes vignettes vignettes" "pied pied pied" "liens liens liens"; grid-template-rows: auto minmax(0, 1fr) auto auto auto; column-gap: 0.6rem;
    padding-inline: max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); }
  .l2-liens { justify-content: center; }
  .l2-pied { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "prec curseur suiv" "og curseur2 od"; gap: 0.35rem 0.6rem; }
  .l2-outils.d { justify-content: flex-end; }
  .l2-plan { bottom: 9.5rem; left: 8px; }
}
@media (max-height: 520px) { .l2-sur { display: none; } .l2-tete h2 { font-size: 1rem; } }
@media (prefers-reduced-motion: reduce) { .lecteur2 * { scroll-behavior: auto !important; } .l2-anim * { transition: none !important; } .l2-ecran { transition: none; } }
