/* ---------------------------------------------------------
 * Outil d'accessibilité — bandeau flottant + réglages appliqués
 * sur <html> (classes a11y-* posées par assets/js/accessibility.js,
 * lues au chargement par le script inline dans wp_head — voir
 * isnar_a11y_inline_bootstrap() dans functions.php).
 * --------------------------------------------------------- */

/* ---------- Lien d'évitement ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 10000;
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  transition: top .15s;
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Bouton déclencheur ---------- */
.a11y-trigger {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}
.a11y-trigger:hover,
.a11y-trigger[aria-expanded="true"] { background: var(--navy-deep); }
.a11y-trigger__icon { width: 22px; height: 22px; flex: none; }
.a11y-trigger__label {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .a11y-trigger__label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
  }
  .a11y-trigger { right: 16px; bottom: 16px; padding: 12px; }
}

/* ---------- Panneau ---------- */
.a11y-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 9999;
  width: min(320px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  border: 1px solid var(--line);
}
.a11y-panel[hidden] { display: none; }

.a11y-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.a11y-panel__title { font-weight: 800; margin: 0; color: var(--navy); }
.a11y-panel__close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  padding: 4px 8px;
}
.a11y-panel__close:hover { color: var(--orange); }

.a11y-panel__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.a11y-row__label { font-size: 0.875rem; font-weight: 700; }

.a11y-fontsize {
  display: flex;
  align-items: center;
  gap: 8px;
}
.a11y-fontsize button {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 0.85rem;
}
.a11y-fontsize button:hover { border-color: var(--orange); color: var(--orange); }
.a11y-fontsize__value { font-size: 0.8rem; color: var(--muted); min-width: 40px; text-align: center; }

.a11y-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  color: var(--ink);
}
.a11y-toggle::after {
  content: "";
  width: 34px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--line);
  position: relative;
  flex: none;
  transition: background .15s;
}
.a11y-toggle::before {
  content: "";
  position: absolute;
}
.a11y-toggle[aria-pressed="true"] { border-color: var(--orange); }
.a11y-toggle[aria-pressed="true"]::after { background: var(--orange); }

.a11y-reset {
  margin-top: 4px;
  border: 2px solid var(--navy);
  background: var(--bg);
  color: var(--navy);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.85rem;
}
.a11y-reset:hover { background: var(--navy); color: #fff; }

.a11y-trigger:focus-visible,
.a11y-panel__close:focus-visible,
.a11y-fontsize button:focus-visible,
.a11y-toggle:focus-visible,
.a11y-reset:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* ---------- Réglages appliqués au site ---------- */

/* Taille de police : multiplie la règle existante (style.css) plutôt que la remplacer */
:root { --a11y-font-scale: 1; }
html { font-size: calc(clamp(14px, 1.1vw, 20px) * var(--a11y-font-scale, 1)); }

/* Niveaux de gris */
html.a11y-grayscale { filter: grayscale(1); }

/* Contraste négatif */
html.a11y-contrast-negative { filter: invert(1) hue-rotate(180deg); }

/* Contraste élevé : palette noir/blanc pur + bordures renforcées */
html.a11y-contrast-high {
  --ink: #000000;
  --bg: #ffffff;
  --bg-soft: #ffffff;
  --muted: #000000;
  --line: #000000;
}
html.a11y-contrast-high a { text-decoration: underline; }
html.a11y-contrast-high .btn,
html.a11y-contrast-high .card,
html.a11y-contrast-high .ville__card,
html.a11y-contrast-high .partenaire__card { border: 2px solid #000 !important; }

/* Fond sombre : les composants existants lisent déjà var(--bg)/var(--ink), rien d'autre à réécrire */
html.a11y-bg-dark {
  --bg: #121212;
  --bg-soft: #1e1e1e;
  --ink: #f0f0f0;
  --line: #3a3a3a;
  --muted: #b5b5b5;
}
/* var(--navy) reste une couleur de marque fixe (non liée au thème clair/sombre) :
   sur fond sombre, le texte/bordure "navy" du panneau d'accessibilité devient
   illisible (contraste quasi nul) — on le fait suivre var(--ink) uniquement ici. */
html.a11y-bg-dark .a11y-panel__title { color: var(--ink); }
html.a11y-bg-dark .a11y-reset { border-color: var(--ink); color: var(--ink); }

/* Soulignage des liens */
html.a11y-underline-links a { text-decoration: underline !important; }

/* Police "lisible" */
html.a11y-readable-font,
html.a11y-readable-font * { font-family: Verdana, Arial, Helvetica, sans-serif !important; }
