/* --- FONT LOCALI --- */
@font-face {
    font-family: 'Joyride';
    src: url("font/Joyride\ W05\ STD.otf") format("opentype"); 
    font-weight: normal; font-style: normal;
}
@font-face {
    font-family: 'PPAgrandir';
    src: url("font/PPAgrandir-Regular.otf") format("opentype");
    font-weight: normal; font-style: normal;
}

:root {
    --purple: #4c2aff;
    --acid: #ccff00;
    --white: #ffffff;
    --dark-bg: #0a0015;
    --font-display: 'Joyride', sans-serif; 
    --font-body: 'PPAgrandir', sans-serif;
}

/* --- RESET & BOX SIZING (Fix per lo sforamento) --- */
* {
    box-sizing: border-box; /* FONDAMENTALE: Include il padding nella larghezza totale */
}

/* --- SELEZIONE DEL TESTO (CUSTOM) --- */
::selection {
    background-color: var(--acid);
    color: var(--purple);
    text-shadow: none;
}
::-moz-selection {
    background-color: var(--acid);
    color: var(--purple);
    text-shadow: none;
}

body {
    margin: 0; padding: 0;
    background-color: var(--purple);
    font-family: var(--font-body);
    color: var(--white);
    overflow-x: hidden; /* Nasconde scroll orizzontale indesiderato */
    cursor: none;
    width: 100%;
}

/* SFONDO */
.gradient-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 70% 30%, #5c3aff 0%, var(--purple) 40%, #8bc34a 100%);
    background-size: 150% 150%; z-index: -5;
}
.noise-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: -4; opacity: 0.15;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.mobile-thumb {
    display: none !important; 
}

/* 2. Il trucco "display: contents":
   Finge che il contenitore .project-text-group non esista.
   Così su desktop l'ID, il Titolo e i Tag tornano a essere figli diretti 
   di .project-item e il layout desktop torna perfetto (spaziato). */
.project-text-group {
    display: contents;
}

/* HERO LAYOUT */
.hero-split { 
    position: relative; 
    width: 100%; 
    height: 100vh; 
    overflow: hidden; 
    z-index: 5; 
    pointer-events: none;
}
#physics-container { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    z-index: 0; 
    pointer-events: none; 
}

/* BIO */
.hero-bio {
    position: absolute; top: 0; left: 0; height: 100%; width: 45%; 
    z-index: 10; display: flex; flex-direction: column; justify-content: center;
    padding-left: 5vw; padding-right: 20px; /* Padding di sicurezza a destra */
    pointer-events: none; 
}
.bio-content { pointer-events: auto; max-width: 600px; width: 100%; }

.profile-img { width: 250px; height: 250px; bottom: 20px; margin-bottom: 1.2rem; }
.profile-img img { width: 100%; height: 100%; object-fit: cover; }

.hero-bio h1 { 
    font-family: var(--font-display); 
    font-size: 5vw; 
    line-height: 0.9; 
    margin: 0 0 1.5rem 0; 
    text-transform: uppercase; 
    color: var(--white);
    word-wrap: nowrap; /* Rompe le parole se troppo lunghe */
}

.bio-desc { font-family: var(--font-body); font-size: 1.2rem; line-height: 1.4; opacity: 0.9; margin-bottom: 2.5rem; }
.social-links { display: flex; gap: 25px; flex-wrap: wrap; }
.social-links a { color: var(--acid); text-decoration: none; font-weight: 500; font-size: 1rem; text-transform: uppercase; border-bottom: 1px solid transparent; transition: border 0.3s; }
.social-links a:hover { border-bottom: 1px solid var(--acid); }

/* --- STILE OGGETTI FISICI --- */
.phys-item {
    position: absolute; top: 0; left: 0;
    display: flex; justify-content: center; align-items: center;
    border-radius: 50px;
    font-family: var(--font-display); 
    font-weight: 900;
    font-size: 20px; 
    letter-spacing: 1px;
    white-space: nowrap;
    will-change: transform;
    pointer-events: auto; 
    user-select: none;
    z-index: 1; 
}
.phys-item img { display: block; pointer-events: none; object-fit: contain; }

/* --- LISTA PROGETTI --- */
.projects-list { 
    padding: 10vh 5vw; position: relative; 
    z-index: 20; 
    background: rgba(10, 0, 26, 0.9); 
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.1);
    pointer-events: auto;
}
.list-header { font-family: var(--font-display); border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 20px; margin-bottom: 50px; opacity: 0.6; }
.project-item { display: flex; align-items: center; justify-content: space-between; padding: 3.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.1); transition: opacity 0.3s, transform 0.3s; cursor: none; }
.projects-list:hover .project-item { opacity: 0.3; } 
.projects-list:hover .project-item:hover { opacity: 1; transform: translateX(20px); }
.p-id { color: var(--acid); font-family: var(--font-body); }
.p-name { font-family: var(--font-display); font-size: 5vw; margin: 0; }
.p-tags { border: 1px solid var(--white); padding: 5px 15px; border-radius: 50px; font-size: 0.9rem; font-family: var(--font-body); }

