/* css/style.css - CÓDIGO COMPLETO Y UNIFICADO (FÍSICAS DE HOVER RE-DISEÑADAS) */

/* =========================================
   1. RESET BÁSICO Y BODY
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-cuerpo);
    background-color: var(--color-fondo-base);
    background: rgba(36, 22, 12, 0.9);
    color: var(--color-texto-cuerpo);
    overflow-x: hidden;
}

/* =========================================
   2. HERO SECTION & OVERLAYS
   ========================================= */
.hero-section {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--color-fondo-oscuro);
    background-image: url('../assets/img/hero-bg-movil.jpg');
    background-size: cover;
    background-position: center;
}

@media (min-width: 769px) {
    .hero-section {
        background-image: url('../assets/img/hero-bg.jpg');
    }
}

.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 180px;
    background: linear-gradient(to bottom, rgba(36, 22, 12, 0.9) 0%, transparent 100%);
    z-index: 5;
    pointer-events: none;
}

.hero-section::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 250px;
    background: linear-gradient(to top, rgba(36, 22, 12, 0.9) 0%, transparent 100%);
    z-index: 5;
    pointer-events: none;
}

/* =========================================
   3. SISTEMA DE VIDEO DE FONDO HTML5
   ========================================= */
.video-background-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
}

.hero-html5-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    animation: fadeInVideo 2.5s ease-in forwards;
}

@keyframes fadeInVideo {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* =========================================
   4. NAVEGACIÓN SUPERIOR (NAVBAR)
   ========================================= */
.top-nav {
    position: relative;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 50px;
    height: 100px;
}

.nav-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
}

.logo-blanco-svg {
    height: 45px;
    width: auto;
    color: var(--color-texto-menu);
    transition: opacity 0.3s ease;
}

.logo-blanco-svg:hover {
    opacity: 0.8;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-title {
    font-family: var(--font-brand-title);
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--color-texto-menu);
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.brand-subtitle {
    font-family: var(--font-brand-subtitle);
    font-weight: 300;
    font-size: 0.65rem;
    color: var(--color-texto-menu);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    line-height: 1.2;
    margin-top: 3px;
    opacity: 0.95;
}

.nav-links {
    flex: 2;
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0;
    align-items: center;
    height: 100%;
}

.nav-links>li {
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-links>li>a {
    position: relative;
    text-decoration: none;
    font-family: var(--font-menu);
    font-weight: 400;
    font-size: 16px;
    letter-spacing: 0.01em;
    color: var(--color-texto-menu);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    height: 100%;
    padding: 0 25px;
}

.nav-links>li>a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: 0;
    height: 2px;
    background-color: #FFFFFF;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 12px 1px rgba(255, 255, 255, 0.7);
}

.nav-links>li>a:hover,
.nav-links>li.dropdown:hover>a {
    opacity: 1;
    color: var(--color-texto-menu);
    transform: translateY(-3px);
}

.nav-links>li>a:hover::after,
.nav-links>li.dropdown:hover>a::after {
    width: 100%;
    transform: translateX(-50%) translateY(3px);
}

.nav-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 22px;
}

