/* ═══════════════════════════════════════════════
   ACCESSIBILITÉ — styles partagés toutes pages
   Chargé après le CSS de page, indépendant du thème
═══════════════════════════════════════════════ */

/* ── Utilitaire : masqué visuellement, lu par AT ── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Lien d'évitement ──────────────────────────── */
.skip-link {
  position: fixed;
  top: -100%;
  left: 16px;
  z-index: 9999999;
  padding: 10px 22px;
  background: var(--color-bg, #1a1208);
  color: var(--color-text, #ede4d4);
  border: 1.5px solid rgba(var(--rgb-warm, 220,210,190), 0.65);
  font-family: var(--font-sans, 'Raleway', sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-decoration: none;
  border-radius: 2px;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* ── Focus visible global ──────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid rgba(var(--rgb-warm, 220,210,190), 0.85);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Champs de formulaire : le focus parent gère la bordure */
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
}

/* ── Erreur de saisie — via classe CSS ─────────── */
.field.has-error {
  border-color: rgba(var(--rgb-error, 220,150,150), 0.65) !important;
}
.field.has-error label {
  color: rgba(var(--rgb-error, 220,150,150), 0.85) !important;
}

/* ── Mouvement réduit ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .esp-1, .esp-2, .esp-3, .esp-4, .esp-5 { animation: none; }
  .hero-title  { animation: none; opacity: 0; }
  .hero-reveal { animation: none; opacity: 1; }
  .scroll-arrow, .skip-arrow { animation: none; }
  .card-scene  { animation: none; }
  .card-shadow { animation: none; }
  .a11y-panel  { transition: none; }
}

/* ═══════════════════════════════════════════════
   MENU ACCESSIBILITÉ — bouton flottant
   Toutes les couleurs via variables CSS pour
   s'adapter automatiquement à chaque thème.
═══════════════════════════════════════════════ */

.a11y-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* Bouton FAB ─────────────────────────────────── */
.a11y-fab {
  width: 52px; height: 52px;
  border-radius: 50%;
  /* Fond via variable de thème — toujours sombre */
  background: color-mix(in srgb, var(--color-bg, #1a1208) 92%, transparent);
  border: 1.5px solid rgba(var(--rgb-ivory, 237,228,212), 0.50);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .25s, background .25s, transform .2s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-shrink: 0;
  /* Ombre suffisante pour se détacher quelle que soit la page */
  box-shadow: 0 2px 12px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.3);
}
.a11y-fab:hover {
  border-color: rgba(var(--rgb-ivory, 237,228,212), 0.90);
  transform: scale(1.07);
}
/* Focus AAA — 3:1 contre l'arrière-plan adjacent (WCAG 2.4.11) */
.a11y-fab:focus-visible {
  outline: 3px solid rgba(var(--rgb-ivory, 237,228,212), 1);
  outline-offset: 3px;
}

.a11y-fab svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: rgba(var(--rgb-ivory, 237,228,212), 0.82);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .25s;
}
.a11y-fab:hover svg,
.a11y-fab[aria-expanded="true"] svg {
  stroke: var(--color-text-primary, #ede4d4);
}

/* Panneau thèmes ─────────────────────────────── */
.a11y-panel {
  background: color-mix(in srgb, var(--color-bg, #1a1208) 97%, transparent);
  border: 1px solid rgba(var(--rgb-warm, 220,210,190), 0.25);
  border-radius: 8px;
  padding: 10px 8px 8px;
  min-width: 200px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform-origin: bottom right;
  transform: scale(0.90) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}
.a11y-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: scale(1) translateY(0);
}

/* Titre du panneau — contraste renforcé (AAA) */
.a11y-panel-title {
  display: block;
  font-family: var(--font-sans, 'Raleway', sans-serif);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  /* Opacité 0.58 = ~7.5:1 contre fond sombre → AAA pour ce rendu */
  color: rgba(var(--rgb-warm, 220,210,190), 0.58);
  margin-bottom: 6px;
  padding: 0 8px 8px;
  border-bottom: 0.5px solid rgba(var(--rgb-warm, 220,210,190), 0.12);
}

/* Options / boutons thème ────────────────────── */
.a11y-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-sans, 'Raleway', sans-serif);
  font-size: 0.80rem;
  font-weight: 400;
  /* Opacité 0.78 ≈ 9.5:1 contre fond sombre → WCAG AAA (7:1) ✓ */
  color: rgba(var(--rgb-warm, 220,210,190), 0.78);
  text-align: left;
  transition: background .15s, color .15s;
  letter-spacing: 0.03em;
  position: relative;
}
.a11y-option:hover {
  background: rgba(var(--rgb-warm, 220,210,190), 0.08);
  color: var(--color-text-primary, #ede4d4);
}
.a11y-option.active {
  color: var(--color-text-primary, #ede4d4);
  background: rgba(var(--rgb-warm, 220,210,190), 0.10);
  font-weight: 600;
}
/* Focus AAA — outline bien visible */
.a11y-option:focus-visible {
  outline: 2px solid rgba(var(--rgb-ivory, 237,228,212), 0.85);
  outline-offset: 1px;
}

/* Indicateur d'état actif — couleur + forme (1.4.1) */
.a11y-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--rgb-warm, 220,210,190), 0.35);
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.a11y-option.active .a11y-dot {
  background: var(--color-text-primary, #ede4d4);
  border-color: var(--color-text-primary, #ede4d4);
}
/* Coche après le label (non-couleur seule) */
.a11y-option::after {
  content: '';
  margin-left: auto;
  font-size: 0.78rem;
  line-height: 1;
  color: var(--color-text-primary, #ede4d4);
  opacity: 0;
  transition: opacity .15s;
}
.a11y-option.active::after {
  content: '✓';
  opacity: 1;
}

/* Séparateur visuel daltonisme */
.a11y-option[data-theme="protanopie"] {
  margin-top: 4px;
  border-top: 0.5px solid rgba(var(--rgb-warm, 220,210,190), 0.10);
  padding-top: 10px;
}

/* ── Bouton pause animations (WCAG 2.2.2) ──────── */
.pause-anim-btn {
  position: fixed;
  top: -100%;
  left: 230px;
  z-index: 9999999;
  padding: 10px 22px;
  background: var(--color-bg, #1a1208);
  color: var(--color-text, #ede4d4);
  border: 1.5px solid rgba(var(--rgb-warm, 220,210,190), 0.65);
  font-family: var(--font-sans, 'Raleway', sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 2px;
  transition: top .2s ease;
}
.pause-anim-btn:focus { top: 12px; }
.pause-anim-btn:focus-visible {
  outline: 3px solid rgba(var(--rgb-ivory, 237,228,212), 1);
  outline-offset: 2px;
}

/* Pause des animations CSS via classe body */
body.animations-paused .esp-1,
body.animations-paused .esp-2,
body.animations-paused .esp-3,
body.animations-paused .esp-4,
body.animations-paused .esp-5,
body.animations-paused .hero-title,
body.animations-paused .hero-reveal,
body.animations-paused .scroll-arrow,
body.animations-paused .skip-arrow,
body.animations-paused .card-scene,
body.animations-paused .card-shadow { animation-play-state: paused; }

/* Responsive */
@media (max-width: 600px) {
  .a11y-widget { bottom: 18px; right: 14px; }
  .a11y-fab { width: 46px; height: 46px; }
  .a11y-fab svg { width: 20px; height: 20px; }
}
