/* Bookedex — direction « Rayonnage de nuit ».
   Polices et icônes sont servies par l'application : aucune ressource externe.
   Les polices de lecture (Literata, EB Garamond, Source Serif, Atkinson) ne sont
   téléchargées par le navigateur que si on les choisit. */

@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/polices/cormorant-garamond-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/polices/cormorant-garamond-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/polices/cormorant-garamond-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url('/assets/polices/cormorant-garamond-500-italic.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/polices/dm-sans-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/polices/dm-sans-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/polices/dm-sans-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/polices/literata-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/polices/literata-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/polices/literata-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/polices/eb-garamond-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/polices/eb-garamond-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/polices/source-serif-4-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/polices/source-serif-4-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/polices/atkinson-hyperlegible-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/polices/atkinson-hyperlegible-400-italic.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --fond: #0E1512;
  --carte: #16211C;
  --carte-2: #1D2B25;
  --filet: #26352E;
  --filet-fort: #34483E;
  --encre: #EDE6D6;
  --discret: #9AA79E;
  --laiton-rgb: 201 161 90;
  --laiton: rgb(var(--laiton-rgb));
  --sur-laiton: #1A130A;
  --dock: #17231D;
  --danger: #D9826F;
  --h-idee: #E8CF62;
  --h-creuser: #8FBF80;
  --h-citation: #9DBDE6;
  --h-desaccord: #D9A0B4;

  --disp: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --lecture: 'Literata', Georgia, serif;

  --bas-dock: calc(98px + env(safe-area-inset-bottom));

  --duree-courte: 140ms;
  --duree: 220ms;
  --duree-longue: 380ms;
  --sortie: cubic-bezier(0.2, 0.8, 0.2, 1);
  --entree: cubic-bezier(0.4, 0, 1, 1);
  --ressort: cubic-bezier(0.34, 1.25, 0.64, 1);
}