.nav-icon {
    color: var(--color-texto-menu);
    width: 22px;
    height: 22px;
    transition: color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon:hover {
    color: #FFFFFF;
    transform: translateY(-2px);
}

.nav-icon svg {
    width: 100%;
    height: 100%;
}

/* =========================================
   5. MEGA MENÚS DESPLEGABLES Y FÍSICAS
   ========================================= */
.dropdown {
    position: static;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100vw;
    background-color: rgba(249, 246, 240, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 5;
}

.dropdown:hover .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.1s ease, visibility 0.1s ease;
    z-index: 10;
}

/* 1. ESTADO INICIAL (Menú Oculto) */
.simple-dropdown li,
.mega-menu-grid .mega-card {
    opacity: 0;
    transform: translateY(20px);
    /* Transición rápida solo para ocultarlo al cerrar todo el menú */
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 2. ENTRADA EN CASCADA Y ESTADO BASE HOVER-OUT */
.dropdown:hover .simple-dropdown li,
.dropdown:hover .mega-menu-grid .mega-card {
    opacity: 1;
    transform: translateY(0);
    /* Usamos keyframes para la entrada y así evitar el "Bug del Delay" al quitar el mouse */
    animation: cascadeDrop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;

    /* Esta es la física limpia de aterrizaje al QUITAR el mouse (Hover OUT) */
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cascadeDrop {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tiempos de cascada mediante animation-delay */
.dropdown:hover .simple-dropdown li:nth-child(1),
.dropdown:hover .mega-menu-grid .mega-card:nth-child(1) {
    animation-delay: 0.10s;
}

.dropdown:hover .simple-dropdown li:nth-child(2),
.dropdown:hover .mega-menu-grid .mega-card:nth-child(2) {
    animation-delay: 0.20s;
}

.dropdown:hover .simple-dropdown li:nth-child(3),
.dropdown:hover .mega-menu-grid .mega-card:nth-child(3) {
    animation-delay: 0.30s;
}

.dropdown:hover .simple-dropdown li:nth-child(4),
.dropdown:hover .mega-menu-grid .mega-card:nth-child(4) {
    animation-delay: 0.40s;
}


.simple-dropdown {
    display: flex;
    gap: 40px;
    list-style: none;
}

.simple-dropdown a {
    color: var(--color-texto-cuerpo);
    text-decoration: none;
    font-family: var(--font-cuerpo);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.simple-dropdown a:hover {
    transform: translateX(5px);
    color: var(--color-acento-principal);
    background-color: rgba(36, 22, 12, 0.04);
}

.mega-menu-container {
    padding: 50px 20px;
}

.mega-menu-grid {
    display: grid;
    width: 100%;
    margin: 0 auto;
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1100px;
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
}

.mega-card {
    position: relative;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 25px;
    text-decoration: none;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* 3. FÍSICA DE LEVITACIÓN PERFECTA (HOVER IN) */
.dropdown:hover .mega-menu-grid .mega-card:hover {
    transform: translateY(-15px);
    /* Un levante más notorio */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    /* Curva elástica: Arranca rápido, flota lento al final (0.6s) */
    transition: transform 1.2s cubic-bezier(0.1, 1, 0.2, 1), box-shadow 0.6s cubic-bezier(0.1, 1, 0.2, 1);
}

.mega-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(36, 22, 12, 0.85) 0%, rgba(36, 22, 12, 0.1) 100%);
    z-index: 1;
    transition: background 0.4s ease;
}

.mega-card:hover::before {
    background: linear-gradient(to top, rgba(163, 46, 69, 0.9) 0%, rgba(163, 46, 69, 0.2) 100%);
    transition: background 0.2s ease;
}

.mega-title {
    position: relative;
    z-index: 2;
    color: #FFFFFF;
    font-family: var(--font-cuerpo);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ASIGNACIÓN DE IMÁGENES Y COLORES ESPECÍFICOS A LAS TARJETAS */
.preescolar-card {
    background-color: #d8cbbc;
}

.primaria-card {
    background-color: #beb6ad;
}

.secundaria-card {
    background-color: #a89f96;
}

.bachillerato-card {
    background-color: #8c8279;
}

.spelling-card {
    background-color: #beb6ad;
    background-image: url('../assets/img/Apps/spelling.jpg');
}

.debate-card {
    background-color: #beb6ad;
    background-image: url('../assets/img/debate.jpg');
}

.saberes-card {
    background-color: #beb6ad;
    background-image: url('../assets/img/Apps/saberes.jpg');
}

/* =========================================
   6. CONTENIDO CENTRAL HERO
   ========================================= */
.hero-content {
    position: relative;
    z-index: 10;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
    padding: 0 20px 80px 20px;
}

.hero-subtitle {
    font-family: var(--font-brand-title);
    font-weight: 700;
    font-size: 2.8rem;
    color: var(--color-acento-secundario);
    max-width: 700px;
    line-height: 1.3;
    margin-top: 20px;
    text-shadow: 2px 3px 10px rgba(0, 0, 0, 0.7);
    text-transform: uppercase;
}

/* =========================================
   7. BOTÓN LA PETITE FLEUR 
   ========================================= */
.rose-btn {
    position: relative;
    width: 148px;
    height: 38px;
    display: flex;
    align-items: center;
    background-color: #f9f7f0;
    border: 2px solid #beb6ad;
    border-radius: 40px;
    text-decoration: none;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.rose-btn .icon-circle {
    position: absolute;
    left: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    background-color: #24160c;
    border-radius: 50%;
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.6s ease;
    z-index: 2;
}

.rose-btn .rose-svg {
    height: 16px;
    width: auto;
    color: #eceae0;
    transition: color 0.6s ease;
}

.rose-btn .btn-text {
    position: absolute;
    left: 36px;
    color: #25201c;
    font-family: var(--font-cuerpo);
    font-size: 0.75rem;
    font-weight: 600;
    animation: slideInLight 0.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.rose-btn:hover {
    background-color: #24160c;
    border-color: #f9f7f0;
    box-shadow: 0 4px 15px rgba(36, 22, 12, 0.15);
    transform: translateY(0);
}

.rose-btn:hover .icon-circle {
    left: calc(100% - 31px);
    background-color: #f9f7f0;
}

.rose-btn:hover .rose-svg {
    color: #24160c;
}

.rose-btn:hover .btn-text {
    animation: slideInDark 0.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInDark {
    0% {
        opacity: 1;
        left: 36px;
        transform: translateX(0);
        color: #25201c;
    }

    30% {
        opacity: 0;
        left: 36px;
        transform: translateX(12px);
        color: #25201c;
    }

    31% {
        opacity: 0;
        left: 12px;
        transform: translateX(12px);
        color: #f9f7f0;
    }

    100% {
        opacity: 1;
        left: 12px;
        transform: translateX(0);
        color: #f9f7f0;
    }
}

@keyframes slideInLight {
    0% {
        opacity: 1;
        left: 12px;
        transform: translateX(0);
        color: #f9f7f0;
    }

    30% {
        opacity: 0;
        left: 12px;
        transform: translateX(-12px);
        color: #f9f7f0;
    }

    31% {
        opacity: 0;
        left: 36px;
        transform: translateX(-12px);
        color: #25201c;
    }

    100% {
        opacity: 1;
        left: 36px;
        transform: translateX(0);
        color: #25201c;
    }
}

/* =========================================
   8. COREOGRAFÍA DE ENTRADA (ANIMACIONES)
   ========================================= */
.nav-left {
    animation: fadeSlideRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    animation-delay: 0.2s;
}

.nav-links>li {
    animation: fadeSlideDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.nav-links>li:nth-child(1) {
    animation-delay: 0.3s;
}

.nav-links>li:nth-child(2) {
    animation-delay: 0.4s;
}

.nav-links>li:nth-child(3) {
    animation-delay: 0.5s;
}

.nav-right {
    animation: fadeSlideLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    animation-delay: 0.6s;
}

.hero-subtitle {
    animation: fadeSlideUp 1.2s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    animation-delay: 0.9s;
}

@keyframes fadeSlideRight {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeSlideLeft {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   9. EXPERIENCIA MÓVIL (MENÚ Y ACORDEÓN)
   ========================================= */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 20px;
    cursor: pointer;
    z-index: 100;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--color-texto-menu);
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1024px) {
    .top-nav {
        padding: 0 25px;
    }

    .hamburger {
        display: flex;
    }

    .nav-links,
    .nav-right {
        display: none;
    }

    .nav-links.mobile-active {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        background-color: rgba(36, 22, 12, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        padding-top: 120px;
        padding-bottom: 120px;
        z-index: 40;
        overflow-y: auto;
        animation: fadeInMobile 0.4s ease forwards;
    }

    .nav-links.mobile-active>li {
        width: 100%;
        height: auto;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-links.mobile-active>li>a {
        padding: 20px;
        font-size: 1.15rem;
        justify-content: space-between;
        transform: none !important;
    }

    .nav-links.mobile-active>li>a::after {
        display: none;
    }

    .nav-links.mobile-active>li.dropdown>a::after {
        content: '▼';
        display: block;
        font-size: 0.7rem;
        opacity: 0.6;
        transition: transform 0.3s ease;
    }

    .nav-links.mobile-active>li.dropdown.open>a::after {
        transform: rotate(180deg);
    }

    .nav-links.mobile-active .dropdown-menu {
        position: static;
        width: 100%;
        background: rgba(255, 255, 255, 0.02);
        box-shadow: none;
        border: none;
        padding: 0;
        visibility: visible;
        opacity: 1;
        display: none;
        transform: none;
    }

    .nav-links.mobile-active .dropdown.open .dropdown-menu {
        display: block;
        animation: slideDownAccordion 0.3s ease forwards;
    }

    .nav-links.mobile-active .simple-dropdown,
    .nav-links.mobile-active .mega-menu-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        opacity: 1;
        transform: none;
    }

    /* Cancelamos las animaciones de escritorio en móvil para que no estorben */
    .nav-links.mobile-active .simple-dropdown a,
    .nav-links.mobile-active .mega-card {
        height: auto;
        padding: 15px 40px;
        font-size: 1rem;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0;
        color: rgba(255, 255, 255, 0.75);
        transform: none !important;
        animation: none !important;
    }

    .nav-links.mobile-active .mega-card:hover {
        transform: none;
    }

    .nav-links.mobile-active .mega-card::before {
        display: none;
    }

    .nav-links.mobile-active .mega-title {
        font-size: 1rem;
        color: inherit;
        font-weight: 400;
    }

    .nav-right.mobile-active {
        display: flex;
        position: fixed;
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 50;
        animation: fadeInMobile 0.6s ease forwards;
    }

    .hamburger.toggle-active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .hamburger.toggle-active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.toggle-active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .hero-subtitle {
        font-size: 2rem;
    }
}

@keyframes fadeInMobile {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDownAccordion {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}