
/* =========================================================
   EL BACHI - HOJA DE ESTILOS PRINCIPAL
   Diseño responsive para las cuatro páginas del sitio.
   ========================================================= */


/* =========================================================
   1. VARIABLES GLOBALES
   ========================================================= */

:root {
    /* Colores principales */
    --color-boton-bg: #C39A85;
    --color-boton-texto: #2C6E6E;

    --color-blanco: #FFFFFF;
    --color-fondo: #F7F5F2;
    --color-superficie: #FFFFFF;
    --color-superficie-suave: #EFEAE5;

    --color-texto: #303030;
    --color-texto-secundario: #686868;
    --color-titulos: #2C6E6E;

    --color-borde: #DDD5CE;
    --color-sombra: rgba(0, 0, 0, 0.08);

    /* Estados */
    --color-hover: #AD806B;
    --color-focus: #245C5C;

    /* Tipografía */
    --fuente-principal:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        sans-serif;

    /* Tamaños */
    --texto-pequeno: 0.875rem;
    --texto-normal: 1rem;
    --texto-grande: 1.25rem;

    --titulo-h1: clamp(2rem, 4vw, 3.5rem);
    --titulo-h2: clamp(1.6rem, 3vw, 2.3rem);
    --titulo-h3: clamp(1.25rem, 2vw, 1.6rem);

    /* Espaciados */
    --espacio-xs: 0.5rem;
    --espacio-sm: 1rem;
    --espacio-md: 1.5rem;
    --espacio-lg: 2rem;
    --espacio-xl: 3rem;

    /* Bordes y radios */
    --radio-pequeno: 6px;
    --radio-medio: 12px;
    --radio-grande: 18px;

    /* Sombras */
    --sombra-suave: 0 4px 15px var(--color-sombra);
    --sombra-media: 0 8px 25px var(--color-sombra);

    /* Transiciones */
    --transicion: 0.25s ease;

    /* Ancho de contenido */
    --ancho-contenido: 1200px;
}


/* =========================================================
   2. RESET Y ESTILOS GENERALES
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

body {
    font-family: var(--fuente-principal);
    font-size: var(--texto-normal);
    line-height: 1.7;

    color: var(--color-texto);
    background-color: var(--color-fondo);

    min-height: 100vh;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

h1,
h2,
h3,
h4 {
    line-height: 1.25;
    color: var(--color-titulos);
}

h1 {
    font-size: var(--titulo-h1);
}

h2 {
    font-size: var(--titulo-h2);
}

h3 {
    font-size: var(--titulo-h3);
}

p {
    margin-bottom: var(--espacio-sm);
}

ul,
ol {
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

::selection {
    background-color: var(--color-boton-bg);
    color: var(--color-blanco);
}


/* =========================================================
   3. NAVEGACIÓN COMPARTIDA
   ========================================================= */

.page-header {
    width: 100%;
    padding: var(--espacio-md) 5%;
    background-color: var(--color-blanco);
    box-shadow: var(--sombra-suave);
    text-align: center;
}

.page-header h1 {
    margin-top: var(--espacio-md);
}

.navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--espacio-sm);
}

.btn-nav {
    display: inline-flex;
    justify-content: center;
    align-items: center;

    padding: 0.8rem 1.5rem;

    background-color: var(--color-boton-bg);
    color: var(--color-boton-texto);

    border: 2px solid transparent;
    border-radius: var(--radio-pequeno);

    font-weight: 600;
    text-align: center;

    cursor: pointer;

    transition:
        background-color var(--transicion),
        color var(--transicion),
        transform var(--transicion),
        box-shadow var(--transicion);
}

.btn-nav:hover {
    background-color: var(--color-hover);
    color: var(--color-blanco);

    transform: translateY(-3px);
    box-shadow: var(--sombra-suave);
}

.btn-nav:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 4px;
}


/* =========================================================
   4. PÁGINA PRINCIPAL - INDEX
   ========================================================= */

#home-container {
    display: grid;

    grid-template-rows: repeat(3, minmax(0, 1fr));

    width: 100%;
    height: 100vh;
    min-height: 100vh;

    overflow: hidden;

    background-color: var(--color-blanco);
}


/* BLOQUE SUPERIOR */

.home-top {
    display: flex;
    justify-content: center;
    align-items: center;

    padding: var(--espacio-md);

    background-color: var(--color-blanco);
    text-align: center;
}

.home-top h1 {
    font-size: var(--titulo-h1);
    font-weight: 800;
    letter-spacing: 0.04em;

    color: var(--color-titulos);
}


