/* Sortir de la religion sans en fonder une autre ? : feuille de style de lecture */

:root {
  --fs: 18px;
  /* deux thèmes : sépia (par défaut sur un système clair) et sombre (par défaut sur un système sombre) */
  --bg: #f4ead5;
  --bg-soft: #eadcc0;
  --card: #fbf3e1;
  --ink: #3a2e1f;
  --ink-soft: #6d5c45;
  --accent: #8a3b12;
  --accent-soft: #f2dccb;
  --line: #d8c7a5;
  --shadow: 0 1px 2px rgba(40, 30, 10, .08), 0 4px 16px rgba(40, 30, 10, .06);
  --topbar: 90px; /* bandeau fixe : ligne de titre plus ligne d'onglets */
  --measure: 38rem;
  --serif: "Literata", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="sepia"]) {
    --bg: #15140f; --bg-soft: #1f1d17; --card: #1c1a15; --ink: #e9e3d6; --ink-soft: #a89f8e;
    --accent: #e39a62; --accent-soft: #3a2a1c; --line: #34302a; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15140f; --bg-soft: #1f1d17; --card: #1c1a15; --ink: #e9e3d6; --ink-soft: #a89f8e;
  --accent: #e39a62; --accent-soft: #3a2a1c; --line: #34302a; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--topbar) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: var(--fs); line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
em { font-style: italic; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--card); padding: 8px 12px; }

/* Barre de progression et barre supérieure */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

.topbar {
  position: sticky; top: 0; z-index: 50; min-height: var(--topbar);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 6px;
  padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); font-family: var(--sans);
}
.topbar-title {
  flex: 1; min-width: 0; color: var(--ink); text-decoration: none; font-size: .8rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px;
}
.topbar-actions { display: flex; }
.topbar > #menu-btn, .topbar > .icon-btn:first-child { order: 0; }
.topbar-title { order: 1; }
.topbar-actions { order: 2; }
/* Onglets entre les pages du site : seconde ligne du bandeau sur petit écran, en ligne sur grand écran */
.onglets {
  order: 3; flex-basis: 100%; display: flex; align-items: stretch; height: 38px; margin: 0 -6px;
  padding: 0 6px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line);
  /* défilement horizontal seulement : overflow-x seul rendrait aussi l'axe vertical défilable, et la marge
     négative des onglets dépasse d'un pixel ; le geste vertical revient à la page */
  overflow-y: hidden; overscroll-behavior-x: contain;
}
.onglets::-webkit-scrollbar { display: none; }
.onglet {
  flex: none; display: inline-flex; align-items: center; padding: 0 12px; margin-bottom: -1px;
  font: 600 13px var(--sans); color: var(--ink-soft); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0;
}
.onglet:hover, .onglet:focus-visible { color: var(--ink); background: var(--bg-soft); }
.onglet[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
/* Menu des langues : à droite des onglets, avant les boutons d'action */
.langues { order: 2; position: relative; display: flex; align-items: center; }
.langue-btn { font: 600 12px var(--sans); letter-spacing: .04em; min-width: 40px; }
.langues-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; min-width: 150px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.langues-menu[hidden] { display: none; }
.langue { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font: 14px var(--sans); }
.drapeau { width: 21px; height: 14px; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.langue-btn .drapeau { width: 24px; height: 16px; }
.langue:hover, .langue:focus-visible { background: var(--bg-soft); }
.langue[aria-current="true"] { color: var(--accent); font-weight: 600; }
.topbar-actions { order: 2; }
@media (min-width: 900px) {
  :root { --topbar: 52px; }
  .onglets { order: 1; flex-basis: auto; height: var(--topbar); margin: 0 8px 0 auto; padding: 0; border-top: 0; overflow: visible; }
  .onglet { margin-bottom: 0; border-radius: 0; }
  .topbar-title { flex: 0 1 auto; max-width: 34%; }
  .topbar-actions { order: 2; }
}
.icon-btn {
  min-width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink);
  border-radius: 10px; cursor: pointer; font: 600 15px var(--sans);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--bg-soft); }
.icon-btn sup { font-size: .65em; }

