/* Animación suave para el logo */
.header__logo img {
    transition: transform 0.3s ease;
}

.header__logo img:hover {
    transform: scale(1.05);
}

/* Animación del botón hamburguesa a X */
#header__menu--movil i {
    transition: all 0.3s ease;
    display: block;
}

#header__menu--movil i.fa-bars {
    transform: rotate(0deg);
    opacity: 1;
}

#header__menu--movil i.fa-times {
    position: absolute;
    transform: rotate(-90deg);
    opacity: 0;
}

#header__menu--movil.active i.fa-bars {
    transform: rotate(90deg);
    opacity: 0;
}

#header__menu--movil.active i.fa-times {
    position: static;
    transform: rotate(0deg);
    opacity: 1;
}

/* Animación del botón X dentro del menú */
.header__menu__close {
    animation: fadeInRotate 0.5s ease-out 0.3s both;
}

.header__menu.active .header__menu__close {
    animation: fadeInRotate 0.5s ease-out 0.3s both;
}

@keyframes fadeInRotate {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.header__menu__close:active {
    transform: scale(0.9) rotate(90deg);
}

/* Efecto de ripple en los enlaces del menú */
.header__menu a {
    overflow: hidden;
    position: relative;
}

.header__menu a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.header__menu a:hover::before {
    width: 300px;
    height: 300px;
}

/* Animación de entrada del menú móvil */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

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

/* Animación de fade para overlay */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Stagger animation para los enlaces del menú móvil */
@media (max-width: 1024px) {
    .header__menu.active a {
        animation: slideInLink 0.4s ease forwards;
        opacity: 0;
    }

    .header__menu.active a:nth-child(1) {
        animation-delay: 0.1s;
    }

    .header__menu.active a:nth-child(2) {
        animation-delay: 0.15s;
    }

    .header__menu.active a:nth-child(3) {
        animation-delay: 0.2s;
    }

    .header__menu.active a:nth-child(4) {
        animation-delay: 0.25s;
    }

    .header__menu.active a:nth-child(5) {
        animation-delay: 0.3s;
    }

    .header__menu.active a:nth-child(6) {
        animation-delay: 0.35s;
    }

    .header__menu.active a:nth-child(7) {
        animation-delay: 0.4s;
    }

    .header__menu.active a:nth-child(8) {
        animation-delay: 0.45s;
    }

    @keyframes slideInLink {
        from {
            opacity: 0;
            transform: translateX(50px);
        }

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

/* Efecto de pulso sutil para el botón hamburguesa */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(223, 0, 55, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(223, 0, 55, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(223, 0, 55, 0);
    }
}

#header__menu--movil {
    border-radius: 8px;
}

#header__menu--movil:active {
    animation: pulse 0.6s ease-out;
}

/* Mejora de accesibilidad - focus states */
.header__menu a:focus,
#header__menu--movil:focus {
    outline: 2px solid var(--dorado);
    outline-offset: 4px;
}

/* Smooth scrolling para toda la página */
html {
    scroll-behavior: smooth;
}

/* Prevenir scroll cuando el menú está abierto en móvil */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Indicador visual de página activa en el menú */
.header__menu a.active {
    position: relative;
}

@media (max-width: 1024px) {
    .header__menu a.active::before {
        left: 10px;
    }
}

/* Loading state para transiciones */
.header__menu a {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Mejora de contraste para accesibilidad */
@media (prefers-contrast: high) {
    .header__menu {
        border: 2px solid var(--blanco);
    }

    .header__menu a {
        font-weight: 700;
    }
}

/* Modo de movimiento reducido para accesibilidad */
@media (prefers-reduced-motion: reduce) {

    .header__menu,
    .header__menu a,
    .menu-overlay,
    #header__menu--movil {
        transition: none;
        animation: none;
    }
}