/* Mode sombre — Benin Data Hub
   Activé par html[data-theme="dark"] (préférence système ou bouton lune).
   Les sections déjà sombres (hero, chiffres, carte, pied de page…) restent
   en bleu nuit ; seules les surfaces claires et les textes s'inversent. */

:root[data-theme="dark"] {
	color-scheme: dark;
	--dm-bg: #06121F;
	--dm-surface: #0C1D2F;
	--dm-surface-2: #11283F;
	--dm-heading: #F2F6F9;
	--bdh-white: var(--dm-bg);
	--bdh-soft: #091828;
	--bdh-ink: #D3DDE6;
	--bdh-muted: #95A8B8;
	--bdh-line: rgba(255, 255, 255, .1);
	--shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
	--shadow-md: 0 18px 40px -18px rgba(0, 0, 0, .6);
	--shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, .7);
}
:root[data-theme="dark"] body { background: var(--dm-bg); }

/* Titres et textes qui utilisaient le bleu nuit */
:root[data-theme="dark"] :is(h1, h2, h3, h4, h5, h6),
:root[data-theme="dark"] :is(.trust__item strong, .post-card__more, .contact__list strong, .field label, .single-post__lead, .entry-content .wp-block-quote, .entry-content th, .entry-content .bdh-stat-value),
:root[data-theme="dark"] a:hover { color: var(--dm-heading); }
:root[data-theme="dark"] .contact__list a { color: var(--bdh-ink); }

