/* ============================================================
   LA BIBLIOTHÈQUE (vues/bibliotheque.js) — application ET site
   Les couleurs viennent de jetons.css ; --c = la couleur du logiciel.
   Pas d'« inset », de « color-mix » ni de « gap » en flex : les
   vieux Safari (iOS 12) ne les connaissent pas (voir pomme.css).
   ============================================================ */

/* ---------- l'en-tête et le statut Pro */
.bib-tete { display: grid; grid-template-columns: auto 1fr; grid-gap: 12px; align-items: center; margin: 2px 0 14px; }
.bib-tete h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.bib-tete p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--texte-2); }
.bib-robot { animation: r-entre 600ms var(--ressort) 200ms backwards; }

.bib-statut {
  display: grid; grid-gap: 6px; margin: 0 0 18px; padding: 14px 16px; border-radius: var(--r-l);
  background: var(--surface); border: 1.5px dashed var(--or);
  animation: entre-bas 520ms var(--ressort) 120ms backwards;
}
.bib-statut b { font-size: 15.5px; font-weight: 800; color: var(--or); }
.bib-statut span { font-size: 13px; line-height: 1.45; color: var(--texte-2); }
.bib-statut .btn { margin-top: 6px; }
.bib-statut.pro { border-style: solid; }

/* ---------- un livre */
.bib-liste { display: grid; grid-gap: 16px; }
.bib-livre {
  position: relative; padding: 14px; border-radius: var(--r-l);
  background: var(--surface); border: 1.5px solid var(--bord);
  border-top: 4px solid var(--c);
  animation: entre-bas 520ms var(--ressort) backwards;
}
.bib-livre:nth-child(2) { animation-delay: 60ms; }
.bib-livre:nth-child(3) { animation-delay: 120ms; }
.bib-livre:nth-child(n+4) { animation-delay: 180ms; }
.bib-livre.appelle { animation: bib-appelle 900ms var(--ressort); }
@keyframes bib-appelle { 0% { box-shadow: 0 0 0 0 var(--c); } 40% { box-shadow: 0 0 0 6px var(--c); } 100% { box-shadow: 0 0 0 0 transparent; } }