/* BLOQUE CENTRAL */

.home-middle {
    width: 100%;
    height: 100%;

    overflow: hidden;
}

.home-figure {
    width: 100%;
    height: 130%;
    object-fit: cover;
}

.home-image {
    display: block;
    width: 100%;
    height: 100%;
}


/* BLOQUE INFERIOR */

.home-bottom {
    display: flex;
    justify-content: center;
    align-items: center;

    flex-wrap: wrap;
    gap: var(--espacio-md);

    padding: var(--espacio-md);

    background-color: var(--color-blanco);
}


/* =========================================================
   5. PÁGINA HISTORIA
   ========================================================= */


/* ESTRUCTURA DE TRES COLUMNAS */

.layout-tres-columnas {
    display: grid;

    grid-template-columns:
        minmax(90px, 180px)
        minmax(0, 1fr)
        minmax(90px, 180px);

    gap: var(--espacio-md);

    align-items: start;

    width: 100%;
}


/* PANELES LATERALES */

.panel-lateral {
    position: sticky;
    top: 0;

    width: 100%;
    height: 100vh;

    overflow: hidden;

    background-color: var(--color-superficie-suave);
}

.panel-lateral img {
    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center;

    /* Evita deformaciones de las fotografías */
}

/*
   Las imágenes laterales permanecen fijas mientras
   se desplaza el contenido de la página.

   El movimiento de cámara avanzado puede incorporarse
   posteriormente con CSS Scroll-driven Animations.
*/


/* CONTENIDO CENTRAL */

.contenido-historia {
    width: 100%;
    max-width: 850px;

    margin: 0 auto;

    padding: var(--espacio-xl) var(--espacio-lg);
}

.introduccion-historia {
    margin-bottom: var(--espacio-xl);
    padding-bottom: var(--espacio-lg);

    border-bottom: 2px solid var(--color-borde);
}

.introduccion-historia h2 {
    margin-bottom: var(--espacio-md);
}


/* ARTÍCULOS DE CADA DÉCADA */

.decada {
    margin-bottom: var(--espacio-xl);
    padding: var(--espacio-lg);

    background-color: var(--color-superficie);

    border: 1px solid var(--color-borde);
    border-radius: var(--radio-medio);

    box-shadow: var(--sombra-suave);

    transition:
        transform var(--transicion),
        box-shadow var(--transicion);
}

.decada:hover {
    transform: translateY(-3px);
    box-shadow: var(--sombra-media);
}

.decada h2 {
    margin-bottom: var(--espacio-md);
}

.decada p {
    color: var(--color-texto-secundario);
}


/* FIGURAS HISTÓRICAS */

.figura-historica {
    margin-top: var(--espacio-lg);
}

.imagen-historica {
    width: 100%;
    max-height: 450px;

    object-fit: cover;

    border-radius: var(--radio-medio);
}

.figura-historica figcaption {
    margin-top: var(--espacio-xs);

    color: var(--color-texto-secundario);
    font-size: var(--texto-pequeno);

    text-align: center;
    font-style: italic;
}


/* =========================================================
   6. PÁGINA DATOS E INSCRIPCIONES
   ========================================================= */

.contenido-datos {
    width: min(100% - 2rem, var(--ancho-contenido));

    margin: 0 auto;
    padding: var(--espacio-xl) 0;
}

/* Fondo de la página de datos e inscripciones */

