/**
 * H2A Accessibility Tools : couche de contraste renforcé (body.high-contrast).
 * Chargée à part du panneau (css/accessibility.css) ; absente en mode « thème seul ».
 */

/* ==========================================================================
   Contraste renforcé

   Couche 1 — structurelle (modes « générique » et « les deux ») : ce que les
   couleurs des presets ne peuvent pas corriger (soulignement des liens, focus,
   dégradés, texte sur image, ombres).
   Couche 2 — palette de repli (body.h2a-hc-generic) : appliquée seulement
   quand ni le thème parent ni l'enfant ne fournissent de CSS de contraste.
   Variables surchargeables : --h2a-hc-*.
   ========================================================================== */

body.high-contrast {
	--h2a-hc-bg: #000000;
	--h2a-hc-fg: #ffffff;
	--h2a-hc-link: #ffff00;
	--h2a-hc-border: #ffffff;
	--h2a-hc-input-bg: #000000;
	--h2a-hc-media-border: #ffff00;
	--h2a-hc-focus: #00ffff;
}

/* Couche 1 */
body.high-contrast:not(.h2a-contrast-mode-theme) :where(a):not(.wp-element-button):not(.wp-block-button__link):not(.h2a-accessibility-wrapper *) {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

body.high-contrast:not(.h2a-contrast-mode-theme) :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--h2a-hc-focus) !important;
	outline-offset: 2px !important;
}

body.high-contrast:not(.h2a-contrast-mode-theme) *:not(.h2a-accessibility-wrapper):not(.h2a-accessibility-wrapper *) {
	text-shadow: none !important;
}

/* Dégradés et voiles : aplatis, le texte ne peut pas être lu sur un dégradé. */
body.high-contrast:not(.h2a-contrast-mode-theme) [style*="gradient"]:not(.h2a-accessibility-wrapper *),
body.high-contrast:not(.h2a-contrast-mode-theme) .has-background-gradient:not(.h2a-accessibility-wrapper *) {
	background-image: none !important;
}

body.high-contrast:not(.h2a-contrast-mode-theme) .wp-block-cover__image-overlay,
body.high-contrast:not(.h2a-contrast-mode-theme) .wp-block-cover__gradient-background {
	opacity: 1 !important;
	background-image: none !important;
}

/* Couche 2 — palette de repli */
body.high-contrast.h2a-hc-generic,
body.high-contrast.h2a-hc-generic *:not(.h2a-accessibility-wrapper):not(.h2a-accessibility-wrapper *):not(svg *):not(img):not(video) {
	background-color: var(--h2a-hc-bg) !important;
	color: var(--h2a-hc-fg) !important;
	border-color: var(--h2a-hc-border) !important;
	box-shadow: none !important;
}

body.high-contrast.h2a-hc-generic a:not(.h2a-accessibility-wrapper *) {
	color: var(--h2a-hc-link) !important;
}

body.high-contrast.h2a-hc-generic a:not(.h2a-accessibility-wrapper *):hover,
body.high-contrast.h2a-hc-generic a:not(.h2a-accessibility-wrapper *):focus {
	color: var(--h2a-hc-fg) !important;
}

body.high-contrast.h2a-hc-generic :is(button, input, select, textarea, .wp-element-button, .wp-block-button__link):not(.h2a-accessibility-wrapper *) {
	background-color: var(--h2a-hc-input-bg) !important;
	color: var(--h2a-hc-fg) !important;
	border: 2px solid var(--h2a-hc-border) !important;
}

body.high-contrast.h2a-hc-generic :is(img, video, canvas):not(.h2a-accessibility-wrapper *) {
	outline: 2px solid var(--h2a-hc-media-border);
}
