/* ==========================================================
   Thème sombre — activé par data-theme="dark" sur <html>
   (posé avant l'affichage par le script de functions.php :
   choix enregistré du visiteur, sinon réglage de son système)
   ========================================================== */

/* La palette est redéfinie : chaque couleur garde son rôle (fond, texte, accent) */
html[data-theme="dark"] {
	color-scheme: dark;
	--wp--preset--color--creme: #121714;
	--wp--preset--color--papier: #1A201C;
	--wp--preset--color--sable: #232A25;
	--wp--preset--color--trait: #2F3833;
	--wp--preset--color--menthe: #182620;
	--wp--preset--color--encre: #EDE8DD;
	--wp--preset--color--texte: #CDD4CE;
	--wp--preset--color--attenue: #A0AAA3;
	--wp--preset--color--vert: #8CC2A5;
	--lc-vert-fond: #173A2C;
	--lc-noir: #0B0F0D;
}

/* Fonds qui doivent rester sombres alors que leur couleur sert aussi de texte */
html[data-theme="dark"] .has-vert-background-color { background-color: var(--lc-vert-fond) !important; }
html[data-theme="dark"] .has-encre-background-color { background-color: var(--lc-noir) !important; }
html[data-theme="dark"] .has-creme-color { color: #F3EEE4 !important; }
html[data-theme="dark"] .has-trait-color { color: #C9C2B2 !important; }
html[data-theme="dark"] .has-encre-background-color a { color: #C9C2B2; }

/* Carte mise en avant (formule Visible) */
html[data-theme="dark"] .lc-carte.lc-sombre {
	background: var(--lc-vert-fond);
	color: #F3EEE4;
	border-color: #2E5A47;
}
html[data-theme="dark"] .wp-block-button.is-style-clair .wp-block-button__link {
	background: #F3EEE4;
	color: #121714;
}

/* Badge du bilan gratuit : texte foncé sur le vert clair */
html[data-theme="dark"] .lc-bilan .lc-badge { color: #121714; }

/* En-tête collant */
html[data-theme="dark"] header.wp-block-template-part.is-scrolled {
	background: rgba(18, 23, 20, .9);
	box-shadow: 0 1px 0 var(--wp--preset--color--trait), 0 8px 24px -16px rgba(0, 0, 0, .8);
}

/* Ombres : plus discrètes, sinon elles salissent le fond */
html[data-theme="dark"] .lc-image.lc-ecran img,
html[data-theme="dark"] .lc-cartes > .wp-block-column > .wp-block-group:hover,
html[data-theme="dark"] .lc-carte:hover { box-shadow: 0 18px 36px -24px rgba(0, 0, 0, .9); }
html[data-theme="dark"] .wp-block-button__link:hover { box-shadow: 0 10px 20px -12px rgba(0, 0, 0, .9); }

/* Illustrations (fonds clairs) : légèrement atténuées pour ne pas éblouir */
html[data-theme="dark"] .lc-image img[src$=".svg"] { filter: brightness(.9); }

/* Divers filets codés en dur */
html[data-theme="dark"] .lc-fiche { border-top-color: #3A443E; }
html[data-theme="dark"] .lc-filet { border-top-color: #3A443E; }
html[data-theme="dark"] .has-vert-background-color .lc-filet { border-top-color: #2E5A47; }

/* Focus clavier : visible sur fond sombre comme sur fond vert */
html[data-theme="dark"] .has-vert-background-color :focus-visible,
html[data-theme="dark"] .has-encre-background-color :focus-visible { outline-color: #F3EEE4; }

/* Formulaire */
html[data-theme="dark"] .lc-champ input,
html[data-theme="dark"] .lc-champ select,
html[data-theme="dark"] .lc-champ textarea {
	background: #1A201C;
	border-color: #66716A;
}
html[data-theme="dark"] .lc-champ input:focus,
html[data-theme="dark"] .lc-champ select:focus,
html[data-theme="dark"] .lc-champ textarea:focus { box-shadow: 0 0 0 3px rgba(140, 194, 165, .25); }
html[data-theme="dark"] .lc-champ-erreur input,
html[data-theme="dark"] .lc-champ-erreur textarea { border-color: #F08A8A; }
html[data-theme="dark"] .lc-erreur { color: #F08A8A; }
html[data-theme="dark"] .lc-form-erreurs { border-color: #F08A8A; background: #331C1C; }
html[data-theme="dark"] .lc-form-erreurs a { color: #F6B4B4; }

/* Effets (assets/css/effets.css) */
html[data-theme="dark"] .lcx-progression { background: var(--wp--preset--color--vert); }
html[data-theme="dark"] .lcx-hero::before { background: radial-gradient(circle at 30% 30%, rgba(140, 194, 165, .14) 0%, rgba(140, 194, 165, 0) 65%); }
html[data-theme="dark"] .lcx-bandeau { background: var(--lc-noir); border-block-color: var(--wp--preset--color--trait); }
html[data-theme="dark"] .lcx-sommaire { background: rgba(18, 23, 20, .94); border-bottom-color: var(--wp--preset--color--trait); }
html[data-theme="dark"] .lcx-sommaire a { color: var(--wp--preset--color--texte); }
html[data-theme="dark"] .lcx-sommaire a:hover { border-color: #4A554E; }
html[data-theme="dark"] .lcx-sommaire a[aria-current] { background: var(--wp--preset--color--vert); color: #121714; }
html[data-theme="dark"] .lcx-avant-apres { border-color: var(--wp--preset--color--trait); }

/* ==========================================================
   Bouton de bascule clair / sombre (ajouté par interactions.js)
   ========================================================== */
.lc-theme {
	width: 44px;
	height: 44px;
	border-radius: 999px;
	border: 1.5px solid var(--wp--preset--color--trait);
	background: transparent;
	color: var(--wp--preset--color--encre);
	display: inline-grid;
	place-items: center;
	cursor: pointer;
	transition: border-color .2s ease, background-color .2s ease;
}
.lc-theme:hover { border-color: var(--wp--preset--color--vert); }
.lc-theme svg { width: 20px; height: 20px; }
.lc-theme .lc-soleil { display: none; }
html[data-theme="dark"] .lc-theme .lc-soleil { display: block; }
html[data-theme="dark"] .lc-theme .lc-lune { display: none; }