/* UI */
.project-preview { width: 350px; height: 450px; position: fixed; top: 0; left: 0; background: #000; background-size: cover; pointer-events: none; visibility: hidden; z-index: 50; border-radius: 8px; }

/* CURSORI */
.cursor-dot { width: 20px; height: 20px; background: var(--acid); position: fixed; border-radius: 50%; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%); }
.cursor-circle { width: 40px; height: 40px; border: 2px solid var(--white); position: fixed; border-radius: 50%; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%); transition: width 0.2s, height 0.2s; }

/* PRELOADER */
.preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--purple); z-index: 10000; display: flex; justify-content: center; align-items: center; } 
.symbol { width: 60px; height: 60px; }
.nav-corner { position: fixed; padding: 2rem; font-family: var(--font-display); font-size: 14px; z-index: 100; mix-blend-mode: overlay; } 
.top-left { top: 0; left: 0; } 
.top-right { top: 0; right: 0; }
.scroll-indicator { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); font-size: 0.8rem; opacity: 0.5; z-index: 20; letter-spacing: 2px; }
.footer { height: 40vh; display: flex; justify-content: center; align-items: center; position: relative; z-index: 10; } 
.footer h2 { font-family: var(--font-display); font-size: 6vw; color: var(--acid); }

.footer {
    height: 60vh; /* Più alto per dare respiro */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 20;
    background: transparent;
}

.footer-cta {
    position: relative;
    text-decoration: none;
    cursor: none; /* Manteniamo il cursore custom */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s linear; /* Per l'effetto magnetico */
}

