/* ==========================================================================
   HEADER Y FOOTER UNIFICADOS - INSTITUCIÓN EDUCATIVA ANTONIO RICAURTE CASD
   Diseño Oficial Responsivo para PC y Móviles (Idéntico a index.html)
   ========================================================================== */

/* REGLAS GLOBALES DE SEGURIDAD RESPONSIVA PARA TABLETS, iPADS Y MÓVILES */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

img, svg, video, iframe {
    max-width: 100%;
}

/* LÍNEA SUPERIOR MULTICOLOR ANIMADA */
.top-line {
    height: 5px;
    background: linear-gradient(90deg, #0f6d2f 0%, #158a3e 50%, #f1c40f 100%);
    width: 100%;
    background-size: 200% 200%;
    animation: gradientMoveHF 6s ease infinite;
}

@keyframes gradientMoveHF {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* CABECERA PRINCIPAL */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 5000;
    transition: all 0.3s ease;
    width: 100%;
}

.header-inner {
    max-width: 1260px;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    width: 100%;
    position: relative;
}

/* Línea inferior animada (Verde/Amarillo institucional) */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #0f6d2f, #f1c40f, #158a3e, #0f6d2f);
    background-size: 300% 300%;
    animation: gradientMoveHF 6s ease infinite;
}

/* LOGO CASD */
.logo-area {
    display: flex;
    align-items: center;
    position: relative;
    padding-right: 25px;
}

.logo-area::after {
    content: '';
    position: absolute;
    right: 0;
    top: 15%;
    height: 70%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(15, 109, 47, 0.25), transparent);
}

.logo-area img {
    height: 68px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.03));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-area img:hover {
    transform: scale(1.03);
}

/* MENÚ DE NAVEGACIÓN DESKTOP */
.menu {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu li {
    position: relative;
    list-style: none;
}

.menu a {
    text-decoration: none;
    display: block;
    font-size: 14.5px;
    -webkit-tap-highlight-color: transparent !important;
}

.menu > li > a {
    position: relative;
    color: #334155;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    z-index: 1;
    transition: color 0.3s ease;
}

/* Efecto Tab/Pestaña al hacer hover */
.menu > li > a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 109, 47, 0.05);
    border-bottom: 3px solid #0f6d2f;
    border-radius: 6px 6px 0 0;
    z-index: -1;
    transform: scaleY(0);
    transform-origin: bottom;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2), opacity 0.3s ease;
}

.menu > li:hover > a {
    color: #0f6d2f;
}

.menu > li:hover > a::before {
    transform: scaleY(1);
    opacity: 1;
}

/* SUBMENÚ PC REFINADO PREMIUM */
.submenu {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(255, 255, 255, 0.99);
    width: 260px;
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.04);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.submenu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    z-index: -1;
    border-radius: 3px 0 0 0;
}

.submenu::after {
    content: '';
    position: absolute;
    top: -25px;
    left: 0;
    width: 100%;
    height: 25px;
    background: transparent;
}

