/* Page « Chroniques » (chroniques.html) : le papier de lecture validé par Loïc (vélin, rouge garance, sommaire collant, lettrines).
   Propriété de l’agent de la page. Socle commun : monde.css.
   Refonte 3 : le vélin a son grain et ses bords barbés ; chaque image s’imprime dans le papier (multiply) avec un fondu
   propre à sa place (débord, bande, marge, encart, envoi) ; l’ornement du site, en garance, ouvre chaque chapitre ;
   le sommaire suit la lecture sur un fil ; sur téléphone, il devient une barre repliable collée sous l’en-tête. */

.page-chro {
  --madder-line: rgba(141, 59, 36, .36);
  --toc-unread: #6f6250;
  /* grain du vélin : bruit très fin, brun, presque invisible */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .24 0 0 0 0 .15 0 0 0 .34 -.13'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  /* bord barbé du vélin (tuile de 1200 px qui se raccorde) */
  --deckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 22' preserveAspectRatio='none'%3E%3Cfilter id='b' x='-5%25' y='-50%25' width='110%25' height='200%25'%3E%3CfeGaussianBlur stdDeviation='.6'/%3E%3C/filter%3E%3Cpath filter='url(%23b)' d='M-16 30L-16 9.9L-12 10.2L-8 10.0L-4 10.1L0 9.2L4 8.7L8 8.7L12 8.7L16 9.1L20 8.6L24 8.9L28 9.2L32 9.6L36 9.6L40 8.7L44 8.3L48 7.7L52 7.8L56 7.4L60 7.0L64 7.1L68 7.3L72 8.1L76 7.8L80 7.6L84 7.4L88 7.6L92 8.3L96 8.2L100 8.6L104 8.7L108 9.7L112 10.4L116 10.3L120 10.3L124 9.7L128 9.9L132 9.4L136 8.9L140 8.4L144 8.0L148 8.7L152 8.7L156 8.6L160 7.9L164 7.4L168 7.5L172 7.1L176 6.9L180 6.4L184 7.1L188 7.9L192 8.5L196 8.8L200 8.4L204 8.8L208 8.9L212 9.0L216 8.7L220 8.4L224 9.1L228 9.5L232 10.1L236 9.8L240 9.6L244 9.8L248 9.8L252 10.0L256 9.3L260 9.4L264 9.8L268 10.6L272 11.4L276 11.4L280 11.9L284 12.0L288 12.7L292 12.6L296 12.2L300 12.2L304 12.2L308 12.9L312 12.7L316 12.6L320 12.4L324 12.1L328 12.1L332 11.1L336 10.3L340 9.4L344 9.3L348 9.5L352 9.2L356 9.2L360 9.0L364 9.6L368 9.7L372 9.5L376 9.1L380 8.8L384 9.5L388 9.7L392 10.0L396 9.9L400 10.1L404 10.8L408 10.7L412 10.5L416 9.4L420 9.1L424 9.2L428 9.2L432 9.3L436 8.8L440 9.4L444 9.6L448 9.7L452 9.3L456 8.6L460 8.9L464 8.9L468 9.4L472 9.1L476 9.2L480 9.7L484 10.0L488 10.3L492 9.4L496 8.9L500 8.4L504 8.2L508 8.1L512 7.2L516 7.1L520 6.9L524 7.2L528 7.0L532 6.3L536 6.1L540 5.7L544 6.1L548 5.9L552 5.9L556 6.3L560 7.0L564 8.4L568 8.7L572 8.9L576 8.7L580 8.9L584 9.2L588 8.8L592 9.0L596 9.0L600 9.9L604 10.4L608 10.4L612 10.3L616 9.8L620 10.3L624 10.0L628 9.8L632 9.4L636 9.5L640 10.6L644 11.1L648 11.6L652 11.4L656 11.7L660 12.0L664 11.8L668 11.6L672 10.9L676 11.1L680 11.3L684 11.6L688 11.5L692 10.9L696 10.9L700 10.5L704 10.3L708 9.3L712 8.6L716 8.8L720 9.1L724 9.7L728 9.5L732 9.7L736 10.1L740 10.5L744 10.9L748 10.2L752 10.3L756 10.4L760 11.1L764 11.6L768 11.5L772 12.0L776 12.0L780 12.6L784 12.1L788 11.2L792 10.5L796 10.1L800 10.4L804 10.0L808 10.0L812 9.9L816 10.2L820 10.6L824 10.0L828 9.6L832 8.8L836 9.0L840 9.1L844 9.1L848 9.2L852 9.1L856 9.8L860 9.6L864 9.1L868 8.2L872 7.4L876 7.6L880 7.1L884 7.0L888 6.4L892 6.5L896 6.8L900 6.8L904 6.8L908 6.0L912 6.2L916 6.4L920 6.7L924 6.9L928 6.9L932 8.1L936 8.8L940 9.6L944 9.5L948 9.2L952 9.6L956 9.5L960 9.9L964 9.3L968 9.2L972 9.4L976 9.7L980 10.1L984 9.4L988 9.3L992 9.0L996 8.9L1000 8.7L1004 8.0L1008 8.3L1012 8.6L1016 9.7L1020 10.0L1024 10.0L1028 10.1L1032 9.9L1036 10.3L1040 9.6L1044 9.3L1048 9.1L1052 9.5L1056 10.2L1060 10.0L1064 10.0L1068 9.6L1072 9.9L1076 9.9L1080 9.3L1084 9.0L1088 8.7L1092 9.6L1096 10.1L1100 10.6L1104 10.8L1108 11.0L1112 11.9L1116 12.0L1120 12.2L1124 11.8L1128 11.9L1132 12.6L1136 12.9L1140 13.4L1144 12.9L1148 13.1L1152 13.0L1156 12.7L1160 12.1L1164 10.9L1168 10.7L1172 10.3L1176 10.4L1180 10.2L1184 9.9L1188 10.2L1192 10.0L1196 10.1L1200 9.2L1204 8.7L1208 8.7L1212 8.7L1216 9.1L1216 30Z'/%3E%3C/svg%3E");
  --paper-edges: linear-gradient(90deg, rgba(104, 76, 42, .08), rgba(104, 76, 42, 0) 9%, rgba(104, 76, 42, 0) 91%, rgba(104, 76, 42, .08));
}

