/* public/assets/css/a11y.css — menu d'accessibilité des pages publiques (classes posées sur <html> par templates/_a11y.html.twig)
   Couleurs via les variables de tokens.css ; seuls le contraste renforcé, le focus et le curseur ont des valeurs fixes, voulues. */

.a11y-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html:not(.js) .a11y { display: none; }

/* ---------- Bouton flottant ---------- */
.a11y-fab {
    position: fixed; left: 16px; bottom: 16px; z-index: 950;
    width: 52px; height: 52px; display: grid; place-items: center;
    border: 2px solid var(--cd-surface); border-radius: 50%;
    background: var(--cd-brand); color: var(--cd-on-brand);
    box-shadow: var(--cd-shadow-panel); cursor: pointer;
    transition: transform 0.2s;
}
.a11y-fab:hover { transform: scale(1.06); }
.a11y-fab svg { width: 28px; height: 28px; }
.a11y-fab:focus-visible, .a11y button:focus-visible { outline: 3px solid var(--cd-accent-ink); outline-offset: 3px; }
html.intro .a11y-fab { display: none; }
@media print { .a11y { display: none !important; } }

/* ---------- Panneau ---------- */
.a11y-panel {
    position: fixed; left: 16px; bottom: 80px; z-index: 951;
    width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px);
    display: flex; flex-direction: column;
    background: var(--cd-surface-card); color: var(--cd-ink);
    border: 1px solid var(--cd-border-strong); border-radius: var(--cd-radius-lg);
    box-shadow: var(--cd-shadow-card);
    font-family: var(--cd-font-sans); font-size: 0.95rem; line-height: 1.45; text-align: left;
}
.a11y-panel[hidden] { display: none; }
.a11y-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--cd-border); }
.a11y-head h2 { margin: 0; font-family: var(--cd-font-serif); font-size: 1.25rem; font-weight: 700; color: var(--cd-ink); }
.a11y-close { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--cd-radius-md); background: transparent; color: var(--cd-slate); cursor: pointer; }
.a11y-close:hover { background: rgb(var(--cd-tint) / 0.08); color: var(--cd-ink); }
.a11y-close svg { width: 20px; height: 20px; }
.a11y-body { padding: 4px 16px 16px; overflow-y: auto; overscroll-behavior: contain; }
.a11y-intro { margin: 10px 0 0; color: var(--cd-slate); font-size: 0.88rem; }
.a11y-body h3 { margin: 18px 0 8px; font-family: var(--cd-font-sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cd-muted); }
.a11y-hint { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--cd-radius-md); background: rgb(var(--cd-tint) / 0.05); color: var(--cd-slate); font-size: 0.85rem; }

.a11y-panel button { font: inherit; color: inherit; }
.a11y-profiles, .a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y-profiles button, .a11y-opt, .a11y-size button {
    border: 1px solid var(--cd-border-strong); border-radius: var(--cd-radius-md);
    background: rgb(var(--cd-tint) / 0.03); cursor: pointer; text-align: left;
    transition: background 0.2s, border-color 0.2s;
}
.a11y-profiles button { padding: 10px 12px; }
.a11y-profiles b { display: block; font-weight: 600; }
.a11y-profiles small { display: block; margin-top: 2px; color: var(--cd-slate); font-size: 0.78rem; line-height: 1.35; }
.a11y-opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px; font-size: 0.88rem; line-height: 1.25; }
.a11y-opt svg { width: 22px; height: 22px; flex: none; color: var(--cd-brand-ink); }
.a11y-size { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.a11y-size button { padding: 8px 4px; text-align: center; font-weight: 700; font-family: var(--cd-font-serif); font-size: calc(0.9rem + var(--lv) * 0.12rem); }
.a11y-profiles button:hover, .a11y-opt:hover, .a11y-size button:hover { background: rgb(var(--cd-tint) / 0.08); }
.a11y-panel button[aria-pressed="true"] { background: var(--cd-brand); border-color: var(--cd-brand); color: var(--cd-on-brand); }
.a11y-panel button[aria-pressed="true"] svg, .a11y-panel button[aria-pressed="true"] small { color: inherit; }
.a11y-opt[aria-pressed="true"]::after { content: '✓'; margin-left: auto; font-weight: 700; }

.a11y-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--cd-border); font-size: 0.78rem; color: var(--cd-muted); }
.a11y-reset { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--cd-border-strong); border-radius: var(--cd-radius-md); background: transparent; cursor: pointer; font-size: 0.88rem !important; font-weight: 600; }
.a11y-reset:hover { background: rgb(var(--cd-tint) / 0.08); }
.a11y-reset svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
    .a11y-fab { left: 12px; bottom: 12px; width: 48px; height: 48px; }
    .a11y-panel { left: 8px; right: 8px; bottom: 70px; width: auto; max-height: calc(100dvh - 86px); }
}

/* =================================================================
   Réglages appliqués à la page
   ================================================================= */

/* Taille du texte : tout le site est en rem, on agrandit la racine */
html.a11y-text-1 { font-size: 112.5%; }
html.a11y-text-2 { font-size: 125%; }
html.a11y-text-3 { font-size: 150%; }

/* Espacement du texte (valeurs du critère WCAG 1.4.12) */
html.a11y-spacing body :where(p, li, dd, dt, td, th, blockquote, label, a, span, small, h1, h2, h3, h4, h5, h6, figcaption, input, textarea, button) {
    letter-spacing: 0.12em !important; word-spacing: 0.16em !important; line-height: 1.8 !important;
}
html.a11y-spacing body p { margin-bottom: 1.2em; }
html.a11y-spacing body :where(h1, h2, .h1, .h2) { letter-spacing: 0.04em !important; line-height: 1.35 !important; }

