/**
 * ============================================================================
 *  accesibilidad.css
 * ----------------------------------------------------------------------------
 *  Estilos del Widget de Accesibilidad de superandoeducando.com
 *
 *  Que hace este archivo:
 *   1) Estiliza el boton flotante y el panel desplegable "Menu de
 *      accesibilidad": 4 "Perfiles de accesibilidad" (Daltonismo, Dislexia,
 *      Convulsiones y epilepticos, TDAH) + 17 opciones individuales
 *      (contraste, enlaces, encabezados, ocultar imagenes, animaciones,
 *      saturacion, escala de grises, tamano de texto, cursor, lupa de
 *      contenido, fuente apta para dislexia, espaciado, altura de linea,
 *      alineacion, estructura de la pagina, lectura facil, leer pagina).
 *      Ver accesibilidad.js (arreglo OPCIONES/PERFILES) para el detalle
 *      de cada una.
 *   2) Define las clases de estado que activa/desactiva accesibilidad.js
 *      sobre <html> — todas con el prefijo "a11y-" (ver cada bloque de
 *      "MODOS DE ACCESIBILIDAD" mas abajo para la lista completa).
 *
 *  Por que un widget propio y no un script de terceros:
 *   - No agrega dependencias externas ni llamadas a servidores de terceros
 *     (mejor privacidad y sin puntos de fallo externos).
 *   - Se integra con el theme.color existente del sitio y respeta el
 *     bootstrap 5 ya cargado (usa utilidades como .visually-hidden).
 *
 *  Convenciones:
 *   - Prefijo "a11y-" para todas las clases de estado (namespacing, evita
 *     colisiones con clases del template Echooling).
 *   - Uso de !important puntual SOLO en los modos de accesibilidad, porque
 *     deben poder sobreescribir estilos inline del template (ej. color:#fff
 *     en el <h1> del slider).
 * ============================================================================
 */

/* --------------------------------------------------------------------------
 * Enlace "saltar al contenido" (skip link)
 * Oculto visualmente hasta que recibe foco por teclado (Tab).
 * -------------------------------------------------------------------------- */
.skip-link {
    position: absolute;
    top: -60px;
    left: 8px;
    z-index: 100000;
    background: #0a3d62;
    color: #fff !important;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.2s ease-in-out;
}
.skip-link:focus {
    top: 8px;
    outline: 3px solid #ffcc00;
}

/* --------------------------------------------------------------------------
 * Boton flotante de accesibilidad
 * ----------------------------------------------------------------------------
 * FIX 2026-09-17 (reporte de Jorge): el boton original era un circulo de
 * solo-icono sin ninguna palabra visible, lo que se percibia como "texto
 * invisible". Ahora es una pastilla icono + texto "Accesibilidad", igual
 * que el selector de idioma (misma familia visual, mismo tamano de fuente).
 * -------------------------------------------------------------------------- */
#a11y-toggle-btn {
    position: fixed;
    left: 20px;
    bottom: 20px;
    height: 48px;
    padding: 0 18px 0 14px;
    border-radius: 24px;
    background: #0a3d62;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    z-index: 99998;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    font-size: 15px;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1;
    white-space: nowrap;
}
#a11y-toggle-btn:hover,
#a11y-toggle-btn:focus {
    background: #0d4e7d;
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}
#a11y-toggle-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    flex-shrink: 0;
}
#a11y-toggle-btn .a11y-toggle-texto {
    color: #fff;
}

/* --------------------------------------------------------------------------
 * Panel del menu de accesibilidad
 * -------------------------------------------------------------------------- */
#a11y-panel {
    position: fixed;
    left: 20px;
    bottom: 78px;
    width: 340px;
    max-width: calc(100vw - 40px);
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    color: #1a1a1a;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 99999;
    display: none;
    font-family: Arial, Helvetica, sans-serif;
}
#a11y-panel.a11y-panel-abierto {
    display: block;
}
#a11y-panel-header {
    background: #0a3d62;
    color: #fff;
    padding: 16px 18px;
    border-radius: 14px 14px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
}
#a11y-panel-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}
#a11y-panel-close:hover,
#a11y-panel-close:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: 2px solid #ffcc00;
}

