/* ============================================================
   a11y-toolbar.css — Widget A11Y DA-aware
   ============================================================
   100% tokens du site courant (--alm-blue, --alm-bg-soft, --alm-text,
   --alm-border, --alm-gray-200, --cta-bg) -> rendu automatique :
     - Sub-brand maternite : bordeaux (#6b1f3a)
     - Almaviva etab/portail : bleu (#004899)
   Aucune couleur hardcodee marque. Greys neutres tolerés (text dark/light).

   Structure :
     .alm-a11y-toolbar (root, position fixed bas-droite)
       .alm-a11y-toolbar__trigger (bouton flottant 56px)
       .alm-a11y-toolbar__panel (panneau, hidden si aria-expanded=false)
         .alm-a11y-toolbar__title + bouton fermer
         .alm-a11y-toolbar__group (x3) : Taille / Contraste / Police
           .alm-a11y-toolbar__row (segmented buttons)
             .alm-a11y-toolbar__btn[aria-pressed]
         .alm-a11y-toolbar__reset
   ============================================================ */

/* ===== @font-face Atkinson Hyperlegible (mode malvoyant) ===== */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible/atkinson-regular.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible/atkinson-bold.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== @font-face OpenDyslexic (mode dyslexique) — GLOBAL =====
   Déplacé depuis subbrand-maternite.css : le mode Dyslexique est une feature
   réseau (44 sites + portail), pas maternité-only. La règle d'application
   html[data-font="dyslexia"] body est globale (ci-dessous) -> la police doit
   l'être aussi, sinon fallback sans-serif hors maternité. */
@font-face {
  font-family: 'OpenDyslexic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/opendyslexic/opendyslexic-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'OpenDyslexic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/opendyslexic/opendyslexic-bold.woff2') format('woff2');
}

/* ===== Modes police (appliques sur <html> via data-attribute) ===== */
html[data-font="lowvision"] body {
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  letter-spacing: 0.01em;
}
html[data-font="lowvision"] body h1,
html[data-font="lowvision"] body h2,
html[data-font="lowvision"] body h3,
html[data-font="lowvision"] body h4,
html[data-font="lowvision"] body h5,
html[data-font="lowvision"] body h6 {
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
}
html[data-font="dyslexia"] body {
  font-family: 'OpenDyslexic', sans-serif;
  word-spacing: 0.16em;
  letter-spacing: 0.05em;
}
html[data-font="dyslexia"] body h1,
html[data-font="dyslexia"] body h2,
html[data-font="dyslexia"] body h3,
html[data-font="dyslexia"] body h4,
html[data-font="dyslexia"] body h5,
html[data-font="dyslexia"] body h6 {
  font-family: 'OpenDyslexic', sans-serif;
  letter-spacing: 0.03em;
}

/* ===== Widget root ===== */
.alm-a11y-toolbar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.alm-a11y-toolbar[hidden] {
  display: none;
}

/* ===== Bouton flottant trigger (rond, fond DA, icône blanche) =====
   Spec haute via chainage .alm-a11y-toolbar .alm-a11y-toolbar__trigger
   (0,2,0) pour battre 'body [type="button"] { color: inherit }' (0,1,1)
   present dans le theme parent qui sinon ramene la color a var(--alm-text). */
.alm-a11y-toolbar .alm-a11y-toolbar__trigger {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--alm-blue);
  color: #ffffff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  /* Shadow teintée DA-aware via color-mix (Chrome 111+, Firefox 113+,
     Safari 16.4+ = >95% global 2026), fallback rgba neutre. */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--alm-blue) 35%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* Hover trigger : INVERSION cercle <-> icone (coherent systeme CTA primary
   sur fond fonce). Normal = cercle DA + icone blanche. Hover = cercle BLANC
   + icone DA. Bat les regles theme parent button:hover transparent et la
   color inherit (spec haute via .alm-a11y-toolbar prefix). */