/* Tiroir du sommaire */
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 80; width: min(88vw, 360px);
  background: var(--card); border-right: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(-102%); transition: transform .25s ease;
  display: flex; flex-direction: column; font-family: var(--sans); font-size: 15px; line-height: 1.4;
  padding-top: env(safe-area-inset-top);
}
.drawer.open { transform: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .35); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 16px; }
#toc-filter {
  margin: 4px 12px 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: 16px var(--sans);
}
/* Menu « Actions » du sommaire : déplier, replier, marques de lecture, hors connexion */
.actions { position: relative; margin: 0 12px 8px; }
.actions > summary { display: inline-flex; align-items: center; gap: 6px; }
.actions > summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-top: -3px; }
.actions[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.actions-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; min-width: 260px; max-width: calc(100vw - 48px);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
  display: flex; flex-direction: column;
}
.actions-menu button {
  width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); border-radius: 8px;
  padding: 9px 10px; font: 14px var(--sans); cursor: pointer;
}
.actions-menu button:hover, .actions-menu button:focus-visible { background: var(--bg-soft); }
.actions-menu button:disabled { opacity: .6; cursor: progress; }
.actions-menu .offline-status { display: block; padding: 0 10px 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px;
  padding: 6px 12px; font: 13px var(--sans); cursor: pointer; min-height: 36px;
}
.toc { list-style: none; margin: 0; padding: 0 0 40px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.toc ul { list-style: none; margin: 0; padding: 0 0 6px; }
.toc a {
  display: block; padding: 9px 16px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent;
}
.toc-part > a { font-weight: 600; }
.toc ul a { padding: 7px 16px 7px 28px; color: var(--ink-soft); }
.toc small { color: var(--ink-soft); font-size: 12px; }
.toc a.active { border-left-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.toc ul a.lu::after { content: " ✓"; color: var(--accent); font-weight: 600; }
.toc-count { float: right; font: 600 11.5px var(--sans); color: var(--ink-soft); background: var(--bg-soft); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.toc-count:empty { display: none; }
.toc-count.complet { background: var(--accent); color: #fff; }
.offline-status { font-size: 12.5px; color: var(--ink-soft); }
.chip:disabled { opacity: .6; cursor: progress; }
.toc li.hidden { display: none; }

/* Accueil */
main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hero { max-width: var(--measure); margin: 0 auto; padding: 20px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 6.5vw, 2.6rem); line-height: 1.15; margin: 18px 0 8px; letter-spacing: -.01em; }
.subtitle { color: var(--ink-soft); font-style: italic; margin: 0 0 10px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0; }
.btn {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none;
  font: 600 15px var(--sans); cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

figure { margin: 1.4em 0; }
figure img { display: block; margin: 0 auto; border-radius: 10px; box-shadow: var(--shadow); background: var(--bg-soft); }
figure.cover img { max-height: 46vh; width: auto; }
figcaption { font: 13.5px/1.45 var(--sans); color: var(--ink-soft); margin-top: 8px; text-align: center; }
figcaption .credit { display: block; font-size: 11.5px; opacity: .8; margin-top: 2px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 8px 0 32px; }
.card {
  display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
}
.card img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; flex: none; }
.card-text { display: flex; flex-direction: column; min-width: 0; }
.card-label { font-weight: 600; }
.card-sub { font-size: .85em; color: var(--ink-soft); line-height: 1.35; }
.card-meta { font: 12px var(--sans); color: var(--ink-soft); margin-top: 4px; }

/* Texte */
.lecture { max-width: var(--measure); margin: 0 auto; }
.lecture p { margin: 0 0 1em; hyphens: auto; -webkit-hyphens: auto; text-align: justify; text-justify: inter-word; overflow-wrap: break-word; }
@media (max-width: 480px) { .lecture p { text-align: left; } }
blockquote { margin: 1.2em 0; padding: .4em 1em; border-left: 3px solid var(--accent); background: var(--bg-soft); border-radius: 0 10px 10px 0; }

/* Encadrés « En littérature » : repliés par défaut, ignorables, distincts du texte de fond. */
.lettres { margin: 1.3em 0; font-size: .94em; }
.lettres > details { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--bg-soft); }
.lettres > details > summary { padding: 9px 36px 9px 12px; position: relative; font: 600 14px/1.45 var(--sans); }
.lettres > details > summary::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: translateY(-70%) rotate(45deg); transition: transform .15s; }
.lettres > details[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
.lettres-label { color: var(--accent); text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; margin-right: 6px; white-space: nowrap; }
.lettres-titre { font-weight: 600; }
.lettres-corps { padding: 2px 14px 10px; border-top: 1px solid var(--line); }
.lettres-corps p { margin: .7em 0; }
.lettres-source { font: 12.5px/1.5 var(--sans); color: var(--ink-soft); }
.bib-oeuvres { list-style: none; padding: 0; margin: 0; }
.bib-oeuvres li { padding: 6px 0; border-top: 1px solid var(--line); }
.bib-oeuvres li:first-child { border-top: 0; }
/* Galerie : une vignette par œuvre, agrandie au survol */
.gal-oeuvres li { display: flex; align-items: center; gap: 12px; }
.gal-texte { display: flex; flex-direction: column; min-width: 0; }
.vignette { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; cursor: zoom-in; flex: none; background: var(--bg-soft); }
.bib-liens { font: 13px var(--sans); color: var(--ink-soft); }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.partie { border-top: 1px solid var(--line); }
.partie > summary {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 18px 40px 18px 0;
}
.partie > summary::after, .section > summary::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg);
  transition: transform .2s;
}
.partie[open] > summary::after, .section[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.part-label { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.part-sub { font-size: 1.35em; font-weight: 600; line-height: 1.25; }
.part-meta { font: 12.5px var(--sans); color: var(--ink-soft); }
.partie > summary { padding-right: 84px; }
.partie > summary .lien-btn { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); }
.lien-btn, .lu-btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.lien-btn:hover, .lien-btn:focus-visible, .lu-btn:hover, .lu-btn:focus-visible { background: var(--bg-soft); color: var(--accent); }
.sec-btns { display: flex; gap: 2px; }
.lu-btn[aria-pressed="true"] { color: var(--accent); }

/* Résumé d'ouverture */
.partie.resume { border-top: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 16px; margin-bottom: 24px; box-shadow: var(--shadow); }
.partie.resume > summary::after { right: 16px; }
.partie.resume > summary .lien-btn { right: 42px; }
.partie.resume .part-label { color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--bg); font: 600 14px var(--sans); padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); overflow-wrap: anywhere;
}
.part-body { padding-bottom: 24px; }
.part-image { margin: 4px 0 20px; }
.part-image img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: cover; border-radius: 14px; }
.part-image figcaption { font: 12.5px var(--sans); color: var(--ink-soft); margin-top: 6px; }
.lecture { padding-bottom: 80px; }
.part-end { text-align: right; font: 13px var(--sans); }