.main-datos {
    background-image: url("../assets/img/escuela-fachada.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 40px 5%;
}   

.seccion-datos,
.seccion-inscripciones {
    margin-bottom: var(--espacio-xl);
    padding: var(--espacio-lg);

    background-color: var(--color-superficie);

    border-radius: var(--radio-grande);
    box-shadow: var(--sombra-suave);
}

.seccion-datos > h2,
.seccion-inscripciones > h2 {
    margin-bottom: var(--espacio-md);

    padding-bottom: var(--espacio-sm);

    border-bottom: 2px solid var(--color-boton-bg);
}


/* DATOS INSTITUCIONALES */

.lista-datos-institucionales {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: var(--espacio-md);

    margin-top: var(--espacio-lg);
}

.dato-institucional {
    padding: var(--espacio-md);

    background-color: var(--color-superficie-suave);

    border-left: 4px solid var(--color-boton-bg);
    border-radius: var(--radio-pequeno);
}

.dato-institucional dt {
    margin-bottom: var(--espacio-xs);

    color: var(--color-titulos);
    font-weight: 700;
}

.dato-institucional dd {
    color: var(--color-texto-secundario);
    overflow-wrap: anywhere;
}

.dato-institucional a {
    color: var(--color-titulos);
    text-decoration: underline;
}


/* REQUISITOS PRESENCIALES */

.requisitos-presenciales {
    margin-top: var(--espacio-xl);
    padding: var(--espacio-lg);

    background-color: var(--color-superficie-suave);

    border-radius: var(--radio-medio);
}

.requisitos-presenciales h3 {
    margin-bottom: var(--espacio-md);
}

.lista-requisitos {
    margin-top: var(--espacio-md);
}

.lista-requisitos li {
    padding-left: var(--espacio-xs);
    margin-bottom: var(--espacio-sm);
}

.aviso-inscripcion {
    margin-top: var(--espacio-lg);
    padding: var(--espacio-md);

    background-color: #F4E8DF;

    border-left: 4px solid var(--color-boton-bg);
    border-radius: var(--radio-pequeno);
}


/* FORMULARIO ONLINE */

.formulario-online {
    margin-top: var(--espacio-xl);
}

.formulario-online h3 {
    margin-bottom: var(--espacio-sm);
}

.contenedor-iframe {
    width: 100%;
    max-width: 820px;

    margin: var(--espacio-lg) auto;

    overflow: hidden;

    background-color: var(--color-blanco);

    border: 1px solid var(--color-borde);
    border-radius: var(--radio-medio);

    box-shadow: var(--sombra-suave);
}

.contenedor-iframe iframe {
    display: block;

    width: 100%;
    min-height: 750px;

    border: none;
}

.ayuda-formulario {
    color: var(--color-texto-secundario);
    font-size: var(--texto-pequeno);
    text-align: center;
}


/* =========================================================
   7. PÁGINA OFERTA Y ACTIVIDADES
   ========================================================= */

.contenido-oferta {
    width: min(100% - 2rem, var(--ancho-contenido));

    margin: 0 auto;
    padding: var(--espacio-xl) 0;
}

.seccion-servicios,
.seccion-eventos {
    margin-bottom: var(--espacio-xl);
}

.seccion-servicios > h2,
.seccion-eventos > h2 {
    margin-bottom: var(--espacio-lg);

    padding-bottom: var(--espacio-sm);

    border-bottom: 3px solid var(--color-boton-bg);
}


/* ALBERGUE ESTUDIANTIL */

.albergue {
    margin-bottom: var(--espacio-xl);
    padding: var(--espacio-lg);

    background-color: var(--color-superficie);

    border: 1px solid var(--color-borde);
    border-left: 6px solid var(--color-boton-bg);

    border-radius: var(--radio-medio);

    box-shadow: var(--sombra-suave);
}

.albergue h3 {
    margin-bottom: var(--espacio-md);
}

.albergue h4 {
    margin-top: var(--espacio-lg);
    margin-bottom: var(--espacio-sm);

    color: var(--color-titulos);
}

.lista-condiciones-albergue {
    margin-top: var(--espacio-sm);
}

.aviso-albergue {
    margin-top: var(--espacio-lg);
    padding: var(--espacio-md);

    background-color: var(--color-superficie-suave);

    border-radius: var(--radio-pequeno);
}


/* PLAN DE ESTUDIOS */

.plan-estudios {
    margin-bottom: var(--espacio-xl);
}

.plan-estudios > h3 {
    margin-bottom: var(--espacio-md);
}

.curso {
    margin-bottom: var(--espacio-sm);
}

.curso details {
    overflow: hidden;

    background-color: var(--color-superficie);

    border: 1px solid var(--color-borde);
    border-radius: var(--radio-pequeno);

    transition: box-shadow var(--transicion);
}

.curso details[open] {
    box-shadow: var(--sombra-suave);
}

.curso summary {
    padding: var(--espacio-md);

    background-color: var(--color-superficie-suave);

    color: var(--color-titulos);

    font-weight: 700;

    cursor: pointer;

    transition:
        background-color var(--transicion),
        color var(--transicion);
}

.curso summary:hover {
    background-color: var(--color-boton-bg);
    color: var(--color-blanco);
}

.curso summary:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: -3px;
}

.lista-materias {
    padding: var(--espacio-md) var(--espacio-xl);
}

.lista-materias li {
    padding-bottom: var(--espacio-xs);
}


/* GRILLA DE HORARIOS */

.grilla-horarios {
    margin-top: var(--espacio-xl);
}

