/* =========================
   RESET / BASE
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}


/* =========================
   NAVBAR
========================= */

header {
    position: relative;
    z-index: 100;
}

nav {
    width: 100%;
    background: #faf1e1;
}

.nav-container {
    max-width: 1200px;
    height: 90px;
    margin: 0 auto;
    padding: 0 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* =========================
   LOGO
========================= */

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;

    min-width: 0;

    transition: opacity 0.35s ease;
}

.logo img {
    display: block;
    height: 42px;
    width: auto;
    max-width: 100%;

    object-fit: contain;

    flex-shrink: 1;
    min-width: 0;
}

.logo:hover {
    opacity: 0.88;
}


/* =========================
   LINK
========================= */

.nav-links {
    display: flex;
    align-items: center;
    gap: 38px;
}

.nav-links a {
    position: relative;

    color: #222;
    text-decoration: none;

    font-size: 15px;
    font-weight: 500;

    padding: 8px 0;

    transition: color 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-links a::after {
    content: "";

    position: absolute;
    left: 0;
    bottom: 2px;

    width: 100%;
    height: 1px;

    background: #e30613;

    transform: scaleX(0);
    transform-origin: right;

    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-links a:hover {
    color: #e30613;
}

.nav-links a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}


/* =========================
   HAMBURGER
========================= */

.menu-toggle {
    display: none;

    width: 42px;
    height: 42px;

    padding: 8px;

    border: none;
    background: transparent;

    cursor: pointer;

    flex-direction: column;
    justify-content: center;
    gap: 5px;

    flex-shrink: 0;
}

.menu-toggle span {
    display: block;

    width: 100%;
    height: 2px;

    background: #222;

    transform-origin: center;

    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.3s ease;
}


/* =========================
   TABLET / MOBILE
========================= */

@media (max-width: 700px) {

    .nav-container {
        position: relative;

        height: 75px;
        padding: 0 20px;
    }

    /* Evita che il logo spinga l'hamburger fuori dallo schermo (si rimpicciolisce, non viene tagliato) */
    .logo {
        max-width: 60%;
    }

    .logo img {
        height: 36px;
    }


    /* =========================
       HAMBURGER
    ========================= */

    .menu-toggle {
        display: flex;
    }


    /* =========================
       MOBILE MENU
    ========================= */

    .nav-links {
        position: absolute;

        top: 75px;
        left: 0;

        width: 100%;
        max-height: calc(100vh - 75px);
        overflow-y: auto;

        padding: 10px 20px 14px;

        background: rgba(255, 255, 255, 0.98);

        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;

        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transform: translateY(-8px);

        transition:
            opacity 0.4s ease,
            transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
            visibility 0.4s ease;
    }


    /* =========================
       MOBILE LINKS
    ========================= */

    .nav-links a {
        width: 100%;

        padding: 10px 0;

        text-align: center;

        font-size: 16px;

        opacity: 0;
        transform: translateY(-6px);

        transition:
            opacity 0.35s ease,
            transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
            color 0.3s ease;
    }


    /* =========================
       MENU APERTO
    ========================= */

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;

        transform: translateY(0);
    }

    .nav-links.active a {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links.active a:nth-child(1) {
        transition-delay: 0.05s;
    }

    .nav-links.active a:nth-child(2) {
        transition-delay: 0.10s;
    }

    .nav-links.active a:nth-child(3) {
        transition-delay: 0.15s;
    }

    .nav-links.active a:nth-child(4) {
        transition-delay: 0.20s;
    }

    .nav-links.active a:nth-child(5) {
        transition-delay: 0.25s;
    }
}


/* =========================
   HAMBURGER → X
========================= */

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

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

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


/* =========================
   MENU COMPATTO (finestra bassa)
========================= */

@media (max-width: 700px) and (max-height: 560px) {

    .nav-links {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px 16px;

        padding: 8px 16px 12px;
    }

    .nav-links a {
        padding: 8px 0;
        font-size: 14px;
    }

    .nav-links a:last-child {
        grid-column: 1 / -1;
    }
}


/* =========================
   ACCESSIBILITY
========================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}