.bib-haut { display: grid; grid-template-columns: 92px 1fr; grid-gap: 14px; align-items: start; }
.bib-couv {
  position: relative; width: 92px; height: 130px; border-radius: 6px; overflow: hidden;
  background: #fff; box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .55), 0 0 0 1px var(--bord);
  transform: rotate(-2deg); transition: transform 300ms var(--ressort);
}
.bib-livre:hover .bib-couv { transform: rotate(0) translateY(-2px); }
.bib-couv img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
/* la couverture dessinée : visible tant que l'image n'est pas là (hors ligne, appli) */
.bib-couv-dessin {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 10px 8px; background: linear-gradient(160deg, #fff 55%, #f1f1f1); color: #111; text-align: left;
}
.bib-couv-dessin em { position: absolute; top: 10px; left: 8px; font-style: normal; font-size: 8px; font-weight: 800; letter-spacing: .2em; color: #333; }
.bib-couv-dessin b { font-size: 14px; line-height: 1.1; font-weight: 800; }
.bib-couv-dessin i { font-style: normal; font-size: 13px; font-weight: 800; color: var(--c); }
.bib-couv.chargee .bib-couv-dessin { visibility: hidden; }

.bib-tome { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.bib-infos h3 { margin: 2px 0 4px; font-size: 19px; font-weight: 800; }
.bib-sous { margin: 0 0 6px; font-size: 13px; line-height: 1.4; color: var(--texte-2); }
.bib-meta { margin: 0; font-size: 12px; line-height: 1.45; color: var(--texte-3); font-weight: 600; }

/* ---------- les trois téléchargements */
.bib-fichiers { display: grid; grid-gap: 8px; margin-top: 14px; }
.bib-fichier {
  display: grid; grid-template-columns: 30px 1fr auto; grid-gap: 10px; align-items: center; width: 100%;
  padding: 11px 12px; border-radius: var(--r-m); text-align: left; cursor: pointer;
  background: var(--fond-2); border: 1.5px solid var(--bord); color: var(--texte); font-family: inherit;
  transition: transform 180ms var(--ressort), border-color 180ms ease;
}
.bib-fichier:active { transform: scale(.98); }
@media (hover: hover) { .bib-fichier:hover { border-color: var(--c); } }
.bf-pict { font-size: 22px; line-height: 1; text-align: center; }
.bf-txt { display: grid; min-width: 0; }
.bf-txt b { font-size: 14px; font-weight: 700; }
.bf-txt em { font-style: normal; font-size: 11.5px; color: var(--texte-3); font-weight: 600; }
.bf-action {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 99px; display: flex; align-items: center; justify-content: center;
  background: var(--c); color: #fff; font-size: 16px; font-weight: 800;
}
.bib-fichier.verrou .bf-action { background: var(--surface-3); color: var(--texte-2); font-size: 14px; }
.bib-fichier.absent { opacity: .62; border-style: dashed; }
.bib-fichier.absent .bf-action { background: var(--surface-3); }
.bib-fichier.envoi .bf-action { animation: bib-tourne 900ms linear infinite; }
@keyframes bib-tourne { to { transform: rotate(360deg); } }
.bib-fichier.fait { border-color: var(--succes); }
.bib-fichier.fait .bf-action { background: var(--succes); }

.bib-message {
  margin-top: 10px; padding: 11px 13px; border-radius: var(--r-m); font-size: 13px; line-height: 1.5;
  background: var(--fond-2); border: 1px solid var(--bord); color: var(--texte-2);
  animation: entre-bas 320ms var(--ressort) backwards;
}
.bib-message[hidden] { display: none; }
.bib-message b { color: var(--texte); }
.bib-message.verrou { border: 1.5px dashed var(--or); }
.bib-message.ok { border-color: var(--succes); }
.bib-message .btn { margin-top: 10px; }

/* ---------- les fichiers niveau par niveau */
.bib-niveaux { margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 10px; }
.bib-niveaux summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--texte-2); list-style: none; padding: 4px 0; }
.bib-niveaux summary::-webkit-details-marker { display: none; }
.bib-niveaux summary em { font-style: normal; font-weight: 600; color: var(--texte-3); margin-left: 4px; }
.bib-niveaux summary::after { content: ' ▾'; color: var(--c); }
.bib-niveaux[open] summary::after { content: ' ▴'; }
.bib-niv-aide { margin: 4px 0 8px; font-size: 12.5px; line-height: 1.45; color: var(--texte-3); }
.bib-niv-liste { display: grid; grid-gap: 6px; }
.bib-fichier.bib-niv { padding: 8px 10px; grid-template-columns: 28px 1fr auto; }
.bib-niv .bn-n {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800; color: var(--c); border: 2px solid var(--c);
}
.bib-niv .bf-txt b { font-size: 13px; }
.bib-niv .bf-action { min-width: 28px; height: 28px; font-size: 13px; }
.bib-niv-rang { display: grid; grid-template-columns: minmax(0, 1fr) 92px; grid-gap: 6px; }
.bib-fichier.bib-fiche { padding: 8px 6px; grid-template-columns: minmax(0, 1fr); text-align: center; }
.bib-fiche .bf-txt b { font-size: 12.5px; white-space: nowrap; }
.bib-fiche .bf-txt em { font-size: 11px; }
.bib-fichier.appelle { animation: bib-appelle 1100ms var(--ressort) 2; }
/* le petit dossier à côté du titre de chaque niveau, sur le chemin */
.bib-niv-chemin {
  width: 30px; height: 30px; margin-right: 6px; border-radius: 50%; border: 1.5px solid var(--bord);
  background: var(--surface); font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
}
.bib-niv-chemin:active { transform: scale(.92); }

/* ---------- feuilleter */
.bib-apercu { margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 10px; }
.bib-apercu summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--texte-2); list-style: none; padding: 4px 0; }
.bib-apercu summary::-webkit-details-marker { display: none; }
.bib-apercu summary::after { content: ' ▾'; color: var(--c); }
.bib-apercu[open] summary::after { content: ' ▴'; }
.bib-pages { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 10px; margin: 10px 0 12px; }
.bib-pages img { width: 100%; height: auto; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px var(--bord), 0 8px 18px -12px rgba(0, 0, 0, .5); }
.bib-sommaire-titre { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-3); margin-bottom: 6px; }
.bib-chapitres { margin: 0; padding-left: 26px; font-size: 13.5px; line-height: 1.7; color: var(--texte-2); }
.bib-chapitres li::marker { color: var(--c); font-weight: 800; }
.bib-note { margin-top: 18px; }