.grilla-horarios h3 {
    margin-bottom: var(--espacio-md);
}

.tabla-responsive {
    width: 100%;
    margin-top: var(--espacio-md);

    overflow-x: auto;

    border-radius: var(--radio-medio);
    box-shadow: var(--sombra-suave);
}

.tabla-horarios {
    width: 100%;
    min-width: 550px;

    border-collapse: collapse;

    background-color: var(--color-superficie);
}

.tabla-horarios caption {
    padding: var(--espacio-md);

    color: var(--color-titulos);
    font-weight: 700;

    text-align: left;
}

.tabla-horarios thead {
    background-color: var(--color-titulos);
    color: var(--color-blanco);
}

.tabla-horarios th,
.tabla-horarios td {
    padding: var(--espacio-md);

    text-align: left;

    border-bottom: 1px solid var(--color-borde);
}

.tabla-horarios tbody th {
    color: var(--color-titulos);
}

.tabla-horarios tbody tr:nth-child(even) {
    background-color: var(--color-superficie-suave);
}

.tabla-horarios tbody tr:hover {
    background-color: #F1E5DE;
}

.nota-horarios {
    margin-top: var(--espacio-md);

    color: var(--color-texto-secundario);
    font-size: var(--texto-pequeno);
}


/* =========================================================
   8. EVENTOS Y ACTIVIDADES EXTRACURRICULARES
   ========================================================= */

.seccion-eventos {
    padding-top: var(--espacio-lg);
}

.evento {
    margin-bottom: var(--espacio-xl);
    padding: var(--espacio-lg);

    background-color: var(--color-superficie);

    border: 1px solid var(--color-borde);
    border-radius: var(--radio-grande);

    box-shadow: var(--sombra-suave);
}

.evento h3 {
    margin-bottom: var(--espacio-md);
}


/* GALERÍAS DE FOTOGRAFÍAS */

.galeria-evento {
    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));

    gap: var(--espacio-md);

    margin-top: var(--espacio-lg);
}

.figura-evento {
    overflow: hidden;

    background-color: var(--color-superficie-suave);

    border-radius: var(--radio-medio);

    box-shadow: var(--sombra-suave);

    transition:
        transform var(--transicion),
        box-shadow var(--transicion);
}

.figura-evento:hover {
    transform: translateY(-5px);
    box-shadow: var(--sombra-media);
}

.figura-evento img {
    width: 100%;
    height: 200px;

    object-fit: cover;

    transition: transform 0.4s ease;
}

.figura-evento:hover img {
    transform: scale(1.04);
}

.figura-evento figcaption {
    padding: var(--espacio-sm);

    color: var(--color-texto-secundario);

    font-size: var(--texto-pequeno);
    text-align: center;
}


/* =========================================================
   9. PIE DE PÁGINA
   ========================================================= */

.page-footer {
    display: flex;
    justify-content: center;
    align-items: center;

    flex-wrap: wrap;
    gap: var(--espacio-md);

    padding: var(--espacio-lg);

    background-color: var(--color-titulos);
    color: var(--color-blanco);

    text-align: center;
}

.page-footer p {
    margin-bottom: 0;
}

.page-footer .btn-nav {
    background-color: var(--color-boton-bg);
    color: var(--color-boton-texto);
}


/* =========================================================
   10. RESPONSIVE - TABLETS
   ========================================================= */

