/* ESTILOS MENU */

header#main-header #et-top-navigation {
    padding: 0 !important;
    display: flex;
    align-items: center;
    gap: 56px;
}

/* Ocultar menú Divi original */
#et-top-navigation .et_mobile_nav_menu,
#et-top-navigation .mobile_menu_bar {
    display: none !important;
}

/* ··················· MENU BURGER + DESPLEGABLE ··········· */

/* --- Botón Burger --- */
#custom-menu-toggle {
    height: 80px;
    width: 80px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: var(--corner-small);
    background-color: transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    z-index: 2;
}

#custom-menu-toggle:focus-visible {
    outline: 4px solid var(--button-solid-focus-outline-color);
    outline-offset: 2px;
}

/* Fondo animado al hacer hover */
#custom-menu-toggle::before {
    content: "";
    height: 80px;
    width: 80px;
    background-color: var(--background-neutral);
    position: absolute;
    border-radius: var(--corner-small);
    left: -2px;
    top: 78px;
    transition: var(--transition);
    z-index: 0;
}

#custom-menu-toggle:hover::before {
    top: -2px;
}

/* Líneas */
#custom-menu-toggle span {
    background-color: var(--on-background-main);
    height: 3px;
    width: 28px;
    border-radius: var(--corner-extra-small);
    display: block;
    position: absolute;
    z-index: 1;
    left: 50%;
    transform: translateX(-50%);
    transition: var(--transition);
}

/* Posición vertical fija */
#custom-menu-toggle span.line-1 {
    top: calc(50% - 17px);
}

#custom-menu-toggle span.line-2 {
    top: calc(50% - 1px);
    width: 40px;
}

#custom-menu-toggle span.line-3 {
    top: calc(50% + 15px);
}

/* Hover (cuando no está abierto) */
#custom-menu-toggle:hover span {
    background-color: var(--surface);
    width: 40px;
}

#custom-menu-toggle:hover span.line-1 {
    top: calc(50% - 17px);
}

#custom-menu-toggle:hover span.line-2 {
    top: calc(50% - 1px);
    width: 24px;
}

#custom-menu-toggle:hover span.line-3 {
    top: calc(50% + 15px);
}

/* --- FASE 1: CENTRADO DE LÍNEAS --- */
#custom-menu-toggle.open span.line-1,
#custom-menu-toggle.open span.line-2,
#custom-menu-toggle.open span.line-3 {
    top: calc(50% - 1px);
}

/* --- FASE 2: PELOTITAS PEQUEÑAS --- */
#custom-menu-toggle.open.ready span {
    width: 3px;
    height: 3px;
}

/* Animaciones para la formación de la X partiendo desde las pelotitas */
@keyframes line1-open {
    0% {
        transform: translateX(-50%) rotate(0deg);
        width: 3px;
        height: 3px;
    }

    2% {
        transform: translateX(-50%) rotate(45deg);
        width: 3px;
        height: 3px;
    }

    100% {
        transform: translateX(-50%) rotate(45deg);
        width: 40px;
        height: 3px;
    }
}

@keyframes line3-open {
    0% {
        transform: translateX(-50%) rotate(0deg);
        width: 3px;
        height: 3px;
    }

    2% {
        transform: translateX(-50%) rotate(-45deg);
        width: 3px;
        height: 3px;
    }

    100% {
        transform: translateX(-50%) rotate(-45deg);
        width: 40px;
        height: 3px;
    }
}

/* --- FASE INVERSA: de la X a pelotitas y volver a líneas --- */
@keyframes line1-close {
    0% {
        transform: translateX(-50%) rotate(45deg);
        width: 40px;
        height: 3px;
    }

    49% {
        transform: translateX(-50%) rotate(45deg);
        width: 3px;
        height: 3px;
    }

    50% {
        transform: translateX(-50%) rotate(0deg);
        width: 3px;
        height: 3px;
    }

    100% {
        transform: translateX(-50%) rotate(0deg);
        width: 40px;
        height: 3px;
    }
}

