@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap');

:root {
    --h1: normal 700 4rem / 1.2 "Roboto Mono", monospace;
    --h2: normal 600 2rem / 1.3 "Roboto Mono", monospace;
    --h3: normal 500 2rem / 1.4 "Roboto Mono", monospace;
    --h4: normal 500 1.5rem / 1.4 "Roboto Mono", monospace;
    --p: normal 400 1rem / 1.6 "Roboto Mono", monospace;
    --link: normal 500 1rem / 1.6 "Roboto Mono", monospace;
    --h1-mobile: normal 700 2rem / 1.2 "Roboto Mono", monospace;
    --h2-mobile: normal 600 1.9rem / 1.25 "Roboto Mono", monospace;
    --h3-mobile: normal 500 1.6rem / 1.3 "Roboto Mono", monospace;
    --h4-mobile: normal 500 1.25rem / 1.3 "Roboto Mono", monospace;
    --p-mobile: normal 400 0.8rem / 1.45 "Roboto Mono", monospace;
    --link-mobile: normal 500 0.95rem / 1.45 "Roboto Mono", monospace;

    --transition: all 0.3s ease-in-out;

    --yellow: #EBEB37;
    --black: #000000;
    --spuma: #FFFFFF;
    --grey: #c1c1c1;
}

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--spuma);
    color: var(--black);
    font: var(--p);
}

/* ── MENU ── */

.side-menu {
    position: fixed;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-link {
    text-decoration: none;
    color: var(--grey);
    font: var(--link);
    display: inline-block;
    transform-origin: left center;
    transition:
        transform .35s ease,
        color .35s ease,
        opacity .35s ease;
    opacity: .6;
}

.menu-link:hover { opacity: 1; }

.menu-link.active {
    color: var(--black);
    opacity: 1;
    transform: scale(1.35);
}

/* ── SEZIONI DESKTOP ──
   Ogni section è esattamente 100vw × 100vh.
   Il contenuto non può mai sforare grazie a overflow: hidden.
   section-inner è il canvas su cui lavori, con padding interno.
────────────────────────── */

.section {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-inner {
    width: 100%;
    height: 100%;
    padding: 80px 80px 80px 160px; /* 160px a sinistra per il menù fisso */
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.section h1 { font: var(--h1); }

/* ── HOME DESKTOP ── */

.home-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    width: 100%;
    height: 100%; /* eredita l'altezza da section-inner che è 100% di section */
}

.home-img-wrap {
    height: 100%;
    display: flex;
    align-items: stretch;
}

.home-img-wrap img {
    width: 100%;
    height: 100%;
    max-height: 80vh;
    object-fit: contain;
    object-position: top;
    display: block;
}

.home-text h1 {
    font: var(--h1);
    margin-bottom: 2rem;
    letter-spacing: -5%;
    text-transform: uppercase;
    line-height: 90%;
}

.home-text p {
    font: var(--p);
    color: var(--grey);
    max-width: 48ch;
    
}

/* ── MOBILE (<=768px) ──
   Il page-wrapper è ruotato di 90deg: width e height si invertono.
   Ogni section è 100dvh × 100dvw (larghezza = altezza schermo, altezza = larghezza schermo).
   Il menù è sticky a sinistra nel flusso ruotato.
────────────────────────── */

@media (max-width: 768px) {

    /* ── RESET ROTAZIONE: layout verticale classico ── */

    html, body {
        overflow: auto;
    }

    .page-wrapper {
        position: static;
        width: 100%;
        height: auto;
        transform: none;
        overflow: visible;
        display: block;
    }

    /* menù fisso in cima */
    .side-menu {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 56px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 24px;
        padding: 0 20px;
        background: var(--spuma);
        z-index: 1000;
        transform: none;
        border-bottom: 1px solid var(--grey);
        box-sizing: border-box;
    }

    .menu-link {
        font: var(--link-mobile);
        opacity: .5;
    }

    .menu-link.active {
        opacity: 1;
        transform: none;
        color: var(--black);
    }

    .sections-wrapper {
        display: block;
    }

    /* ogni section: altezza automatica, scroll verticale */
    .section {
        width: 100%;
        height: auto;
        min-height: 100svh;
        flex-shrink: unset;
        display: flex;
        align-items: center;
        justify-content: center;
        padding-top: 56px; /* compensa il menù fisso */
        box-sizing: border-box;
    }

    .section-inner {
        width: 100%;
        height: auto;
        min-height: calc(100svh - 56px);
        padding: 40px 24px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        overflow: visible;
    }

    .section h1 { font: var(--h1-mobile); }

    /* home mobile: immagine sopra, testo sotto */
    .home-layout {
        display: flex;
        flex-direction: column;
        gap: 32px;
        width: 100%;
        height: auto;
    }

    .home-img-wrap {
        width: 100%;
        height: 50svh;
    }

    .home-img-wrap img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }

    .home-text h1 {
        font: var(--h1-mobile);
        margin-bottom: 1rem;
    }

    .home-text p {
        font: var(--p-mobile);
        max-width: none;
        padding-right: 0;
    }
}

/* ── SERVIZI ── */

.servizi-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-top: 35px;
    gap: 24px;
    width: 100%;
    height: 70%;

}

