/*
Theme Name: Ajedrez Accesible
Theme URI: https://ajedrezsinbarreras.com
Description: Tema accesible para personas ciegas - Gestión de audios de ajedrez
Author: Tu Nombre
Version: 1.0.0
Text Domain: ajedrez-accesible
*/

/* VARIABLES */
:root {
    --bg: #000000;
    --fg: #FFFFFF;
    --fg-muted: #E6E6E6;
    --accent: #FFD400;
    --focus: #FFD400;
    --border: #3A3A3A;
    --font-size: 20px;
}

html {
    font-size: var(--font-size);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

.bg-texture {
    background:
        radial-gradient(1200px 800px at 50% 10%, rgba(255, 212, 0, 0.08), transparent 60%),
        radial-gradient(900px 600px at 80% 70%, rgba(255, 212, 0, 0.06), transparent 60%),
        radial-gradient(700px 500px at 20% 80%, rgba(255, 212, 0, 0.05), transparent 60%),
        #000;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
}

.site-header,
.site-footer {
    border-bottom: 2px solid var(--border);
    padding: 1rem;
}

.site-footer {
    border-top: 2px solid var(--border);
    border-bottom: none;
    text-align: center;
}

h1,
h2,
h3 {
    line-height: 1.25;
    margin-top: 0;
}

h2 {
    margin-bottom: 0.75rem;
}

a {
    color: var(--accent);
}

.prefs {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}

button,
.btn,
select {
    font: inherit;
    color: #000;
    background: var(--accent);
    border: 3px solid #000;
    border-radius: 14px;
    padding: .9rem 1.2rem;
    cursor: pointer;
}

input,
textarea {
    font: inherit;
    color: var(--fg);
    background: #111;
    border: 3px solid var(--accent);
    border-radius: 12px;
    padding: .8rem 1rem;
}

button:hover,
.btn:hover {
    filter: brightness(1.05);
}

button:active {
    transform: scale(0.99);
}

/* ESTILOS DE FOCO ACCESIBLE */
/* Solo mostrar borde grueso en elementos interactivos reales */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
audio:focus-visible,
summary:focus-visible,
.btn:focus-visible {
    outline: 4px solid var(--focus);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 212, 0, 0.25);
    z-index: 10;
}

/* Elementos no interactivos que reciben foco programático (como H2 al navegar) no deben tener borde visual */
[tabindex="-1"]:focus {
    outline: none;
}

/* Accesibilidad táctil y móvil */
button {
    min-height: 44px;
    min-width: 44px;
    font-size: 1rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    padding: .6rem .9rem;
    background: var(--accent);
    color: #000;
    font-weight: 700;
}

.hero {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 1rem 0.5rem;
    gap: 0.5rem;
}

.hero h1 {
    font-size: clamp(2rem, 6vw, 4rem);
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.hero p {
    color: var(--fg-muted);
    max-width: 720px;
    margin: 0 auto;
}

.hero .cta {
    font-weight: 800;
    font-size: 1.1rem;
}

.navchap {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem 0;
}

.lesson-list ul,
.lesson-list li {
    list-style: none;
    margin: 0;
    padding: 0;
}

#lista {
    display: grid;
    gap: .9rem;
}

.lesson-item {
    border: 3px solid var(--accent);
    border-radius: 16px;
    padding: 1rem;
    background: #0A0A0A;
}

.lesson-item h3 {
    margin: 0 0 .4rem;
    font-size: 1.25rem;
    color: var(--accent);
}

.lesson-meta {
    color: var(--fg-muted);
    font-size: 1rem;
}

.play-btn {
    margin-top: .6rem;
    font-weight: 700;
}

.player {
    margin-top: 1.5rem;
    border: 3px solid var(--accent);
    border-radius: 16px;
    padding: 1rem;
    background: #0A0A0A;
}

.controls {
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}

.controls-secondary {
    margin-top: .5rem;
}

.controls-speed {
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: .5rem;
}

.speed-display {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 4rem;
    text-align: center;
    padding: .5rem 1rem;
    background: #111;
    border: 2px solid var(--accent);
    border-radius: 8px;
}

.estado {
    margin-bottom: .6rem;
    font-weight: 700;
    min-height: 1.5em;
}

.lbl-vel {
    margin-left: .5rem;
    color: var(--accent);
    font-weight: 700;
}

.transc {
    margin-top: .5rem;
}

.transc summary {
    cursor: pointer;
}

.transc-content {
    padding: .5rem 0;
}

.footer-note {
    color: var(--fg-muted);
    font-size: .95rem;
}