@keyframes line3-close {
    0% {
        transform: translateX(-50%) rotate(-45deg);
        width: 40px;
        height: 3px;
    }

    49% {
        transform: translateX(-50%) rotate(-45deg);
        width: 3px;
        height: 3px;
    }

    50% {
        transform: translateX(-50%) rotate(0deg);
        width: 3px;
        height: 3px;
    }

    100% {
        transform: translateX(-50%) rotate(0deg);
        width: 40px;
        height: 3px;
    }
}

/* --- FASE 3: EXPANDIR Y FORMAR X CON ANIMACIÓN --- */
#custom-menu-toggle.open.ready-x span.line-1 {
    animation: line1-open 0.4s forwards ease-in-out;
}

#custom-menu-toggle.open.ready-x span.line-3 {
    animation: line3-open 0.4s forwards ease-in-out;
}

/* Ocultar line-2 en fase 3, manteniendo pelotita centrada */
#custom-menu-toggle.open.ready-x span.line-2 {
    opacity: 0;
    transition: opacity 0.3s ease;
    width: 3px;
    height: 3px;
    top: calc(50% - 1px);
    transform: translateX(-50%);
}

/* Hover mientras está abierto: mantener color */
#custom-menu-toggle.open:hover span,
#custom-menu-toggle.open.ready:hover span,
#custom-menu-toggle.open.ready-x:hover span {
    background-color: var(--on-background-light);
}

#custom-menu-toggle.open.ready-x span.line-1,
#custom-menu-toggle.open.ready-x span.line-3 {
    width: 52px;
}

/* --- FASE INVERSA: aplicar animaciones al cerrar --- */
#custom-menu-toggle.closing span.line-1,
#custom-menu-toggle.closing span.line-3 {
    animation-fill-mode: forwards;
}

#custom-menu-toggle.closing span.line-1 {
    animation: line1-close 0.5s ease-in-out forwards;
}

#custom-menu-toggle.closing span.line-3 {
    animation: line3-close 0.5s ease-in-out forwards;
}

/* Restaurar line-2 al cerrar */
#custom-menu-toggle.closing span.line-2 {
    opacity: 1;
    width: 3px;
    /* inicialmente pequeño */
    height: 3px;
    top: calc(50% - 1px);
    transform: translateX(-50%);
    transition: width 0.3s ease 0.5s, opacity 0.3s ease;
    /* retraso para esperar animaciones */
}

/* --- Menú desplegable --- */
#custom-fullscreen-menu {
    background: rgba(34, 37, 37, 0.4);
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    position: fixed;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 1;
}

#custom-fullscreen-menu.active {
    opacity: 1;
    pointer-events: auto;
}

/* Contenido del menú */
#custom-fullscreen-menu .content-menu {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 50vw;
    height: calc(100vh - 24px);
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    padding: 56px;
    background: rgba(248, 249, 249, 0.85);
    border-radius: var(--corner-small);
    backdrop-filter: blur(20px);
    opacity: 0;
    transition: transform .7s cubic-bezier(.92, .17, .56, .99), opacity .7s cubic-bezier(.92, .17, .56, .99);
    z-index: 9999;
    transform: scaleY(0);
    transform-origin: top;
}

/* Cuando está abierto */
#custom-fullscreen-menu.active .content-menu {
    opacity: 1;
    transform: scaleY(1);
    transition-delay: 0s;
}

/* Al cerrar: delay en la opacidad */
#custom-fullscreen-menu.closing .content-menu {
    opacity: 0;
    transform: scaleY(0);
    transition: transform .5s cubic-bezier(.92, .17, .56, .99) 0.4s, opacity .5s cubic-bezier(.92, .17, .56, .99) 5s;
    /* Espera antes de desaparecer */
}

