/*
 * Iwego Accessibilité — effets sur la page.
 * Les réglages de la barre posent des classes sur <html> (iwego-a11y-…).
 * L'interface de la barre est dans un shadow DOM (#iwego-a11y-root) : ces règles ne la touchent pas.
 */

/* ---------- Utilitaires ---------- */
.iwego-a11y-sr {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.iwego-a11y-fichier { font-size: .85em; white-space: nowrap; }

/* ---------- Lien d'évitement ajouté par l'extension ---------- */
.iwego-a11y-evitement {
    position: absolute; left: 1rem; top: -100px; z-index: 2147483646;
    padding: .75em 1.25em; background: #fff; color: #000; font: 600 16px/1.3 system-ui, sans-serif;
    border: 3px solid #000; border-radius: 4px; text-decoration: underline;
}
.iwego-a11y-evitement:focus { top: 1rem; }

/* ---------- Focus toujours visible ---------- */
html.iwego-a11y-focus :focus-visible {
    outline: 3px solid var(--iwego-a11y-focus, #1f4e79) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px #fff !important;
}

/* ---------- Respect de « réduire les animations » du système ---------- */
@media (prefers-reduced-motion: reduce) {
    html.iwego-a11y-mouvement *, html.iwego-a11y-mouvement *::before, html.iwego-a11y-mouvement *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
}

/* ---------- Interlignage / espacements (critère 10.12 : 1,5 ; 0,12 ; 0,16 ; 2× paragraphes) ---------- */
html.iwego-a11y-interligne-1 body :where(*:not(#iwego-a11y-root)) { line-height: 1.5 !important; }
html.iwego-a11y-interligne-2 body :where(*:not(#iwego-a11y-root)) { line-height: 1.8 !important; }
html.iwego-a11y-interligne-3 body :where(*:not(#iwego-a11y-root)) { line-height: 2.1 !important; }
html[class*="iwego-a11y-interligne-"] body :where(main, article, [role="main"], .entry-content) p { margin-bottom: 2em !important; }

html.iwego-a11y-espacement-1 body :where(*:not(#iwego-a11y-root)) { letter-spacing: .12em !important; word-spacing: .16em !important; }
html.iwego-a11y-espacement-2 body :where(*:not(#iwego-a11y-root)) { letter-spacing: .2em !important; word-spacing: .3em !important; }

/* ---------- Polices (les polices d'icônes sont épargnées) ---------- */
html.iwego-a11y-police-lisible body :where(*:not(#iwego-a11y-root):not(i):not(svg):not(svg *):not([class*="fa-"]):not([class*="icon"]):not([class*="dashicons"]):not(.material-icons)) {
    font-family: 'Iwego A11y Lisible', Verdana, Arial, sans-serif !important;
}
html.iwego-a11y-police-dyslexie body :where(*:not(#iwego-a11y-root):not(i):not(svg):not(svg *):not([class*="fa-"]):not([class*="icon"]):not([class*="dashicons"]):not(.material-icons)) {
    font-family: 'Iwego A11y Dyslexie', 'Comic Sans MS', Verdana, sans-serif !important;
}

/* ---------- Alignement ---------- */
html.iwego-a11y-alignement body :where(p, li, dd, dt, blockquote, td, th, h1, h2, h3, h4, h5, h6, figcaption, label) { text-align: left !important; }

/* ---------- Contraste renforcé ---------- */
html.iwego-a11y-contraste-clair body, html.iwego-a11y-contraste-clair body :where(*:not(#iwego-a11y-root):not(img):not(video):not(svg):not(svg *):not(picture):not(canvas)) {
    background-color: #fff !important; background-image: none !important; color: #000 !important;
    border-color: #000 !important; text-shadow: none !important; box-shadow: none !important;
}
html.iwego-a11y-contraste-clair body a, html.iwego-a11y-contraste-clair body a * { color: #0000c8 !important; text-decoration: underline !important; }
html.iwego-a11y-contraste-clair body :where(button, input, select, textarea) { border: 2px solid #000 !important; }

html.iwego-a11y-contraste-sombre body, html.iwego-a11y-contraste-sombre body :where(*:not(#iwego-a11y-root):not(img):not(video):not(svg):not(svg *):not(picture):not(canvas)) {
    background-color: #000 !important; background-image: none !important; color: #fff !important;
    border-color: #fff !important; text-shadow: none !important; box-shadow: none !important;
}
html.iwego-a11y-contraste-sombre body a, html.iwego-a11y-contraste-sombre body a * { color: #ffeb3b !important; text-decoration: underline !important; }
html.iwego-a11y-contraste-sombre body :where(button, input, select, textarea) { border: 2px solid #fff !important; }
html.iwego-a11y-contraste-sombre body svg:not([fill]) , html.iwego-a11y-contraste-clair body svg:not([fill]) { color: inherit; }

/* ---------- Niveaux de gris ---------- */
/* sur <html> : le filtre ne crée pas de bloc conteneur pour les éléments fixes (en-têtes collants, modales) */
html.iwego-a11y-gris { filter: grayscale(1) !important; }

/* ---------- Liens / titres ---------- */
html.iwego-a11y-liens body a:not(.iwego-a11y-evitement) {
    text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 3px !important;
    outline: 2px dashed currentColor !important; outline-offset: 2px !important;
}
html.iwego-a11y-titres body :where(h1, h2, h3, h4, h5, h6) {
    outline: 3px solid currentColor !important; outline-offset: 4px !important;
}

/* ---------- Grand curseur ---------- */
html.iwego-a11y-curseur, html.iwego-a11y-curseur * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 3l30 27H22l8 15-6 3-8-15-10 9z' fill='%23000' stroke='%23fff' stroke-width='2.5'/%3E%3C/svg%3E") 6 3, auto !important;
}
html.iwego-a11y-curseur :where(a, button, [role="button"], label, select, summary) {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M18 4a4 4 0 018 0v16l12 3a5 5 0 014 6l-3 13a6 6 0 01-6 4H22a6 6 0 01-5-3L8 30a4 4 0 016-5l4 4z' fill='%23000' stroke='%23fff' stroke-width='2.5'/%3E%3C/svg%3E") 20 4, pointer !important;
}

/* ---------- Arrêt des animations ---------- */
html.iwego-a11y-animations *, html.iwego-a11y-animations *::before, html.iwego-a11y-animations *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* ---------- Lecture audio : bloc en cours de lecture ---------- */
.iwego-a11y-lecture-en-cours {
    outline: 3px solid #f5b800 !important; outline-offset: 4px !important;
    background-color: rgba(245, 184, 0, .15) !important;
}

@media print {
    #iwego-a11y-root { display: none !important; }
}

/* ---------- Plan du site et déclaration (mise en page minimale, surchargeable par le thème) ---------- */
.iwego-a11y-plan, .iwego-a11y-declaration { padding: 2em 0 4em; }
.iwego-a11y-plan > ul { margin: 0 0 2.5em; padding-left: 1.2em; columns: 2 18em; column-gap: 3em; }
.iwego-a11y-plan li { margin: .35em 0; break-inside: avoid; }
.iwego-a11y-plan ul ul { columns: auto; margin: .3em 0; }
.iwego-a11y-declaration h2 { margin-top: 1.6em; }
.iwego-a11y-declaration ul { padding-left: 1.2em; }