/* Police plus lisible : sans empattement, sans italique, sans capitales forcées */
html.a11y-font body, html.a11y-font body *:not(svg):not(svg *) {
    font-family: Verdana, 'Atkinson Hyperlegible', Tahoma, 'DejaVu Sans', Arial, sans-serif !important;
    font-style: normal !important;
}
html.a11y-font body :where(.eyebrow, h3, small, .badge, .label) { text-transform: none !important; }

/* Contraste renforcé : on remplace les rôles de couleur (les feuilles du site et des formulaires en dépendent) */
:root.a11y-contrast, :root.a11y-contrast[data-theme] {
    --cd-surface: #000; --cd-surface-alt: #000; --cd-surface-card: #0A0A0A; --cd-surface-inverse: #FFF;
    --cd-ink: #FFF; --cd-slate: #FFF; --cd-muted: #E6E6E6;
    --cd-border: #BDBDBD; --cd-border-strong: #FFF;
    --cd-brand: #0B5FBF; --cd-brand-ink: #8CC8FF; --cd-accent-ink: #FFD54A; --cd-on-brand: #FFF;
    --cd-success: #7CE0A0; --cd-danger: #FF8A75; --cd-tint: 255 255 255;
    --cd-rubrique-accueil: #0B5FBF; --cd-rubrique-ia: #6A35A0; --cd-rubrique-auto: #0B6B66; --cd-rubrique-web: #0B5FBF;
    --cd-rubrique-app: #4F6116; --cd-rubrique-seo: #8A4A0C; --cd-rubrique-cyber: #1F6B3A; --cd-rubrique-contact: #A23A1E;
    color-scheme: dark;
}
:root.a11y-contrast[data-theme="light"] {
    --cd-surface: #FFF; --cd-surface-alt: #FFF; --cd-surface-card: #FFF; --cd-surface-inverse: #000;
    --cd-ink: #000; --cd-slate: #000; --cd-muted: #1A1A1A;
    --cd-border: #404040; --cd-border-strong: #000;
    --cd-brand: #0B4F9E; --cd-brand-ink: #0B4F9E; --cd-accent-ink: #6B3A00;
    --cd-success: #1B5E33; --cd-danger: #8E2A12; --cd-tint: 0 0 0;
    color-scheme: light;
}
html.a11y-contrast body, html.a11y-contrast body [class*="theme-"] { --accent-ink: var(--cd-ink) !important; --accent-2-ink: var(--cd-accent-ink) !important; --emerald-ink: var(--cd-success) !important; }
html.a11y-contrast body :where(.orb, .grid-bg, canvas.net) { display: none !important; }
html.a11y-contrast body a:not(.btn):not([class*="a11y"]) { color: var(--cd-accent-ink); }
html.a11y-contrast body :where(input, select, textarea) { border: 2px solid var(--cd-border-strong) !important; }

/* Nuances de gris (posé sur la racine : ne casse pas les éléments fixes) */
html.a11y-gray { filter: grayscale(1); }

/* Souligner et repérer les liens */
html.a11y-links body a:not(.a11y *) { text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 0.2em !important; }
html.a11y-links body a:not(.btn):not(.brand):not(.a11y *):hover { background: rgb(var(--cd-tint) / 0.12); }

/* Arrêter les animations */
html.a11y-motion { scroll-behavior: auto !important; }
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: 0.01ms !important; transition-delay: 0s !important;
}
html.a11y-motion.js [data-reveal] { opacity: 1 !important; transform: none !important; }
html.a11y-motion .mock > *, html.a11y-motion .flow-node em { opacity: 1 !important; }
html.a11y-motion .marquee-track { animation: none !important; flex-wrap: wrap; width: auto; justify-content: center; }
html.a11y-motion canvas.net { display: none !important; }
html.a11y-motion .intro-splash { display: none !important; }

/* Focus très visible */
html.a11y-focus *:focus-visible { outline: 3px solid #FFD400 !important; outline-offset: 3px !important; box-shadow: 0 0 0 6px #000 !important; border-radius: 2px; }

/* Grand curseur */
html.a11y-cursor, html.a11y-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l15 8.5-6.6 1.6L9 19z' fill='%23000' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, auto !important;
}
html.a11y-cursor :where(a, button, [role="button"], label, select, summary, input[type="checkbox"], input[type="radio"], input[type="submit"]),
html.a11y-cursor :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 24 24'%3E%3Cpath d='M4 2l15 8.5-6.6 1.6L9 19z' fill='%230B5FBF' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, pointer !important;
}
html.a11y-cursor :where(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"], input[type="url"], input:not([type]), textarea) { cursor: text !important; }

/* Masque de lecture : deux voiles laissent une bande lisible autour du pointeur */
.a11y-veil { display: none; }
html.a11y-mask .a11y-veil { display: block; position: fixed; inset: 0; z-index: 940; pointer-events: none; --y: 40vh; --h: 7.5rem; }
.a11y-veil span { position: absolute; left: 0; right: 0; background: rgb(0 0 0 / 0.6); }
.a11y-veil-top { top: 0; height: max(0px, calc(var(--y) - var(--h) / 2)); border-bottom: 3px solid var(--cd-accent); }
.a11y-veil-bottom { bottom: 0; top: calc(var(--y) + var(--h) / 2); border-top: 3px solid var(--cd-accent); }

/* Lecture à voix haute : bloc en cours de lecture */
html.a11y-speech main :where(p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, figcaption, dd, dt) { cursor: help; }
.a11y-reading { outline: 3px dashed var(--cd-accent) !important; outline-offset: 4px; background: rgb(var(--cd-tint) / 0.08) !important; }
