/* ── Reset ── */
html {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
}

/* ── Header / Navbar ── */
header {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #eee;
}

.logo img {
    height: 60px;
    width: auto;
    display: block;
}

.logo a {
    color: #333;
    text-decoration: none;
    font-size: 1.2rem;
    font-family: 'Avenir Next', Avenir, Helvetica, Arial, sans-serif;
}

nav a {
    color: #333;
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    margin-left: 20px;
    font-weight: 300;
}

nav a:hover,
nav a.active {
    text-decoration: underline;
    text-underline-offset: 4px;
}

nav a.lang-switch {
    border: 1px solid #ccc;
    padding: 2px 8px;
    letter-spacing: 0.05rem;
    font-size: 0.7rem;
    text-decoration: none;
}

nav a.lang-switch:hover {
    background-color: #eee;
    border-color: #999;
}

/* ── Main content (grows to push footer down) ── */
main {
    flex: 1;
}

/* ── Footer ── */
footer {
    padding: 40px 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #999;
    font-size: 0.65rem;
    letter-spacing: 0.1rem;
    background-color: #fff;
    border-top: 1px solid #eee;
}

footer div {
    margin-bottom: 5px;
}

footer a {
    color: #999;
    text-decoration: none;
}

footer a:hover {
    color: #333;
    text-decoration: underline;
}

/* ── Hamburger button – hidden on desktop ── */
.openMenuButton {
    display: none;
}

/* ── Mobile nav overlay – hidden on desktop ── */
.mobile-nav {
    display: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    header {
        padding: 15px 25px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .logo img {
        height: 50px;
    }

    header nav {
        display: none;
    }

    header {
        z-index: 100;
    }

    /* ── Hamburger button ── */
    .openMenuButton {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 99;
        font-size: 2.2rem;
        line-height: 1;
        color: #333;
        transition: transform 0.6s ease;
        padding: 0;
        user-select: none;
    }

    .openMenuButton.active {
        transform: rotate(-45deg);
    }

    /* ── Mobile nav overlay ── */
    .mobile-nav {
        display: block;
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        opacity: 0;
        transition: opacity 0.6s ease-in-out;
        z-index: 98;
    }

    .mobile-nav.active {
        right: 0;
        opacity: 1;
    }

    .mobile-nav:not(.active) {
        transition: opacity 0.6s ease-in-out, right 0.1s ease-in-out 0.65s;
    }

    .mobile-nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-start;
        padding-top: 30%;
        height: 70%;
        width: 100%;
        gap: 2.2rem;
    }

    .mobile-nav ul li a {
        display: block;
        color: #000;
        font-size: 1.5rem;
        font-weight: 300;
        letter-spacing: 0.15rem;
        text-transform: uppercase;
        text-decoration: none;
        margin-right: 30px;
        transition: opacity 0.2s ease;
    }

    .mobile-nav ul li a:hover {
        opacity: 0.5;
    }

    .mobile-nav ul li a.lang-switch {
        border: 1px solid rgba(0, 0, 0, 0.4);
        padding: 4px 14px;
        font-size: 1rem;
        letter-spacing: 0.1rem;
    }
}

/* ── Page headings ── */
h1,
h2 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.3rem;
    text-transform: uppercase;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: left;
}

/* ── Description text ── */
.description {
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: justify;
    color: #666;
}

/* ── Page content wrapper ── */
.content {
    padding: 30px 50px;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .content {
        padding: 25px 20px;
    }
}

/* ── Project gallery ── */
.gallery {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.project-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

.project-images {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
    height: 400px;
}

.project-image {
    background-color: #eee;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(20%);
    transition: filter 0.5s ease;
}

.project-image:hover img {
    filter: grayscale(0%);
}

/* ── LQIP blur-up ── */
/* Il <picture class="img-lqip"> mostra subito un placeholder sfocato     */
/* (LQIP via --lqip CSS var) e lo dissolvere quando l'immagine è carica. */
picture.img-lqip {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

picture.img-lqip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--lqip, #eee) center / cover no-repeat;
    filter: blur(15px);
    transform: scale(1.1);
    /* nasconde i bordi sfumati del blur */
    transition: opacity 0.5s ease;
    z-index: 1;
    pointer-events: none;
}

picture.img-lqip.lqip-loaded::before {
    opacity: 0;
}

picture.img-lqip img {
    position: relative;
    z-index: 0;
}

.project-meta {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.6rem;
    text-transform: uppercase;
    color: #fff;
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.35);
    padding: 4px 6px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 5;
    backdrop-filter: blur(3px);
}

.project-section:hover .project-meta {
    opacity: 1;
}

@media (max-width: 768px) {
    .gallery {
        display: grid;
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .project-images {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 88px;
        gap: 6px;
        height: auto;
    }

    .project-images .project-image:nth-child(1) {
        grid-column: 1 / span 2;
        grid-row: 1 / span 2;
    }

    .project-images .project-image:nth-child(2) {
        grid-column: 3 / span 1;
        grid-row: 1 / span 1;
    }

    .project-images .project-image:nth-child(3) {
        grid-column: 3 / span 1;
        grid-row: 2 / span 1;
    }

    .project-image {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .project-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .project-meta {
        font-size: 0.65rem;
        bottom: 6px;
        left: 6px;
        padding: 3px 6px;
    }
}