/* Page d'un texte (texte.php) : en creux et en relief sur fond clair, Alegreya.
   Écran large : titre, puis le dessin (carré) à gauche et le texte à droite, sans défilement de la première vue ;
   la taille du dessin et du texte est ajustée par assets/js/page-texte.js (sans JavaScript, des valeurs de repli).
   Écran étroit : tout s'empile. Les noms de classes sont propres à cette page (clap.css a déjà .serie, .marque, .recueil…). */

@font-face { font-family: 'Alegreya'; src: url(../fonts/alegreya-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alegreya'; src: url(../fonts/alegreya-latin-400-italic.woff2) format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Alegreya'; src: url(../fonts/alegreya-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alegreya'; src: url(../fonts/alegreya-latin-700-italic.woff2) format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/alegreya-sans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/alegreya-sans-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/alegreya-sans-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alegreya SC'; src: url(../fonts/alegreya-sc-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

body.corps-texte {
  --bg: #efeeee; --ink: #1f1d1a; --muted: #5f5a52;
  --rouge: #de5654; --rouge-txt: var(--rouge); --rouge-ico: var(--rouge); --rouge-fonce: var(--rouge);   /* un seul rouge dans tout le site */
  --ombre-d: rgba(209, 205, 199, .5); --ombre-l: rgba(255, 255, 255, .5);
  --h-pseudo: 2.75rem; --gap-ps: .625rem;
  --serif: 'Alegreya', Georgia, 'Times New Roman', serif;
  --sans: 'Alegreya Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --k: 1.07;   /* Alegreya Sans est plus petite que les sans-serif du système */
  margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 var(--serif);
  -webkit-text-size-adjust: 100%;
}
:where(.corps-texte) a { color: var(--rouge-txt); }   /* :where() : n'emporte jamais sur la couleur propre à un élément */
:where(.corps-texte) a:hover { text-decoration: underline; text-underline-offset: .15em; }
.corps-texte :focus-visible { outline: 2px solid var(--rouge-txt); outline-offset: 3px; }

.haut, main.page-texte { max-width: 96rem; margin-inline: auto; padding-inline: 1.25rem; }
main.page-texte { padding-block: 0 4rem; }
.haut { height: 3.5rem; display: flex; align-items: center; justify-content: space-between; }
.retour-recueil { font-family: var(--sans); font-size: calc(1.0625rem * var(--k)); text-decoration: none; }
.marque-texte { display: flex; align-items: baseline; text-decoration: none; }
.marque-texte .clap { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: 2rem; line-height: 1; color: var(--rouge); }
.marque-texte .sous { font-style: italic; font-size: 1.375rem; color: var(--muted); margin-left: .6rem; }

/* Séries : cases égales (3 par ligne sur téléphone, 4, puis 6 ; une seule ligne à partir de 76 rem), en creux ; la série du texte en relief.
   Un nom court (data/series.json) remplace le nom complet tant que les séries sont en grille. Le menu d'une série s'ouvre au survol. */
.barre-series { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; padding: .5rem; border-radius: 18px;
  box-shadow: inset 6px 6px 16px var(--ombre-d), inset -6px -6px 16px var(--ombre-l); }
.serie-lien { flex: 0 0 calc((100% - .5rem) / 3); margin: 0; padding: .6rem .25rem; border: 1px solid transparent; border-radius: 12px; background: none; color: var(--muted);
  font-family: var(--sans); font-weight: 500; font-size: calc(.875rem * var(--k)); line-height: 1; text-align: center; text-decoration: none; cursor: pointer; transition: color .15s; }
.serie-lien:hover, .serie-lien.ouverte { color: var(--rouge-txt); }
.serie-lien.courante { color: var(--rouge-txt); background: var(--bg); border-color: rgba(255, 255, 255, .2);
  box-shadow: 3px 3px 8px var(--ombre-d), -3px -3px 8px var(--ombre-l); }
.serie-lien .long { display: none; }
.serie-lien .court { display: inline; }
.menu-serie { position: absolute; z-index: 10; top: calc(100% + .5rem); width: min(27.5rem, 100%); padding: .5rem; background: var(--bg);
  border: 1px solid #dcd8d2; border-radius: 14px; box-shadow: 0 12px 32px rgba(209, 205, 199, .7); }
.menu-serie[hidden] { display: none; }
.menu-serie a { display: flex; gap: .875rem; align-items: flex-start; padding: .55rem .75rem; border-radius: 10px; color: var(--ink); text-decoration: none;
  font-family: var(--sans); font-size: calc(.9375rem * var(--k)); line-height: 1.35; }
.menu-serie a b { flex: 0 0 1.6rem; color: var(--muted); font-weight: 700; }
.menu-serie a:hover { background: rgba(255, 255, 255, .6); color: var(--rouge-txt); }
.menu-serie a.courant, .menu-serie a.courant b { color: var(--rouge-txt); }
@media (min-width: 36rem) and (max-width: 59.99rem) { .serie-lien { flex-basis: calc((100% - .75rem) / 4); } }
@media (min-width: 60rem) and (max-width: 75.99rem) { .serie-lien { flex-basis: calc((100% - 1.25rem) / 6); } }
@media (min-width: 76rem) {
  .barre-series { flex-wrap: nowrap; justify-content: space-evenly; }
  .serie-lien { flex: 0 1 auto; padding: .6rem .75rem; white-space: nowrap; }
  .serie-lien .long { display: inline; }
  .serie-lien .court { display: none; }
}

/* Titre, dessin, texte : empilés par défaut. */
.milieu { display: grid; grid-template-columns: minmax(0, 40rem); justify-content: center; row-gap: 1.5rem; padding-top: 1.5rem; }
/* Sur un écran étroit, les boutons de langue passent sous le titre (à droite) plutôt que de déborder. */
.titre-ligne { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem 1rem; min-width: 0; }
.titre { scroll-margin-top: .5rem; margin: 0; min-width: 0; max-width: 100%; font-weight: 400; line-height: 1.1; }
.nom-serie { display: block; font-family: 'Alegreya SC', Georgia, serif; font-weight: 400; font-feature-settings: 'smcp', 'c2sc'; text-transform: lowercase;
  font-size: clamp(2rem, 9vw, 3.75rem); line-height: 1; letter-spacing: .06em; overflow-wrap: break-word; }
.sous-titre { white-space: pre-line; display: block; margin-top: .4rem; font-style: italic; font-size: 1.25rem; line-height: 1.35; color: var(--muted); }
.fragment { display: block; font-size: 1.9375rem; color: var(--muted); margin-top: .25rem; }
.langues-texte { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-left: auto; }
.langues-texte a, .langues-texte > span { min-width: 2.5rem; height: 2.5rem; padding: 0 .5rem; display: flex; align-items: center; justify-content: center; border-radius: 12px;
  font-family: var(--sans); font-size: calc(.8125rem * var(--k)); letter-spacing: .06em; color: var(--muted); text-decoration: none;
  box-shadow: inset 3px 3px 8px var(--ombre-d), inset -3px -3px 8px var(--ombre-l); }
.langues-texte a[aria-current], .langues-texte [aria-current] { color: var(--ink); font-weight: 700; }
.dessin-fig { margin: 0; }
.dessin { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.legende-dessin { margin: .5rem 0 0; font-family: var(--sans); font-size: calc(.8125rem * var(--k)); line-height: 1.3; color: var(--muted); }
.texte { font-size: clamp(1.1rem, 1rem + .6vw, 1.35rem); line-height: 1.6; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-align: justify; text-align-last: left; }
.texte .partie { margin: 0 0 .5rem; font-size: inherit; font-weight: 400; font-style: italic; text-align: left; }
.texte .mention-ia { margin: 0 0 .5rem; font-family: var(--sans); font-size: .9em; color: var(--muted); text-align: left; }
.texte .corps { font-size: inherit; }
.texte .corps p { margin: 0 0 .6em; }
.texte .corps > :last-child { margin-bottom: 0; }
.texte .corps .sous-partie { font-size: .85em; }
/* Sous le dessin et le texte : le texte précédent et le suivant, d'un bout à l'autre du recueil. */
.voisins { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--sans); font-weight: 500; font-size: calc(1.0625rem * var(--k)); line-height: 1.25; }
.voisins a { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 0; text-decoration: none; }
.voisins .suiv { margin-left: auto; text-align: right; }

/* Zone d'écoute : un grand cadre discret (titre et pseudos), et à côté le bouton « Lire à voix haute ». */
.lectures { max-width: 40rem; margin: 0 auto; padding: 2.5rem 0 1rem; }
.lect-grille { display: grid; grid-template-columns: minmax(0, 1fr) clamp(8.5rem, 26vw, 14.4rem); column-gap: 1.5rem; align-items: start; }
.zone-ecoute { container-type: inline-size; padding: 1.25rem 1.5rem 1.5rem; border: 1px solid rgba(31, 29, 26, .07); border-radius: 24px;
  box-shadow: inset 2px 2px 7px rgba(209, 205, 199, .28), inset -2px -2px 7px rgba(255, 255, 255, .45); }
.titre-lect { margin: 0 0 1rem; line-height: 0; }
.titre-lect svg { display: block; }
.titre-lect text { font-family: var(--serif); font-size: 26px; fill: var(--ink); }
.aucune-lecture { margin: 0; font-family: var(--sans); font-size: calc(1rem * var(--k)); color: var(--muted); }
.pseudos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); row-gap: var(--gap-ps); }
@container (min-width: 30rem) { .pseudos { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; } }
.lec { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem; }
/* Ligne fine sous le pseudo, à la fin de la lecture : « Le salon de … » (lecteur.js). Vide, elle ne prend aucune place. */
.salon-ligne { flex: 0 0 100%; margin-top: -.2rem; padding-left: 1.1rem; font-family: var(--sans); font-size: calc(.9375rem * var(--k)); }
.salon-ligne:empty { display: none; }
.salon-ligne a::after { content: " \2192"; }
.pseudo { flex: 1 1 0; min-width: 0; max-width: 14.4rem; height: var(--h-pseudo); margin: 0; padding: 0 1.1rem; text-align: left; background: var(--bg); color: var(--rouge-txt);
  border: 1px solid transparent; border-radius: 14px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--sans); font-weight: 500; font-size: calc(1rem * var(--k));
  box-shadow: inset 3px 3px 8px var(--ombre-d), inset -3px -3px 8px var(--ombre-l); transition: color .15s, box-shadow .15s; }
.pseudo:hover { color: var(--rouge-fonce); }
.lec.en-cours .pseudo { border-color: rgba(255, 255, 255, .2); font-weight: 700; box-shadow: 3px 3px 8px var(--ombre-d), -3px -3px 8px var(--ombre-l); }
.signes { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.lec:hover .signes, .lec:focus-within .signes, .lec.en-cours .signes { opacity: 1; }
.sg { width: 2.5rem; height: 2.5rem; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 0;
  color: var(--rouge-ico); cursor: pointer; transition: transform .12s, color .12s; }
.sg:hover { color: var(--rouge-fonce); transform: scale(1.15); }
.lire { position: sticky; top: 1rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  height: calc(4 * var(--h-pseudo) + 3 * var(--gap-ps)); padding: 0 1.25rem; text-align: center; background: var(--bg); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, .2); border-radius: 28px; text-decoration: none; font-family: var(--sans); font-weight: 700;
  font-size: calc(1.0625rem * var(--k)); line-height: 1.25; box-shadow: 6px 6px 16px var(--ombre-d), -6px -6px 16px var(--ombre-l); transition: box-shadow .15s; }
.corps-texte a.lire:hover { color: var(--ink); box-shadow: 4px 4px 10px var(--ombre-d), -4px -4px 10px var(--ombre-l); }
.lire:active { box-shadow: inset 6px 6px 16px var(--ombre-d), inset -6px -6px 16px var(--ombre-l); }
.lire .micro { width: 3.75rem; height: 3.75rem; border-radius: 50%; background: var(--rouge); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 4px 4px 10px rgba(150, 38, 36, .45), inset -4px -4px 10px rgba(255, 150, 148, .45); }

/* Écran large (à partir de 60 rem) : le dessin à gauche, aussi grand que la hauteur le permet ; le texte à droite, sur une colonne plafonnée à 28 em
   (environ 65 caractères par ligne, comme dans un livre). Sans JavaScript : --cote et la taille du texte ont des valeurs de repli. */
@media (min-width: 60rem) {
  .haut, main.page-texte { padding-inline: 2.5rem; }
  .milieu { --cote: min(55%, calc(100vh - 18rem)); font-size: 1.45rem;
    grid-template-columns: var(--cote) var(--colw, minmax(0, 28em)); grid-template-rows: minmax(6rem, auto) auto auto;
    grid-template-areas: "tete tete" "dessin texte" "voisins voisins";
    justify-content: center; column-gap: 2.5rem; row-gap: 1rem; padding-top: 1rem; }
  /* Le titre a toute la largeur de la composition, et sa ligne grandit avec lui : il ne remonte jamais sur la barre des séries. */
  .titre-ligne { grid-area: tete; flex-wrap: nowrap; align-self: end; }
  .titre { flex: 1 1 auto; font-size: 1rem; }
  .nom-serie { font-size: 3.75rem; }
  .langues-texte { flex: none; }
  .dessin-fig { grid-area: dessin; }
  .dessin { width: 100%; height: auto; }
  .milieu.avec-legende { --cote: min(55%, calc(100vh - 20rem)); }   /* repli sans JavaScript : de la place pour la ligne sous le dessin */
  .voisins { grid-area: voisins; }
  .texte { grid-area: texte; align-self: start; font-size: var(--taille, 1em); line-height: 1.55; }
  .texte.defile { max-height: var(--cote); overflow-y: auto; padding-right: .75rem; }
  .lectures { max-width: var(--compo, 64rem); }
  .lect-grille { grid-template-columns: minmax(0, 1fr) 14.4rem; column-gap: 2rem; }
  .lire { position: static; width: 100%; max-width: 14.4rem; }
  /* Texte sans dessin : une colonne de livre, centrée. */
  .milieu.sans-dessin { display: block; max-width: 40rem; margin-inline: auto; font-size: 1.45rem; }
  .milieu.sans-dessin .titre-ligne { margin-bottom: 1.5rem; }
  .milieu.sans-dessin .voisins { margin-top: 1.5rem; }
  .milieu.sans-dessin .titre { font-size: 1rem; }
  .milieu.sans-dessin + .lectures { max-width: 54rem; }
}

/* Téléphone : « Lire à voix haute » en barre fixe en bas de l'écran. */
@media (max-width: 35.99rem) {
  main.page-texte { padding-bottom: 5.5rem; }
  .marque-texte .clap { font-size: 1.5rem; }
  .marque-texte .sous { font-size: 1rem; }
  .lect-grille { grid-template-columns: minmax(0, 1fr); }
  .zone-ecoute { padding: 1rem; }
  .lire { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 20; height: 3.75rem; border-radius: 0; flex-direction: row; gap: .75rem; box-shadow: 0 -6px 16px var(--ombre-d); }
  .lire .micro { width: 2.5rem; height: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .serie-lien, .pseudo, .signes, .sg, .lire { transition: none; }
}

/* Interface traduite (allemand, espagnol, anglais, italien) : rappel que la version française du consentement fait foi. */
.foi, .foi p { font-size: .85rem; }
/* Les noms de séries traduits sont plus longs : cases plus serrées, et la barre passe à la ligne plutôt que de déborder. */
@media (min-width: 76rem) { html:not([lang="fr"]) .barre-series { flex-wrap: wrap; } html:not([lang="fr"]) .serie-lien { padding: .6rem .3rem; } }

/* « Proposer une amélioration de la traduction » : une ligne fermée sous les lectures (texte.php), qui se déroule sur place ;
   la même sur la page d'un envoi refusé. */
.proposition { max-width: var(--compo, 40rem); margin: .5rem auto 0; border: 1px solid rgba(31, 29, 26, .14); border-radius: 24px;
  box-shadow: inset 2px 2px 7px rgba(209, 205, 199, .28), inset -2px -2px 7px rgba(255, 255, 255, .45); scroll-margin-top: 1rem; }
.proposition > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.5rem; border-radius: 24px; cursor: pointer; list-style: none; }
.proposition > summary::-webkit-details-marker { display: none; }
.proposition > summary::after { content: ""; flex: 0 0 auto; width: .5rem; height: .5rem; margin-top: -.25rem; border: solid var(--rouge); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.proposition[open] > summary::after { margin-top: .25rem; transform: rotate(225deg); }
.proposition h2 { margin: 0; font-family: var(--sans); font-weight: 700; font-size: calc(1rem * var(--k)); line-height: 1.3; color: var(--ink); }
.proposition > summary:hover h2 { color: var(--rouge); }
.proposition-corps { padding: 0 1.5rem 1.5rem; }
.proposition-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.proposition-tete .proposition-details { margin-left: auto; }
.proposition a.proposition-details, .proposition button { font-family: var(--sans); font-weight: 700; font-size: calc(.9375rem * var(--k)); line-height: 1.25; color: var(--rouge);
  background: var(--bg); border: 1px solid rgba(255, 255, 255, .2); border-radius: 14px; padding: .55rem 1rem; margin: 0; cursor: pointer; text-decoration: none;
  box-shadow: 3px 3px 8px var(--ombre-d), -3px -3px 8px var(--ombre-l); }
.proposition button[hidden], .proposition [hidden] { display: none; }
.proposition form { margin: 1rem 0 0; }
.proposition textarea, .proposition input[type=email], .proposition input[type=text] { box-sizing: border-box; width: 100%; padding: .65rem .85rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid rgba(31, 29, 26, .22); border-radius: 14px; box-shadow: inset 3px 3px 9px var(--ombre-d), inset -3px -3px 9px var(--ombre-l); }
.proposition textarea { display: block; resize: vertical; min-height: 7rem; line-height: 1.5; }
.proposition-outils { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-top: .75rem; }
.proposition-compte { margin-left: auto; font-family: var(--sans); font-size: calc(.8125rem * var(--k)); color: var(--muted); }
.proposition-compte.trop, .proposition-erreur { color: var(--rouge); font-weight: 700; }
.proposition-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem 1rem; margin-top: 1rem; }
.proposition-champs label { display: flex; flex-direction: column; justify-content: flex-end; gap: .25rem; font-family: var(--sans); font-weight: 500; }
.proposition-accord { display: flex; gap: .6rem; align-items: flex-start; margin-top: 1rem; }
.proposition-accord input { margin-top: .35rem; accent-color: var(--rouge); }
.proposition-foi { margin-top: .5rem; font-size: .85rem; color: var(--muted); }
.proposition .proposition-envoyer { margin-top: 1rem; }
.proposition-merci { margin-bottom: 0; }
.proposition-piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 35.99rem) { .proposition > summary { padding-inline: 1rem; } .proposition-corps { padding: 0 1rem 1rem; } }