/* ---------- la ligne sur le chemin d'un parcours */
.bib-ligne {
  display: grid; grid-template-columns: 34px 1fr auto; grid-gap: 12px; align-items: center; width: 100%;
  margin: -2px 0 10px; padding: 11px 14px; border-radius: var(--r-l); text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--bord); border-left: 4px solid var(--c);
  color: var(--texte); font-family: inherit; animation: entre-bas 420ms var(--doux) backwards;
}
.bib-ligne:active { transform: scale(.98); }
.bl-pict { font-size: 26px; line-height: 1; }
.bl-txt { display: grid; min-width: 0; }
.bl-txt b { font-size: 14.5px; font-weight: 800; }
.bl-txt em { font-style: normal; font-size: 12px; color: var(--texte-2); }
.bl-etat { font-size: 12px; font-weight: 800; color: var(--or); white-space: nowrap; }

/* ---------- la carte de l'accueil */
.bib-accueil {
  display: grid; grid-template-columns: auto 1fr auto; grid-gap: 14px; align-items: center; width: 100%;
  margin: 18px 0 4px; padding: 12px 14px; border-radius: var(--r-l); text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--bord); color: var(--texte); font-family: inherit;
  animation: entre-bas 520ms var(--ressort) 160ms backwards;
}
.bib-accueil:active { transform: scale(.98); }
.ba-couvs { position: relative; width: 74px; height: 50px; }
.ba-couvs img {
  position: absolute; top: 0; width: 36px; height: 50px; object-fit: cover; border-radius: 3px; background: #fff;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .6);
}
.ba-couvs img:nth-child(1) { left: 0; transform: rotate(-8deg); }
.ba-couvs img:nth-child(2) { left: 13px; transform: rotate(-3deg); }
.ba-couvs img:nth-child(3) { left: 26px; transform: rotate(3deg); }
.ba-couvs img:nth-child(4) { left: 38px; transform: rotate(8deg); }
.ba-txt { display: grid; min-width: 0; }
.ba-txt b { font-size: 15px; font-weight: 800; }
.ba-txt em { font-style: normal; font-size: 12px; color: var(--texte-2); }
.ba-go { font-size: 22px; font-weight: 800; color: var(--texte-3); }

/* ---------- grand écran : deux livres par ligne */
@media (min-width: 900px) {
  .vue-bibliotheque .bib-liste { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ---------- LE SITE (index.html, section #bibliotheque) */
.biblio-site { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 18px; max-width: 1000px; margin: 0 auto; }
@media (max-width: 860px) { .biblio-site { grid-template-columns: repeat(2, 1fr); } }
.bs-livre { display: block; text-align: center; color: inherit; text-decoration: none; }
.bs-couv {
  position: relative; display: block; width: 100%; padding-top: 141%; border-radius: 6px; overflow: hidden; background: #fff;
  box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform 300ms cubic-bezier(.2, 1.4, .4, 1);
}
.bs-couv img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.bs-livre:hover .bs-couv { transform: translateY(-4px) rotate(-1deg); }
.bs-cadenas {
  position: absolute; right: 8px; bottom: 8px; padding: 4px 8px; border-radius: 99px;
  background: rgba(0, 0, 0, .78); color: #fff; font-size: 11px; font-weight: 700;
}
.bs-nom { display: block; margin-top: 10px; font-weight: 800; font-size: 15px; }
.bs-meta { display: block; font-size: 12px; opacity: .7; }
.biblio-site-statut { text-align: center; margin: 22px auto 0; max-width: 640px; }
.biblio-site-statut .bouton { margin-top: 12px; }