.alm-a11y-toolbar .alm-a11y-toolbar__trigger:hover {
  background-color: var(--alm-blue-2, #003a7d);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--alm-blue) 45%, transparent);
}
.alm-a11y-toolbar__trigger:focus-visible {
  outline: 3px solid #ffffff;
  box-shadow: 0 0 0 6px var(--alm-blue-2, #003a7d);
  outline-offset: 2px;
}
/* Icône SVG trigger : blanc HARDCODE (et non token) -- garanti sur les
   2 DA (blanc sur fond bordeaux mat ET blanc sur fond bleu Almaviva).
   Forcage `fill: #fff` redondant (CSS + attribut fill SVG du JS) pour
   battre toute regle 'svg path { fill: currentColor }' qui pourrait
   recuperer la color du parent (var(--alm-text) via heritage button). */
.alm-a11y-toolbar .alm-a11y-toolbar__trigger svg,
.alm-a11y-toolbar .alm-a11y-toolbar__trigger svg path {
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

/* ===== Panneau ===== */
.alm-a11y-toolbar__panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 280px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--alm-border, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--alm-blue) 18%, rgba(0, 0, 0, 0.12));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.alm-a11y-toolbar[aria-expanded="false"] .alm-a11y-toolbar__panel {
  display: none;
}

/* Header panneau */
.alm-a11y-toolbar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--alm-border, #e5e7eb);
}
.alm-a11y-toolbar__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--alm-blue, #004899);
}
.alm-a11y-toolbar__close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--alm-text, #4a4a4a);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.alm-a11y-toolbar__close:hover {
  background: var(--alm-bg-grey, #f4f4f0);
  color: var(--alm-blue);
}
.alm-a11y-toolbar__close:focus-visible {
  outline: 2px solid var(--alm-blue);
  outline-offset: 2px;
}
.alm-a11y-toolbar__close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Groupes */
.alm-a11y-toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alm-a11y-toolbar__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--alm-text, #4a4a4a);
  letter-spacing: 0.02em;
}

/* Row segmented buttons */
.alm-a11y-toolbar__row {
  display: flex;
  gap: 6px;
}

/* Bouton segment normal (inactif) */
.alm-a11y-toolbar__btn {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  color: var(--alm-text, #1a1a1a);
  border: 1px solid var(--alm-border, #c0c0c0);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.alm-a11y-toolbar__btn:hover {
  background: var(--alm-bg-grey, #f4f4f0);
  border-color: var(--alm-blue);
  color: var(--alm-blue);
}
.alm-a11y-toolbar__btn:focus-visible {
  outline: 2px solid var(--alm-blue);
  outline-offset: 2px;
}

/* Bouton segment actif (aria-pressed=true) */
.alm-a11y-toolbar__btn[aria-pressed="true"] {
  background: var(--alm-blue);
  color: #ffffff;
  border-color: var(--alm-blue);
}
.alm-a11y-toolbar__btn[aria-pressed="true"]:hover {
  background: var(--alm-blue-2, var(--alm-blue));
  border-color: var(--alm-blue-2, var(--alm-blue));
  color: #ffffff;
}

/* Toggle contraste (2 states : OFF transparent / ON pressed bg DA) */
.alm-a11y-toolbar__btn--toggle {
  flex: none;
  width: 100%;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 14px;
  text-align: left;
}
.alm-a11y-toolbar__btn--toggle::after {
  content: 'Activer';
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--alm-bg-grey, #f4f4f0);
  color: var(--alm-text, #4a4a4a);
}
.alm-a11y-toolbar__btn--toggle[aria-pressed="true"]::after {
  content: 'Activé';
  background: #ffffff;
  color: var(--alm-blue);
}

/* Bouton reset */
.alm-a11y-toolbar__reset {
  margin-top: 4px;
  padding: 10px;
  background: transparent;
  color: var(--alm-text, #4a4a4a);
  border: 1px solid var(--alm-border, #c0c0c0);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.alm-a11y-toolbar__reset:hover {
  background: var(--alm-bg-grey, #f4f4f0);
  color: var(--alm-blue);
  border-color: var(--alm-blue);
}
.alm-a11y-toolbar__reset:focus-visible {
  outline: 2px solid var(--alm-blue);
  outline-offset: 2px;
}

/* ===== Responsive mobile (375px) ===== */
@media (max-width: 480px) {
  .alm-a11y-toolbar {
    bottom: 12px;
    right: 12px;
  }
  .alm-a11y-toolbar__panel {
    width: calc(100vw - 24px);
    max-width: 320px;
    bottom: 68px;
    right: 0;
    max-height: calc(100vh - 100px);
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .alm-a11y-toolbar,
  .alm-a11y-toolbar__trigger,
  .alm-a11y-toolbar__btn,
  .alm-a11y-toolbar__close,
  .alm-a11y-toolbar__reset {
    transition: none;
  }
  .alm-a11y-toolbar__trigger:hover {
    transform: none;
  }
}

/* Mode contraste élevé : widget reste readable (override tokens DA mat fait
   par html[data-contrast=high] dans subbrand-maternite.css). Le widget hérite
   donc des tokens noirs/blancs forcés sans rien à patcher ici. */