/* Stile Base del Testo */
.cta-text {
    font-family: var(--font-display);
    font-size: 10vw;
    margin: 0;
    line-height: 1;
    text-transform: uppercase;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* 1. Versione Outline (Bordo) - Visibile di default */

/* 2. Versione Filled (Piena) - Nascosta di default */
.cta-text.filled {
    position: absolute;
    top: 0; left: 0;
    color: var(--acid);
    width: 0%; /* Inizia vuoto */
    overflow: hidden; /* Nasconde il testo */
    white-space: nowrap;
    z-index: 3;
    transition: width 0.5s cubic-bezier(0.19, 1, 0.22, 1); /* Animazione fluida */
}

/* 3. L'email piccola sotto */
.cta-sub {
    font-family: var(--font-body);
    color: var(--white);
    font-size: 1.2rem;
    margin-top: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}


/* --- PAGINA PROGETTO STYLES --- */

/* Hero Progetto */
.p-hero {
    position: relative;
    width: 100%;
    padding-top: 20vh; /* Spazio per la nav */
    padding-bottom: 10vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.p-hero-content {
    text-align: center;
    margin-bottom: 5vh;
    z-index: 2;
}

.p-title {
    font-family: var(--font-display);
    font-size: 10vw; /* Gigante */
    line-height: 0.85;
    margin: 0;
    text-transform: uppercase;
    color: var(--white);
}

.p-subtitle {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--acid);
    margin-top: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.p-hero-img-container {
    width: 90vw;
    height: 70vh;
    overflow: hidden; /* Fondamentale per il parallax */
    border-radius: 12px;
    position: relative;
}

.parallax-img {
    width: 100%;
    height: 120%; /* Più alta del container per muoversi */
    object-fit: cover;
    object-position: center;
}

/* Info Grid */
.p-info {
    width: 90vw;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 Colonne */
    gap: 20px;
    padding: 10vh 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-col {
    display: flex;
    flex-direction: column;
}

.info-col.desc {
    grid-column: span 2; /* La descrizione occupa 2 colonne */
}

.info-col .label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--acid);
    margin-bottom: 15px;
    opacity: 0.8;
}

.info-col .value {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Gallery */
.p-gallery {
    width: 90vw;
    margin: 10vh auto;
    display: flex;
    flex-direction: column;
    gap: 5vh; /* Spazio tra le immagini */
}

.gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.gallery-row {
    display: flex;
    gap: 20px;
}

.gallery-item.half {
    width: 50%; /* Due immagini affiancate */
}

/* Next Project Footer */
.next-project {
    height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.next-label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.next-link {
    text-decoration: none;
    position: relative;
    cursor: none;
}

.next-link h2 {
    font-family: var(--font-display);
    font-size: 8vw;
    margin: 0;
    line-height: 1;
    color: var(--white);
    transition: color 0.3s;
}

/* Effetto Hover Next Project (Riutilizziamo stile footer) */
.next-link .outline {
    -webkit-text-stroke: 0px var(--white);
    color: transparent;
    position: absolute; top:0; left:0;
}
.next-link .filled {
    color: var(--acid);
    opacity: 0.7;
    transition: opacity 0.3s;
}
.next-link:hover .filled { opacity: 1; }

/* --- PAGE TRANSITION (Il Sipario) --- */
.transition-curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--purple); /* O usa var(--purple) se preferisci */
    z-index: 99999; /* Sopra a tutto */
    transform: scaleY(0); /* Inizialmente invisibile (schiacciato) */
    transform-origin: bottom; /* Si alza dal basso */
    pointer-events: none; /* Lascia cliccare sotto quando non c'è */
}

/* Classe per attivare il sipario a tutto schermo */
.is-transitioning {
    pointer-events: auto; /* Blocca i click durante l'animazione */
}


 

/* --- RESPONSIVE MEDIA QUERIES --- */

/* 1. TABLET & PICCOLI LAPTOP */
@media (max-width: 1024px) {
    .hero-bio { width: 60%; }
    .hero-bio h1 { font-size: 7vw; }
}

/* 2. MOBILE (Qui risolviamo lo sforamento) */
@media (max-width: 768px) {
    
    /* 1. SETUP BASE */
    body { cursor: auto; overflow-x: hidden; }
    .cursor-dot, .cursor-circle { display: none; }
    
    /* HERO & BACKGROUND */
    .hero-split { 
        height: auto; 
        min-height: 100vh; 
        display: block; 
        overflow: visible; 
    }

    /* ★ GRADIENTE PIÙ FORTE ★ */
    .hero-bio { 
        width: 100%; 
        height: 100vh;
        position: relative; 
        /* Aumentiamo il padding sotto per dare spazio allo "Scroll to Explore" */
        z-index: 50; 
        /* Gradiente molto più visibile: parte solido e sfuma lentamente */
        background: linear-gradient(
            -90deg, 
            #4c2aff 0%,               /* Viola Pieno in alto */
            rgba(76, 42, 255, 0.85) 25%, /* Quasi pieno al centro */
            var(--acid) 140%  /* Sfuma in fondo per vedere le figure */
        );
    }

    /* Le figure stanno sotto */
    #physics-container { z-index: 0; opacity: 0.9; }

    .profile-img { 
        width: 50vw; /* Ridimensionata per mobile */
        height: 50vw; 
        margin-left: 0; /* Rimuove eventuali margini di centratura */
        margin-right: auto; 
        margin-bottom: 1.5rem;
        display: block;
    }

    /* Testi Hero */
    .hero-bio h1 { font-size: 11vw; margin-top: 20px; width: 100%; text-shadow: 0 10px 30px rgba(0,0,0,0.3); }
    .social-links { gap: 15px; margin-top: 10px; }
    .social-links a { font-size: 0.9rem; opacity: 1; font-weight: 500; }

    /* ★ SCROLL INDICATOR SOTTO I SOCIAL ★ */
    .scroll-indicator {
        left: 20px;        /* Allineato a sinistra come il testo */
        bottom: 10vh;      /* Staccato dal fondo */
        transform: none;   /* Rimuove la centratura desktop */
        text-align: left;
        font-size: 0.75rem;
        opacity: 0.8;
        z-index: 60;       /* Sopra a tutto */
    }

    /* --- LAYOUT PROGETTI (Confermato quello di prima) --- */
    .project-item {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 1.5rem 0;
        width: 100%;
        text-align: left;
        gap: 10px;
    }
    .p-id { display: flex; }
    .p-name { order: 1; flex: 0.5; min-width: 0; font-size: 6vw; line-height: 1.1; margin: 0; }
    .mobile-thumb {
        order: 2; display: block !important; width: 50px; height: 70px;
        object-fit: cover; border-radius: 0px; border: 0px solid rgba(255,255,255,0.2); flex-shrink: 0; 
    }
    .p-tags { display:none;  font-size: 0.7rem; opacity: 0.8; white-space: nowrap; flex-shrink: 0; margin: 0; }
    .project-preview { display: none !important; }

    /* --- FOOTER --- */
    .footer { height: 30vh; padding-bottom: 0px; }
    .footer-cta { width: 100%; pointer-events: auto; }
    .cta-text.outline { display: none; }
    .cta-text.filled { position: relative; width: 100%; font-size: 8vw; text-align: center; }
    .cta-sub { opacity: 0.7; transform: translateY(0); font-size: 0.9rem; margin-top: 10px; }
}


/* 3. SCHERMI GRANDI */
@media (min-width: 2000px) {
    .hero-bio h1 { font-size: 120px; }
    .bio-desc { font-size: 1.8rem; max-width: 700px; }
    .p-name { font-size: 150px; }
}