/* Sur-titres : vert plus lumineux pour rester lisible sur fond sombre */
:root[data-theme="dark"] :is(.eyebrow, .bdh-eyebrow) { color: #5FD3A6; }
:root[data-theme="dark"] :is(.section--dark, .hero, .page-hero, .bdh-section--dark) :is(.eyebrow, .bdh-eyebrow),
:root[data-theme="dark"] .section-head--light .eyebrow { color: var(--bdh-yellow); }

/* Bandeau défilant : fondu sur la couleur de fond sombre */
:root[data-theme="dark"] .trust::before { background: linear-gradient(90deg, var(--dm-bg), transparent); }
:root[data-theme="dark"] .trust::after { background: linear-gradient(-90deg, var(--dm-bg), transparent); }

/* En-tête */
:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .site-header.is-scrolled {
	color: var(--dm-heading);
	background: rgba(6, 18, 31, .92);
	box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
}
:root[data-theme="dark"] .has-hero .site-header:not(.is-scrolled) { background: transparent; box-shadow: none; }
:root[data-theme="dark"] .site-header .bdh-mark path { fill: #fff; }
:root[data-theme="dark"] .site-header .bdh-mark circle { fill: var(--bdh-navy); }
:root[data-theme="dark"] .site-header .brand__l2 { color: var(--bdh-yellow); }
:root[data-theme="dark"] .site-nav .sub-menu { color: var(--dm-heading); background: var(--dm-surface); border-color: var(--bdh-line); }
:root[data-theme="dark"] .site-nav .sub-menu .current-menu-item > a { background: var(--dm-surface-2); }
:root[data-theme="dark"] .lang-switch a[aria-current="true"] { background: #fff; color: var(--bdh-navy); }

/* Boutons : le principal passe au jaune, le secondaire en clair */
:root[data-theme="dark"] .btn--primary,
:root[data-theme="dark"] .wp-block-button:not(.is-style-outline) .wp-block-button__link,
:root[data-theme="dark"] .comment-form .submit {
	--btn-bg: var(--bdh-yellow);
	--btn-fg: var(--bdh-navy);
	--btn-bd: var(--bdh-yellow);
	color: var(--bdh-navy);
}
:root[data-theme="dark"] .comment-form .submit { background: var(--bdh-yellow); }
:root[data-theme="dark"] .btn--primary:hover { --btn-bg: #ffe04d; --btn-bd: #ffe04d; }
:root[data-theme="dark"] .btn--secondary,
:root[data-theme="dark"] .wp-block-button.is-style-outline .wp-block-button__link {
	--btn-fg: var(--dm-heading);
	--btn-bd: rgba(255, 255, 255, .45);
	color: var(--dm-heading);
	border-color: rgba(255, 255, 255, .45);
}
:root[data-theme="dark"] .btn--secondary:hover,
:root[data-theme="dark"] .wp-block-button.is-style-outline .wp-block-button__link:hover {
	--btn-bg: #fff;
	--btn-fg: var(--bdh-navy);
	--btn-bd: #fff;
	background: #fff;
	color: var(--bdh-navy);
}

/* Surfaces blanches → cartes sombres */
:root[data-theme="dark"] :is(.service-card, .post-card, .contact__form, .bdh-cards > .wp-block-column, .chain__node, .tabs__icon, .front-content) {
	background: var(--dm-surface);
	border-color: var(--bdh-line);
}
:root[data-theme="dark"] .env__card { background: rgba(8, 22, 37, .94); color: var(--bdh-ink); }
:root[data-theme="dark"] .env { color: var(--bdh-ink); }
:root[data-theme="dark"] .service-card__icon { background: rgba(0, 104, 71, .22); color: #5fd3a6; }
:root[data-theme="dark"] .service-card:hover .service-card__icon { background: var(--bdh-yellow); color: var(--bdh-navy); }
:root[data-theme="dark"] .chain__step.is-active .chain__node { background: var(--bdh-yellow); border-color: var(--bdh-yellow); color: var(--bdh-navy); }
:root[data-theme="dark"] .tabs__tab:hover,
:root[data-theme="dark"] .tabs__tab[aria-selected="true"] { color: var(--dm-heading); background: var(--dm-surface); }
:root[data-theme="dark"] .tabs__panels { background: var(--dm-surface-2); }
:root[data-theme="dark"] :is(.std-item, .cta-band__box, .bdh-callout, .entry-content .bdh-callout) { background: var(--dm-surface-2); }
:root[data-theme="dark"] .std-item:nth-child(2) { background: #12302A; }
:root[data-theme="dark"] .related + .cta-band { background: linear-gradient(180deg, var(--bdh-soft) 50%, var(--dm-bg) 50%); }

/* Puces, filtres, pagination, tags, réseaux */
:root[data-theme="dark"] :is(.cat-filter a, .page-numbers, .socials a) { color: var(--dm-heading); border-color: rgba(255, 255, 255, .18); }
:root[data-theme="dark"] :is(.cat-filter a[aria-current="page"], .page-numbers.current, .cat-filter a:hover, a.page-numbers:hover) {
	color: var(--bdh-navy);
	background: var(--bdh-yellow);
	border-color: var(--bdh-yellow);
}
:root[data-theme="dark"] .tags a { color: var(--dm-heading); background: var(--dm-surface-2); }
:root[data-theme="dark"] .socials a:hover { color: var(--bdh-navy); background: var(--bdh-yellow); border-color: var(--bdh-yellow); }
:root[data-theme="dark"] :is(.post-card__cat, .status) { background: rgba(0, 104, 71, .25); color: #7fe0b8; }
:root[data-theme="dark"] :is(.contact__icon, .checklist .icon--shield, .search-form button) { background: var(--dm-surface-2); color: var(--bdh-yellow); }
:root[data-theme="dark"] .bdh-steps > li::before { background: var(--dm-surface-2); color: var(--bdh-yellow); }

/* Formulaires */
:root[data-theme="dark"] :is(.contact-form input, .contact-form select, .contact-form textarea, .search-form input[type="search"], .comment-form input, .comment-form textarea) {
	color: var(--dm-heading);
	background: var(--dm-bg);
	border-color: rgba(255, 255, 255, .16);
}
:root[data-theme="dark"] .search-form input[type="search"]:focus { background: var(--dm-surface-2); }
:root[data-theme="dark"] .contact-form .is-invalid { background: #2a0d14 !important; }

/* Contenu éditorial */
:root[data-theme="dark"] .entry-content :is(code, th) { background: var(--dm-surface-2); }
:root[data-theme="dark"] .has-navy-color { color: var(--dm-heading) !important; }
:root[data-theme="dark"] .has-white-background-color { background-color: var(--dm-surface) !important; }
:root[data-theme="dark"] main img:not(.hero__img) { filter: brightness(.92); }

/* 404 */
:root[data-theme="dark"] .has-hero .error-404 { color: var(--bdh-ink); }
:root[data-theme="dark"] .has-hero.error404 .site-header:not(.is-scrolled) { color: var(--dm-heading); }

/* Bouton de bascule clair / sombre */
.theme-toggle {
	position: relative;
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 1px solid var(--bdh-line);
	border-radius: 50%;
	cursor: pointer;
	transition: border-color .25s ease, transform .4s var(--ease-out);
}
.theme-toggle:hover { transform: rotate(-18deg); border-color: currentColor; }
.theme-toggle svg { grid-area: 1 / 1; width: 19px; height: 19px; transition: opacity .35s ease, transform .5s var(--ease-out); }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.4); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.4); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: none; color: var(--bdh-yellow); }
.has-hero .site-header:not(.is-scrolled) .theme-toggle { border-color: rgba(255, 255, 255, .35); }

/* Transition douce pendant la bascule */
:root.theme-switching *,
:root.theme-switching *::before,
:root.theme-switching *::after {
	transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease !important;
}
@media (prefers-reduced-motion: reduce) {
	:root.theme-switching *,
	:root.theme-switching *::before,
	:root.theme-switching *::after { transition: none !important; }
}

/* Référencement : sommaire, FAQ, plan du site */
:root[data-theme="dark"] :is(.toc__box, .faq-item, .sitemap__col) { background: var(--dm-surface); }
:root[data-theme="dark"] :is(.toc__title, .faq-item__q, .sitemap__list a) { color: var(--dm-heading); }
:root[data-theme="dark"] :is(.toc__num, .sitemap__icon, .sitemap__chip, .faq-item__plus) { background: var(--dm-surface-2); color: #5FD3A6; }
:root[data-theme="dark"] .toc__icon i { background: #5FD3A6; }
:root[data-theme="dark"] .toc__list a:hover { background: var(--dm-surface-2); color: #5FD3A6; }
:root[data-theme="dark"] .toc__list a.is-active { background: rgba(95, 211, 166, .1); color: #5FD3A6; }
:root[data-theme="dark"] .toc__list a.is-active .toc__num { background: #5FD3A6; color: var(--dm-bg); }
:root[data-theme="dark"] .faq-item__num { color: #5FD3A6; }
:root[data-theme="dark"] .faq-item__plus::before,
:root[data-theme="dark"] .faq-item__plus::after { background: var(--dm-heading); }
:root[data-theme="dark"] .faq-item[open] .faq-item__plus { background: #5FD3A6; }
:root[data-theme="dark"] .faq-item[open] .faq-item__plus::before,
:root[data-theme="dark"] .faq-item[open] .faq-item__plus::after { background: var(--dm-bg); }
:root[data-theme="dark"] :is(.faq-item:hover, .faq-item[open]) { border-color: rgba(95, 211, 166, .35); }
