/* ══════════════════════════════════════════════════════════════
   WIDGET D'ACCESSIBILITÉ — Styles
   ══════════════════════════════════════════════════════════════ */

/* ── Effets document ─────────────────────────────────────────── */
html.a11y-spacing * {
  line-height:    1.9 !important;
  letter-spacing: 0.06em !important;
  word-spacing:   0.15em !important;
}

html.a11y-dyslexic p,
html.a11y-dyslexic li,
html.a11y-dyslexic caption,
html.a11y-dyslexic figcaption,
html.a11y-dyslexic td,
html.a11y-dyslexic th {
  font-family: 'OpenDyslexic', system-ui, sans-serif !important;
}

html.a11y-numbered-headings body { counter-reset: h1c h2c h3c h4c h5c h6c; }
html.a11y-numbered-headings h1 { counter-reset: h2c h3c h4c h5c h6c; counter-increment: h1c; }
html.a11y-numbered-headings h2 { counter-reset: h3c h4c h5c h6c;    counter-increment: h2c; }
html.a11y-numbered-headings h3 { counter-reset: h4c h5c h6c;        counter-increment: h3c; }
html.a11y-numbered-headings h4 { counter-reset: h5c h6c;            counter-increment: h4c; }
html.a11y-numbered-headings h5 { counter-reset: h6c;                counter-increment: h5c; }
html.a11y-numbered-headings h6 {                                     counter-increment: h6c; }
html.a11y-numbered-headings h1::before { content: counter(h1c) ". "; }
html.a11y-numbered-headings h2::before { content: counter(h1c) "." counter(h2c) " "; }
html.a11y-numbered-headings h3::before { content: counter(h1c) "." counter(h2c) "." counter(h3c) " "; }

html.a11y-contrast body > *:not(#a11y-widget):not(#a11y-mask-top):not(#a11y-mask-bottom) {
  filter: contrast(1.4) saturate(1.2);
}

/* ── Masques ─────────────────────────────────────────────────── */
#a11y-mask-top,
#a11y-mask-bottom {
  display: none;
  position: fixed;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.35);
}

/* ── Bouton flottant ─────────────────────────────────────────── */
#a11y-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  font-family: "Raleway", sans-serif;
}

#a11y-toggle {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--cnam-rouge, #C1002A);
  color: white;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: background 0.15s, transform 0.15s;
}

#a11y-toggle:hover {
  background: var(--cnam-bleu-fonce, #11304C);
  transform: scale(1.08);
}

/* ── Panneau ─────────────────────────────────────────────────── */
#a11y-panel {
  display: none;
  position: absolute;
  bottom: 3.8rem;
  right: 0;
  width: 280px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

#a11y-panel.a11y-open {
  display: block;
}

#a11y-panel h3 {
  font-family: "Raleway", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cnam-bleu-fonce, #11304C);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--cnam-rouge, #C1002A);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.a11y-row {
  margin-bottom: 0.8rem;
}

.a11y-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #405A68;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.a11y-slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#a11y-font-slider {
  flex: 1;
  accent-color: var(--cnam-rouge, #C1002A);
}

#a11y-font-value {
  font-size: 0.82rem;
  color: #666;
  min-width: 2.5rem;
  text-align: right;
}

.a11y-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.a11y-opt-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  font-family: "Raleway", sans-serif;
  transition: all 0.15s;
}

.a11y-opt-btn:hover {
  border-color: var(--cnam-rouge, #C1002A);
  color: var(--cnam-rouge, #C1002A);
}

.a11y-opt-btn.a11y-active {
  background: var(--cnam-rouge, #C1002A);
  color: white;
  border-color: var(--cnam-rouge, #C1002A);
}

#a11y-reset {
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.4rem;
  font-size: 0.78rem;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #888;
  cursor: pointer;
  font-family: "Raleway", sans-serif;
  transition: all 0.15s;
}

#a11y-reset:hover {
  border-color: #C1002A;
  color: #C1002A;
}
