/* HEADER — nav fijo. Dirección: «café porteño antañón».
   Contrastes: links crema s/ espresso-oscuro 14.1:1 (y s/ cualquier punto
   del hero 9.4+); burger/filete latón s/ el punto más claro del hero 4.8:1.
   TODO scopeado a #nav: acá vive el ÚNICO <nav id="nav"> fijo del sitio;
   un selector "nav" pelado le pegaría a otros <nav> (ej. .categorias del menú) */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 6%;
    transition: background .4s, box-shadow .4s, border-color .4s;
    border-bottom: 1px solid transparent;

    &.solid,
    &.open {
        /* espresso-oscuro pleno (sin alpha ni blur): los links crema miden
           14.1:1 y el filete de latón 7.2:1 sobre esta superficie */
        background: var(--espresso-oscuro);
        /* vidriera antañona: filete de latón al pie de la barra */
        border-color: rgba(201, 162, 95, .4);
        box-shadow: 0 4px 24px rgba(15, 9, 4, .3);

        img {
            height: 42px;
        }
    }

    /* el logo manda al home */
    .logo {
        display: inline-flex;
        align-items: center;
        text-decoration: none;
    }

    img {
        height: 56px;
        width: auto; /* el atributo width del HTML no manda: evita el ensanche horizontal */
        transition: height .3s;
    }

    ul {
        display: flex;
        gap: 34px;
        list-style: none;
        align-items: center;

        li {
            a {
                color: var(--crema);
                text-decoration: none;
                font-size: .85rem;
                letter-spacing: .14em;
                text-transform: uppercase;
                position: relative;

                &::after {
                    content: '';
                    position: absolute;
                    left: 0;
                    bottom: -6px;
                    width: 0;
                    height: 1px;
                    background: var(--laton);
                    transition: width .3s;
                }

                &:hover::after {
                    width: 100%;
                }

                /* anillo de foco latón: 4.8:1 s/ el punto más claro del hero */
                &:focus-visible {
                    outline: 2px solid var(--laton);
                    outline-offset: 3px;
                }
            }
        }
    }

    button {
        display: none;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        /* latón pleno s/ el punto más claro del gradiente hero: 4.8:1 (>=3 en control) */
        border: 1px solid var(--laton);
        border-radius: 3px;
        background: transparent;
        cursor: pointer;

        span {
            display: block;
            width: 100%;
            height: 2px;
            background: var(--crema);
            transition: transform .3s, opacity .3s;
        }

        &:hover {
            background: rgba(201, 162, 95, .15);
        }

        &:focus-visible {
            outline: 2px solid var(--laton);
            outline-offset: 2px;
        }
    }

    &.open {
        button {
            span:nth-child(1) {
                transform: translateY(7px) rotate(45deg);
            }

            span:nth-child(2) {
                opacity: 0;
            }

            span:nth-child(3) {
                transform: translateY(-7px) rotate(-45deg);
            }
        }
    }

    @media(max-width:720px) {
        button {
            display: flex;
        }

        ul {
            display: none;
        }
    }
}

/* panel full-screen del menú mobile. Vive FUERA del nav (es su hermano, no su
   hijo): así el panel ocupa todo el viewport y la sincronización con nav.open
   se hace con el selector de hermanos */
#nav-menu {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 110px 10% 60px;
    background: rgba(36, 26, 17, .97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-16px);
    transition: opacity .3s, transform .3s, visibility .3s;

    ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        list-style: none;
        margin: 0;

        li {
            opacity: 0;
            transform: translateY(-12px);
            transition: opacity .3s, transform .3s;

            a {
                display: block;
                padding: 12px 0;
                color: var(--crema); /* 14.1:1 s/ el panel espresso */
                text-decoration: none;
                font-size: 1.15rem;
                letter-spacing: .14em;
                text-transform: uppercase;
                position: relative;

                &::after {
                    content: '';
                    position: absolute;
                    left: 0;
                    bottom: -6px;
                    width: 0;
                    height: 1px;
                    background: var(--laton);
                    transition: width .3s;
                }

                &:hover::after {
                    width: 100%;
                }

                /* anillo de foco latón s/ el panel espresso: 7.2:1 */
                &:focus-visible {
                    outline: 2px solid var(--laton);
                    outline-offset: 3px;
                }
            }
        }
    }

    @media(max-width:720px) {
        display: flex;
    }
}

/* abierto: fade + slide escalonado de los links; al cerrar vuelve sin delay */
#nav.open + #nav-menu {
    opacity: 1;
    visibility: visible;
    transform: none;

    @media(max-width:720px) {
        li {
            opacity: 1;
            transform: none;

            &:nth-child(1) {
                transition-delay: .05s;
            }

            &:nth-child(2) {
                transition-delay: .1s;
            }

            &:nth-child(3) {
                transition-delay: .15s;
            }

            &:nth-child(4) {
                transition-delay: .2s;
            }
        }
    }
}
