/* =============================================================
   APE Les Phoenix – mode sombre (site seulement)
   Remplace les rôles de couleur (theme.json, custom.role) par les teintes
   sombres (theme.json, custom.sombre). Les composants n'ont rien à changer :
   ils utilisent les rôles (ape-phoenix.css).
   Deux cas, avec exactement les mêmes valeurs :
   - « Automatique » (aucun choix enregistré) et appareil réglé en sombre ;
   - « Sombre » choisi avec le bouton Apparence : attribut data-apparence posé
     sur <html> avant le premier affichage (script en tête de page, functions.php).
   « Clair » choisi : le mode sombre ne s'applique pas, même si l'appareil est
   en sombre. Écran seulement : l'impression reste en clair. Jamais chargé dans
   l'éditeur, qui reste en clair.
   ============================================================= */

@media screen and (prefers-color-scheme: dark) {
	:root:not([data-apparence="clair"]) {
		color-scheme: dark;
		--wp--custom--role--fond: var(--wp--custom--sombre--fond);
		--wp--custom--role--fond-doux: var(--wp--custom--sombre--fond-doux);
		--wp--custom--role--fond-accent: var(--wp--custom--sombre--fond-accent);
		--wp--custom--role--surface: var(--wp--custom--sombre--surface);
		--wp--custom--role--texte: var(--wp--custom--sombre--texte);
		--wp--custom--role--texte-doux: var(--wp--custom--sombre--texte-doux);
		--wp--custom--role--accent: var(--wp--custom--sombre--accent);
		--wp--custom--role--accent-fort: var(--wp--custom--sombre--accent-fort);
		--wp--custom--role--filet: var(--wp--custom--sombre--filet);
		--wp--custom--role--contour: var(--wp--custom--sombre--contour);
		--wp--custom--role--focus: var(--wp--custom--sombre--focus);
		--wp--custom--role--saisie-fond: var(--wp--custom--sombre--saisie-fond);
		--wp--custom--role--saisie-bord: var(--wp--custom--sombre--saisie-bord);
		--wp--custom--role--pied-fond: var(--wp--custom--sombre--pied-fond);
		--wp--custom--role--erreur: var(--wp--custom--sombre--erreur);
		--wp--custom--role--erreur-fond: var(--wp--custom--sombre--erreur-fond);
		--wp--custom--role--succes: var(--wp--custom--sombre--succes);
		--wp--custom--role--succes-fond: var(--wp--custom--sombre--succes-fond);
		--wp--custom--role--desactive-texte: var(--wp--custom--sombre--desactive-texte);
		--wp--custom--role--desactive-fond: var(--wp--custom--sombre--desactive-fond);
		--wp--custom--role--desactive-bord: var(--wp--custom--sombre--desactive-bord);
		--wp--custom--role--ombre: var(--wp--custom--sombre--ombre);
		--logo-plaque: 1;
		--pied-separation: inset 0 1px 0 var(--wp--custom--sombre--filet);
	}
}

@media screen {
	:root[data-apparence="sombre"] {
		color-scheme: dark;
		--wp--custom--role--fond: var(--wp--custom--sombre--fond);
		--wp--custom--role--fond-doux: var(--wp--custom--sombre--fond-doux);
		--wp--custom--role--fond-accent: var(--wp--custom--sombre--fond-accent);
		--wp--custom--role--surface: var(--wp--custom--sombre--surface);
		--wp--custom--role--texte: var(--wp--custom--sombre--texte);
		--wp--custom--role--texte-doux: var(--wp--custom--sombre--texte-doux);
		--wp--custom--role--accent: var(--wp--custom--sombre--accent);
		--wp--custom--role--accent-fort: var(--wp--custom--sombre--accent-fort);
		--wp--custom--role--filet: var(--wp--custom--sombre--filet);
		--wp--custom--role--contour: var(--wp--custom--sombre--contour);
		--wp--custom--role--focus: var(--wp--custom--sombre--focus);
		--wp--custom--role--saisie-fond: var(--wp--custom--sombre--saisie-fond);
		--wp--custom--role--saisie-bord: var(--wp--custom--sombre--saisie-bord);
		--wp--custom--role--pied-fond: var(--wp--custom--sombre--pied-fond);
		--wp--custom--role--erreur: var(--wp--custom--sombre--erreur);
		--wp--custom--role--erreur-fond: var(--wp--custom--sombre--erreur-fond);
		--wp--custom--role--succes: var(--wp--custom--sombre--succes);
		--wp--custom--role--succes-fond: var(--wp--custom--sombre--succes-fond);
		--wp--custom--role--desactive-texte: var(--wp--custom--sombre--desactive-texte);
		--wp--custom--role--desactive-fond: var(--wp--custom--sombre--desactive-fond);
		--wp--custom--role--desactive-bord: var(--wp--custom--sombre--desactive-bord);
		--wp--custom--role--ombre: var(--wp--custom--sombre--ombre);
		--logo-plaque: 1;
		--pied-separation: inset 0 1px 0 var(--wp--custom--sombre--filet);
	}

	/* « Clair » choisi sur un appareil en sombre : commandes natives en clair aussi */
	:root[data-apparence="clair"] { color-scheme: light; }
}
