/* Accessibilité : boutons Dys et daltonien (même principe que Nosavel), thème clair Cortex. */
@font-face { font-family: "OpenDyslexic"; src: url("/media/a11y/fonts/opendyslexic-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "OpenDyslexic"; src: url("/media/a11y/fonts/opendyslexic-latin-700-normal.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "Lexend"; src: url("/media/a11y/fonts/lexend-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lexend"; src: url("/media/a11y/fonts/lexend-latin-600-normal.woff2") format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/media/a11y/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/media/a11y/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 500 800; font-display: swap; }

:root { --a11y-accent: #ea580c; --a11y-ink: #1c1917; --a11y-muted: #57534e; --a11y-line: #e7e5e4; --a11y-bg: #ffffff; }

/* ----- Lecture adaptée (dys) ----- */
html.dys body, html.dys body *:not(svg):not(svg *):not(.anticon):not(.anticon *):not(code):not(pre) { font-family: var(--dys-font), sans-serif !important; }
html.dys body { zoom: var(--dys-zoom, 1); }
html.dys body * { font-style: normal !important; text-transform: none !important; }
html.dys :is(p, li, blockquote, .ql-editor, .jodit, td, dd) { text-align: left !important; }
html.dys :is(.bg-clip-text, .text-transparent) { background: none !important; -webkit-background-clip: border-box !important; background-clip: border-box !important; color: inherit !important; }
html.dys-spacing body * { letter-spacing: 0.02em !important; word-spacing: 0.1em; }
html.dys-spacing :is(p, li, blockquote, td, dd, label, small, .ql-editor, .jodit) { line-height: 1.8 !important; }
.reading-ruler { position: fixed; left: 0; right: 0; top: 0; height: 44px; z-index: 2147483000; pointer-events: none; background: rgba(255, 237, 180, 0.12); border-top: 1px solid rgba(234, 88, 12, 0.45); border-bottom: 1px solid rgba(234, 88, 12, 0.45); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.22); }
.reading-ruler[hidden] { display: none; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }

/* ----- Daltonisme : palettes de remplacement (Okabe-Ito) pour les couleurs d'état ----- */
html[data-cvd="protan"], html[data-cvd="deutan"] { --cvd-ok: #0072b2; --cvd-ok-bg: #e5f1f8; --cvd-ko: #d55e00; --cvd-ko-bg: #fbeee5; --cvd-wait: #8a6d00; --cvd-wait-bg: #fdf6d8; --cvd-info: #56b4e9; --cvd-info-bg: #eaf5fc; }
html[data-cvd="tritan"] { --cvd-ok: #009e73; --cvd-ok-bg: #e5f5f0; --cvd-ko: #c62828; --cvd-ko-bg: #fdecec; --cvd-wait: #cc79a7; --cvd-wait-bg: #f9eef4; --cvd-info: #444444; --cvd-info-bg: #f0f0f0; }
html[data-cvd="achroma"] { --cvd-ok: #111111; --cvd-ok-bg: #ffffff; --cvd-ko: #111111; --cvd-ko-bg: #d9d9d9; --cvd-wait: #444444; --cvd-wait-bg: #f0f0f0; --cvd-info: #666666; --cvd-info-bg: #fafafa; }

/* Étiquettes et alertes de l'espace (Ant Design) */
html[data-cvd] :is(.ant-tag-green, .ant-tag-success) { color: var(--cvd-ok) !important; background: var(--cvd-ok-bg) !important; border: 2px solid var(--cvd-ok) !important; }
html[data-cvd] :is(.ant-tag-red, .ant-tag-error, .ant-tag-volcano) { color: var(--cvd-ko) !important; background: var(--cvd-ko-bg) !important; border: 2px dashed var(--cvd-ko) !important; }
html[data-cvd] :is(.ant-tag-orange, .ant-tag-gold, .ant-tag-warning) { color: var(--cvd-wait) !important; background: var(--cvd-wait-bg) !important; border: 2px dotted var(--cvd-wait) !important; }
html[data-cvd] :is(.ant-tag-blue, .ant-tag-cyan, .ant-tag-geekblue, .ant-tag-processing) { color: var(--cvd-info) !important; background: var(--cvd-info-bg) !important; border: 1px solid var(--cvd-info) !important; }
html[data-cvd] :is(.ant-tag-green, .ant-tag-success)::before { content: "✓ "; font-weight: 700; }
html[data-cvd] :is(.ant-tag-red, .ant-tag-error, .ant-tag-volcano)::before { content: "✗ "; font-weight: 700; }
html[data-cvd] :is(.ant-tag-orange, .ant-tag-gold, .ant-tag-warning)::before { content: "! "; font-weight: 700; }
html[data-cvd] .ant-alert-success { border: 2px solid var(--cvd-ok) !important; background: var(--cvd-ok-bg) !important; }
html[data-cvd] .ant-alert-error { border: 2px dashed var(--cvd-ko) !important; background: var(--cvd-ko-bg) !important; }
html[data-cvd] .ant-alert-warning { border: 2px dotted var(--cvd-wait) !important; background: var(--cvd-wait-bg) !important; }
html[data-cvd] .ant-alert-success .ant-alert-icon { color: var(--cvd-ok) !important; }
html[data-cvd] .ant-alert-error .ant-alert-icon { color: var(--cvd-ko) !important; }
html[data-cvd] .ant-alert-warning .ant-alert-icon { color: var(--cvd-wait) !important; }
html[data-cvd] .ant-progress-success-bg, html[data-cvd] .ant-progress-status-success .ant-progress-bg { background-color: var(--cvd-ok) !important; }
html[data-cvd] .ant-progress-status-exception .ant-progress-bg { background-color: var(--cvd-ko) !important; }
html[data-cvd] :is(.ant-btn-dangerous, .ant-typography-danger) { color: var(--cvd-ko) !important; border-color: var(--cvd-ko) !important; }
html[data-cvd] .ant-btn-dangerous.ant-btn-primary { color: #fff !important; background: var(--cvd-ko) !important; }
html[data-cvd] .ant-badge-count { background: var(--cvd-ko) !important; }
html[data-cvd] .ant-steps-item-error .ant-steps-item-icon { border-style: dashed !important; }
/* Liens : soulignés pour ne pas dépendre de la couleur */
html[data-cvd] :is(.ql-editor, .jodit, .ant-typography, p) a { text-decoration: underline !important; }
html[data-cvd="achroma"] a { text-decoration: underline !important; }

/* ----- Boutons et panneau ----- */
.a11y-dock { position: fixed; right: 18px; bottom: 18px; z-index: 2147483001; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-family: Nunito, "Segoe UI", Arial, sans-serif; }
.a11y-dock[hidden] { display: none; }
.a11y-dock--left { right: auto; left: 18px; align-items: flex-start; }
.a11y-dock--raised { bottom: 96px; }
.a11y-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 48px; height: 48px; padding: 0 14px; border-radius: 999px; cursor: pointer; border: 1px solid var(--a11y-line); background: rgba(255, 255, 255, 0.92); color: var(--a11y-ink); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.35); font-size: 13px; font-weight: 700; transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.a11y-btn:hover { transform: translateY(-2px); border-color: var(--a11y-accent); }
.a11y-btn:focus-visible { outline: 3px solid var(--a11y-accent); outline-offset: 2px; }
.a11y-btn.on { border-color: var(--a11y-accent); box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.35), 0 8px 24px -10px rgba(0, 0, 0, 0.35); }
.a11y-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
#a11yDys b { font-family: "OpenDyslexic", Arial, sans-serif !important; font-size: 15px; font-weight: 700; }
.a11y-panel { position: absolute; right: 0; bottom: calc(100% + 10px); width: min(360px, calc(100vw - 36px)); max-height: min(70vh, 640px); overflow: auto; padding: 16px 18px; border-radius: 18px; background: var(--a11y-bg); color: var(--a11y-ink); border: 1px solid var(--a11y-line); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45); text-align: left; }
.a11y-dock--left .a11y-panel { right: auto; left: 0; }
.a11y-panel[hidden] { display: none; }
.a11y-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.a11y-head b { font-size: 16px; font-weight: 800; }
.a11y-x { border: 0; background: none; color: var(--a11y-muted); font-size: 24px; cursor: pointer; line-height: 1; }
.a11y-switch { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; font-size: 14px; }
.a11y-switch input, .a11y-option input { accent-color: var(--a11y-accent); width: 17px; height: 17px; margin-top: 2px; flex: none; }
.a11y-group { padding: 8px 0; border-top: 1px solid var(--a11y-line); }
.a11y-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--a11y-muted); margin-bottom: 6px; font-weight: 700; }
.a11y-option { display: flex; gap: 10px; padding: 7px 8px; border-radius: 12px; cursor: pointer; }
.a11y-option:hover { background: #faf7f4; }
.a11y-option span { display: flex; flex-direction: column; }
.a11y-option b { font-weight: 700; font-size: 14px; }
.a11y-option small { color: var(--a11y-muted); font-size: 12px; line-height: 1.4; }
.a11y-sizes { display: flex; gap: 6px; }
.a11y-sizes button { flex: 1; padding: 8px 0; border-radius: 10px; border: 1px solid var(--a11y-line); background: #fafaf9; color: var(--a11y-ink); cursor: pointer; font-weight: 700; }
.a11y-sizes button.on { border-color: var(--a11y-accent); background: #fff1e6; }
.a11y-preview { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; }
.a11y-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.a11y-pill.is-ok { color: #237804; background: #f6ffed; border-color: #b7eb8f; }
.a11y-pill.is-ko { color: #cf1322; background: #fff1f0; border-color: #ffa39e; }
.a11y-pill.is-wait { color: #ad6800; background: #fffbe6; border-color: #ffe58f; }
.a11y-pill.is-info { color: #0958d9; background: #e6f4ff; border-color: #91caff; }
html[data-cvd] .a11y-pill.is-ok { color: var(--cvd-ok); background: var(--cvd-ok-bg); border: 2px solid var(--cvd-ok); }
html[data-cvd] .a11y-pill.is-ko { color: var(--cvd-ko); background: var(--cvd-ko-bg); border: 2px dashed var(--cvd-ko); }
html[data-cvd] .a11y-pill.is-wait { color: var(--cvd-wait); background: var(--cvd-wait-bg); border: 2px dotted var(--cvd-wait); }
html[data-cvd] .a11y-pill.is-info { color: var(--cvd-info); background: var(--cvd-info-bg); border-color: var(--cvd-info); }
html[data-cvd] .a11y-pill.is-ok::before { content: "✓ "; }
html[data-cvd] .a11y-pill.is-ko::before { content: "✗ "; }
html[data-cvd] .a11y-pill.is-wait::before { content: "! "; }
.a11y-note { font-size: 12px; color: var(--a11y-muted); margin: 8px 0 0; line-height: 1.5; }
@media (max-width: 860px) {
  .a11y-btn span { display: none; }
  .a11y-btn { min-width: 44px; height: 44px; padding: 0; }
  .a11y-dock { right: 12px; bottom: 12px; }
  .a11y-dock--left { left: 12px; bottom: 76px; }
  .a11y-dock--raised { bottom: 88px; }
}
@media print { .a11y-dock, .reading-ruler { display: none !important; } }
