/* ==========================================================================
   readtheorg-sombre.css — thème sombre du Book (v1 : inversion noir/blanc)
   À charger APRÈS readtheorg.css :
   <link rel="stylesheet" type="text/css" href="../styles/readtheorg_theme/css/readtheorg-sombre.css"/>
   Les encadrés de couleur gardent leur rendu actuel : leurs fonds
   semi-transparents sont remplacés par leur équivalent opaque calculé
   sur l'ancien fond #f6f4f7, et leur texte reste sombre.
   ========================================================================== */

:root,
::backdrop {
  --fond-droite: #141210;
  --fond-page:  #141210;          /* anthracite du Graph */
  --texte:       #ddd9d9;          /* blanc du Graph */
  --texte-gris:  #a8a4a0;          /* remplace dimgray */
  --texte-sombre:#201e1e;          /* ancien noir, conservé dans les encadrés */
  --trait:       #444;
  --surface:     #2a2724;          /* code, blockquote, tableaux */
  --surface-alt: #24211f;
  --texture: url("../images/black-paper.png");
  /* ou la texture locale du Graph : url("<chemin>/img/black-paper.png") */

  --harm-bg: #cfdf97;              /* #CCDD8FEB composé sur #f6f4f7 */
  --menu-bg: #2e2a26;
}

/* --- Fond et texte ------------------------------------------------------ */
body {
  background: var(--fond-droite);
  background-image: var(--texture);
  color: var(--texte);
}
#content {
  background: var(--fond-page);
  background-image: var(--texture);
}
@media screen and (min-width: 1400px) {
  #content { background: var(--fond-page); background-image: var(--texture); }
}

/* --- Gris (dimgray & co) ------------------------------------------------ */
#intro-pub,
#formule-magique p, #formule-magique p b,
#aspect, #renvoi-aspect, #etq-org-ul,
.tip + div, #content .tip { color: var(--texte-gris); }

#renvoi-diss a, #renvoi-harm a,
#lien-maison a, #renvoi-lien-asp a { color: #c8c4c0; }

/* Bordure orange semi-transparente → équivalent opaque */
#renvoi-aspect-titre-diss { border-left-color: #f3b36f; }

/* Gras : #824636 illisible sur anthracite → version éclaircie */
b, strong { color: #c98a74; }

/* --- Éléments « blancs » ------------------------------------------------ */
blockquote { background-color: var(--surface); border-left-color: #555; }
code { background: var(--surface); border-color: var(--trait); color: #c9957f; }
.codeblock, pre.src, #content .literal-block, .codeblock-example {
  background: var(--surface); border-color: var(--trait);
}
.example { background: var(--surface-alt); border-color: var(--trait); color: var(--texte); }
table { border-bottom-color: var(--trait); }
table td, table th { background-color: var(--surface); border-color: var(--trait); }
table thead th { border-top-color: var(--trait); border-bottom-color: var(--trait); }
table tr:nth-child(2n-1) td { background-color: var(--surface-alt); }
table tr:nth-child(2n) td   { background-color: var(--surface); }
table caption, .figure p { color: var(--texte); }
hr, #footnotes { border-top-color: var(--trait); }
label { color: var(--texte-gris); }
.footpara { color: var(--texte-gris); }
#postamble .date { color: var(--texte-gris); }
div.tip b { background: var(--surface); color: var(--texte-gris); }

/* --- Sommaire latéral : éléments actifs --------------------------------- */
li.active { background: var(--menu-bg); }
li.active > a { color: var(--texte) !important; }
ul.nav > li.active a { color: #c8c4c0 !important; }
ul.nav > li.active > a {
  background-color: var(--fond-page);
  color: var(--texte) !important;
  border-bottom: solid 1px #555 !important;
  border-right: solid 1px #555 !important;
}
ul.nav > li.active li.active { background-color: #4a443c; }
ul.nav > li.active li.active > a { color: var(--texte) !important; }
#table-of-contents li.current { background: #3a3632; background-image: var(--texture); }
#table-of-contents li.current a { color: #c8c4c0; border-right-color: #555; }
#table-of-contents li.current a:hover { background: #46423d; }
#table-of-contents li.on a:hover,
#table-of-contents li.current > a:hover { background: var(--surface); }

/* --- Encadrés de couleur : rendu inchangé ------------------------------- */
/* Intros de sections (note) : #9569183b sur #f6f4f7 */
.note + div, #content .note { background: #e0d4c3; color: var(--texte-sombre); }
/* Aspects dissonants (warning) : #EC9D37A1 sur #f6f4f7 */
.warning + div, #content .warning { background: #f0bd7e; color: #261c06; }
#content .admonition-title.warning { background: #f3b36f; }
/* Aspects harmonieux (attention) */
.attention + div, #content .attention { color: var(--texte-sombre); }
#content .admonition-title.attention { background: #b7cb70; }
/* Avertissements (danger) */
.danger + div, #content .danger { color: var(--texte-sombre); }
/* Planètes en signes / maîtres (ul.org-ul) : #0eafbf52 sur #f6f4f7 */
ul.org-ul { background: #abdee5; border-color: #dfcecb; color: var(--texte-sombre); }
/* Renvois */
#renvoi-harm { background: #cfe5a6; color: #404040; }
#renvoi-diss { color: #404040; }
#renvoi-diss a, #renvoi-harm a { color: #404040; }

/* --- Colonne de texte centrée à droite du sommaire --------------------- */
@media screen and (min-width: 769px) {
    #content {
	margin-left: max(300px, calc(300px + (100% - 300px - 800px) / 2));
    }
}
@media screen and (max-width: 768px) {
    #content { margin-left: auto; margin-right: auto; }
}