@media (max-width:600px) {
    html {
        font-size: 22px;
    }

    .container {
        padding: .75rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls button,
    .btn-categoria,
    .btn-subcategoria {
        width: 100%;
        margin-bottom: 0.8rem;
        /* Mayor separación táctil */
        min-height: 54px;
        /* Zona táctil más generosa */
    }

    .controls-speed {
        justify-content: center;
    }

    .speed-display {
        margin: .3rem 0;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mejoras de accesibilidad */
audio {
    width: 100%;
    margin-top: .5rem;
}

.lesson-item:focus-within {
    outline: 4px solid var(--focus);
    outline-offset: 3px;
}

/* Estilos para categorías y subcategorías */
.categorias-section,
.subcategorias-section {
    margin-top: 1rem;
}

.categorias-list,
.subcategorias-list {
    display: grid;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.categoria-item,
.subcategoria-item {
    border: 3px solid var(--accent);
    border-radius: 16px;
    padding: 1rem;
    background: #0A0A0A;
}

.categoria-item h2,
.subcategoria-item h3 {
    margin: 0 0 .3rem;
    font-size: 1.5rem;
    color: var(--accent);
}

.categoria-meta,
.subcategoria-meta {
    color: var(--fg-muted);
    font-size: 1rem;
    margin-bottom: .5rem;
}

.btn-categoria,
.btn-subcategoria {
    margin-top: .5rem;
    font-weight: 700;
    width: 100%;
    /* Borde transparente para High Contrast Mode */
    border: 3px solid #000;
}

.error {
    color: #ff4444;
    padding: 1rem;
    border: 2px solid #ff4444;
    border-radius: 8px;
    background: #1a0000;
}

/* Breadcrumbs */
.breadcrumb {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span[aria-hidden="true"] {
    margin: 0 0.5rem;
    color: var(--fg-muted);
}

/* Contador de audios */
.audio-counter {
    color: var(--accent);
    font-weight: 700;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Atajos de teclado */
kbd {
    background: #222;
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-family: monospace;
    font-size: 0.9em;
}

/* Región de anuncios mejorada */
.estado {
    font-size: 1.1rem;
    padding: 0.8rem;
    background: #111;
    border: 2px solid var(--accent);
    border-radius: 8px;
}

/* --- NUEVOS ESTILOS PARA EJERCICIOS Y RESPUESTAS --- */

/* Contenedores de Ejercicios y Respuestas */
.ejercicios-container,
.respuestas-container {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-in;
    display: block;
}

/* Caja de Ejercicios: Fondo claro y borde gris */
.ejercicios-container>div {
    background-color: #ffffff !important;
    border: 3px solid #ccc;
    padding: 1.5rem;
    border-radius: 12px;
    color: #000;
    margin-bottom: 1.5rem;
}

/* Caja de Respuestas: Fondo azulado y borde azul */
.respuestas-container>div {
    background-color: #e3f2fd !important;
    border: 3px solid #2196F3;
    padding: 1.5rem;
    border-radius: 12px;
    color: #0d47a1;
}

/* Títulos dentro de las cajas */
.ejercicios-container h3,
.respuestas-container h3 {
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Botones dentro de las listas de ejercicios */
.ejercicios-container button,
.respuestas-container button {
    width: 100%;
    text-align: left;
    margin-bottom: 0.8rem;
    padding: 1rem;
    font-size: 1rem;
    background: transparent;
    border: 2px solid currentColor;
    /* Toma el color del texto (negro o azul) */
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    color: inherit;
}

.ejercicios-container button:hover,
.respuestas-container button:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateX(5px);
    transition: transform 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- ESTILOS DEL HEADER Y LOGO --- */

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.custom-logo-link img {
    max-height: 90px;
    /* Tamaño controlado del logo */
    width: auto;
    height: auto;
    display: block;
}

/* Asegurar que el foco en el logo sea visible */
.custom-logo-link:focus-visible {
    outline: 4px solid var(--focus);
    outline-offset: 4px;
    border-radius: 4px;
}

.site-title a {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 900;
}

/* Ajuste responsive para header */
@media (max-width: 600px) {
    .site-header .container {
        flex-direction: column;
        text-align: center;
    }

    .site-branding {
        margin-bottom: 1rem;
    }
}

/* --- ESTILOS DEL FOOTER (COLUMNAS) --- */

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    text-align: left;
}

.footer-col h3 {
    color: var(--accent);
    font-size: 1.2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu li {
    margin-bottom: 0.8rem;
}

.footer-menu a {
    display: inline-block;
    text-decoration: none;
    color: var(--fg);
    /* Blanco */
    font-weight: 500;
    padding: 5px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.2s;
}

.footer-menu a:hover {
    color: var(--accent);
    /* Amarillo al pasar mouse */
    border-bottom-color: var(--accent);
}

/* Iconito visual antes de los enlaces del footer */
.footer-menu a::before {
    content: "🔗 ";
    filter: grayscale(1);
}

.footer-menu a:hover::before {
    filter: none;
}

.footer-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.prefs-footer {
    justify-content: center;
    margin-bottom: 1rem;
}

.empty-menu-msg {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}