/*
 * Panneau d'accessibilité — bouton flottant + panneau latéral.
 * Chrome du panneau uniquement ; les effets des réglages (contraste, taille
 * de texte, police, animations...) sont dans base.css et les fichiers de
 * composants/pages qu'ils affectent (sélecteurs html.a11y-*).
 */

.fab {
    position: fixed;
    right: 24px;
    z-index: 161;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    transition: background 0.35s var(--mr-ease-bounce), transform 0.35s var(--mr-ease-bounce), box-shadow 0.35s ease;
}

.btn-a11y {
    bottom: 24px;
    background: var(--mr-focus-color);
    color: var(--mr-blanc);
}

.btn-a11y:hover {
    background: var(--mr-brun-tres-fonce);
    transform: translateY(-2px) scale(1.05);
}

.btn-a11y:active {
    transform: scale(0.95);
}

.btn-a11y svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.a11y-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.12);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}

.a11y-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.a11y-panel {
    position: fixed;
    right: 24px;
    bottom: 88px;
    width: min(400px, 92vw);
    max-height: 82vh;
    background: var(--mr-blanc);
    z-index: 200;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border-radius: var(--mr-r-xl);
    overflow-y: auto;
    padding: 22px 22px 24px;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.a11y-panel.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
}

.a11y-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.a11y-head .a11y-title {
    font-family: var(--mr-font-titrage);
    color: var(--mr-brun);
    font-size: 24px;
    font-weight: 900;
    margin: 0;
}

.a11y-close {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--mr-r-m);
    border: 0;
    background: var(--mr-gris-fond);
    color: var(--mr-brun);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a11y-close:hover {
    background: var(--mr-gris-bord);
}

.a11y-desc {
    color: var(--mr-gris-texte);
    font-size: 14px;
    line-height: 1.45;
    margin: 0 0 14px;
}

.a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    border: 1px solid var(--mr-gris-bord-2);
    border-radius: var(--mr-r-m);
    padding: 11px 16px;
    margin-bottom: 9px;
    background: var(--mr-blanc);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: var(--mr-brun);
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.a11y-row.master {
    border-color: var(--mr-corail);
}

.a11y-row:hover {
    border-color: var(--mr-corail);
    background: var(--mr-rose-pale);
}

.switch {
    flex: 0 0 auto;
    width: 40px;
    height: 24px;
    border-radius: var(--mr-r-pill);
    /* Retour utilisateur : interrupteur désactivé presque invisible —
       gris-bord (#f0f0f0, pensé pour un simple filet de séparation) sur le
       panneau blanc ne donnait qu'1,14:1, et le rond blanc dessus était
       tout aussi peu visible sur ce même gris. gris-texte passe le seuil
       3:1 (composant d'interface) des deux côtés. */
    background: var(--mr-gris-texte);
    position: relative;
    transition: background 0.2s ease;
}

.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--mr-blanc);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s var(--mr-ease-bounce);
}

.a11y-row[aria-pressed='true'] .switch {
    /* corail (2,88:1) ne passait pas non plus le seuil 3:1 pour le rond
       blanc dessus — corail-fonce (3,84:1), déjà la teinte "survol" de
       marque ailleurs sur le site, plutôt qu'une nouvelle couleur. */
    background: var(--mr-corail-fonce);
}

.a11y-row[aria-pressed='true'] .switch::after {
    transform: translateX(16px);
}

.a11y-label {
    font-weight: 900;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--mr-brun);
    margin: 12px 0 8px;
    letter-spacing: 0.02em;
}

.a11y-sizes {
    display: flex;
    gap: 10px;
    margin-bottom: 9px;
}

.a11y-size {
    flex: 1;
    border: 1px solid var(--mr-gris-bord-2);
    border-radius: var(--mr-r-m);
    padding: 11px 8px;
    background: var(--mr-blanc);
    cursor: pointer;
    font-weight: 900;
    color: var(--mr-brun);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.a11y-size:hover {
    border-color: var(--mr-corail);
    background: var(--mr-rose-pale);
}

.a11y-size[aria-pressed='true'] {
    background: var(--mr-rose-pale);
    border-color: var(--mr-corail);
}

.a11y-reset {
    width: 100%;
    border: 0;
    background: var(--mr-gris-fond);
    color: var(--mr-brun);
    border-radius: var(--mr-r-m);
    padding: 12px;
    cursor: pointer;
    font-weight: 700;
    margin-top: 6px;
    transition: background 0.2s ease;
}

.a11y-reset:hover {
    background: var(--mr-gris-bord);
}

.a11y-decl {
    display: block;
    text-align: center;
    color: var(--mr-bleu-leclerc);
    text-decoration: underline;
    margin-top: 12px;
    font-size: 14px;
}

html.a11y-contrast .a11y-close,
html.a11y-contrast .a11y-decl,
html.a11y-enhanced .a11y-close,
html.a11y-enhanced .a11y-decl {
    color: var(--mr-a11y-accent) !important;
}

html.a11y-contrast .a11y-row.master,
html.a11y-contrast .a11y-row:hover,
html.a11y-contrast .a11y-size:hover,
html.a11y-enhanced .a11y-row.master,
html.a11y-enhanced .a11y-row:hover,
html.a11y-enhanced .a11y-size:hover {
    border-color: var(--mr-encre) !important;
}

@media (max-width: 480px) {
    .a11y-panel {
        right: 12px;
        left: 12px;
        width: auto;
    }

    .fab {
        right: 16px;
    }
}