#custom-fullscreen-menu .content-menu #top-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    width: 100%;
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item {
    display: flex;
    width: 100%;
    padding: 0;
    opacity: 0;
    transform: translateY(40px);
    transition: .7s cubic-bezier(.92, .17, .56, .99);
}

#custom-fullscreen-menu.active .content-menu #top-menu .menu-item {
    opacity: 1;
    transform: translateY(0);
}

#custom-fullscreen-menu.active .content-menu #top-menu .menu-item:nth-child(1) {
    transition-delay: 0.40s;
}

#custom-fullscreen-menu.active .content-menu #top-menu .menu-item:nth-child(2) {
    transition-delay: 0.44s;
}

#custom-fullscreen-menu.active .content-menu #top-menu .menu-item:nth-child(3) {
    transition-delay: 0.48s;
}

#custom-fullscreen-menu.active .content-menu #top-menu .menu-item:nth-child(4) {
    transition-delay: 0.52s;
}

#custom-fullscreen-menu.active .content-menu #top-menu .menu-item:nth-child(5) {
    transition-delay: 0.56s;
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a {
    font-size: 44px;
    line-height: 44px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--on-background);
    padding: 8px 24px;
    border-radius: var(--corner-small);
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a:hover {
    color: var(--on-background-light);
    padding: 8px 64px 8px 24px;
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a::before {
    content: "";
    display: flex;
    width: 100%;
    height: 100%;
    background-color: var(--on-background-main);
    position: absolute;
    top: 100%;
    left: 0;
    z-index: -1;
    transition: var(--transition);
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a::after {
    content: "arrow_forward";
    font-family: "Material Symbols Rounded";
    font-size: 40px;
    font-weight: 600;
    line-height: 40px;
    width: 40px;
    height: 40px;
    display: flex;
    position: absolute;
    top: 50%;
    right: 16px;
    margin-top: -20px;
    color: transparent;
    transition: var(--transition);
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a:hover::after {
    color: var(--on-background-light);
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a:hover::before {
    top: 0;
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a,
#custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a:hover,
#custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a:focus {
    background-color: var(--background-neutral);
    color: var(--on-background-light);
    padding: 8px 24px;
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a::before,
#custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a:after {
    content: none;
}

#custom-fullscreen-menu .content-menu #top-menu .menu-item a:focus-visible {
    outline: 4px solid var(--button-solid-focus-outline-color);
    outline-offset: 2px;
}


/* ··················· fin MENU BURGER + DESPLEGABLE ··········· */

/* ··················· MENU ACTIONS ··········· */
.content-header-actions {
    display: flex;
    align-items: center;
    gap: 56px;
}

/* idioma */
.content-header-actions .box-idioma {
    text-transform: uppercase;
    font-size: 16px;
    font-weight: 200;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-header-actions .box-idioma a {
    font-weight: 400;
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: transparent;
    border-radius: var(--corner-extra-small);
    transition: var(--transition);
}

.content-header-actions .box-idioma a:hover {
    text-decoration-color: currentColor;
    color: var(--link-hover);
}

.content-header-actions .box-idioma a:focus-visible,
.content-header-actions .box-area-privada a:focus-visible,
.content-header-actions .box-buscador button:focus-visible {
    outline: 4px solid var(--button-solid-focus-outline-color);
    outline-offset: 2px;
}

.content-header-actions .box-idioma .active-lang,
.content-header-actions .box-idioma .active-lang:hover {
    color: var(--link-disabled);
    font-weight: 700;
    cursor: default;
    text-decoration: none;
}

/* area privada */
.content-header-actions .box-area-privada,
.content-header-actions .box-area-privada a,
.content-header-actions .box-buscador,
.content-header-actions .box-buscador button {
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--corner-extra-small);
    transition: var(--transition);
}

.content-header-actions .box-area-privada a span {
    font-size: 40px;
}

.content-header-actions .box-area-privada a:hover span {
    color: var(--on-background-main);
}

/* buscador */
.content-header-actions .box-buscador #custom-search-toggle {
    padding: 0;
    border: none;
    background: no-repeat;
    cursor: pointer;
}

.content-header-actions .box-buscador #custom-search-toggle:hover {
    color: var(--on-background-main);
}

.content-header-actions .box-buscador #custom-search-toggle .material-symbols-rounded {
    font-size: 40px;
}