.section { margin: 18px 0; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.section > summary { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 40px 12px 12px; }
.section:not(.auteur) > summary { padding: 12px 40px 12px 16px; }
.sec-titles { display: flex; flex-direction: column; min-width: 0; }
.sec-nom { font-weight: 600; font-size: 1.08em; line-height: 1.25; }
.sec-dates { font: 12.5px var(--sans); color: var(--ink-soft); }
.sec-formule { font-style: italic; font-size: .9em; color: var(--ink-soft); line-height: 1.3; }
.sec-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.section.lu > summary .sec-side::before { content: "✓ lu"; font: 11px var(--sans); color: var(--accent); }
.sec-body { padding: 4px 16px 8px; }
.avatars { display: flex; flex: none; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: center 20%;
  border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); background: var(--bg-soft);
}
.avatars .avatar + .avatar { margin-left: -16px; }
img.avatar { cursor: zoom-in; }
.avatar-sm { width: 40px; height: 40px; flex: none; }
.avatar-init.avatar-sm { font-size: 14px; }

/* Fenêtre du portrait au survol de l'avatar */
.portrait-popup {
  position: fixed; z-index: 70; width: 320px; max-width: calc(100vw - 32px); margin: 0; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 32px rgba(0, 0, 0, .28);
  pointer-events: none; opacity: 0; transition: opacity .15s ease;
}
.portrait-popup.visible { opacity: 1; }
.portrait-popup.large { width: min(720px, calc(100vw - 32px)); }
/* Annexes : les œuvres de la Galerie qui illustrent l'article, et l'index des passages bibliques */
.annexe-oeuvres { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 6px; font: 13px var(--sans); color: var(--ink-soft); }
.annexe-oeuvre { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); text-decoration: none; max-width: 100%; }
.annexe-oeuvre:hover span { text-decoration: underline; }
.annexe-oeuvre .vignette { width: 56px; height: 42px; }
table.passages { font-size: .92em; }
table.passages td:first-child { white-space: nowrap; font-weight: 600; }
.portrait-popup img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 8px; background: var(--bg-soft); }
.portrait-popup figcaption { margin: 8px 4px 2px; font: 12.5px/1.4 var(--sans); color: var(--ink-soft); }
.avatar-init { display: inline-flex; align-items: center; justify-content: center; font: 600 20px var(--sans); color: var(--accent); background: var(--accent-soft); }
.portrait-credit { font: 11px var(--sans) !important; color: var(--ink-soft); text-align: left !important; opacity: .8; }