/* Couleur d'accent : choisie dans les réglages, posée sur <html> par prefs.js avant le premier affichage. */
:root[data-accent="rubrication"] { --laiton-rgb: 214 98 70; --sur-laiton: #1D0A05; }
:root[data-accent="vert-de-gris"] { --laiton-rgb: 95 156 142; --sur-laiton: #07140F; }
:root[data-accent="prusse"] { --laiton-rgb: 124 150 204; --sur-laiton: #0A1224; }

* { box-sizing: border-box; }

html { background: var(--fond); overflow-x: clip; }

body {
  margin: 0; max-width: 100%; overflow-x: clip;
  background: var(--fond);
  color: var(--encre);
  font: 400 15px/1.5 var(--ui);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(var(--bas-dock) + 18px);
}
main.sans-dock { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

a { color: var(--laiton); }
img, svg { max-width: 100%; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--laiton); outline-offset: 3px; border-radius: 6px; }

.ph { display: block; flex: none; fill: currentColor; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- typographie */

h1, h2, h3 { font-weight: 500; }
.titre-serif { margin: 0; font-family: var(--disp); font-size: 38px; font-weight: 500; line-height: 1; letter-spacing: -0.01em; }
.titre-section { margin: 0; font-family: var(--disp); font-size: 26px; font-weight: 500; line-height: 1.1; }
.sur-titre { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--laiton); }
.calme { color: var(--discret); }
.italique { font-family: var(--disp); font-style: italic; }
.phrase { margin: 7px 0 0; font-family: var(--disp); font-style: italic; font-size: 16.5px; line-height: 1.25; color: var(--discret); }
.message { margin: 16px 0 0; min-height: 1.4em; font-size: 14px; color: var(--discret); }
.code { padding: 12px 14px; border-radius: 12px; background: var(--carte); font-size: 12.5px; overflow-x: auto; }

/* --------------------------------------------------------------- en-têtes */

.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 34px 0 22px; }
.entete-actions { display: flex; align-items: center; gap: 8px; }
.entete-bib { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 36px; }
.entete-bib > div:first-child { min-width: 0; }
.retour { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-left: -8px; padding: 0 8px; color: var(--laiton); text-decoration: none; font-size: 15px; }

/* ---------------------------------------------------------------- boutons */

.icone {
  width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: 22px;
  background: transparent; color: var(--encre); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.icone:hover { background: var(--carte); }
.icone.plein { width: 48px; height: 48px; border-radius: 24px; background: var(--carte); color: var(--laiton); }
.icone.plein:hover { background: var(--carte-2); }

.bouton-principal {
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 24px;
  background: var(--laiton); color: var(--sur-laiton); font: 600 15px var(--ui); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.bouton-principal.large { width: 100%; min-height: 56px; border-radius: 28px; font-size: 16px; }
.bouton-discret {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--filet-fort); border-radius: 22px;
  background: transparent; color: var(--encre); font: 500 14px var(--ui); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.bouton-discret:hover { background: var(--carte); }
.bouton-principal:disabled, .bouton-discret:disabled { opacity: 0.5; cursor: default; }

.puce {
  flex: none; min-height: 38px; padding: 0 15px; border: 1px solid transparent; border-radius: 19px;
  background: var(--carte); color: var(--encre); font: 500 13.5px var(--ui); white-space: nowrap; cursor: pointer;
}
.puce .compte { margin-left: 4px; color: var(--discret); font-weight: 400; }
.puce.est-actif { border-color: var(--laiton); background: rgb(var(--laiton-rgb) / 0.12); color: var(--laiton); }
.filtres { display: flex; gap: 8px; overflow-x: auto; margin: 16px -20px 0; padding: 0 20px; scrollbar-width: none; }
.filtres::-webkit-scrollbar { display: none; }

.segments { display: flex; gap: 3px; padding: 3px; border-radius: 16px; background: var(--carte); }
.segments > * {
  flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 13px; background: transparent; color: var(--encre); font: 500 14px var(--ui); cursor: pointer;
}
.segments > [aria-pressed="true"], .segments > [aria-current="true"] { background: var(--filet); color: var(--laiton); font-weight: 600; }

.interrupteur {
  flex: none; width: 52px; height: 32px; padding: 2px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--filet); display: flex; justify-content: flex-start;
}
.interrupteur span { width: 28px; height: 28px; border-radius: 14px; background: var(--encre); display: block; transition: transform var(--duree) var(--ressort); }
.interrupteur[aria-checked="true"] { background: var(--laiton); }
.interrupteur[aria-checked="true"] span { transform: translateX(20px); }

/* ------------------------------------------------------------- couvertures */

/* Teinte d'un livre sans couverture : une classe par cuir (voir Couverture::PALETTE). */
.cp0 { --c: #7A3B2E; }
.cp1 { --c: #2B4C7E; }
.cp2 { --c: #233140; }
.cp3 { --c: #3F4A3C; }
.cp4 { --c: #5A4631; }
.cp5 { --c: #4A4458; }
.cp6 { --c: #8C6D3F; }
.cp7 { --c: #1F3B3A; }
.cp8 { --c: #5C2F3A; }
.cp9 { --c: #2F4D6B; }
.cp10 { --c: #556B5A; }
.cp11 { --c: #6B4B35; }


.couv {
  position: relative; display: block; width: 100%; aspect-ratio: 2 / 3;
  border-radius: 3px 6px 6px 3px; background: var(--carte-2);
  box-shadow: 0 10px 18px -6px rgba(0, 0, 0, 0.7);
  container-type: inline-size;
}
.couv-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; transition: opacity var(--duree-longue) var(--sortie); }
.couv-img.attend { opacity: 0; }
/* le dos du livre : une ombre à gauche, un reflet à côté, comme sur un volume relié */
.couv-image::after, .couv-genere::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.07) 7%, rgba(255, 255, 255, 0) 16%, rgba(0, 0, 0, 0.2));
}
/* Les unités cqw se mesurent sur la boîte de contenu du conteneur : pas de padding sur .couv, l'espacement passe par les marges des enfants. */
.couv-genere {
  overflow: visible; background: linear-gradient(90deg, rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.06) 18%, rgba(0, 0, 0, 0.22)), var(--c);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #E6D3A2;
}
.couv-cadre { position: absolute; inset: 6.5cqw; border: 1px solid rgba(201, 161, 90, 0.7); pointer-events: none; }
.couv-titre {
  position: relative; margin: 0 13cqw; font-family: var(--disp); font-weight: 600; font-size: 13.4cqw; line-height: 1.05; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden;
}
.couv-orn { position: relative; width: 4.6cqw; height: 4.6cqw; margin: 6cqw 0; background: var(--laiton); transform: rotate(45deg); }
.couv-auteur { position: relative; margin: 0 11cqw; font-size: 7.4cqw; letter-spacing: 0.2em; text-transform: uppercase; color: var(--laiton); line-height: 1.25; }
@container (max-width: 70px) { .couv-titre, .couv-auteur, .couv-orn { display: none; } .couv-cadre { inset: 4px; } }

.couv-ruban {
  position: absolute; top: -3px; right: 9cqw; width: 9.5cqw; height: 25cqw; z-index: 2; background: var(--laiton);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
/* Les barres sont des <progress> : pas de style en ligne (la CSP l'interdit), et un vrai sens pour VoiceOver. */
progress { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--laiton); overflow: hidden; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--laiton); border-radius: inherit; transition: width var(--duree-longue) var(--sortie); }
progress::-moz-progress-bar { background: var(--laiton); border-radius: inherit; }
.couv-barre {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: max(3px, 3.4cqw); z-index: 1;
  background: rgba(0, 0, 0, 0.55); border-radius: 0 0 6px 3px;
}
.couv-lu {
  position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 10px; z-index: 2;
  background: var(--laiton); display: flex; align-items: center; justify-content: center;
}
.couv-lu::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--sur-laiton); border-width: 0 2px 2px 0; transform: rotate(45deg); }
@container (max-width: 70px) { .couv-ruban { display: none; } .couv-lu { display: none; } }

/* ------------------------------------------------------------- bibliothèque */

.vues { display: flex; padding: 3px; border-radius: 24px; background: var(--carte); }
.vues > * {
  width: 44px; height: 42px; padding: 0; border: 0; border-radius: 21px; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--discret); text-decoration: none;
}
.vues > [aria-pressed="true"] { background: var(--filet); color: var(--laiton); }

.jauge-fine { display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--filet); margin: 8px 0 6px; }

/* « Sur la table » : les lectures en cours, une carte chacune. La piste défile, chaque carte s'arrête bien en place,
   et la suivante dépasse un peu pour dire qu'il y en a d'autres. Pas d'inclinaison : la couverture se lit droite. */
.en-cours { margin-top: 26px; }
.en-cours-piste {
  display: flex; gap: 12px; margin: 0 -20px; padding: 4px 20px 22px; list-style: none;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 20px; overscroll-behavior-x: contain; scrollbar-width: none;
}
.en-cours-piste::-webkit-scrollbar { display: none; }
.en-cours-carte {
  position: relative; flex: none; width: min(86%, 340px); scroll-snap-align: start; display: flex; gap: 18px; align-items: stretch;
  padding: 20px 18px 20px 20px; border-radius: 24px; border: 1px solid var(--filet);
  background: linear-gradient(155deg, rgb(var(--laiton-rgb) / 0.10), rgb(var(--laiton-rgb) / 0) 55%), var(--carte);
}
.en-cours-piste.seule .en-cours-carte { width: 100%; }
.en-cours-couv { flex: none; width: 100px; align-self: flex-start; display: block; filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.5)); }
.en-cours-couv .couv { box-shadow: none; }
.en-cours-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.en-cours-fiche { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.en-cours-titre {
  margin: 6px 0 3px; font-family: var(--disp); font-weight: 500; font-size: 24px; line-height: 1.06;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.en-cours-auteur { font-size: 13.5px; color: var(--discret); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.en-cours-avance { margin-top: auto; padding-top: 14px; }
.en-cours-pct b { font-family: var(--disp); font-weight: 500; font-size: 30px; line-height: 1; }
.en-cours-detail { font-size: 12.5px; line-height: 1.4; color: var(--discret); }
.en-cours-texte .bouton-principal { margin-top: 14px; align-self: flex-start; min-height: 46px; padding: 0 22px 0 18px; }

.grille { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
@media (min-width: 520px) { .grille { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grille > a { display: block; color: inherit; text-decoration: none; border-radius: 6px; }
.grille > a:focus-visible { outline-offset: 4px; }

/* le vide : une phrase, pas un tableau de zéros */
.vide p { margin: 0 0 14px; }
.vide { margin: 34px 0; text-align: center; color: var(--discret); font-family: var(--disp); font-style: italic; font-size: 19px; line-height: 1.35; }
.grille > .vide, .etageres > .vide { grid-column: 1 / -1; }
.vide .ph { margin: 0 auto 10px; color: var(--filet-fort); width: 44px; height: 44px; }

/* ------------------------------------------------------------ vue en dos */

.tris { display: flex; gap: 8px; overflow-x: auto; margin: 16px -20px 0; padding: 0 20px; scrollbar-width: none; }
.tris::-webkit-scrollbar { display: none; }
.tris .puce { min-height: 36px; font-size: 13px; }

.etageres { position: relative; margin-top: 22px; padding-right: 30px; display: flex; flex-direction: column; gap: 16px; }
.etagere { display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 84px; }
.etagere-titre { font-family: var(--disp); font-style: italic; font-size: 17px; color: var(--discret); }
.etagere-rang { display: flex; align-items: flex-end; gap: 2px; height: 152px; padding: 0 2px; }
.etagere-planche {
  height: 8px; border-top: 1px solid rgb(var(--laiton-rgb) / 0.35); border-radius: 0 0 2px 2px;
  background: linear-gradient(#3A2A1B, #241A11); box-shadow: 0 10px 14px -6px rgba(0, 0, 0, 0.7);
}
.dos {
  position: relative; flex: none; padding: 0; margin: 0; border: 0; overflow: hidden; border-radius: 2px 2px 0 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.4), rgba(255, 255, 255, 0.07) 28%, rgba(0, 0, 0, 0.28)), var(--c);
  transition: transform var(--duree) var(--ressort), box-shadow var(--duree) ease;
}
.dos::before, .dos::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--bande, rgb(var(--laiton-rgb) / 0.8)); }
.dos::before { top: 11px; }
.dos::after { bottom: 11px; }
.dos-titre {
  writing-mode: vertical-rl; transform: rotate(180deg); max-height: calc(100% - 50px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--disp); font-weight: 600; font-size: 13px; line-height: 1; color: var(--encre-dos, #EADFC4);
}
.dos-ruban { position: absolute; top: 0; right: 3px; width: 8px; height: 24px; z-index: 2; background: var(--laiton); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.dos.en-cours, .dos.choisi { transform: translateY(-14px); box-shadow: 0 14px 14px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgb(var(--laiton-rgb) / 0.6); }
.dos.choisi { transform: translateY(-20px); box-shadow: 0 16px 16px -8px rgba(0, 0, 0, 0.75), 0 0 0 2px var(--laiton); }
.dos.lu { opacity: 0.78; }

.rail {
  position: fixed; right: 4px; top: 50%; z-index: 4; width: 24px; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 12px;
  background: rgba(14, 21, 18, 0.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); touch-action: none;
}
.rail { transition: opacity var(--duree) ease; }
.rail.en-retrait { opacity: 0; pointer-events: none; }
.rail span { width: 100%; padding: 2px 0; text-align: center; font: 500 10px/1 var(--ui); color: var(--discret); border-radius: 6px; cursor: pointer; }
.rail span.sans { opacity: 0.3; cursor: default; }
.rail span.courant { background: rgb(var(--laiton-rgb) / 0.18); color: var(--laiton); font-weight: 600; }

.apercu-livre {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 5;
  max-width: 528px; margin: 0 auto; height: 84px; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 14px;
  border-radius: 20px; background: #1B2923; border: 1px solid var(--filet); box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55);
  animation: surgit-bas var(--duree-longue) var(--ressort) both;
}
.apercu-livre .couv { width: 44px; flex: none; box-shadow: none; }
.apercu-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.apercu-texte b { font-family: var(--disp); font-weight: 600; font-size: 20px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apercu-texte span { margin-top: 2px; font-size: 12.5px; color: var(--discret); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apercu-livre .bouton-principal { min-height: 42px; padding: 0 16px 0 12px; font-size: 14px; }
@keyframes surgit-bas { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------- barre d'onglets */

.dock {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 10;
  width: min(calc(100% - 32px), 520px); height: 66px; transform: translateX(-50%);
  padding: 0 4px; border-radius: 33px; background: var(--dock); border: 1px solid var(--filet);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.55);
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: center;
}
.dock a {
  height: 54px; margin: 0 3px; border-radius: 27px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--discret); text-decoration: none; font: 500 10.5px var(--ui);
}
.dock a { position: relative; }
.dock a > .ph, .dock-nom { position: relative; }
.dock a.est-actif { color: var(--laiton); }
.dock-pastille { position: absolute; inset: 0; border-radius: 27px; background: rgb(var(--laiton-rgb) / 0.14); }

/* ----------------------------------------------------------------- fiche */

/* Le hero court sous l'encoche : la couverture, floue et assombrie, fait l'ambiance ; la vraie couverture se pose dessus, en grand.
   Le titre, lui, reste dessous, sur le fond uni. */
.fiche-hero { position: relative; height: 420px; margin: calc(-1 * max(20px, env(safe-area-inset-top))) -20px 0; overflow: hidden; }
.fiche-fond {
  position: absolute; inset: -30px; width: calc(100% + 60px); height: calc(100% + 60px); max-width: none; object-fit: cover;
  filter: blur(24px) saturate(1.3) brightness(0.46); transform: scale(1.25); /* on cadre un peu le milieu : les marges blanches d'un scan ne gâchent pas le fond */
}
.fiche-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(14, 21, 18, 0) 40%, var(--fond) 99%); }
.fiche-couv, .fiche-barre { z-index: 2; }
.fiche-halo { position: absolute; inset: 0; background: radial-gradient(62% 70% at 50% 64%, color-mix(in srgb, var(--c) 70%, transparent), transparent 74%); }
.fiche-fond + .fiche-halo { display: none; } /* une vraie couverture donne sa couleur : pas de halo de palette par-dessus */
.fiche-barre { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; z-index: 2; display: flex; justify-content: space-between; }
.fiche-barre .icone { background: rgba(22, 33, 28, 0.78); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.fiche-couv { position: absolute; left: 50%; bottom: 14px; width: 188px; transform: translateX(-50%); filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.7)); view-transition-name: couverture; }
.fiche-couv .couv { box-shadow: none; }
.fiche-corps { display: flex; flex-direction: column; gap: 22px; padding-top: 22px; }
.fiche-titre { text-align: center; }
.fiche-titre h1 { margin: 0; font-family: var(--disp); font-weight: 500; font-size: 38px; line-height: 1.02; letter-spacing: -0.01em; }
.fiche-titre p { margin: 6px 0 0; font-size: 15px; color: var(--discret); }

.statut { border-radius: 22px; background: var(--carte); padding: 18px 18px 16px; }
.statut-haut { display: flex; gap: 16px; align-items: center; }
.anneau { flex: none; }
.anneau text { font-family: var(--disp); font-weight: 500; }
.statut-texte { min-width: 0; }
.statut-texte p { margin: 0; }
.statut-chap { margin-top: 4px !important; font-size: 15px; font-weight: 500; }
.statut-titre { margin-top: 1px !important; font-family: var(--disp); font-style: italic; font-size: 17.5px; line-height: 1.2; color: var(--discret); }
.statut-reste { margin-top: 6px !important; font-size: 12.5px; line-height: 1.4; color: var(--discret); }
.carte-ouvrage { margin-top: 18px; }
.carte-ouvrage svg { display: block; overflow: visible; }
.carte-ouvrage .trait { fill: var(--filet-fort); }
.carte-ouvrage .trait.lu { fill: var(--laiton); opacity: 0.75; }
.carte-ouvrage .epingle { stroke: var(--laiton); stroke-width: 2; }
.carte-ouvrage .epingle-tete { fill: var(--laiton); stroke: var(--carte); stroke-width: 3; paint-order: stroke; }
.carte-ouvrage .h-idee { fill: var(--h-idee); }
.carte-ouvrage .h-a_creuser { fill: var(--h-creuser); }
.carte-ouvrage .h-citation { fill: var(--h-citation); }
.carte-ouvrage .h-desaccord { fill: var(--h-desaccord); }
.carte-ouvrage-bornes { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--discret); }
.statut-pied { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--filet); font-size: 12.5px; color: var(--discret); }

.passages { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.passages-tete { display: flex; align-items: baseline; justify-content: space-between; }
.passages-tete a { font-size: 13.5px; font-weight: 500; text-decoration: none; }
.passage { display: flex; gap: 12px; text-decoration: none; color: inherit; }
.passage .point { flex: none; width: 9px; height: 9px; margin-top: 9px; border-radius: 5px; }
.passage-texte { display: block; font-family: var(--disp); font-style: italic; font-size: 19.5px; line-height: 1.3; }
.passage-meta { display: block; margin-top: 5px; font-size: 12px; color: var(--discret); }
.passage-note { display: block; margin-top: 8px; padding: 8px 11px; border-radius: 10px; background: var(--carte-2); font-size: 13px; line-height: 1.45; }
.passage-note b { color: var(--laiton); font-weight: 600; }

.mots-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mot-chip { display: inline-flex; align-items: center; height: 36px; padding: 0 15px; border-radius: 18px; background: var(--carte); font-family: var(--disp); font-size: 18px; color: var(--encre); text-decoration: none; }
.mot-chip.petite { height: 34px; padding: 0 14px; font: 400 13.5px var(--ui); }

.fiche-detail { margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--filet); }
.fiche-detail .sur-titre { margin-bottom: 12px; }
.detail-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.detail-compact > div { min-width: 0; }
.detail-compact dt { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--discret); }
.detail-compact dd { margin: 2px 0 0; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.detail-compact .fichier { grid-column: 1 / -1; }

/* Reprendre reste à portée de pouce : fixe, comme la barre d'onglets, juste au-dessus d'elle. */
.fiche-cta { position: fixed; left: 0; right: 0; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 6; width: min(calc(100% - 32px), 520px); margin: 0 auto; }
.fiche-cta .bouton-principal { box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.75); }
.fiche-page { padding-bottom: calc(var(--bas-dock) + 84px); }
.liste-carte { border-radius: 18px; background: var(--carte); overflow: hidden; }
.liste-carte .rang { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--filet); font-size: 14px; }
.liste-carte .rang:last-child { border-bottom: 0; }
.liste-carte .rang dt { color: var(--discret); }
.liste-carte .rang dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.lien-discret { color: var(--discret); font-size: 13px; text-decoration: underline; }

.edition { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 22px; background: var(--carte); }
.edition label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
.edition input, .edition textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--filet-fort); border-radius: 12px; background: var(--fond); color: var(--encre); font: 400 16px var(--ui); }
.edition textarea { min-height: 110px; font-family: var(--disp); font-size: 18px; line-height: 1.4; resize: vertical; }
.edition-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* -------------------------------------------------------------- réglages */

