/* ==========================================================
   ACCESIBILIDAD AAA
   ========================================================== */

/* ----------------------------------------------------------
   Enlace de salto
   ---------------------------------------------------------- */

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 10000;
    padding: 1rem 1.5rem;
    background: #000000;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    border-radius: 0.5rem;
}

.skip-link:focus {
    top: 1rem;
}


/* ----------------------------------------------------------
   Indicador de foco accesible
   ---------------------------------------------------------- */

*:focus {
    outline: 3px solid #005fcc;
    outline-offset: 3px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 3px;
}


/* ----------------------------------------------------------
   Herramientas de accesibilidad
   ---------------------------------------------------------- */

.accessibility-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.accessibility-button {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border: 1px solid #666666;
    border-radius: 0.25rem;
    background: #ffffff;
    color: #000000;
    font-size: 0.95rem;
}

.accessibility-button:hover,
.accessibility-button:focus {
    background: #f2f2f2;
}

.accessibility-button--reset {
    background: #f8f8f8;
}


/* ----------------------------------------------------------
   Alto contraste
   ---------------------------------------------------------- */

body.high-contrast {
    background: #000000;
    color: #ffffff;
}

body.high-contrast a {
    color: #ffff00;
}

body.high-contrast header,
body.high-contrast footer,
body.high-contrast nav,
body.high-contrast section,
body.high-contrast article,
body.high-contrast .card {
    background: #000000;
    color: #ffffff;
    border-color: #ffffff;
}

body.high-contrast button,
body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
}


/* ----------------------------------------------------------
   Fuente legible
   ---------------------------------------------------------- */

body.readable-font {
    font-family:
        "Atkinson Hyperlegible",
        Arial,
        Helvetica,
        sans-serif;
}


/* ----------------------------------------------------------
   Espaciado ampliado
   ---------------------------------------------------------- */

body.expanded-spacing {
    letter-spacing: 0.08em;
    word-spacing: 0.16em;
    line-height: 1.8;
}

body.expanded-spacing p,
body.expanded-spacing li,
body.expanded-spacing a {
    line-height: 1.8;
}


/* ----------------------------------------------------------
   Reducir movimiento
   ---------------------------------------------------------- */

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}


/* ----------------------------------------------------------
   Menú móvil
   ---------------------------------------------------------- */

.menu-toggle {
    display: none;
}

@media (max-width: 768px) {

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
        cursor: pointer;
    }

    .main-menu {
        display: none;
    }

    .main-menu.menu-visible,
    .menu-open .main-menu {
        display: block;
    }

}


/* ----------------------------------------------------------
   Submenús
   ---------------------------------------------------------- */

.sub-menu {
    display: none;
}

.sub-menu.submenu-open {
    display: block;
}

.submenu-toggle {
    cursor: pointer;
}


/* ----------------------------------------------------------
   Lectores de pantalla
   ---------------------------------------------------------- */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}


/* ----------------------------------------------------------
   Formularios accesibles
   ---------------------------------------------------------- */

label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    border: 1px solid #999999;
    border-radius: 0.25rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}


/* ----------------------------------------------------------
   Mensajes del sistema
   ---------------------------------------------------------- */

.flash-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

.flash-success {
    background: #e8f5e9;
    color: #1b5e20;
}

.flash-error {
    background: #ffebee;
    color: #b71c1c;
}

.flash-warning {
    background: #fff8e1;
    color: #e65100;
}


/* ----------------------------------------------------------
   Contraste de enlaces
   ---------------------------------------------------------- */

a {
    text-decoration-thickness: 2px;
}

a:hover,
a:focus {
    text-decoration: underline;
}


/* ----------------------------------------------------------
   Imágenes accesibles
   ---------------------------------------------------------- */

img {
    max-width: 100%;
    height: auto;
}


/* ----------------------------------------------------------
   Tablas accesibles
   ---------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    border: 1px solid #cccccc;
}

th {
    text-align: left;
    font-weight: 700;
}


/* ----------------------------------------------------------
   Impresión
   ---------------------------------------------------------- */

@media print {

    .accessibility-tools,
    .menu-toggle,
    nav,
    footer {
        display: none;
    }

}
