/* Lecteur PDF des ouvrages Spartacus-IDH — même allure que les compléments
   numériques (webApps/052, 060) : bandeau bordeaux, pastilles, fond papier. */

@font-face { font-family: "Manrope"; src: url(polices/manrope-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(polices/manrope-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(polices/manrope-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
    --bordeaux: #973c3e;
    --bordeaux-fonce: #7a2f31;
    --rose: #fbeeee;
    --papier: #f7f3ec;
    --carte: #ffffff;
    --texte: #232323;
    --discret: #6b6560;
    --trait: #e3dcd1;
    --fond-doux: #f1ece3;
    --ombre: 0 1px 2px rgba(60, 40, 30, .06), 0 4px 16px rgba(60, 40, 30, .07);
    --rayon: 12px;
    /* pdf_viewer.css déclare « light dark » : en mode sombre, les <dialog> et
       les champs prendraient le fond du système sous un texte sombre. */
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
    margin: 0; display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
    background: var(--papier); color: var(--texte);
    font: 16px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--bordeaux); }
:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }

/* ---------- Bandeau ---------- */
.bandeau {
    position: relative; z-index: 20;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    background: var(--bordeaux); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.bandeau-papier {
    justify-self: start; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap;
    padding: 7px 12px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 999px;
}
.bandeau-papier:hover { background: rgba(255, 255, 255, .12); }
.bandeau-titre { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; min-width: 0; }
.bandeau-livre { font-weight: 800; font-size: 18px; margin: 0; }
.bandeau-auteur { font-size: 13px; opacity: .85; }
.bandeau-nav { justify-self: end; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .16); }
.bandeau-nav a, .bandeau-nav button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: none; cursor: pointer;
    padding: 7px 14px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.bandeau-nav a:hover, .bandeau-nav button:hover { background: rgba(255, 255, 255, .14); }
.bandeau-nav .actif { background: #fff; color: var(--bordeaux); }
.bandeau-nav .actif:hover { background: #fff; }
svg.icone { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Barre d'outils ---------- */
.barre {
    position: relative; z-index: 10;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px;
    padding: 8px 16px; background: var(--carte); border-bottom: 1px solid var(--trait);
}
.groupe { display: inline-flex; align-items: center; gap: 6px; }
.rond {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--trait); background: var(--carte);
    display: grid; place-items: center; cursor: pointer; color: var(--bordeaux); padding: 0;
}
.rond:hover:not(:disabled) { background: var(--rose); border-color: var(--bordeaux); }
.rond:disabled { opacity: .35; cursor: default; }
.champ {
    border: 1.5px solid var(--trait); border-radius: 999px; background: #fff; padding: 6px 12px; font-size: 14px;
}
.champ:focus { outline: none; border-color: var(--bordeaux); }
#numeroPage { width: 4.2em; text-align: center; padding: 6px 4px; }
.discret { color: var(--discret); font-size: 14px; white-space: nowrap; }
select.champ { padding-right: 28px; cursor: pointer; }

/* Recherche */
.recherche { flex-basis: 100%; display: flex; justify-content: center; align-items: center; gap: 6px; }
.recherche input { width: min(420px, 60vw); }

/* ---------- Pages ---------- */
.lecteur { position: relative; flex: 1; min-height: 0; }
#conteneur { position: absolute; inset: 0; overflow: auto; background: var(--fond-doux); }
#conteneur .pdfViewer { padding: 14px 0 24px; }
#conteneur .pdfViewer .page {
    border: 0; margin: 0 auto 14px; box-shadow: var(--ombre); border-radius: 2px;
    /* pdf_viewer.css pose une bordure par image : on la remplace par l'ombre. */
    border-image: none;
}
.message { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--discret); }
.message .carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 22px 26px; max-width: 520px; }

/* ---------- Sommaire ---------- */
dialog.fenetre {
    border: 0; border-radius: var(--rayon); box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    padding: 0; width: min(560px, 92vw); max-height: 80dvh; color: var(--texte); background: var(--carte);
}
dialog.fenetre::backdrop { background: rgba(35, 25, 20, .45); }
.fenetre-tete { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--carte); border-bottom: 1px solid var(--trait); }
.fenetre-tete h2 { margin: 0; font-size: 18px; font-weight: 800; }
.fermer { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--discret); }
.sommaire { list-style: none; margin: 0; padding: 8px 10px 14px; }
.sommaire ul { list-style: none; margin: 0; padding-left: 16px; }
.sommaire a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--texte); text-decoration: none; }
.sommaire a:hover { background: var(--rose); color: var(--bordeaux); }

/* ---------- Pied ---------- */
.pied { text-align: center; font-size: 12px; color: var(--discret); padding: 6px 16px; border-top: 1px solid var(--trait); background: var(--papier); }

/* ---------- Petits écrans ---------- */
@media (max-width: 860px) {
    .bandeau { grid-template-columns: auto 1fr auto; }
    .bandeau-livre { font-size: 15px; }
    .bandeau-auteur { display: none; }
    .bandeau-nav .libelle { display: none; }
    .bandeau-nav a, .bandeau-nav button { padding: 7px 9px; }
}
@media (max-width: 560px) {
    .bandeau-papier .libelle { display: none; }
    .barre { gap: 6px 10px; padding: 6px 8px; }
    #zoomChoix { display: none; }
    .pied { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