/* ············································································responsive 1366px ······································ */
@media (max-width: 1366px) {
    #custom-fullscreen-menu .content-menu {
        width: 70vw;
    }
}

/* ············································································responsive 767px ······································ */
@media (max-width: 767px) {
    header#main-header #et-top-navigation {
        gap: 24px;
    }

    #custom-menu-toggle {
        height: 64px;
        width: 64px;
    }

    #custom-menu-toggle::before {
        height: 64px;
        width: 64px;
        top: 64px;
    }

    #custom-menu-toggle span {
        width: 20px;
    }

    #custom-menu-toggle:hover span {
        width: 32px;
    }

    #custom-menu-toggle span.line-1,
    #custom-menu-toggle:hover span.line-1 {
        top: calc(50% - 12px);
    }

    #custom-menu-toggle span.line-2 {
        width: 32px;
    }

    #custom-menu-toggle:hover span.line-2 {
        width: 20px;
    }

    #custom-menu-toggle span.line-3,
    #custom-menu-toggle:hover span.line-3 {
        top: calc(50% + 10px);
    }

    #custom-menu-toggle.open span.line-1,
    #custom-menu-toggle.open span.line-2,
    #custom-menu-toggle.open span.line-3 {
        top: calc(50% - 1px);
    }


    #custom-fullscreen-menu .content-menu {
        width: calc(100vw - 16px);
        height: 100vh;
        /* 100vh Fallback para navegadores antiguos */
        height: calc(100dvh - 16px);
        /* 100dvh Vista dinámica para navegadores modernos y así en móvil se adapta perfecta al tamaño de pantalla tanto si hay barra de búsqueda como si no la hay */
        padding: 24px;
        top: 8px;
        right: 8px;
        display: flex;
        flex-wrap: wrap;
        flex-direction: column-reverse;
        justify-content: space-between;
        align-items: flex-start;
    }

    #custom-fullscreen-menu .content-menu #top-menu {
        gap: 16px;
    }

    #custom-fullscreen-menu .content-menu #top-menu .menu-item a {
        font-size: 18px;
        padding: 12px 44px 12px 16px;
        line-height: 18px;

    }

    #custom-fullscreen-menu .content-menu #top-menu .menu-item a:hover {
        padding: 12px 44px 12px 16px;
    }

    #custom-fullscreen-menu .content-menu #top-menu .menu-item a::after {
        font-size: 24px;
        line-height: 24px;
        width: 24px;
        height: 24px;
        right: 12px;
        margin-top: -12px;
        color: var(--on-background);
    }

    #custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a,
    #custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a:hover,
    #custom-fullscreen-menu .content-menu #top-menu .menu-item.current_page_item a:focus {
        padding: 12px 16px;
    }

    .content-header-actions {
        flex-wrap: wrap;
        width: 64px;
        gap: 24px;
    }

    .content-header-actions .box-idioma {
        font-size: 14px;
        gap: 8px;
    }

    .content-header-actions .box-area-privada,
    .content-header-actions .box-area-privada a,
    .content-header-actions .box-buscador,
    .content-header-actions .box-buscador button {
        font-size: 28px;
        width: 28px;
        height: 28px;
    }

    .content-header-actions .box-area-privada a span {
        font-size: 28px;
    }

    .content-header-actions .box-buscador #custom-search-toggle .material-symbols-rounded {
        font-size: 28px;
    }
}

/* ··················· fin MENU ACTIONS ··········· */