/* --------------------------------------------------------------------------
 * Seccion "Perfiles de accesibilidad" (2026-09-29)
 * -------------------------------------------------------------------------- */
#a11y-perfiles-titulo {
    padding: 14px 16px 4px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#a11y-perfiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 6px 16px 4px 16px;
}
.a11y-perfil-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7faff;
    border: 1px solid #cfe0f5;
    border-radius: 10px;
    padding: 10px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    color: #0a3d62;
}
.a11y-perfil-btn .a11y-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.a11y-perfil-btn:hover,
.a11y-perfil-btn:focus {
    border-color: #0a3d62;
    outline: 2px solid #0a3d62;
    outline-offset: 1px;
}
.a11y-perfil-btn[aria-pressed="true"] {
    background: #0a3d62 !important;
    color: #fff !important;
    border-color: #0a3d62 !important;
}
.a11y-perfil-btn[aria-pressed="true"] span {
    color: #fff !important;
}

#a11y-reset-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 16px auto 8px auto;
    padding: 12px;
    background: #f1f3f5;
    border: 1px solid #dcdfe3;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
#a11y-reset-btn:hover,
#a11y-reset-btn:focus {
    background: #e6e8eb;
    outline: 2px solid #0a3d62;
}

#a11y-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 8px 16px 20px 16px;
}

/* Cada boton de opcion (Contraste alto, Escala de grises, etc.) */
.a11y-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #dcdfe3;
    border-radius: 10px;
    padding: 14px 8px;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
    color: #1a1a1a;
    min-height: 90px;
}
.a11y-option-btn:hover,
.a11y-option-btn:focus {
    border-color: #0a3d62;
    outline: 2px solid #0a3d62;
    outline-offset: 1px;
}
.a11y-option-btn .a11y-icon {
    font-size: 22px;
    line-height: 1;
}
/* Estado activo: la opcion esta encendida
   FIX 2026-10-01 (reporte de Jorge, con captura): el texto y el icono de
   los botones activos (perfiles y opciones) se veian invisibles. No se
   logro aislar con certeza que otra regla ganaba la cascada contra el
   color:#fff original (sin !important, especificidad (0,2,0)) — asi que
   se blinda con !important + una regla explicita para los <span> hijos
   (icono y etiqueta), lo que gana contra practicamente cualquier otra
   regla no marcada !important con igual o menor especificidad. */
.a11y-option-btn[aria-pressed="true"] {
    background: #0a3d62 !important;
    color: #fff !important;
    border-color: #0a3d62 !important;
}
.a11y-option-btn[aria-pressed="true"] span {
    color: #fff !important;
}

/* Grupo especial "Agrandar texto" con 3 puntos de progreso (como en la captura) */
.a11y-progreso-dots {
    display: flex;
    gap: 4px;
}
.a11y-progreso-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c3c9d1;
}
.a11y-option-btn[aria-pressed="true"] .a11y-progreso-dots span.activo {
    background: #ffcc00;
}
.a11y-option-btn:not([aria-pressed="true"]) .a11y-progreso-dots span.activo {
    background: #0a3d62;
}

/* ============================================================================
 * MODOS DE ACCESIBILIDAD (activados sobre <html>/<body> por accesibilidad.js)
 * ========================================================================= */

/* --- Alto contraste --- */
html.a11y-alto-contraste,
html.a11y-alto-contraste body {
    background: #000 !important;
    color: #fff !important;
}
html.a11y-alto-contraste * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
html.a11y-alto-contraste a,
html.a11y-alto-contraste a * {
    color: #ffff00 !important;
}
html.a11y-alto-contraste img,
html.a11y-alto-contraste svg {
    filter: brightness(0.9) contrast(1.3);
}

/* --- Escala de grises --- */
html.a11y-escala-grises {
    filter: grayscale(100%);
}

