/* Menú de accesibilidad — widget genérico y portable.
   ============================================================
   Este archivo define SOLO el botón, el panel y los controles
   (apariencia del propio menú). NO define qué hace cada modo sobre el
   contenido de la página — eso es "el efecto" y se declara aparte, en
   el CSS propio de cada página que use este widget, mediante clases
   sobre <html>:
     html.a11y-tamano-1     → tamaño de letra grande
     html.a11y-tamano-2     → tamaño de letra muy grande
     html.a11y-legibilidad  → modo legibilidad (dislexia)
     html.a11y-resaltar     → resaltar botones/controles
     html.a11y-modo-oscuro  → modo de color: Oscuro
     html.a11y-modo-claro   → modo de color: Claro
     html.a11y-modo-bn      → modo de color: Escala de grises (filtro
                              sobre lo que sea que se esté mostrando)
   ("normal" es la ausencia de las tres clases anteriores: es el diseño
   de base de la página anfitriona, sin ninguna intervención de este
   widget)

   Pensado para copiarse tal cual a otro proyecto (junto con
   accesibilidad-menu.js): no depende de variables ni clases de ningún
   proyecto en particular. Los colores están fijos (no toman el
   branding del sistema) porque el widget debe verse igual —y seguir
   siendo legible— sin importar el fondo sobre el que se use. */

.a11y-boton {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
    z-index: 20;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(10, 14, 18, .35);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: background .2s ease;
}

.a11y-boton:hover { background: rgba(10, 14, 18, .55); }

.a11y-icono { width: 22px; height: 22px; }

.a11y-boton[aria-expanded="true"] {
    background: #fff;
    color: #14181f;
}

.a11y-panel {
    position: absolute;
    top: calc(max(14px, env(safe-area-inset-top)) + 52px);
    right: 14px;
    left: 14px;
    z-index: 21;
    background: rgba(20, 24, 31, .94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 18px;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .9rem;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

.a11y-panel[hidden] { display: none; }

.a11y-etiqueta {
    font-size: .8rem;
    font-weight: 600;
    opacity: .85;
    display: block;
    margin-bottom: .4rem;
}

.a11y-opciones-tamano {
    display: flex;
    gap: .5rem;
}

.a11y-tamano-btn {
    flex: 1;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-radius: 10px;
    padding: .55rem 0;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
}

.a11y-tamano-btn:nth-child(2) { font-size: 1.12em; }
.a11y-tamano-btn:nth-child(3) { font-size: 1.24em; }

.a11y-tamano-btn[aria-pressed="true"] {
    background: #fff;
    color: #14181f;
    border-color: #fff;
}

.a11y-switch {
    appearance: none;
    border: none;
    background: none;
    color: #fff;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font: inherit;
    font-size: .95rem;
    padding: .2rem 0;
    cursor: pointer;
    text-align: left;
}

.a11y-switch-visual {
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .25);
    position: relative;
    flex-shrink: 0;
    transition: background .2s ease;
}

.a11y-switch-visual::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s ease;
}

.a11y-switch[aria-pressed="true"] .a11y-switch-visual { background: #3ecf6e; }
.a11y-switch[aria-pressed="true"] .a11y-switch-visual::before { transform: translateX(16px); }

.a11y-fila-modo {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.a11y-modo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-modo-header .a11y-etiqueta { margin-bottom: 0; }

.a11y-ayuda-boton {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.a11y-ayuda-boton[aria-expanded="true"] {
    background: #fff;
    color: #14181f;
}

.a11y-ayuda-texto {
    font-size: .82rem;
    line-height: 1.4;
    opacity: .85;
}

.a11y-ayuda-texto[hidden] { display: none; }

.a11y-modo-boton {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-radius: 10px;
    padding: .6rem .75rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    width: 100%;
}

.a11y-modo-icono { width: 20px; height: 20px; flex-shrink: 0; }

/* Visible solo para lectores de pantalla: da contexto ("Modo de
   color:") sin duplicar visualmente la etiqueta que ya está arriba. */
.a11y-sr-solo {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.a11y-restablecer {
    appearance: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .75);
    font-family: inherit;
    font-size: .85rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    align-self: center;
    padding: .3rem;
}

.a11y-boton:focus-visible,
.a11y-tamano-btn:focus-visible,
.a11y-switch:focus-visible,
.a11y-modo-boton:focus-visible,
.a11y-ayuda-boton:focus-visible,
.a11y-restablecer:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
