:root {
    --home-nav-offset: 88px;
}

:is(#atelier, #galerie, #processus, #lanterne, #distribution, #maintenance, #distinctions, #servizi, #finale) {
    scroll-margin-top: var(--home-nav-offset);
}

.home-sections[hidden],
.menu-open .home-sections {
    display: none;
}

.home-sections {
    min-width: 0;
}

.home-sections-links {
    display: flex;
    gap: clamp(.75rem, 1.6vw, 1.6rem);
    align-items: center;
}

.home-sections-toggle {
    display: none;
}

.home-sections a {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 2.65rem;
    color: var(--ink);
    font-family: var(--body);
    font-size: .94rem;
    font-weight: 550;
    text-transform: uppercase;
    white-space: nowrap;
}

.home-sections a:is(:hover, [aria-current="location"]) {
    text-decoration: underline;
    text-underline-offset: .3em;
}

.home-sections a:focus-visible {
    outline: 1px solid var(--ink);
    outline-offset: -1px;
}

#header:has(.home-sections) :is(.logo, #menuBtn) {
    flex-shrink: 0;
}

body:not(.menu-open) #header:is(.scrolled, .home-sections-visible) {
    background: #070707;
    backdrop-filter: none;
}

#header.home-sections-visible .header-progress {
    width: 100%;
    height: 2px;
    background: var(--ink);
    transform: scaleX(var(--home-progress, 0));
}

@media (max-width: 1120px) {
    :root {
        --home-nav-offset: 80px;
    }

    #lavori {
        padding-top: calc(var(--home-nav-offset) + .5rem);
    }

    #header.home-sections-visible {
        gap: .5rem;
        padding: .65rem 1rem;
    }

    .home-sections-toggle {
        display: inline-flex;
        align-items: center;
        gap: .65rem;
        min-height: 44px;
        padding: .45rem .55rem;
        background: transparent;
        border: 1px solid var(--line);
        color: var(--ink);
        font: 600 .9rem/1.25 var(--body);
        text-align: left;
        text-transform: uppercase;
    }

    .home-sections-chevron {
        width: .45rem;
        height: .45rem;
        flex: none;
        margin: -.2rem .1rem 0 0;
        border-right: 1px solid currentColor;
        border-bottom: 1px solid currentColor;
        transform: rotate(45deg);
    }

    .home-sections-toggle[aria-expanded="true"] .home-sections-chevron {
        transform: rotate(225deg);
        margin-top: .2rem;
    }

    .home-sections-toggle:focus-visible {
        outline: 1px solid var(--ink);
        outline-offset: 2px;
    }

    .home-sections-links {
        display: none;
        position: absolute;
        inset-inline: 1rem;
        top: calc(100% + 4px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: .2rem .55rem;
        max-height: 65svh;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: .65rem;
        background: #070707;
        border: 1px solid var(--line);
        box-shadow: 0 10px 30px #0008;
    }

    .home-sections-toggle[aria-expanded="true"] + .home-sections-links {
        display: grid;
    }

    .home-sections-links a {
        min-height: 44px;
        padding: .45rem;
        font-size: .9rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