/* AISLAMIENTO DE HOVER DESKTOP: Solo en pantallas grandes */
@media (min-width: 769px) {
    .menu li:hover .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

.submenu a {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    color: #505f75;
    font-weight: 600;
    letter-spacing: 0.2px;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin-bottom: 4px;
    overflow: hidden;
}

.submenu a:last-child {
    margin-bottom: 0;
}

.submenu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: linear-gradient(180deg, #f1c40f, #f39c12);
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transform: scaleY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.submenu a:hover {
    background: #f8fafc;
    color: #0f6d2f;
    padding-left: 28px;
    box-shadow: inset 0 0 0 1px rgba(15, 109, 47, 0.05);
}

.submenu a:hover::before {
    opacity: 1;
    transform: scaleY(1);
}

/* BOTÓN HAMBURGUESA */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.4s ease;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    border: none !important;
    background: transparent !important;
    user-select: none;
}

.hamburger:focus,
.hamburger:active,
.hamburger:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

.hamburger:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: #0f6d2f;
    border-radius: 2px;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.hamburger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* FOOTER OFICIAL */
.footer {
    background: linear-gradient(145deg, #002b04 0%, #064d14 100%) !important;
    color: white !important;
    margin-top: 60px;
    position: relative;
    padding-top: 15px;
    width: 100%;
}

.footer-wave {
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: clamp(50px, 7vw, 100px);
    overflow: hidden;
    line-height: 0;
    z-index: 10;
}

.footer-wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

.footer-contenedor {
    max-width: 1200px;
    margin: auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    padding: 60px 40px 25px 40px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-col h3 {
    color: #f1c40f;
    margin-bottom: 25px;
    font-size: 20px;
    position: relative;
    display: inline-block;
    font-weight: 700;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #f1c40f;
    border-radius: 2px;
}

.footer-slogan {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    padding: 7px 16px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 18px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: default;
}

.footer-slogan:hover {
    background: rgba(241, 196, 15, 0.15);
    border-color: rgba(241, 196, 15, 0.5);
    color: #f1c40f;
    transform: translateY(-2px);
}

.footer-logo-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.footer-logo-wh {
    max-width: 180px;
    height: auto;
    opacity: 0.95;
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.footer-logo-wh:hover {
    opacity: 1;
    transform: scale(1.05);
}

.footer p {
    line-height: 1.8;
    font-size: 15px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.85);
}

/* LISTA DE CONTACTO (ICONOS) */
.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-list li {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14.5px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contact-list li:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(241, 196, 15, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.contact-list .icon {
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(241, 196, 15, 0.15);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.contact-list li:hover .icon {
    background: #f1c40f;
}

.contact-list .icon svg {
    width: 18px;
    height: 18px;
    fill: #f1c40f;
    transition: fill 0.3s ease;
}

.contact-list li:hover .icon svg {
    fill: #064d14;
}

.contact-list div,
.contact-list span:not(.icon) {
    transition: color 0.3s ease;
}

.contact-list li:hover div,
.contact-list li:hover span:not(.icon) {
    color: #fff;
}

/* REDES SOCIALES OFICIALES */
.social-links {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.social-btn {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 18px 8px 8px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: fit-content;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.social-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    transition: all 0.4s ease;
}

.social-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.social-btn:hover {
    transform: translateX(8px);
    color: #ffffff;
    border-color: transparent;
}

.social-btn:hover .social-icon {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.social-btn:hover .social-icon img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.instagram:hover .social-icon img {
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.social-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 30px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.social-btn:hover::before {
    opacity: 1;
}

.facebook:hover {
    box-shadow: 0 6px 15px rgba(24, 119, 242, 0.4);
}

.facebook::before {
    background: linear-gradient(135deg, #1877F2, #115cbf);
}

.x-twitter:hover {
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

.x-twitter::before {
    background: linear-gradient(135deg, #333333, #000000);
}

.instagram:hover {
    box-shadow: 0 6px 15px rgba(225, 48, 108, 0.4);
}

.instagram::before {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.mapa {
    width: 100%;
    height: 200px;
    border: none;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s ease;
}

.mapa:hover {
    transform: scale(1.03);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    padding: 25px;
    font-size: 14px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS, iPADS Y MÓVILES)
   ========================================================================== */

/* TABLETS Y iPADS EN PORTRAIT Y PANTALLAS HASTA 1024px */
@media (max-width: 1024px) {
    .header-inner {
        padding: 14px 28px !important;
    }

    .logo-area img {
        height: 56px !important;
    }

    .hamburger {
        display: flex !important;
    }

    /* MENÚ MÓVIL Y TABLET TOTALMENTE OPACO Y TÁCTIL */
    .menu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        flex-direction: column !important;
        display: none;
        padding: 20px 28px 28px !important;
        gap: 8px !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18) !important;
        z-index: 99999 !important;
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    }

    .menu.show {
        display: flex !important;
        animation: slideDownMenuHF 0.3s ease forwards;
    }

    @keyframes slideDownMenuHF {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .menu li {
        width: 100% !important;
    }

    .menu > li > a {
        padding: 14px 18px !important;
        border-radius: 10px !important;
        color: #334155 !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        display: block !important;
        width: 100% !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .menu > li > a::before {
        display: none !important;
    }

    .menu > li > a:hover,
    .menu > li.open > a {
        color: #0f6d2f !important;
        background: rgba(15, 109, 47, 0.06) !important;
    }

    /* SUBMENÚ MÓVIL/TABLET ESTILO ACORDEÓN PERFECTO */
    .menu li:hover .submenu,
    .submenu {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 10px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #f8fafc !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease, margin 0.3s ease;
        opacity: 1 !important;
        visibility: visible !important;
        border: none !important;
    }

    .submenu::before,
    .submenu::after {
        display: none !important;
    }

    .submenu a {
        padding: 12px 20px !important;
        margin: 3px 6px !important;
        border-radius: 8px !important;
        background: transparent !important;
        border: none !important;
        color: #505f75 !important;
        font-size: 14.5px !important;
        font-weight: 600 !important;
        display: block !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .submenu a::before {
        display: none !important;
    }

    .submenu a:hover,
    .submenu a:active {
        background: #eef5f0 !important;
        color: #0f6d2f !important;
        padding-left: 24px !important;
    }

    .menu li.open .submenu {
        max-height: 500px !important;
        margin-top: 6px !important;
        margin-bottom: 6px !important;
        padding: 8px 0 !important;
        border: 1px solid rgba(15, 109, 47, 0.1) !important;
    }

    /* FOOTER TABLETS Y iPADS (2 COLUMNAS) */
    .footer-contenedor {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 35px !important;
        padding: 50px 30px 25px 30px !important;
    }
}

/* REGLAS ESPECÍFICAS PARA TABLETS Y iPADS (768px a 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Padding uniforme y cómodo para tablets */
    .wrapper, .container, main {
        padding-left: 24px !important;
        padding-right: 24px !important;
        box-sizing: border-box !important;
    }

    /* Rejillas optimizadas a 2 columnas en iPads */
    .teachers-container,
    .grades-container,
    .projects-grid,
    .profs-grid,
    .cards-grid,
    .card-grid,
    .directivos-grid,
    .gallery-grid,
    .symbols-grid,
    .uniformes-grid,
    .events-grid,
    .pedagogy-grid,
    .subjects-grid,
    .area-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 24px !important;
    }

    /* Carruseles y sliders en iPad */
    .main-image {
        height: 420px !important;
    }

    /* Tamaño táctil accesible para iPad */
    button, .btn, .hero-btn, a.hero-btn {
        min-height: 44px;
    }
}

/* PANTALLAS MÓVILES (TELÉFONOS <= 767px) */
@media (max-width: 767px) {
    .header-inner {
        padding: 12px 18px !important;
    }

    .logo-area img {
        height: 50px !important;
    }

    .footer-contenedor {
        grid-template-columns: 1fr !important;
        gap: 35px !important;
        padding: 40px 20px 20px 20px !important;
    }

    .contact-list li {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        justify-content: center !important;
    }

    .contact-list .icon {
        margin-right: 0 !important;
        margin-bottom: 8px !important;
    }
}

/* iPAD PRO EN LANDSCAPE (1025px a 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .header-inner {
        padding: 12px 24px !important;
    }

    .logo-area {
        padding-right: 18px !important;
    }

    .logo-area img {
        height: 58px !important;
    }

    .menu {
        gap: 2px !important;
    }

    .menu > li > a {
        padding: 8px 12px !important;
        font-size: 13.5px !important;
    }
}

/* RESET GENERAL PARA TOUCH / TAP Y FOCOS INDESEADOS */
.menu,
.menu *,
.hamburger,
.hamburger * {
    -webkit-tap-highlight-color: transparent !important;
}

.menu a:focus,
.menu a:active,
.menu a:focus-visible,
.hamburger:focus,
.hamburger:active,
.hamburger:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   ESCALA GENERAL DEL SITIO EN PANTALLAS GRANDES (125%, TODAS LAS SECCIONES)
   --------------------------------------------------------------------------
   En monitores grandes el contenido queda limitado a 1260px, por lo que la
   página se veía pequeña y "alejada". Desde 1600px de ancho se aplica el
   mismo efecto que el zoom del navegador al 125%: todo (texto, imágenes,
   tarjetas, menú y pie de página) crece un 25% de forma proporcional.

   Por debajo de 1600px no se aplica nada: ahí el contenido ya ocupa todo el
   ancho disponible y el diseño se ve como siempre.

   Para cambiar la escala solo hay que modificar --escala-sitio: las
   compensaciones de abajo se recalculan solas.
   ========================================================================== */
:root {
    --escala-sitio: 1.25;
}

@media (min-width: 1600px) {
    body {
        zoom: var(--escala-sitio);
    }

    /* ------------------------------------------------------------------
       Compensación de las unidades de viewport.
       El zoom multiplica los valores expresados en vh y vw, así que las
       ventanas de imagen, las portadas a pantalla completa y las secciones
       alineadas con 100vw podrían desbordarse. Estas reglas solo se activan
       cuando el navegador realmente las multiplica: lo detecta
       js/header-footer.js y agrega las clases "zoom-escala-vh" / "-vw".
       En los navegadores que ya respetan estas unidades, todo queda igual.
       ------------------------------------------------------------------ */
    html.zoom-escala-vh .modal-content,
    html.zoom-escala-vh .prom-gallery-content,
    html.zoom-escala-vh .estudiantes-gallery-content,
    html.zoom-escala-vh #newsModal > div,
    html.zoom-escala-vh #modalImage {
        max-height: calc(90vh / var(--escala-sitio)) !important;
    }

    html.zoom-escala-vh .modal-box {
        max-height: calc(88vh / var(--escala-sitio)) !important;
    }

    html.zoom-escala-vh .modal-img {
        max-height: calc(58vh / var(--escala-sitio)) !important;
    }

    html.zoom-escala-vh .hero-video-container {
        height: calc(85vh / var(--escala-sitio)) !important;
        min-height: calc(600px / var(--escala-sitio)) !important;
        max-height: calc(900px / var(--escala-sitio)) !important;
    }

    html.zoom-escala-vh .hero {
        min-height: calc(100vh / var(--escala-sitio)) !important;
    }

    html.zoom-escala-vh #inicio.hero {
        height: calc(100vh / var(--escala-sitio)) !important;
    }

    /* ------------------------------------------------------------------
       Secciones que se alinean con la rejilla de 1260px usando 100vw
       (index.html). Con el zoom, 100vw se multiplica y la sección quedaría
       desalineada; aquí se calcula sobre el ancho real del diseño.
       ------------------------------------------------------------------ */
    html.zoom-escala-vw .welcome-content {
        padding: 90px 40px 90px max(40px, calc((100vw / var(--escala-sitio) - 1260px) / 2)) !important;
        max-width: calc(max(40px, calc((100vw / var(--escala-sitio) - 1260px) / 2)) + 650px) !important;
    }
}