/* Tableaux : défilement horizontal, cartes sur mobile */
.table-wrap { overflow-x: auto; margin: 1.2em 0; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font: 14px/1.4 var(--sans); width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--bg-soft); }
@media (max-width: 720px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  table.cards td { border: 0; padding: 3px 0; }
  table.cards td::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
  table.cards td:first-child { font-weight: 600; font-size: 15px; }
}

.sources { font-size: .85em; }
.sources ul { padding-left: 1.1em; }
.sources li { margin: .3em 0; overflow-wrap: anywhere; }
.sources h3 { font-size: 1.1em; margin-top: 1.6em; }

.footer { text-align: center; font: 13px var(--sans); color: var(--ink-soft); padding: 32px 16px 80px; }

.to-top, .jump-nav button {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.to-top { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40; }
/* Position précédente et suivante, au-dessus du retour en haut */
.jump-nav { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px); z-index: 40; display: flex; gap: 8px; }
.jump-nav button:disabled { opacity: .35; cursor: default; }

/* Grand écran : sommaire fixe à gauche */
@media (min-width: 1100px) {
  :root { --measure: max(48rem, 80%); }
  .drawer { transform: none; top: var(--topbar); width: 300px; box-shadow: none; z-index: 30; padding-top: 0; }
  .drawer-head #close-drawer { display: none; }
  .drawer-backdrop { display: none !important; }
  #menu-btn { visibility: hidden; }
  body { padding-left: 300px; }
  main { padding: 0 32px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .drawer, .drawer-backdrop, .progress, .to-top, .jump-nav, .cards-grid, .hero-actions, .lien-btn, .lu-btn, .toast { display: none !important; }
  body { padding: 0; background: #fff; color: #000; font-size: 11pt; }
  details { display: block; }
  details > summary::after { display: none; }
  .section { border: 0; background: none; }
}

/* Liens du lexique et des annexes dans l'essai */
a.lex, a.ann { color: inherit; text-decoration: underline dotted var(--accent); text-underline-offset: 3px; }
a.lex:hover, a.ann:hover { color: var(--accent); }
/* Ligne « Pour comprendre » en tête d'une section ou d'une partie */
.annexes-ligne { font: 13px/1.5 var(--sans); color: var(--ink-soft); margin: 0 0 1em; text-align: left !important; hyphens: none !important; }
.annexes-ligne a { color: var(--accent); text-decoration: none; }
.annexes-ligne a:hover { text-decoration: underline; }

/* Pages outils : frise, réponses, lexique, annexes, bibliothèque */
.outil { max-width: var(--measure); margin: 0 auto; padding: 0 16px 24px; }
.outil [id] { scroll-margin-top: calc(var(--topbar) + 72px); } /* une ancre profonde reste sous la barre de filtres collante */
.outil h1 { font-size: clamp(1.5rem, 6vw, 2.1rem); margin: 16px 0 6px; }
.outil-intro { color: var(--ink-soft); font-size: .95em; }
.chip.actif, .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.outil-filtres { position: sticky; top: var(--topbar); z-index: 5; background: var(--bg); padding: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.outil-filtres input, .outil-filtres select {
  flex: 1 1 200px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: 16px var(--sans);
}
.outil-filtres .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.siecle > h2 { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 22px 0 6px; }
/* Page Les auteurs : une fiche par auteur, par siècle */
.f-dates { font: 13px var(--sans); color: var(--ink-soft); }
.fiche > summary { list-style: none; cursor: pointer; position: relative; padding-right: 28px; }
.fiche > summary::-webkit-details-marker { display: none; }
.fiche > summary::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); transition: transform .2s;
}
.fiche[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.fiche h2 { flex-wrap: wrap; }
.outil-filtres .plier { margin-left: auto; }
.fiche h2 .f-dates { font-weight: 400; margin-left: auto; }
.fiche-meta { margin: 0 0 6px; font: 13px var(--sans); color: var(--ink-soft); }
.fiche-meta a { color: var(--accent); }
.r-section { font: 13px var(--sans); color: var(--accent); margin-left: 6px; white-space: nowrap; }
.fiche-tab { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0 10px; }
.fiche-tab dt { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding-top: 3px; }
.fiche-tab dd { margin: 0; font-size: .95em; }
.rep-carte { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 16px 10px; margin: 12px 0; }
.rep-carte h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15em; margin: 8px 0 2px; }
.rep-carte h3 { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 10px 0 4px; }
.rep-carte ul { list-style: none; margin: 0; padding: 0; }
.rep-carte li { padding: 6px 0; border-top: 1px solid var(--line); }
.rep-carte li:first-child { border-top: 0; }
.r-type { display: inline-block; font: 600 11px var(--sans); padding: 1px 7px; border-radius: 999px; margin-right: 4px; }
.r-type.attestee { background: var(--accent); color: #fff; }
.r-type.construite { background: var(--bg-soft); color: var(--ink-soft); border: 1px dashed var(--ink-soft); }
.r-note { display: block; font-size: .9em; color: var(--ink-soft); }
.lexique { margin: 0; }
.lex-entree { padding: 10px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--topbar) + 70px); }
.lex-entree > summary { list-style: none; cursor: pointer; position: relative; padding-right: 28px; }
.lex-entree > summary::-webkit-details-marker { display: none; }
.lex-entree > summary::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); transition: transform .15s;
}
.lex-entree[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.lex-terme { font-weight: 600; font-size: 1.05em; }
.lex-langue { font: 12.5px var(--sans); color: var(--ink-soft); font-weight: 400; }
.lex-def { margin: 4px 0 0; }
.lex-voir { font: 13px var(--sans); white-space: nowrap; }
.lex-entree.cible { background: var(--accent-soft); border-radius: 10px; padding: 10px; }
/* Annexes : articles repliés, dans des cartes par catégorie */
.annexe { border-top: 1px solid var(--line); scroll-margin-top: calc(var(--topbar) + 70px); }
.annexe:first-of-type { border-top: 0; }
.annexe > summary { position: relative; padding: 10px 28px 10px 0; display: flex; gap: 10px; align-items: baseline; }
.annexe > summary::after { content: ""; position: absolute; right: 8px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); transition: transform .15s; }
.annexe[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.annexe-titre { font-weight: 600; }
.annexe-cat { font: 11.5px var(--sans); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-left: auto; white-space: nowrap; }
.annexe-corps { padding: 0 0 12px; }
.annexe-corps p { margin: 0 0 .9em; }
.annexe-corps h3 { font: 600 1.05em/1.3 var(--serif); text-transform: none; letter-spacing: 0; color: var(--ink); margin: 1em 0 .3em; }
.annexe-corps ul { list-style: disc; margin: 0 0 .9em; padding-left: 1.3em; }
.annexe-corps li { padding: 2px 0; border-top: 0; }
.annexe-essai, .annexe-refs { font: 13px/1.5 var(--sans); color: var(--ink-soft); }
.annexe.cible { background: var(--accent-soft); border-radius: 10px; padding: 0 10px; }
.annexe.cible > summary::after { right: 2px; }
body.page-outil { padding-left: 0 !important; }
body.page-outil .jump-nav { bottom: max(16px, env(safe-area-inset-bottom)); } /* pas de retour en haut sur ces pages */

/* Recherche plein texte */
.search-panel {
  position: fixed; z-index: 95; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg);
  display: flex; flex-direction: column; font-family: var(--sans);
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
@media (min-width: 760px) {
  .search-panel { top: calc(var(--topbar) + 8px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
    width: min(720px, 94vw); max-height: 78vh; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 0 12px; }
}
.search-head { display: flex; gap: 6px; align-items: center; padding: 10px 0 4px; }
#search-input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 16px var(--sans); }
.search-aide { font-size: 12.5px; color: var(--ink-soft); margin: 2px 2px 8px; }
.search-results { list-style: none; margin: 0; padding: 0 0 16px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.search-results a { display: block; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--bg-soft); }
.res-titre { display: block; font: 600 12px var(--sans); color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.res-extrait { display: block; font: 14.5px/1.45 var(--serif); }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.trouve { animation: trouve 2.4s ease-out; border-radius: 6px; }
@keyframes trouve { 0%, 40% { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); } 100% { background: transparent; box-shadow: none; } }
.vers-integral { font: 13px var(--sans); }
p.vers-integral { text-align: right !important; margin-top: .4em; }
@media print { .search-panel, #search-btn, .vers-integral { display: none !important; } }