/* =================================================
   LE PAPIER
   ================================================= */
.page-chro .chro-body { position: relative; z-index: 1; background: var(--grain), var(--paper-edges), var(--vellum); color: var(--text); overflow-x: clip; }
.page-chro .chro-body h2 { color: var(--text); }
/* Bords barbés : la feuille se pose sur la nuit de l’en-tête, et la quitte avant le pied de page */
.page-chro .chro-body::before, .page-chro .chro-body::after {
  content: ""; position: absolute; left: 0; right: 0; height: 22px; pointer-events: none;
  background: var(--grain), var(--paper-edges), var(--vellum);
  -webkit-mask: var(--deckle) 0 0 / 1200px 100% repeat-x;
  mask: var(--deckle) 0 0 / 1200px 100% repeat-x;
}
.page-chro .chro-body::before { bottom: calc(100% - 1px); }
.page-chro .chro-body::after { top: calc(100% - 1px); transform: scaleY(-1); }

.chro-layout { max-width: 1260px; margin: 0 auto; padding: clamp(56px, 6vw, 96px) var(--gutter) clamp(80px, 9vw, 136px); display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 64px; }

/* =================================================
   SOMMAIRE — un fil garance qui se remplit au fil de la lecture, une perle au chapitre en cours
   ================================================= */
.chro-toc { position: sticky; top: calc(var(--header-h) + 28px); align-self: start; font-size: 15.5px; }
.chro-toc-title { font-family: var(--font-display); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--madder); margin: 0 0 16px; }
.chro-toc ol { position: relative; list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--vellum-3); }
.chro-toc ol::before { content: ""; position: absolute; left: -1px; top: 0; width: 1px; height: 100%; background: var(--madder); transform: scaleY(var(--p, 0)); transform-origin: 50% 0; }
.chro-toc ol::after { content: ""; position: absolute; left: -4px; top: -3.5px; width: 7px; height: 7px; background: var(--madder); box-shadow: 0 0 0 3px var(--vellum); transform: translateY(var(--y, 0px)) rotate(45deg); opacity: 0; transition: opacity .4s; }
.chro-toc.is-reading ol::after { opacity: 1; }
.chro-toc a { display: grid; grid-template-columns: 38px 1fr; padding: 6px 0 6px 18px; color: var(--toc-unread); line-height: 1.3; transition: color .25s; }
.chro-toc a span { font-family: var(--font-tale); color: var(--madder); }
.chro-toc a.is-read { color: var(--text-soft); }
.chro-toc a.is-on, .chro-toc a:hover { color: var(--text); }
.chro-toc a:focus-visible, .chro-toc-btn:focus-visible { outline: 1px solid var(--madder); outline-offset: 3px; }
.chro-toc-btn { display: none; }
.chro-progress { display: none; }

/* =================================================
   LE TEXTE
   ================================================= */
