﻿/* ===================================================================
   BOTÓN AUDIO GLOBAL
   =================================================================== */
.btn-audio-global {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid rgba(36,75,92,.22);
    color: var(--brandDark);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(16,24,40,.04);
}

    .btn-audio-global:hover {
        background: rgba(47,93,115,.06);
        transform: translateY(-1px);
        border-color: rgba(36,75,92,.35);
    }
    /* Estado cuando está reproduciendo audio */
    .btn-audio-global.leyendo {
        background: var(--accent);
        color: #1a1a1a;
        border-color: var(--accentDark);
        animation: pulsoAudio 1.5s infinite;
    }

@keyframes pulsoAudio {
    0% {
        box-shadow: 0 0 0 0 rgba(198,182,74, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(198,182,74, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(198,182,74, 0);
    }
}

/* ===================================================================
   BARRA LATERAL DE ACCESIBILIDAD (Derecha, Media Altura, Verde Pastel)
   =================================================================== */
.a11y-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    background: rgba(235, 245, 240, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(36,75,92,.08);
    border-right: none;
    border-radius: 16px 0 0 16px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: -4px 8px 32px rgba(16,24,40,.08);
    /* ¡NUEVO!: Le sumamos "gap" al final de la transición para que el encogimiento sea fluido */
    transition: background 0.4s ease, padding 0.4s ease, border-color 0.4s ease, border-radius 0.4s ease, gap 0.4s ease;
}

/* Ícono superior representativo (Gatillo) */
.a11y-header-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brandDark);
    opacity: 0.6;
    margin-bottom: -4px; /* Acerca la línea divisoria */
    transition: color 0.4s ease, opacity 0.4s ease, margin 0.4s ease;
}

/* Botones individuales (Íconos) */
.a11y-tool {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--brandDark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .a11y-tool:hover {
        background: rgba(47,93,115,.08);
        transform: scale(1.05);
    }

    /* Cuando la herramienta está activada */
    .a11y-tool.active {
        background: var(--brandDark);
        color: #fff;
        box-shadow: 0 4px 12px rgba(47,93,115,.25);
    }

/* Pequeña línea divisoria */
.a11y-divider {
    height: 1px;
    background: rgba(36,75,92,.1);
    margin: 2px 4px;
}

/* Estilo especial para el botón de Reset */
.a11y-tool.reset {
    color: #E03C31;
}

    .a11y-tool.reset:hover {
        background: rgba(224, 60, 49, 0.08);
    }

/* Responsive y ajustes de tamaño general */
@media (max-width: 600px) {
    .a11y-tool, .a11y-header-icon {
        width: 38px;
        height: 38px;
    }

        .a11y-tool svg, .a11y-header-icon svg {
            width: 18px;
            height: 18px;
        }
}

/* (Acá abajo continúan tus REGLAS GLOBALES DE ACCESIBILIDAD) */
/* ===================================================================
   REGLAS GLOBALES DE ACCESIBILIDAD (Funciones)
   =================================================================== */

/* 1. Alto Contraste (Modo oscuro extremo por inversión) */
html.a11y-on-contrast {
    filter: invert(1) hue-rotate(180deg);
    background: #fff;
}

    html.a11y-on-contrast img,
    html.a11y-on-contrast video,
    html.a11y-on-contrast svg {
        filter: invert(1) hue-rotate(180deg);
    }

/* 2. Escala de Grises */
html.a11y-on-grayscale {
    filter: grayscale(100%);
}

/* 3. Resaltar Enlaces */
body.a11y-on-links a {
    text-decoration: underline !important;
    text-decoration-color: #E03C31 !important;
    text-decoration-thickness: 3px !important;
    text-underline-offset: 4px !important;
    font-weight: 800 !important;
}

/* 4. Fuente Legible / Dislexia */
body.a11y-on-dyslexia * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
    line-height: 1.6 !important;
}

/* 5. Clases dinámicas de Tamaño de Texto */
html.a11y-text-1 {
    zoom: 1.05;
}

html.a11y-text-2 {
    zoom: 1.10;
}

html.a11y-text-3 {
    zoom: 1.15;
}

html.a11y-text--1 {
    zoom: 0.95;
}


/* ===================================================================
   ANIMACIÓN SUAVE PARA OCULTAR/MOSTRAR EN MÓVIL (Acordeón)
   =================================================================== */

/* Le damos a los botones la capacidad de animar su altura y opacidad */
.a11y-tool, .a11y-divider {
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, margin 0.4s ease, transform 0.4s ease, background 0.2s ease, color 0.2s ease;
    max-height: 50px; /* Altura normal */
    overflow: hidden;
}

/* --- ESTADO COLAPSADO --- */
/* Cuando el JS agrega la clase .collapsed, transformamos la caja entera en un botón oscuro */
.a11y-sidebar.collapsed {
    background: #2F5D73; /* Color oscuro/pizarra sólido */
    backdrop-filter: none;
    border-color: transparent;
    border-radius: 12px 0 0 12px; /* Un poco más cuadrado */
    /* Ajustamos el padding para que abrace exactamente al ícono */
    padding: 4px;
    box-shadow: -4px 4px 16px rgba(16,24,40,.15);
}

    /* El ícono principal se vuelve blanco y sólido al estar colapsado */
    .a11y-sidebar.collapsed .a11y-header-icon {
        color: #ffffff;
        opacity: 1;
        margin-bottom: 0;
    }

    /* Encoge los botones a tamaño 0, los vuelve transparentes y desactiva clics */
    .a11y-sidebar.collapsed .a11y-tool,
    .a11y-sidebar.collapsed .a11y-divider {
        max-height: 0;
        opacity: 0;
        margin-top: 0;
        margin-bottom: 0;
        transform: scale(0.8);
        pointer-events: none;
    }
