/**
 * ADASFRO — Barra de Accesibilidad
 * WCAG 2.1 AA — Diseño inclusivo para neurodivergencia
 */

/* =========================================
   BOTÓN FLOTANTE (icono universal)
========================================= */
#a11y-trigger {
  position: fixed;
  bottom: 88px;
  left: 24px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary, #00695C);
  color: white;
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

#a11y-trigger:hover {
  background: var(--secondary, #1A237E);
  transform: scale(1.08);
}

#a11y-trigger:focus {
  outline: 3px solid var(--accent, #FF8F00);
  outline-offset: 3px;
}

/* =========================================
   OVERLAY
========================================= */
#a11y-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#a11y-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* =========================================
   PANEL LATERAL
========================================= */
#a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 320px;
  max-width: 100vw;
  background: white;
  z-index: 9002;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
}

#a11y-panel.open {
  transform: translateX(0);
}

/* Cabecera del panel */
.a11y-panel-header {
  background: linear-gradient(135deg, #00695C 0%, #004D40 100%);
  color: white;
  padding: 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.a11y-panel-header span {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

#a11y-close {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#a11y-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

#a11y-close:focus {
  outline: 3px solid white;
  outline-offset: 2px;
}

/* Secciones */
.a11y-section {
  padding: 18px 16px;
  border-bottom: 1px solid #E2E8F0;
}

.a11y-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748B;
  margin: 0 0 12px 0;
}

.a11y-section p {
  font-size: 12px;
  color: #64748B;
  margin: 8px 0 0 0;
  line-height: 1.5;
}

.a11y-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Botones del panel */
.a11y-btn {
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid #E2E8F0;
  border-radius: 8px;
  background: white;
  color: #1E293B;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-height: 48px;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  font-family: inherit;
}

.a11y-btn:hover {
  border-color: #00695C;
  background: #F0FBF9;
  color: #00695C;
}

.a11y-btn:focus {
  outline: 3px solid #00695C;
  outline-offset: 2px;
}

.a11y-btn[aria-pressed="true"] {
  background: #00695C;
  border-color: #00695C;
  color: white;
}

/* Botones tipo toggle (ancho completo) */
.a11y-toggle {
  flex: none;
  width: 100%;
  justify-content: flex-start;
}

/* Botón restablecer */
.a11y-reset {
  padding: 16px;
  margin-top: auto;
  border-top: 1px solid #E2E8F0;
}

.a11y-btn-reset {
  width: 100%;
  flex: none;
  justify-content: center;
  background: #FFF5F5;
  border-color: #D32F2F;
  color: #D32F2F;
}

.a11y-btn-reset:hover {
  background: #D32F2F;
  color: white;
  border-color: #D32F2F;
}

/* =========================================
   MODO: TAMAÑO DE LETRA
========================================= */
html.font-large {
  font-size: 20px;
}

html.font-xlarge {
  font-size: 24px;
}

/* =========================================
   MODO: ALTO CONTRASTE
========================================= */
html.high-contrast {
  --primary: #00DD99;
  --primary-light: #00FFCC;
  --secondary: #FFFFFF;
  --accent: #FFEE00;
  --danger: #FF5555;
  --bg-body: #000000;
  --bg-surface: #111111;
  --text-main: #FFFFFF;
  --text-light: #DDDDDD;
  --border: #555555;
}

html.high-contrast body {
  background-color: #000 !important;
  color: #fff !important;
}

html.high-contrast p {
  color: #DDD !important;
}

html.high-contrast h1,
html.high-contrast h2,
html.high-contrast h3,
html.high-contrast h4,
html.high-contrast h5,
html.high-contrast h6 {
  color: #FFF !important;
}

html.high-contrast a {
  color: #00DD99 !important;
}

html.high-contrast a:hover {
  color: #00FFCC !important;
}

html.high-contrast .card,
html.high-contrast .sidebar .widget {
  background: #111 !important;
  border-color: #555 !important;
}

html.high-contrast #header-wrapper {
  background: #111 !important;
  border-bottom-color: #444 !important;
}

html.high-contrast #main-nav {
  background: #000 !important;
  border-bottom-color: #444 !important;
}

html.high-contrast .main-menu .widget a {
  color: #FFF !important;
}

html.high-contrast .main-menu .widget a:hover {
  background: #222 !important;
  color: #00DD99 !important;
}

html.high-contrast .hero-section {
  background: linear-gradient(135deg, #002A22 0%, #001A14 100%) !important;
  border: 2px solid #00DD99;
}

html.high-contrast .mission-block {
  background: linear-gradient(135deg, #2D0040 0%, #1A0025 100%) !important;
  border: 2px solid #AA00EE;
}

html.high-contrast #footer-wrapper {
  background: linear-gradient(135deg, #000033 0%, #000011 100%) !important;
  border-top: 2px solid #3355CC;
}

html.high-contrast #a11y-trigger {
  background: #000033 !important;
  color: #FFFFFF !important;
  border-color: #FFFFFF !important;
}

html.high-contrast #whatsapp-float {
  background: #00BB55 !important;
  box-shadow: 0 4px 16px rgba(0, 187, 85, 0.5) !important;
}

/* =========================================
   MODO: FUENTE PARA DISLEXIA
   Excluye <i> para no romper Font Awesome
========================================= */
html.dyslexia-font body,
html.dyslexia-font p,
html.dyslexia-font h1, html.dyslexia-font h2,
html.dyslexia-font h3, html.dyslexia-font h4,
html.dyslexia-font h5, html.dyslexia-font h6,
html.dyslexia-font li, html.dyslexia-font dt,
html.dyslexia-font dd, html.dyslexia-font td,
html.dyslexia-font th, html.dyslexia-font label,
html.dyslexia-font input, html.dyslexia-font textarea,
html.dyslexia-font select,
html.dyslexia-font button,
html.dyslexia-font a,
html.dyslexia-font span:not([class*="fa"]):not([class*="swiper"]) {
  font-family: 'Atkinson Hyperlegible', Arial, sans-serif !important;
  letter-spacing: 0.05em;
  word-spacing: 0.15em;
  line-height: 1.9;
}

/* =========================================
   MODO: BAJA ESTIMULACIÓN
========================================= */
html.low-stimulation *,
html.low-stimulation *::before,
html.low-stimulation *::after {
  animation: none !important;
  animation-duration: 0.01ms !important;
  transition: none !important;
  transition-duration: 0.01ms !important;
}

html.low-stimulation .hero-section::before {
  display: none !important;
}

html.low-stimulation .card:hover,
html.low-stimulation .swiper-slide:hover,
html.low-stimulation .btn:hover {
  transform: none !important;
}

html.low-stimulation img {
  filter: grayscale(35%);
}

html.low-stimulation .hero-section {
  background: #004D40 !important;
}

html.low-stimulation .mission-block {
  background: #4A0E6B !important;
}

html.low-stimulation .donation-icon {
  animation: none !important;
}

/* =========================================
   PREFERENCIA DEL SISTEMA (prefers-reduced-motion)
========================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================
   BOTÓN FLOTANTE WHATSAPP
========================================= */
#whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 8999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25D366;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
  border: 3px solid white;
}

#whatsapp-float:hover {
  background: #128C7E;
  color: white;
  transform: scale(1.08);
}

#whatsapp-float:focus {
  outline: 3px solid #25D366;
  outline-offset: 3px;
  color: white;
}

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 480px) {
  #a11y-panel {
    width: 100vw;
  }

  #a11y-trigger {
    bottom: 84px;
    left: 16px;
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  #whatsapp-float {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
}
