/**
 * Confort de lecture : réglages du panneau « Affichage », communs à tous les thèmes enfants
 * (voir functions/components/reading-preferences.php).
 * Chaque réglage actif est listé dans l'attribut data-reading de <html>. Les styles des thèmes fixent
 * police et interlignage à de nombreux endroits : les réglages les remplacent donc avec !important,
 * comme le ferait une feuille de style utilisateur (critère RGAA 10.12, WCAG 1.4.12).
 * La barre d'administration WordPress n'est pas concernée.
 */

@font-face {
	font-family: "OpenDyslexic";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/OpenDyslexic-400-normal.woff2") format("woff2");
}

@font-face {
	font-family: "OpenDyslexic";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/OpenDyslexic-400-italic.woff2") format("woff2");
}

@font-face {
	font-family: "OpenDyslexic";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/OpenDyslexic-700-normal.woff2") format("woff2");
}

@font-face {
	font-family: "OpenDyslexic";
	font-style: italic;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/OpenDyslexic-700-italic.woff2") format("woff2");
}

/* Police adaptée à la dyslexie (le code garde une police à chasse fixe) */
:root[data-reading~="dyslexic-font"] body :not(#wpadminbar, #wpadminbar *, code, kbd, pre, samp) {
	font-family: "OpenDyslexic", sans-serif !important;
}

/* Interlignage augmenté, plus resserré sur les titres pour qu'ils restent lisibles d'un bloc */
:root[data-reading~="line-height"] body :not(#wpadminbar, #wpadminbar *) {
	line-height: 2 !important;
}

:root[data-reading~="line-height"] body :is(h1, h2, h3, h4, h5, h6, h1 *, h2 *, h3 *, h4 *, h5 *, h6 *) {
	line-height: 1.5 !important;
}

/* Lettres et mots espacés (valeurs du critère WCAG 1.4.12) */
:root[data-reading~="spacing"] body :not(#wpadminbar, #wpadminbar *) {
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}

/* Texte non justifié : seuls les textes justifiés par les contributeurs sont concernés */
:root[data-reading~="no-justify"] body :is([style*="text-align: justify"], [style*="text-align:justify"], .has-text-align-justify) {
	text-align: start !important;
}

/* Liens soulignés, y compris dans les menus, boutons et cartes */
:root[data-reading~="underline-links"] body a:not(#wpadminbar a) {
	text-decoration-line: underline !important;
	text-decoration-thickness: max(1px, 0.0625em) !important;
	text-underline-offset: 0.15em !important;
}
