/* =========================
   RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================
   VARIABILI
========================= */
:root {
    --accent: rgb(133,145,156);
    --text-main: #111;
    --text-muted: #666;
    --bg-main: #fff;
    --transition: 0.3s ease;
}

/* =========================
   BASE
========================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* =========================
   NAVBAR (UNIFORMATA)
========================= */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 40px;
    border-bottom: 2px solid rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-main);
}

/* logo */
nav h1 a {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
    color: var(--text-main);
}

nav h1 a::after {
    display: none;
}

/* menu desktop */
nav ul {
    list-style: none;
    display: flex;
    gap: 32px;
}

nav ul a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    transition: color var(--transition);
}

nav ul a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width var(--transition);
}

nav ul a:hover {
    color: var(--accent);
}

nav ul a:hover::after {
    width: 100%;
}

/* =========================
   TOGGLE MOBILE
========================= */
.menu-toggle {
    display: none;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2000;
    color: #111;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* =========================
   PAGE TITLE
========================= */
.work-title {
    text-align: center;
    margin: 50px 0 30px;
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
}

/* =========================
   GALLERY (MASONRY CON ANIMAZIONE PER RIGA)
========================= */
.gallery {
    max-width: 1200px;
    margin: 40px auto 80px;
    column-count: 3;
    column-gap: 0;
}

.item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
}

.item img {
    width: 100%;
    display: block;
    transition: transform 0.6s ease, filter 0.6s ease;
}

.item:hover img {
    transform: scale(1.04);
    filter: brightness(0.85);
}

/* overlay testi */
.overlay-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.item:hover .overlay-text {
    opacity: 1;
}

/* =========================
   FOOTER
========================= */
footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: #f1f1f1;
}

/* =========================
   LIGHTBOX
========================= */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    z-index: 2000;
    flex-direction: column;
}

#lightbox.show {
    display: flex;
}

#lightbox img.lightbox-img {
    max-width: 90%;
    max-height: 80%;
    margin-bottom: 10px;
}

#lightbox .lightbox-caption {
    color: #fff;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1rem;
}

#lightbox .close,
#lightbox .prev,
#lightbox .next {
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    user-select: none;
    position: absolute;
}

#lightbox .close { top: 20px; right: 30px; }
#lightbox .prev { left: 20px; top: 50%; transform: translateY(-50%); }
#lightbox .next { right: 20px; top: 50%; transform: translateY(-50%); }

/* ========================= ANIMAZIONI ========================= */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInMobile {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================= RESPONSIVE
   GALLERY & NAV MOBILE
========================= */
/* ========================= RESPONSIVE
   GALLERY & NAV MOBILE
========================= */
@media (max-width: 900px) {
    .gallery {
        column-count: 2; /* forziamo due colonne su tablet e mobile */
    }
}

@media (max-width: 600px) {
    .gallery {
        column-count: 2; /* mobile: sempre due colonne */
    }

    .menu-toggle {
        display: block;
    }

    body.menu-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.25);
        z-index: 1400;
    }

    .nav-links {
        position: fixed;
        top: 72px;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #fff;
        display: flex;
        flex-direction: column;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        z-index: 1500;
        padding-top: 30px;
    }

    .nav-links.open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav-links ul {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .nav-links ul li {
        list-style: none;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        opacity: 0;
    }

    .nav-links ul li::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 25%;
        width: 50%;
        height: 1px;
        background: rgba(0,0,0,0.12);
    }

    .nav-links.open ul li:nth-child(1) { animation: slideInMobile 0.3s forwards 0s; }
    .nav-links.open ul li:nth-child(2) { animation: slideInMobile 0.3s forwards 0.05s; }
    .nav-links.open ul li:nth-child(3) { animation: slideInMobile 0.3s forwards 0.1s; }
    .nav-links.open ul li:nth-child(4) { animation: slideInMobile 0.3s forwards 0.15s; }
    .nav-links.open ul li:nth-child(5) { animation: slideInMobile 0.3s forwards 0.2s; }
    .nav-links.open ul li:nth-child(6) { animation: slideInMobile 0.3s forwards 0.25s; }

    .nav-links a {
        font-size: 1.3rem;
        text-decoration: none;
        color: var(--text-main);
        transition: color 0.25s ease;
    }

    .nav-links a:hover {
        color: var(--accent);
    }

    /* =========================
       LINK INSTAGRAM DENTRO L’HAMBURGER
    ========================= */
    .nav-links > a {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 0;
        z-index: 1501;
    }

    .nav-links > a img {
        width: 25px;
        margin-bottom: 8px;
    }
}