/* --- Agrandar texto (3 niveles) --- */
html.a11y-texto-1 body { font-size: 112.5% !important; }
html.a11y-texto-2 body { font-size: 125% !important; }
html.a11y-texto-3 body { font-size: 137.5% !important; }

/* --- Resaltar enlaces --- */
html.a11y-resaltar-enlaces a {
    background-color: #ffe600 !important;
    color: #000 !important;
    text-decoration: underline !important;
    outline: 2px solid #000 !important;
}

/* --- Lectura facil: fuente simple, ancho de linea reducido, mas contraste de texto --- */
html.a11y-lectura-facil body,
html.a11y-lectura-facil body * {
    font-family: Arial, Helvetica, sans-serif !important;
}
html.a11y-lectura-facil p,
html.a11y-lectura-facil li,
html.a11y-lectura-facil h1,
html.a11y-lectura-facil h2,
html.a11y-lectura-facil h3 {
    max-width: 70ch !important;
    color: #111 !important;
}

/* --- Detener animaciones (incluye WOW.js, carruseles, transiciones CSS) --- */
html.a11y-sin-animaciones *,
html.a11y-sin-animaciones *::before,
html.a11y-sin-animaciones *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* --- Ocultar imagenes decorativas (deja el texto como foco de lectura) --- */
html.a11y-ocultar-imagenes img,
html.a11y-ocultar-imagenes .icon img {
    visibility: hidden !important;
}

/* --- Alinear texto a la izquierda (corrige texto centrado/justificado) --- */
html.a11y-alinear-izquierda body,
html.a11y-alinear-izquierda p,
html.a11y-alinear-izquierda h1,
html.a11y-alinear-izquierda h2,
html.a11y-alinear-izquierda h3,
html.a11y-alinear-izquierda li {
    text-align: left !important;
}

/* --- Cursor (3 niveles de tamaño — 2026-09-29; antes era un unico tamaño
   con la clase "a11y-cursor-grande", que ya no se usa — accesibilidad.js
   ahora trata esta opcion como multiNivel con prefijo "a11y-cursor-") --- */
html.a11y-cursor-1,
html.a11y-cursor-1 * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path d="M3 2l7.07 17.5 2.51-6.92 6.92-2.51z" fill="black" stroke="white" stroke-width="1"/></svg>') 4 4, auto !important;
}
html.a11y-cursor-2,
html.a11y-cursor-2 * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path d="M3 2l7.07 17.5 2.51-6.92 6.92-2.51z" fill="black" stroke="white" stroke-width="1.2"/></svg>') 4 4, auto !important;
}
html.a11y-cursor-3,
html.a11y-cursor-3 * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24"><path d="M3 2l7.07 17.5 2.51-6.92 6.92-2.51z" fill="black" stroke="white" stroke-width="1.5"/></svg>') 4 4, auto !important;
}

/* --- Resaltar encabezados (2026-09-29) --- */
html.a11y-resaltar-encabezados h1,
html.a11y-resaltar-encabezados h2,
html.a11y-resaltar-encabezados h3,
html.a11y-resaltar-encabezados h4,
html.a11y-resaltar-encabezados h5,
html.a11y-resaltar-encabezados h6 {
    outline: 3px dashed #0a3d62 !important;
    outline-offset: 3px;
    background-color: #fff6cc !important;
    color: #0a3d62 !important;
}

/* --- Saturacion (2 niveles: baja / alta — 2026-09-29) --- */
html.a11y-saturacion-1 { filter: saturate(0.4); }
html.a11y-saturacion-2 { filter: saturate(2); }

/* --- Apto para dislexia (2026-09-29): aproximacion con fuentes del sistema
   — no se incluye la fuente OpenDyslexic para no agregar una dependencia
   externa de red al sitio (ver README.md para el detalle). --- */