@media screen and (max-width: 900px) {

    /* PÁGINA PRINCIPAL */

    .home-bottom {
        gap: var(--espacio-sm);
    }

    .home-bottom .btn-nav {
        padding: 0.7rem 1rem;
    }


    /* HISTORIA */

    .layout-tres-columnas {
        grid-template-columns: 90px minmax(0, 1fr) 90px;
        gap: var(--espacio-sm);
    }

    .contenido-historia {
        padding: var(--espacio-lg) var(--espacio-sm);
    }


    /* DATOS */

    .lista-datos-institucionales {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    /* EVENTOS */

    .galeria-evento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


/* =========================================================
   11. RESPONSIVE - MÓVILES
   ========================================================= */

@media screen and (max-width: 600px) {

    body {
        font-size: 0.95rem;
    }

    /* NAVEGACIÓN */

    .page-header {
        padding: var(--espacio-md);
    }

    .navigation {
        flex-direction: column;
        align-items: stretch;
    }

    .navigation .btn-nav {
        width: 100%;
    }


    /* PÁGINA PRINCIPAL */

    #home-container {
        grid-template-rows: 1fr 2fr 1fr;

        height: 100svh;
        min-height: 100svh;
    }

    .home-top {
        padding: var(--espacio-sm);
    }

    .home-top h1 {
        font-size: clamp(1.5rem, 7vw, 2.3rem);
    }

    .home-middle {
        min-height: 0;
    }

    .home-bottom {
        flex-direction: column;
        justify-content: center;

        gap: var(--espacio-xs);

        padding: var(--espacio-sm);
    }

    .home-bottom .btn-nav {
        width: min(100%, 300px);

        padding: 0.65rem 1rem;

        font-size: 0.9rem;
    }


    /* HISTORIA */

    .layout-tres-columnas {
        display: block;
    }

    .panel-lateral {
        display: none;
    }

    .contenido-historia {
        width: 100%;
        padding: var(--espacio-lg) var(--espacio-sm);
    }

    .decada {
        padding: var(--espacio-md);
        margin-bottom: var(--espacio-lg);
    }

    .decada h2 {
        font-size: 1.4rem;
    }

    .imagen-historica {
        max-height: 300px;
    }


    /* DATOS E INSCRIPCIONES */

    .contenido-datos {
        width: calc(100% - 1.5rem);
        padding: var(--espacio-lg) 0;
    }

    .seccion-datos,
    .seccion-inscripciones {
        padding: var(--espacio-md);
    }

    .lista-datos-institucionales {
        grid-template-columns: 1fr;
    }

    .requisitos-presenciales {
        padding: var(--espacio-md);
    }

    .contenedor-iframe iframe {
        min-height: 650px;
    }


    /* OFERTA Y ACTIVIDADES */

    .contenido-oferta {
        width: calc(100% - 1.5rem);
        padding: var(--espacio-lg) 0;
    }

    .albergue,
    .evento {
        padding: var(--espacio-md);
    }

    .galeria-evento {
        grid-template-columns: 1fr;
    }

    .figura-evento img {
        height: 220px;
    }

    .tabla-responsive {
        margin-bottom: var(--espacio-md);
    }


    /* PIE DE PÁGINA */

    .page-footer {
        flex-direction: column;
    }

}


/* =========================================================
   12. ACCESIBILIDAD Y PREFERENCIAS DEL USUARIO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

}


/* CONTROLES GENERADOS POR JAVASCRIPT */

.controles-filtros,
.controles-acordeon {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.controles-filtros p {
    width: 100%;
    margin-bottom: 0;
    font-weight: 600;
}

.filtro-activo {
    background-color: var(--color-titulos);
    color: var(--color-blanco);
}

/* RESALTADO DE TABLAS */

.tabla-horarios .fila-activa {
    background-color: rgba(195, 154, 133, 0.20);
}

.tabla-horarios .celda-activa {
    background-color: rgba(195, 154, 133, 0.40);
}

/* BOTÓN DE COPIAR */

.btn-copiar {
    margin-left: 0.75rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--color-boton-bg);
    border-radius: var(--radio-pequeno);
    background-color: var(--color-boton-bg);
    color: var(--color-boton-texto);
    cursor: pointer;
}

/* LIGHTBOX */

.lightbox {
    width: min(90vw, 1100px);
    max-width: 90vw;
    max-height: 90vh;
    padding: 2rem;
    margin: auto;
    border: none;
    border-radius: var(--radio-medio);
    background-color: #222;
    color: white;
}

.lightbox::backdrop {
    background-color: rgba(0, 0, 0, 0.88);
}

.lightbox figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.lightbox-imagen {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

.lightbox-texto {
    color: white;
    text-align: center;
}

.lightbox button {
    padding: 0.5rem 0.8rem;
    border: none;
    border-radius: 6px;
    background-color: var(--color-boton-bg);
    color: var(--color-boton-texto);
    font-size: 1.5rem;
    cursor: pointer;
}

.lightbox-cerrar {
    position: absolute;
    top: 10px;
    right: 10px;
}

.aviso-imagen {
    display: block;
    padding: 1rem;
    background-color: var(--color-superficie-suave);
    color: var(--color-texto-secundario);
    text-align: center;
}

@media (max-width: 600px) {
    .controles-filtros,
    .controles-acordeon {
        flex-direction: column;
        align-items: stretch;
    }

    .lightbox {
        padding: 1rem;
    }

    .lightbox-imagen {
        max-height: 65vh;
    }
}

.tabla-horarios a {
    color: var(--color-titulos);
    font-weight: 700;
    text-decoration: underline;
}