/* --room : la place libre entre la colonne de lecture et le bord de l’écran, où les images peuvent déborder */
.chro-text { --room: max(0px, (100vw + min(100vw, 1260px)) / 2 - var(--gutter) - 1012px); max-width: 680px; font-size: var(--read); line-height: 1.7; }
.chro-text p { margin: 0 0 1.05em; hyphens: auto; text-wrap: pretty; }
.chro-opening { font-family: var(--font-tale); font-size: clamp(22px, 2vw, 26px); line-height: 1.5; font-style: italic; color: var(--text-soft); margin: 0 !important; }

/* Chapitres : l’ornement du site, en garance, ouvre chacun d’eux */
.chro-ch { margin-top: 3.4em; scroll-margin-top: calc(var(--header-h) + 8px); }
.chro-ch::after { content: ""; display: table; clear: both; }
.chro-body .ornament { width: 200px; margin: 0 auto 2.6em; }
.chro-body .ornament span { background: linear-gradient(90deg, transparent, var(--madder)); opacity: .6; }
.chro-body .ornament span:last-child { background: linear-gradient(90deg, var(--madder), transparent); }
.chro-body .ornament i { border-color: var(--madder); }
.chro-ch-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 26px; border-bottom: 1px solid var(--vellum-3); padding-bottom: 16px; }
.chro-num { font-family: var(--font-tale); font-size: 42px; line-height: 1; color: var(--madder); min-width: 1.5em; margin: 0 !important; }
.chro-ch-head h2 { font-size: clamp(32px, 3.3vw, 46px); line-height: 1.06; text-wrap: balance; }
/* Lettrine, et première ligne en petites capitales comme dans les vieux livres */
.dropcap::first-letter { font-family: var(--font-tale); float: left; font-size: 4.5em; line-height: .8; margin: .07em .1em 0 -.02em; color: var(--madder); }
.dropcap::first-line { font-variant-caps: small-caps; letter-spacing: .03em; }
/* Paroles rapportées : centrées entre deux filets garance */
.pull { clear: both; margin: 2.2em auto; padding: 0; border: 0; text-align: center; }
.pull::before, .pull::after { content: ""; display: block; width: 64px; height: 1px; margin: 0 auto; background: var(--madder); opacity: .55; }
.pull p { font-family: var(--font-tale); font-size: clamp(27px, 2.7vw, 34px); line-height: 1.28; font-style: italic; color: var(--text); max-width: 20em; margin: .6em auto !important; hyphens: manual; text-wrap: balance; }

/* =================================================
   IMAGES — imprimées dans le vélin : le clair prend la couleur du papier, les bords se perdent.
   --fl, --fr, --ft, --fb : longueur du fondu à gauche, à droite, en haut, en bas ; chaque place a les siens.
   ================================================= */