html.a11y-apto-dislexia body,
html.a11y-apto-dislexia body * {
    font-family: Verdana, Arial, sans-serif !important;
    letter-spacing: 0.04em !important;
    line-height: 1.6 !important;
    text-align: left !important;
}
html.a11y-apto-dislexia body {
    background-color: #fbf6e9 !important;
}
html.a11y-apto-dislexia p,
html.a11y-apto-dislexia li {
    color: #222 !important;
}

/* --- Espaciado de texto (ahora solo letter/word-spacing, 3 niveles —
   2026-09-29: antes era un unico nivel que tambien tocaba line-height; el
   line-height ahora es la opcion separada "Altura de la linea" de abajo) --- */
html.a11y-espaciado-1 body,
html.a11y-espaciado-1 body * { letter-spacing: 0.05em !important; word-spacing: 0.08em !important; }
html.a11y-espaciado-2 body,
html.a11y-espaciado-2 body * { letter-spacing: 0.1em !important; word-spacing: 0.16em !important; }
html.a11y-espaciado-3 body,
html.a11y-espaciado-3 body * { letter-spacing: 0.18em !important; word-spacing: 0.26em !important; }

/* --- Altura de la linea (3 niveles — 2026-09-29) --- */
html.a11y-alturalinea-1 body,
html.a11y-alturalinea-1 body * { line-height: 1.5 !important; }
html.a11y-alturalinea-2 body,
html.a11y-alturalinea-2 body * { line-height: 1.8 !important; }
html.a11y-alturalinea-3 body,
html.a11y-alturalinea-3 body * { line-height: 2.1 !important; }

/* --------------------------------------------------------------------------
 * Lupa de contenido (2026-09-29)
 * -------------------------------------------------------------------------- */
#a11y-lupa-lens {
    position: fixed;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 4px solid #0a3d62;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    pointer-events: none;
    z-index: 999995;
    background: #fff;
}
.a11y-lupa-clon {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    transform: scale(2);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
 * Estructura de la pagina (2026-09-29): panel lateral con los encabezados
 * -------------------------------------------------------------------------- */
#a11y-estructura-panel {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 280px;
    max-width: calc(100vw - 40px);
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dcdfe3;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    padding: 14px;
    z-index: 999994;
    font-family: Arial, Helvetica, sans-serif;
}
#a11y-estructura-titulo {
    font-weight: 700;
    color: #0a3d62;
    margin-bottom: 10px;
    font-size: 15px;
}
#a11y-estructura-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#a11y-estructura-panel li {
    margin: 4px 0;
}
#a11y-estructura-panel li button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    padding: 6px 8px;
    font-size: 13px;
    color: #1a1a1a;
    cursor: pointer;
    border-radius: 4px;
}
#a11y-estructura-panel li button:hover,
#a11y-estructura-panel li button:focus {
    background: #f1f3f5;
    border-left-color: #0a3d62;
    outline: none;
}
/* Sangria segun el nivel del encabezado (h1 a h6) */
#a11y-estructura-panel .a11y-estructura-nivel-1 button { padding-left: 8px; font-weight: 700; }
#a11y-estructura-panel .a11y-estructura-nivel-2 button { padding-left: 18px; }
#a11y-estructura-panel .a11y-estructura-nivel-3 button { padding-left: 28px; font-size: 12px; }
#a11y-estructura-panel .a11y-estructura-nivel-4 button,
#a11y-estructura-panel .a11y-estructura-nivel-5 button,
#a11y-estructura-panel .a11y-estructura-nivel-6 button { padding-left: 38px; font-size: 12px; color: #555; }
#a11y-estructura-vacio {
    font-size: 13px;
    color: #666;
    margin: 0;
}

/* --- Foco visible reforzado para navegacion por teclado (siempre activo) --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #ffcc00 !important;
    outline-offset: 2px !important;
}

/* Responsive: en pantallas muy pequenas el panel ocupa casi todo el ancho */
@media (max-width: 420px) {
    #a11y-panel {
        left: 10px;
        right: 10px;
        width: auto;
    }
    #a11y-toggle-btn {
        left: 12px;
        bottom: 12px;
    }
}
