:root {
  --papier: #fffdf7;
  --encre: #16120c;
  --estompe: #6b6257;
  --vin: #7a1f2b;
  --filet: #d8d0c2;
  --jeu-fond: #f6f1e6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #14120f;
    --encre: #e8e2d6;
    --estompe: #9a9183;
    --vin: #c4717c;
    --filet: #3a352d;
    --jeu-fond: #1d1a15;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Charter, Georgia, serif;
  font-size: calc(1.3125rem * var(--echelle, 1));
  line-height: 1.72;
}

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3.5rem 1.4rem 5rem;
}

header.titre {
  text-align: center;
  margin-bottom: 3.5rem;
}

.surtitre {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--estompe);
  margin-bottom: 1.4rem;
}

h1 {
  font-family: Didot, "Didot LT STD", "Bodoni MT", "Bodoni 72", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.7rem, 5.5vw, 2.5rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.25;
  margin: 0 0 1.6rem;
}

.ornement {
  color: var(--vin);
  font-size: 1.1rem;
  letter-spacing: 0.6em;
  padding-left: 0.6em;
}

p { margin: 0 0 1.45em; }

em { font-style: italic; }

.jeu {
  font-style: italic;
  color: var(--estompe);
  background: var(--jeu-fond);
  border-left: 3px solid var(--filet);
  padding: 0.7em 1em;
  font-size: 0.92em;
  margin: 1.8em 0;
}

.paroles {
  font-style: italic;
  border-left: 3px solid var(--vin);
  padding: 0.4em 0 0.4em 1.2em;
  margin: 1.8em 0;
  white-space: pre-line;
  line-height: 1.55;
}

.paroles-manquantes {
  border-left: 3px dashed var(--filet);
  padding: 0.7em 1.2em;
  margin: 1.8em 0;
  color: var(--estompe);
  font-style: italic;
  font-size: 0.92em;
}

.plage {
  margin: 2.2em 0;
}

.plage-label {
  font-family: Didot, "Bodoni 72", Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--vin);
  margin-bottom: 0.55em;
}

.plage iframe {
  display: block;
  width: 100%;
  height: 80px;
  border: 0;
  border-radius: 12px;
}

.intermede {
  text-align: center;
  margin: 2.6em 0;
}

.intermede .ligne {
  border: 0;
  border-top: 1px solid var(--filet);
  margin: 0 0 1.4em;
}

.fin {
  text-align: center;
  margin-top: 3rem;
  font-style: italic;
}

footer {
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--filet);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  color: var(--estompe);
}

footer a { color: var(--estompe); }

/* Connexion */

.connexion {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.4rem;
}

.connexion form {
  width: 100%;
  max-width: 22rem;
  text-align: center;
}

.connexion h1 {
  font-size: 1.35rem;
  margin-bottom: 2.2rem;
}

.connexion label {
  display: block;
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--estompe);
  margin: 1.2rem 0 0.4rem;
}

.connexion input {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 0.55em 0.7em;
  background: transparent;
  color: var(--encre);
  border: 1px solid var(--filet);
  border-radius: 8px;
}

.connexion input:focus {
  outline: 2px solid var(--vin);
  outline-offset: 1px;
  border-color: var(--vin);
}

.connexion button {
  margin-top: 2rem;
  font: inherit;
  font-size: 0.92rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.75em 2.4em;
  background: var(--vin);
  color: var(--papier);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.connexion button:focus-visible {
  outline: 2px solid var(--encre);
  outline-offset: 2px;
}

.erreur {
  color: var(--vin);
  font-style: italic;
  margin-top: 1.4rem;
  font-size: 0.95rem;
}

/* Familles de police (barre d'affichage) */
body[data-police="serif"] { font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Charter, Georgia, serif; }
body[data-police="sans"] { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; }
body[data-police="lisible"] { font-family: "Atkinson Hyperlegible", Verdana, "Trebuchet MS", sans-serif; line-height: 1.78; }

/* Thèmes de fond (barre d'affichage) */
body[data-theme="clair"]     { --papier:#fffdf7; --encre:#16120c; --estompe:#6b6257; --vin:#7a1f2b; --filet:#d8d0c2; --jeu-fond:#f6f1e6; }
body[data-theme="sepia"]     { --papier:#f4ecd8; --encre:#3a2f1d; --estompe:#7a6c52; --vin:#8a3322; --filet:#d8c9a8; --jeu-fond:#ece0c4; }
body[data-theme="sombre"]    { --papier:#14120f; --encre:#e8e2d6; --estompe:#9a9183; --vin:#c4717c; --filet:#3a352d; --jeu-fond:#1d1a15; }
body[data-theme="contraste"] { --papier:#000000; --encre:#ffffff; --estompe:#d0d0d0; --vin:#ff9aa2; --filet:#777777; --jeu-fond:#161616; }

/* Barre d'affichage */
.affichage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.5rem;
  align-items: center;
  font-family: Didot, "Bodoni 72", Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--estompe);
  border: 1px solid var(--filet);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin-bottom: 2.8rem;
}
.affichage .groupe { display: flex; align-items: center; gap: 0.35rem; }
.affichage .lbl { margin-right: 0.25rem; }
.affichage button {
  font: inherit;
  cursor: pointer;
  color: var(--estompe);
  background: transparent;
  border: 1px solid var(--filet);
  border-radius: 6px;
  padding: 0.3em 0.65em;
  line-height: 1;
}
.affichage button[aria-pressed="true"] {
  background: var(--vin);
  color: var(--papier);
  border-color: var(--vin);
}
.affichage button:focus-visible { outline: 2px solid var(--vin); outline-offset: 1px; }

/* Plages optionnelles / vidéo */
.plage.optionnelle { border-left: 3px dashed var(--filet); padding-left: 1.2rem; }
.plage.video iframe { height: 220px; }

/* Lien et page orateur */
.orateur-lien { margin: 1.6rem 0 0; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; }
.orateur-lien a { color: var(--estompe); text-decoration: none; border-bottom: 1px solid var(--filet); padding-bottom: 2px; }
.orateur-lien a:hover { color: var(--vin); border-color: var(--vin); }
.orateur p { margin: 0 0 1.45em; }
.retour { margin-top: 3rem; font-size: 0.82rem; letter-spacing: 0.04em; }
.retour a { color: var(--estompe); }
.retour a:hover { color: var(--vin); }

@media print {
  .plage, .affichage, footer { display: none; }
  body { font-size: 12pt; }
}