.regl-tete { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 36px; }
.regl-tete .eyebrow { display: block; margin-bottom: 4px; }
.regl { display: flex; flex-direction: column; gap: 26px; margin-top: 22px; }
.regl h2 { margin: 0 0 10px; padding: 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); font-family: var(--ui); }
.apercu { border-radius: 22px; padding: 22px; border: 1px solid transparent; transition: background-color var(--duree-longue) ease, color var(--duree-longue) ease; }
.apercu .legende { margin: 0 0 10px; font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.65; }
.apercu p.echantillon { margin: 0; hyphens: auto; -webkit-hyphens: auto; transition: padding var(--duree) var(--sortie); }
.apercu mark { color: inherit; border-radius: 2px; padding: 1px 0; }
.themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.theme { display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 0; border: 0; background: transparent; color: var(--encre); font: 500 13px var(--ui); cursor: pointer; }
.theme[aria-pressed="true"] { color: var(--laiton); }
.theme-echantillon { height: 72px; border-radius: 16px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 10px 11px; border: 1px solid var(--filet); transition: border-color var(--duree) ease; }
.theme[aria-pressed="true"] .theme-echantillon { border: 2px solid var(--laiton); padding: 9px 10px; }
.theme-echantillon b { font: 500 20px/1 var(--lecture); }
.theme-echantillon i { display: block; width: 60%; height: 3px; border-radius: 2px; }
.carte-bloc { border-radius: 18px; background: var(--carte); overflow: hidden; }
.ligne-reglage { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--filet); }
.ligne-reglage:last-child { border-bottom: 0; }
.ligne-reglage > span { display: flex; flex-direction: column; }
.ligne-reglage small { font-size: 12.5px; color: var(--discret); }
.polices { border-radius: 18px; background: var(--carte); overflow: hidden; }
.police {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 54px; padding: 0 16px; border: 0;
  background: transparent; color: var(--encre); text-align: left; font-size: 21px; line-height: 1.2; cursor: pointer; transition: background-color var(--duree) ease;
}
.police .ph { color: var(--laiton); opacity: 0; transition: opacity var(--duree) ease; }
.police[aria-pressed="true"] { background: rgb(var(--laiton-rgb) / 0.10); }
.police[aria-pressed="true"] .ph { opacity: 1; }
.taille { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.taille button { flex: none; width: 48px; height: 44px; border: 0; border-radius: 13px; background: var(--filet); color: var(--encre); font-family: var(--lecture); cursor: pointer; }
.taille-piste { flex: 1; display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.taille-piste > progress { display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--filet); }
.taille-piste small { text-align: center; font-size: 12.5px; color: var(--discret); }
.pave-surlignages { padding: 16px; }
.surlignages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.surlignages span { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.surlignages i { width: 14px; height: 14px; border-radius: 7px; }


/* Thèmes de lecture : les mêmes valeurs que la liseuse (lire.css). */
.t-jour  { --p-bg: #F6F5F1; --p-ink: #1D1C1A; --p-quiet: #625F58; --p-line: #DAD6CD; --p-hl: #F3DF8C; }
.t-sepia { --p-bg: #F2E8D5; --p-ink: #3A2F22; --p-quiet: #6B5B45; --p-line: #DDD0B6; --p-hl: #EBCF7A; }
.t-nuit  { --p-bg: #141416; --p-ink: #D8D5CE; --p-quiet: #8F8C85; --p-line: #2C2C31; --p-hl: #6E5F24; }
.t-noir  { --p-bg: #000000; --p-ink: #C9C6C0; --p-quiet: #7D7A75; --p-line: #1E1E22; --p-hl: #6E5F24; }
.apercu, .theme-echantillon { background: var(--p-bg); color: var(--p-ink); }
.apercu { border-color: var(--p-line); }
.apercu .legende { color: var(--p-quiet); }
.apercu mark { background: var(--p-hl); }
.theme-echantillon i { background: var(--p-quiet); }

/* Les polices de lecture : chacune dans sa propre graphie. */
.f-literata { font-family: 'Literata', Georgia, serif; }
.f-garamond { font-family: 'EB Garamond', Georgia, serif; }
.f-source   { font-family: 'Source Serif 4', Georgia, serif; }
.f-atkinson { font-family: 'Atkinson Hyperlegible', system-ui, sans-serif; }
.police span { font-size: 21px; line-height: 1.2; }

.nuit-auto { margin-top: 12px; }
.mise-en-page { display: flex; flex-direction: column; gap: 10px; }
.taille .grand { font-size: 22px; }
.taille button { font-size: 15px; }
.legende-surlignages { margin: 14px 0 0; font-size: 12.5px; line-height: 1.45; }
.h-fond-idee { background: var(--h-idee); }
.h-fond-a_creuser { background: var(--h-creuser); }
.h-fond-citation { background: var(--h-citation); }
.h-fond-desaccord { background: var(--h-desaccord); }

.accents { display: flex; gap: 16px; padding: 4px; }
.accent { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 20px; cursor: pointer; transition: box-shadow var(--duree) var(--sortie); }
.accent[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--fond), 0 0 0 4px currentColor; }
.a-laiton { background: #C9A15A; color: #C9A15A; }
.a-rubrication { background: #D66246; color: #D66246; }
.a-vert-de-gris { background: #5F9C8E; color: #5F9C8E; }
.a-prusse { background: #7C96CC; color: #7C96CC; }

/* ------------------------------------------------------------ connexion */

.veille { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 16px; padding-bottom: 40px; }
.veille .titre-serif { font-size: 44px; }
.formulaire { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.separateur { margin: 2px 0; font-size: 13px; }
.champ { font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
input[type="password"], input[type="text"], input[type="search"] {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--filet-fort); border-radius: 12px;
  background: var(--carte); color: var(--encre); font: 400 16px var(--ui);
}

/* --------------------------------------------------------------- import */

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.progression { margin: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.jauge { display: block; width: 100%; height: 6px; border-radius: 3px; background: var(--filet); }
.journal { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.journal li { display: flex; gap: 10px; align-items: baseline; }
.journal .signe { flex: none; width: 1.2em; text-align: center; font-weight: 600; }
.journal .imported .signe { color: var(--h-creuser); }
.journal .added_format .signe { color: var(--laiton); }
.journal .duplicate .signe, .journal .skipped .signe { color: var(--discret); }
.journal .error .signe { color: var(--danger); }
.journal .quoi { color: var(--discret); }
.zone-depot {
  margin: 18px 0; padding: 28px 20px; border: 1.5px dashed var(--filet-fort); border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  transition: border-color var(--duree) ease, background-color var(--duree) ease; cursor: pointer;
}
.zone-depot.survol { border-color: var(--laiton); background: var(--carte); }
.zone-titre { margin: 0; font-family: var(--disp); font-size: 22px; }
.lien-fichier { color: var(--laiton); text-decoration: underline; cursor: pointer; }
.envois { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.envois li { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.envois .nom { display: flex; justify-content: space-between; gap: 12px; }
.envois .etat { color: var(--discret); font-size: 13px; flex: none; }
.envois .echec .etat { color: var(--danger); }

/* ----------------------------------------------- annotations et carnet */

.recherche { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--carte); color: var(--discret); margin-bottom: 14px; }
.recherche input { flex: 1 1 auto; min-width: 0; min-height: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--encre); font: 400 15px var(--ui); }
.filtre-livre { margin: 12px 0 18px; }
.filtre-livre select { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--filet-fort); border-radius: 12px; background: var(--carte); color: var(--encre); font: 400 15px var(--ui); }
.point { display: inline-block; width: 10px; height: 10px; border-radius: 5px; margin-right: 7px; vertical-align: -1px; }
.point[data-couleur="idee"] { background: var(--h-idee); }
.point[data-couleur="a_creuser"] { background: var(--h-creuser); }
.point[data-couleur="citation"] { background: var(--h-citation); }
.point[data-couleur="desaccord"] { background: var(--h-desaccord); }
.annotations { display: flex; flex-direction: column; gap: 12px; }
.annotation { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 18px; background: var(--carte); }
.annotation-tete { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--discret); }
.annotation-tete .point { margin: 0; }
.annotation blockquote { margin: 0; font-family: var(--disp); font-style: italic; font-size: 20px; line-height: 1.3; }
.annotation .note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--carte-2); font-size: 13.5px; line-height: 1.5; }
.annotation .note strong { color: var(--laiton); font-weight: 600; }
.annotation .source { font-size: 13px; font-weight: 500; text-decoration: none; }
.annotation .outils { display: flex; gap: 6px; margin-left: auto; }
.annotation .outils button { width: 40px; height: 40px; margin: -6px 0; border: 0; border-radius: 20px; background: transparent; color: var(--discret); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.annotation .outils button:hover { background: var(--carte-2); color: var(--encre); }
.annotation .mot-carnet { display: flex; align-items: baseline; gap: 10px; }
.annotation .mot-carnet strong { font-family: var(--disp); font-size: 26px; font-weight: 600; }

/* ====================================================================== mouvement
   Un seul langage : des durées courtes, une courbe qui démarre vite et se pose
   doucement. Le mouvement relie deux états, il ne décore pas. Tout s'éteint si
   l'iPhone demande de réduire les animations. */

@keyframes apparition { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fondu-entree { from { opacity: 0; } to { opacity: 1; } }
@keyframes fondu-sortie { from { opacity: 1; } to { opacity: 0; } }
@keyframes scintille { 0% { background-position: -160px 0; } 100% { background-position: calc(160px + 100%) 0; } }

a, button, label, summary, select, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.puce, .bouton-principal, .bouton-discret, .icone, .dock a, .vues > *, .segments > *, .annotation .outils button {
  transition: transform var(--duree-courte) var(--sortie), background-color var(--duree) ease, color var(--duree) ease,
              border-color var(--duree) ease, opacity var(--duree) ease;
}
.puce:active, .bouton-principal:active, .bouton-discret:active, .icone:active { transform: scale(0.96); }
.dock a:active { transform: scale(0.92); }
.grille > a .couv, .en-cours-couv { transition: transform var(--duree) var(--sortie), box-shadow var(--duree) ease; }
.grille > a:active .couv { transform: scale(0.96); }
@media (hover: hover) { .grille > a:hover .couv { transform: translateY(-3px); box-shadow: 0 16px 24px -8px rgba(0, 0, 0, 0.8); } }

.grille.anime > a, .annotations > .annotation { animation: apparition var(--duree-longue) var(--sortie) both; animation-delay: calc(var(--i, 0) * 30ms); }
.message:not(:empty) { animation: fondu-entree var(--duree) ease both; }
.squelette {
  aspect-ratio: 2 / 3; border-radius: 4px; background-color: var(--carte);
  background-image: linear-gradient(100deg, var(--carte) 30%, var(--carte-2) 50%, var(--carte) 70%);
  background-size: 160px 100%; background-repeat: no-repeat; animation: scintille 1.3s linear infinite;
}

@keyframes entre-droite  { from { opacity: 0; transform: translateX(38px); } to { opacity: 1; transform: none; } }
@keyframes entre-gauche  { from { opacity: 0; transform: translateX(-38px); } to { opacity: 1; transform: none; } }
@keyframes sort-gauche   { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-26px); } }
@keyframes sort-droite   { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(26px); } }
@keyframes monte         { from { opacity: 0; transform: translateY(46px) scale(0.975); } to { opacity: 1; transform: none; } }
@keyframes s-efface      { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.985); } }
@keyframes descend       { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(46px) scale(0.975); } }
@keyframes revient       { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  /* Le contenu voyage ; la barre d'onglets reste en place et sa pastille glisse d'un onglet à l'autre. */
  main { view-transition-name: page; }
  .dock { view-transition-name: dock; }
  .dock-pastille { view-transition-name: pastille; }

  ::view-transition-old(root) { animation: var(--duree-courte) var(--entree) both fondu-sortie; }
  ::view-transition-new(root) { animation: var(--duree) var(--sortie) both fondu-entree; }

  ::view-transition-group(page) { animation: none; }
  ::view-transition-old(page) { animation: 200ms var(--entree) both fondu-sortie; }
  ::view-transition-new(page) { animation: 420ms var(--sortie) both fondu-entree; }

  html[data-vt="avant"]   ::view-transition-old(page) { animation: 240ms var(--entree) both sort-gauche; }
  html[data-vt="avant"]   ::view-transition-new(page) { animation: 460ms var(--sortie) both entre-droite; }
  html[data-vt="arriere"] ::view-transition-old(page) { animation: 240ms var(--entree) both sort-droite; }
  html[data-vt="arriere"] ::view-transition-new(page) { animation: 460ms var(--sortie) both entre-gauche; }
  html[data-vt="ouvrir"]  ::view-transition-old(page) { animation: 260ms var(--entree) both s-efface; }
  html[data-vt="ouvrir"]  ::view-transition-new(page) { animation: 520ms var(--sortie) both monte; }
  html[data-vt="fermer"]  ::view-transition-old(page) { animation: 260ms var(--entree) both descend; }
  html[data-vt="fermer"]  ::view-transition-new(page) { animation: 460ms var(--sortie) both revient; }

  ::view-transition-group(pastille) { animation-duration: 460ms; animation-timing-function: var(--ressort); }
  ::view-transition-group(couverture) { animation-duration: 520ms; animation-timing-function: var(--sortie); }
  ::view-transition-old(couverture), ::view-transition-new(couverture) { height: 100%; object-fit: cover; animation-duration: 520ms; }

  /* Entrées à l'intérieur d'une page : le contenu se pose, les uns après les autres. */
  @keyframes pose-couverture { from { opacity: 0; transform: translateY(16px) scale(0.93); } to { opacity: 1; transform: none; } }
  @keyframes respire { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: none; } }
  @keyframes glisse-bas { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
  /* Les éléments centrés par transform (barre d'onglets, couverture de la fiche) s'animent par « translate », qui s'y ajoute sans l'écraser. */
  @keyframes glisse-bas-centre { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }

  .en-cours-couv { animation: pose-couverture 700ms var(--ressort) 80ms both; }
  .fiche-halo { animation: respire 900ms var(--sortie) both; }
  .en-cours-fiche > * { animation: glisse-bas 520ms var(--sortie) both; }
  .en-cours-fiche > :nth-child(2) { animation-delay: 60ms; }
  .en-cours-fiche > :nth-child(3) { animation-delay: 110ms; }
  .en-cours-texte > .bouton-principal { animation: glisse-bas 520ms var(--sortie) 260ms both; }
  .en-cours-carte { animation: glisse-bas 520ms var(--sortie) both; }
  .en-cours-carte:nth-child(2) { animation-delay: 120ms; }
  .en-cours-carte:nth-child(n+3) { animation-delay: 200ms; }

  .fiche-couv { animation: glisse-bas-centre 640ms var(--ressort) 60ms both; }
  .fiche-titre { animation: glisse-bas 520ms var(--sortie) 160ms both; }
  #lecture-seule > * { animation: glisse-bas 560ms var(--sortie) both; }
  #lecture-seule > :nth-child(1) { animation-delay: 220ms; }
  #lecture-seule > :nth-child(2) { animation-delay: 290ms; }
  #lecture-seule > :nth-child(3) { animation-delay: 360ms; }
  #lecture-seule > :nth-child(4) { animation-delay: 430ms; }
  #lecture-seule > :nth-child(5) { animation-delay: 500ms; }
  #lecture-seule > :nth-child(n+6) { animation-delay: 560ms; }
  .carte-ouvrage .trait { animation: fondu-entree 600ms ease both; }
  .carte-ouvrage .epingle, .carte-ouvrage .epingle-tete { animation: fondu-entree 500ms ease 700ms both; }

  .regl > section { animation: glisse-bas 520ms var(--sortie) both; }
  .regl > section:nth-child(1) { animation-delay: 40ms; }
  .regl > section:nth-child(2) { animation-delay: 100ms; }
  .regl > section:nth-child(3) { animation-delay: 160ms; }
  .regl > section:nth-child(4) { animation-delay: 220ms; }
  .regl > section:nth-child(n+5) { animation-delay: 280ms; }

  .entete-bib, .entete, .regl-tete { animation: glisse-bas 480ms var(--sortie) both; }
  .dock { animation: glisse-bas-centre 560ms var(--ressort) 120ms both; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .squelette { animation: none; }
}

.liste-carte .rang.echec { color: var(--danger); }
.liste-carte .rang { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }


/* ------------------------------------------------- recherche et filtres */

/* La barre reste collée sous l'encoche : on cherche d'où qu'on soit dans les 1 300 livres. */
.recherche {
  position: sticky; top: 0; z-index: 7; margin: 14px -20px 0; padding: 8px 20px 8px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: linear-gradient(rgba(14, 21, 18, 0.97) 78%, rgba(14, 21, 18, 0));
}
.recherche-barre { display: flex; gap: 8px; }
.champ-recherche {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 6px 0 14px; border-radius: 24px; background: var(--carte); border: 1px solid transparent;
  color: var(--discret);
}
.champ-recherche:focus-within { border-color: var(--laiton); color: var(--laiton); }
.champ-recherche input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--encre);
  font: 400 16px var(--ui); outline: none; -webkit-appearance: none; appearance: none;
}
.champ-recherche input::placeholder { color: var(--discret); }
.champ-recherche input::-webkit-search-cancel-button { display: none; }
.champ-effacer { width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 18px; background: transparent; color: var(--discret); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bouton-filtres {
  position: relative; width: 48px; height: 48px; flex: none; padding: 0; border: 1px solid transparent; border-radius: 24px;
  background: var(--carte); color: var(--encre); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform var(--duree-courte) var(--sortie), background-color var(--duree) ease;
}
.bouton-filtres:active { transform: scale(0.94); }
.bouton-filtres.est-actif { border-color: var(--laiton); color: var(--laiton); background: rgb(var(--laiton-rgb) / 0.12); }
.bouton-filtres-nb {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--laiton); color: var(--sur-laiton); font: 700 11.5px/20px var(--ui); text-align: center;
}

.suggestions {
  position: absolute; left: 20px; right: 76px; top: calc(100% - 4px); z-index: 8; overflow: hidden;
  border-radius: 16px; background: #1B2923; border: 1px solid var(--filet); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.55);
  animation: surgit-bas var(--duree) var(--sortie) both;
}
.suggestion { width: 100%; min-height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--encre); font: 500 14.5px var(--ui); text-align: left; cursor: pointer; }
.suggestion + .suggestion { border-top: 1px solid var(--filet); }
.suggestion:active { background: var(--carte-2); }
.suggestion-genre { flex: none; width: 52px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--laiton); }
.suggestion-nom { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-n { flex: none; font-size: 12.5px; color: var(--discret); }

.pilules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pilule {
  max-width: 100%; min-height: 32px; padding: 0 8px 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--laiton); border-radius: 16px; background: rgb(var(--laiton-rgb) / 0.12); color: var(--laiton);
  font: 500 13px var(--ui); cursor: pointer;
}
.pilule span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compteur { margin: 12px 0 0; min-height: 1.3em; font-size: 12.5px; letter-spacing: 0.02em; color: var(--discret); }

/* 1 300 couvertures : le navigateur ne peint que celles qui approchent de l'écran. */
.grille > a { content-visibility: auto; contain-intrinsic-size: auto 150px; }
.grille.avec-rail { padding-right: 16px; }
.grille-lettre {
  grid-column: 1 / -1; margin: 10px 0 -4px; font-family: var(--disp); font-style: italic; font-weight: 500; font-size: 22px; line-height: 1;
  color: var(--laiton); scroll-margin-top: 84px;
}
.grille-lettre:first-child { margin-top: 0; }

/* La feuille : un volet qui monte du bas, comme les feuilles d'iOS. */
html.feuille-ouverte { overflow: hidden; }
.feuille {
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; height: auto; max-height: 88vh; max-height: 88dvh; margin: 0 auto; padding: 0;
  border: 1px solid var(--filet); border-bottom: 0; border-radius: 24px 24px 0 0; background: #121B17; color: var(--encre);
  flex-direction: column; overflow: hidden;
}
.feuille[open] { display: flex; animation: feuille-monte 320ms var(--sortie) both; }
.feuille::backdrop { background: rgba(4, 8, 6, 0.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fondu-entree 240ms ease both; }
@keyframes feuille-monte { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.feuille-poignee { flex: none; width: 38px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--filet-fort); }
.feuille:focus { outline: none; }
.feuille-tete { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 20px; }
.feuille-tete h2 { flex: 1; margin: 0; font-family: var(--disp); font-size: 28px; font-weight: 500; }
.lien-bouton { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--laiton); font: 500 14px var(--ui); cursor: pointer; }
.feuille-corps { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 18px; }
.feuille-pied { flex: none; padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--filet); background: #121B17; }
.f-section { padding: 14px 0 6px; }
.f-section + .f-section { border-top: 1px solid var(--filet); }
.f-titre { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
.f-puces { display: flex; flex-wrap: wrap; gap: 8px; }
.f-puces.defilant { max-height: 232px; overflow-y: auto; overscroll-behavior: contain; padding: 2px 0; }
.f-puce { min-height: 38px; padding: 0 14px; }
.f-puce[aria-pressed="true"] { border-color: var(--laiton); background: rgb(var(--laiton-rgb) / 0.14); color: var(--laiton); }
.f-puce .compte { margin-left: 6px; }
.f-champ { width: 100%; height: 42px; margin-top: 10px; padding: 0 14px; border: 1px solid var(--filet-fort); border-radius: 21px; background: var(--carte); color: var(--encre); font: 400 16px var(--ui); outline: none; }
.f-champ:focus { border-color: var(--laiton); }
.f-tout { margin-top: 2px; padding-left: 0; }
.f-rien, .f-note { margin: 8px 0 0; font-size: 13px; color: var(--discret); }
.f-ordres > button[aria-pressed="true"] { background: rgb(var(--laiton-rgb) / 0.16); color: var(--laiton); }