.fig { --fl: 7%; --fr: 7%; --ft: 9%; --fb: 9%; margin: 2.4em 0; mix-blend-mode: multiply; }
.fig img, .fig .art-reserve {
  display: block; height: auto;
  --mx: linear-gradient(90deg, transparent, rgba(0, 0, 0, .2) calc(var(--fl) * .32), rgba(0, 0, 0, .66) calc(var(--fl) * .68), #000 var(--fl), #000 calc(100% - var(--fr)), rgba(0, 0, 0, .66) calc(100% - var(--fr) * .68), rgba(0, 0, 0, .2) calc(100% - var(--fr) * .32), transparent);
  --my: linear-gradient(180deg, transparent, rgba(0, 0, 0, .2) calc(var(--ft) * .32), rgba(0, 0, 0, .66) calc(var(--ft) * .68), #000 var(--ft), #000 calc(100% - var(--fb)), rgba(0, 0, 0, .66) calc(100% - var(--fb) * .68), rgba(0, 0, 0, .2) calc(100% - var(--fb) * .32), transparent);
  -webkit-mask-image: var(--mx), var(--my); -webkit-mask-composite: source-in;
  mask-image: var(--mx), var(--my); mask-composite: intersect;
}
/* Le bord d’une image masquée laissait un filet sombre sur le vélin à un zoom non entier : on rogne ce pixel (voir monde.css). */
.fig img { clip-path: inset(1px); }
/* Légende : un filet garance, l’italique de la narration */
.fig figcaption { position: relative; max-width: 36em; margin-top: 8px; padding-left: 30px; font-size: 16px; line-height: 1.45; color: var(--text-soft); text-wrap: pretty; }
.fig figcaption::before { content: ""; position: absolute; left: 0; top: .74em; width: 20px; height: 1px; background: var(--madder); }
.fig figcaption b { font-style: normal; font-family: var(--font-tale-sc); letter-spacing: .04em; color: var(--madder); font-weight: 400; }

/* Large dans la colonne (I, IV) */
.fig--wide { --fl: 8%; --fr: 8%; --ft: 11%; --fb: 11%; }
.fig--wide img, .fig--wide .art-reserve { aspect-ratio: 16/9; }
/* Débord (II, VIII) : l’image sort de la colonne et se perd dans la marge du papier */
.fig--bleed { width: calc(100% + min(360px, var(--room))); margin: 2.8em 0; --fl: 7%; --fr: 18%; --ft: 13%; --fb: 13%; }
.fig--bleed img, .fig--bleed .art-reserve { aspect-ratio: 21/9; }
/* Bande panoramique (VI) : fondue fort en haut et en bas, comme un horizon */
.fig--band { margin: 2.8em calc(-1 * min(320px, var(--room))) 2.8em 0; --fl: 6%; --fr: 22%; --ft: 18%; --fb: 18%; }
.fig--band img, .fig--band .art-reserve { aspect-ratio: 3/1; }
/* Marge droite (III, V) : l’image verticale s’avance dans la marge, le texte la contourne */
.fig--margin-right { float: right; width: 340px; margin: .35em calc(-1 * min(220px, var(--room))) 1.1em 36px; --fl: 14%; --fr: 7%; --ft: 7%; --fb: 9%; }
.fig--margin-right img, .fig--margin-right .art-reserve { aspect-ratio: 4/5; }
.fig--margin-right figcaption, .fig--margin-left figcaption { font-size: 15px; padding-left: 26px; }
.fig--margin-right figcaption::before, .fig--margin-left figcaption::before { width: 16px; }
/* Marge gauche (VII) : mord un peu sur le blanc qui la sépare du sommaire, pour laisser au texte voisin sa largeur */
.fig--margin-left { float: left; width: 270px; margin: .35em 30px 1.1em -24px; --fl: 8%; --fr: 15%; --ft: 9%; --fb: 9%; }
.fig--margin-left img, .fig--margin-left .art-reserve { aspect-ratio: 1/1; }
/* Encart centré (IX) */
.fig--inset { width: 68%; margin-left: auto; margin-right: auto; --fl: 11%; --fr: 11%; --ft: 11%; --fb: 11%; }
.fig--inset img, .fig--inset .art-reserve { aspect-ratio: 4/3; }
/* Décalée vers la marge droite (X) */
.fig--right { width: 84%; margin-left: auto; margin-right: calc(-1 * min(170px, var(--room))); --fl: 16%; --fr: 10%; }
.fig--right img, .fig--right .art-reserve { aspect-ratio: 3/2; }
/* Envoi (fin) : un ovale qui se perd dans le papier, comme un cul-de-lampe */
.fig--envoi { margin: 2.6em auto 1.2em; }
.fig--envoi img, .fig--envoi .art-reserve { aspect-ratio: 16/9;
  --oval: radial-gradient(ellipse 52% 58% at 46% 47%, #000 48%, rgba(0, 0, 0, .72) 64%, rgba(0, 0, 0, .28) 80%, transparent 94%);
  --edge: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
  --side: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-image: var(--oval), var(--edge), var(--side); mask-image: var(--oval), var(--edge), var(--side); }
/* Réglages propres à chaque image : recadrage sur téléphone, fondus (le sujet ne doit jamais tomber dans un fondu) */
.fig[data-art^="chro-cote-noire"] { --m-pos: 24% 50%; --ft: 15%; --fb: 15%; --fr: 14%; }   /* la flotte perdue est à droite */
.fig[data-art^="chro-annee-du-col"] { --m-pos: 66% 50%; --fl: 9%; --fr: 9%; }   /* l’éboulement, la tour et les soldats sont à droite */
.fig[data-art^="chro-marche-du-don"] { --m-pos: 62% 50%; --ft: 6%; --fr: 12%; }   /* la file marche près du bord haut, la gardienne en tête à droite */

/* Fin : la dernière phrase, l’ornement, les chemins */
.chro-envoi { clear: both; font-family: var(--font-tale); font-style: italic; font-size: clamp(25px, 2.5vw, 31px); line-height: 1.32; color: var(--text); text-align: center; max-width: 22em; margin: 1em auto 0 !important; hyphens: manual; text-wrap: balance; }
.chro-ch--last .chro-envoi + .ornament { margin: 1.9em auto 0; }
.chro-end-links { margin: 1.7em 0 0 !important; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 30px; }
.chro-end-links .lnk { margin-right: 0; color: var(--madder); border-color: var(--madder-line); }
.chro-end-links .lnk:hover { color: var(--text); border-color: var(--madder); }

/* =================================================
   ÉCRANS MOYENS ET PETITS
   ================================================= */
@media (max-width: 1180px) {
  .fig--bleed { width: auto; }
  .fig--band { margin-right: 0; }
  .fig--margin-right { width: 40%; margin-right: 0; }
  .fig--margin-left { width: 36%; }
  .fig--right { width: 100%; margin-right: 0; --fl: 9%; }
}
@media (max-width: 900px) {
  .chro-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .chro-text { width: 100%; margin: 0 auto; }
  .chro-ch { scroll-margin-top: calc(var(--header-h) + 60px); }
  /* Sommaire : une barre collée sous l’en-tête, qui montre le chapitre en cours et s’ouvre sur la liste */
  .js .chro-toc { position: sticky; top: var(--header-h); z-index: 20; margin: 0 calc(-1 * var(--gutter)) 34px; padding: 0 var(--gutter); background: var(--grain), var(--vellum); border-bottom: 1px solid var(--vellum-3); font-size: 16px; }
  .js .chro-toc-title { display: none; }
  .js .chro-toc ol { display: none; }
  .js .chro-toc.is-open ol { display: block; position: absolute; left: 0; right: 0; top: 100%; max-height: calc(100svh - var(--header-h) - 72px); overflow-y: auto; overscroll-behavior: contain; padding: 6px var(--gutter) 18px; border-left: 0; border-bottom: 1px solid var(--vellum-3); background: var(--grain), var(--vellum); box-shadow: 0 24px 30px -14px rgba(37, 31, 25, .32); }
  .js .chro-toc ol::before, .js .chro-toc ol::after { display: none; }
  .js .chro-toc a { padding: 11px 0; border-bottom: 1px solid rgba(211, 196, 168, .65); }
  .js .chro-toc li:last-child a { border-bottom: 0; }
  .js .chro-toc a.is-on { color: var(--madder); }
  .chro-toc-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
  .chro-toc-btn-k { flex: none; font-family: var(--font-display); font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--madder); }
  .chro-toc-btn-cur { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-tale); font-size: 18px; }
  .chro-toc-btn-cur span { color: var(--madder); margin-right: .25em; }
  .chro-toc-btn::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 1.5px solid var(--madder); border-bottom: 1.5px solid var(--madder); transform: translateY(-3px) rotate(45deg); transition: transform .25s; }
  .chro-toc.is-open .chro-toc-btn::after { transform: translateY(2px) rotate(225deg); }
  .js .chro-progress { display: block; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; margin: 0; }
  .js .chro-progress span { display: block; height: 100%; background: var(--madder); transform: scaleX(var(--g, 0)); transform-origin: 0 50%; }
  html:not(.js) .chro-toc { position: static; margin-bottom: 36px; }
  /* Débords et bande : d’un bord à l’autre de l’écran, fondus seulement en haut et en bas, recadrés pour rester lisibles */
  .fig--bleed, .fig--band { width: auto; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); --ft: 12%; --fb: 12%; }
  .fig.fig--bleed, .fig.fig--band { --fl: 0%; --fr: 0%; }   /* d’un bord à l’autre : aucun fondu latéral, même pour les réglages propres à une image */
  .fig--bleed img, .fig--bleed .art-reserve { aspect-ratio: 16/10; object-position: var(--m-pos, 50% 50%); }
  .fig--band img, .fig--band .art-reserve { aspect-ratio: 2/1; object-position: var(--m-pos, 50% 50%); }
  .fig--bleed figcaption, .fig--band figcaption { margin-left: var(--gutter); margin-right: var(--gutter); }
  .fig--margin-left { margin-left: 0; }
}
@media (max-width: 640px) {
  .fig--margin-right, .fig--margin-left, .fig--inset, .fig--right { float: none; width: 100%; margin: 2em 0; --fl: 7%; --fr: 7%; --ft: 8%; --fb: 8%; }
  .fig--envoi { margin-left: calc(-.5 * var(--gutter)); margin-right: calc(-.5 * var(--gutter)); }
  .chro-ch { margin-top: 2.8em; }
  .chro-body .ornament { width: 160px; margin-bottom: 2.2em; }
  .chro-ch-head { gap: 14px; }
  .chro-num { font-size: 34px; }
  .dropcap::first-letter { font-size: 4.1em; }
  .pull p { font-size: 26px; }
  .chro-end-links { flex-direction: column; align-items: center; }
}