.servizio-box {
    flex: 1;
    border: 1px solid var(--black);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 32px;
    box-sizing: border-box;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.servizio-box h2 {
    font: var(--h2);
    margin: 0;
    text-transform: uppercase;
}

/* servizi mobile */
@media (max-width: 768px) {

    .servizi-layout {
        flex-direction: column;
        gap: 16px;
        width: 100%;
        height: auto;
        margin-top: 0;
        align-items: stretch;
    }

    .servizio-box {
        padding: 24px;
        border-radius: 14px;
        flex: unset;
        height: auto;
        width: 100%;
        aspect-ratio: unset;
        min-width: 0;
        font: var(--p-mobile);
    }

    .servizio-box h2 {
        font: var(--h3-mobile);
        margin-top: 24px;
    }
}

/* ── PORTFOLIO ── */

.portfolio-inner {
    flex-direction: column;
    justify-content: center;
    gap: 32px;
}

/* la track-wrap nasconde l'overflow e gestisce le sfumature laterali su mobile */
.portfolio-track-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    flex: 1;
}

/* sfumatura destra desktop: mostra che ci sono altri box */
.portfolio-track-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(to left, var(--spuma), transparent);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* sfumatura sinistra desktop */
.portfolio-track-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(to right, var(--spuma), transparent);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-track-wrap.has-prev::before {
    opacity: 1;
}

/* quando si è all'ultimo box, nascondi sfumatura destra */
.portfolio-track-wrap.is-last::after {
    opacity: 0;
}

/* strip scorrevole dei box */
.portfolio-track {
    display: flex;
    flex-direction: row;
    gap: 24px;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    height: 100%;
    will-change: transform;
}

/* ogni box è un quadrato */
.portfolio-box {
    flex-shrink: 0;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;

    /* quadrato: altezza uguale alla larghezza */
    aspect-ratio: 1 / 1;
    height: 100%;
}

.portfolio-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: var(--grey); /* placeholder se l'img non c'è ancora */
    
}


.portfolio-box span {
    position: absolute;
    bottom: 20px;
    left: 24px;
    font: var(--h3);
    color: var(--spuma);
}

/* frecce di navigazione */
.portfolio-nav {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: center;
}

.portfolio-btn {
    background: none;
    border: 1px solid var(--black);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font: var(--p);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--black);
}

.portfolio-btn:hover {
    background: var(--black);
    color: var(--spuma);
}

/* il pulsante prev è invisibile all'inizio */
.portfolio-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── PORTFOLIO MOBILE ── */

@media (max-width: 768px) {

    .portfolio-inner {
        flex-direction: column;
        gap: 12px;
        padding: 0;
        width: 100%;
    }

    .portfolio-track-wrap {
        flex: none;
        width: 100%;
        overflow: hidden;
    }

    .portfolio-track {
        gap: 16px;
    }

    .portfolio-box {
        height: 240px;
        width: 75vw;
        aspect-ratio: unset;
        min-width: 0;
        flex-shrink: 0;
    }

    .portfolio-box span {
        font: var(--h4-mobile);
        bottom: 12px;
        left: 14px;
    }

    .portfolio-nav {
        padding-left: 0;
        gap: 12px;
    }

    .portfolio-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    #portfolio .section-inner {
        justify-content: flex-start;
        padding-top: 32px;
        padding-bottom: 0px;
    }

      #portfolio .section-inner {
        min-height: auto;
        height: auto;
    }

    #portfolio.section {
        min-height: auto;
        height: auto;
    }
}

/* ── CONTATTI ── */

/* la section contatti è il riferimento per l'immagine absolute */
#contatti {
    position: relative;
}

.contatti-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
    justify-content: center;
    /* testo spostato a destra rispetto al menù */
    padding-left: 80px;
    width: 55%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.contatti-voce {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contatti-voce strong {
    font: var(--p);
    font-weight: 700;
}

.contatti-voce a {
    font: var(--p);
    color: var(--black);
    text-decoration: none;
}

.contatti-voce a:hover {
    text-decoration: underline;
}

.contatti-cta p {
    font: var(--p);
    color: var(--black);
    max-width: 48ch;
    margin: 0;
}

.contatti-cta strong {
    font-weight: 700;
}

/* immagine decorativa in absolute, libera di sforare */
.contatti-img {
    position: absolute;
    right: 0;
    top: 200px;
    width: 40%;
    pointer-events: none;
}

.contatti-img img {
    width: 80%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
    display: block;
}

/* contatti mobile */
@media (max-width: 768px) {

    .contatti-layout {
        padding-left: 0;
        width: 100%;
        gap: 24px;
    }

    .contatti-voce strong,
    .contatti-voce a {
        font: var(--p-mobile);
    }

    .contatti-voce strong {
        font-weight: 700;
    }

    .contatti-cta p {
        font: var(--p-mobile);
    }

    .contatti-img {
        position: relative;
        width: 100%;
        height: 200px;

    }

    .contatti-img img {
        position: absolute;
        width: 100%;
        height: 100%;
        top: -60%;
        left: -20%;

    
    }
}

/* portfolio-box come link */
a.portfolio-box {
    text-decoration: none;
    color: var(--spuma);
    cursor: pointer;
    transition: transform .3s ease, box-shadow .3s ease;
}

a.portfolio-box:hover {
    transform: scale(0.97);
}

/* ── SOCIAL ICONS ── */
.contatti-social {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
    margin-top: 8px;
}

.social-icon {
    color: var(--black);
    opacity: .5;
    transition: opacity .3s ease;
    display: flex;
    align-items: center;
}

.social-icon:hover {
    opacity: 1;
}
