/* =====================================================
   BOX21 CREATIVE EXPERIENCE

   PANNELLO DI CONTROLLO  (qui cambi font, logo e colori)
   --------------------------------------------------------
   FONT   : Montserrat Regular + Italic. Per cambiare font
            sostituisci i nomi dei file nelle 2 righe @font-face
            qui sotto (cartella assets/fonts/). Il nome
            "BOX21 Font" NON va cambiato.
   COLORI : cambia solo i codici HEX nel blocco :root
            (es. #D6D2C4). Tutto il sito si aggiorna da solo.
   LOGO   : sostituisci il file Logo_steso.png, oppure cambia
            larghezza e filtro nel blocco :root.
===================================================== */


@font-face { font-family: "BOX21 Font"; src: url("assets/fonts/Montserrat-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "BOX21 Font"; src: url("assets/fonts/Montserrat-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
    /* ---- COLORI (solo HEX) ---- */
    --ink: #373534;        /* sfondo principale (Pantone Black 7, valore indicativo) */
    --ink-light: #454241;  /* sfondo: zona piu' chiara al centro */
    --ink-deep: #1d1c1b;   /* sfondo: zone scure e bordi */
    --sand: #D6D2C4;       /* testi, linee, oggetti (Pantone 7527, valore indicativo) */

    /* ---- FONT ---- */
    --font: "BOX21 Font", Arial, sans-serif;
    --sub-style: italic;   /* stile dei sottotitoli: italic oppure normal */

    /* ---- LOGO ---- */
    --logo-width: clamp(190px, 30vw, 480px);   /* larghezza su computer */
    --logo-width-mobile: 170px;                /* larghezza su telefono */
    --logo-filter: brightness(0) invert(1);    /* logo tutto bianco; scrivi "none" per usare i colori originali del file */

    /* ---- OGGETTI 3D ---- */
    --cube: 170px;         /* dimensione degli oggetti su computer */
    --k: 1;                /* scala degli oggetti 3D */
}


* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; }

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
    background: var(--ink-deep);
    color: var(--sand);
    font-family: var(--font);
    overflow-x: hidden;
}


/* =====================================================
   HEADER
===================================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 88px;
    padding: 0 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 9999;
    pointer-events: none;
}

.site-logo {
    display: block;
    color: var(--sand);
    text-decoration: none;
    pointer-events: auto;
    opacity: .95;
    transition: opacity .3s ease, transform .3s ease;
}

.site-logo img {
    width: var(--logo-width);
    height: auto;
    display: block;
    filter: var(--logo-filter);
}

.site-logo:hover { opacity: .7; transform: translateY(-1px); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 42px;
    pointer-events: auto;
}

.site-nav a {
    position: relative;
    color: var(--sand);
    text-decoration: none;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .22em;
    opacity: .72;
    transition: opacity .3s ease;
}

.site-nav a:hover { opacity: 1; }

.site-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 1px;
    background: var(--sand);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}

.site-nav a:hover::after { transform: scaleX(1); transform-origin: left center; }


/* =====================================================
   SCROLL + VIEWPORT
===================================================== */

.scroll-space { position: relative; height: 1250vh; }

.viewport {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    perspective: 1400px;
    perspective-origin: 50% 50%;
    background: radial-gradient(ellipse at 50% 42%, var(--bg-light, var(--ink-light)) 0%, var(--bg-mid, var(--ink)) 35%, var(--bg-deep, var(--ink-deep)) 100%);
}

/* vignettatura sopra a tutto */
.viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 38%, color-mix(in srgb, var(--bg-deep, var(--ink-deep)) 50%, transparent) 80%, color-mix(in srgb, var(--bg-deep, var(--ink-deep)) 90%, transparent) 100%);
}


/* =====================================================
   ATMOSPHERE (leggera: solo gradienti, niente blur)
===================================================== */

.interactive-atmosphere { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }

.nebula {
    position: absolute;
    width: 65vw;
    height: 65vw;
    max-width: 1000px;
    max-height: 1000px;
    border-radius: 50%;
    opacity: .55;
    will-change: transform;
}

.nebula-1 {
    left: -15%;
    top: -5%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--sand)) 13%, transparent), color-mix(in srgb, var(--glow, var(--sand)) 4%, transparent) 45%, transparent 70%);
}

.nebula-2 {
    right: -18%;
    bottom: -18%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--sand)) 10%, transparent), color-mix(in srgb, var(--glow, var(--sand)) 3%, transparent) 45%, transparent 70%);
}

.cursor-glow {
    position: absolute;
    left: 0;
    top: 0;
    width: 520px;
    height: 520px;
    margin: -260px 0 0 -260px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--sand)) 14%, transparent) 0%, color-mix(in srgb, var(--glow, var(--sand)) 6%, transparent) 28%, transparent 68%);
    will-change: transform;
}


/* =====================================================
   SPACE (sfondo 3D: stelle a strati + orbite)
===================================================== */

.space-3d {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    transform-style: preserve-3d;
}

.space-stars {
    position: absolute;
    inset: -50%;
    background-repeat: repeat;
    will-change: transform;
}

.space-stars-back {
    opacity: .22;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--sand) 65%, transparent) 1px, transparent 1.5px);
    background-size: 170px 170px;
}

.space-stars-mid {
    opacity: .34;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--sand) 75%, transparent) 1px, transparent 2px);
    background-size: 240px 240px;
}

.space-stars-front {
    opacity: .42;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--sand) 95%, transparent) 1.2px, transparent 2.4px);
    background-size: 320px 320px;
}

.stars-lit {
    position: absolute;
    left: 0;
    top: 0;
    width: 620px;
    height: 620px;
    margin: -310px 0 0 -310px;
    opacity: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--glow, var(--sand)) 1.8px, transparent 3.4px);
    background-size: 320px 320px;
    -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 68%);
    mask-image: radial-gradient(circle, #000 0%, transparent 68%);
    will-change: transform, opacity;
}

.space-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80vw;
    height: 80vw;
    max-width: 1100px;
    max-height: 1100px;
    translate: -50% -50%;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--sand)) 10%, transparent) 0%, color-mix(in srgb, var(--glow, var(--sand)) 3.5%, transparent) 32%, transparent 70%);
}

.space-orbit {
    position: absolute;
    left: 50%;
    top: 50%;
    border: 1px solid color-mix(in srgb, var(--sand) 16%, transparent);
    border-radius: 50%;
    transform-style: preserve-3d;
}

.orbit-1 { width: 1200px; height: 520px; margin: -260px 0 0 -600px; opacity: .45; }
.orbit-2 { width: 850px;  height: 380px; margin: -190px 0 0 -425px; opacity: .55; }
.orbit-3 { width: 560px;  height: 240px; margin: -120px 0 0 -280px; opacity: .65; }


/* livello degli oggetti 3D reali (WebGL), dietro ai testi */
.gl-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* =====================================================
   RIG / WORLD / SCENE
   Catena 3D: nessun overflow, opacity, filter o isolation
   tra questi elementi, altrimenti la profondita' si appiattisce.
===================================================== */

.rig, .world {
    position: absolute;
    inset: 0;
    z-index: 10;
    transform-style: preserve-3d;
}

.scene {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

.scene-background {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 760px;
    height: 760px;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) translateZ(-500px);
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--sand)) 8%, transparent), color-mix(in srgb, var(--glow, var(--sand)) 2.5%, transparent) 40%, transparent 70%);
}


/* =====================================================
   CONTENT
===================================================== */

.content {
    position: relative;
    z-index: 30;
    text-align: center;
    transform-style: preserve-3d;
    pointer-events: none;
}

.title {
    display: inline-block;
    font-size: clamp(64px, 10vw, 150px);
    font-weight: 400;
    line-height: .92;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
    transform-style: preserve-3d;
    transform: translateZ(260px);
}

.char {
    display: inline-block;
    backface-visibility: hidden;
}

.char.space { width: .32em; }

.content p {
    font-style: var(--sub-style);
    margin-top: 28px;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: .5em;
    opacity: .75;
}

.scene-6 .content { position: absolute; top: 15vh; left: 0; right: 0; }
.scene-6 .title,
.scene-7 .title { font-size: clamp(52px, 7vw, 105px); }
.scene-7 .content p { font-size: 13px; letter-spacing: .42em; }


/* =====================================================
   OBJECTS + CUBES (le facce sono create da script.js)
===================================================== */

.objects {
    position: absolute;
    inset: 0;
    z-index: 15;
    pointer-events: none;
    transform-style: preserve-3d;
}

.cube {
    position: absolute;
    width: var(--cube);
    height: var(--cube);
    margin: calc(var(--cube) / -2) 0 0 calc(var(--cube) / -2);
    transform-style: preserve-3d;
}

.cube-body {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

.cube-face {
    position: absolute;
    inset: 0;
    border: 1px solid color-mix(in srgb, var(--sand) 65%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 26%, transparent), color-mix(in srgb, var(--sand) 8%, transparent));
    box-shadow: inset 0 0 30px color-mix(in srgb, var(--sand) 8%, transparent);
}

.cube-front  { transform: translateZ(calc(var(--cube) / 2)); }
.cube-back   { transform: rotateY(180deg) translateZ(calc(var(--cube) / 2)); background: color-mix(in srgb, var(--sand) 5%, transparent); }
.cube-right  { transform: rotateY(90deg) translateZ(calc(var(--cube) / 2)); background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 10%, transparent), color-mix(in srgb, var(--sand) 2%, transparent)); }
.cube-left   { transform: rotateY(-90deg) translateZ(calc(var(--cube) / 2)); background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 10%, transparent), color-mix(in srgb, var(--sand) 2%, transparent)); }
.cube-top    { transform: rotateX(90deg) translateZ(calc(var(--cube) / 2)); background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 40%, transparent), color-mix(in srgb, var(--sand) 12%, transparent)); }
.cube-bottom { transform: rotateX(-90deg) translateZ(calc(var(--cube) / 2)); background: color-mix(in srgb, var(--sand) 3%, transparent); }

/* posizioni (solo left/top: il movimento lo gestisce lo script) */
.cube-1  { left: 78%; top: 28%; }
.cube-2  { left: 20%; top: 72%; }
.cube-3  { left: 62%; top: 78%; }
.cube-4  { left: 18%; top: 25%; }
.cube-5  { left: 80%; top: 38%; }
.cube-6  { left: 62%; top: 78%; }
.cube-7  { left: 80%; top: 24%; }
.cube-8  { left: 20%; top: 72%; }
.cube-9  { left: 62%; top: 78%; }
.cube-10 { left: 68%; top: 32%; }
.cube-11 { left: 32%; top: 68%; }
.cube-12 { left: 74%; top: 74%; }


/* =====================================================
   OGGETTI 3D (flaconi, barattoli, scatole, ecc.)
===================================================== */

.obj {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-style: preserve-3d;
    transform: scale(var(--k));
}

.part {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
}

.face { position: absolute; left: 0; top: 0; }

.face.glass {
    border: 1px solid color-mix(in srgb, var(--sand) 60%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 22%, transparent), color-mix(in srgb, var(--sand) 6%, transparent));
}

.face.matte {
    border: 1px solid color-mix(in srgb, var(--sand) 50%, transparent);
    background: color-mix(in srgb, var(--sand) 22%, transparent);
}

.face.light {
    border: 1px solid color-mix(in srgb, var(--sand) 70%, transparent);
    background: color-mix(in srgb, var(--sand) 50%, transparent);
}

.face.dark {
    border: 1px solid color-mix(in srgb, var(--sand) 50%, transparent);
    background: color-mix(in srgb, var(--ink-deep) 80%, transparent);
}

/* =====================================================
   PROJECTS (carosello 3D: posizione gestita da script.js)
===================================================== */

.projects {
    position: absolute;
    inset: 0;
    z-index: 15;
    transform-style: preserve-3d;
}

.project-card {
    position: absolute;
    left: 50%;
    top: 62%;
    width: 250px;
    height: 340px;
    margin: -170px 0 0 -125px;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--sand) 24%, transparent);
    background: linear-gradient(145deg, color-mix(in srgb, var(--sand) 10%, transparent), color-mix(in srgb, var(--sand) 2.5%, transparent));
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 26px;
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transition: border-color .3s ease;
}

.project-card:hover { border-color: color-mix(in srgb, var(--sand) 65%, transparent); }

.project-image {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 16%, transparent), color-mix(in srgb, var(--sand) 1.5%, transparent));
}

.project-image svg { color: var(--sand); }
.project-image .inkfill { fill: var(--ink-deep); }
.project-image .inkstroke { stroke: var(--ink-deep); }

.project-image svg,
.project-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* sfumatura in basso: il testo resta leggibile sopra la grafica */
.project-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 42%, color-mix(in srgb, var(--ink-deep) 78%, transparent) 100%);
}

.project-info { position: relative; z-index: 2; }
.project-info h3 { font-size: 23px; font-weight: 400; letter-spacing: .08em; }
.project-info p { font-style: var(--sub-style); margin-top: 10px; font-size: 11px; font-weight: 400; letter-spacing: .28em; opacity: .75; }


/* =====================================================
   CTA
===================================================== */

.cta {
    display: inline-flex;
    margin-top: 34px;
    padding: 14px 32px;
    border: 1px solid color-mix(in srgb, var(--sand) 50%, transparent);
    border-radius: 50px;
    color: var(--sand);
    text-decoration: none;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .35em;
    text-transform: uppercase;
    pointer-events: auto;
    transition: background .35s ease, color .35s ease, border-color .35s ease;
}

.cta:hover { background: var(--sand); color: var(--ink-deep); border-color: var(--sand); }


/* =====================================================
   MOBILE / TOUCH
===================================================== */

@media (hover: none) {
    .cursor-glow { display: none; }
}

@media (max-width: 768px) {

    :root { --cube: 110px; --k: .65; }

    .site-header { height: 70px; padding: 0 20px; }
    .site-logo img { width: var(--logo-width-mobile); }
    .site-nav { gap: 14px; }
    .site-nav a { font-size: 9px; letter-spacing: .12em; }

    .nebula { width: 100vw; height: 100vw; opacity: .4; }

    .title { font-size: clamp(42px, 14vw, 90px); }
    .scene-6 .title,
    .scene-7 .title { font-size: clamp(42px, 13vw, 80px); }

    .content p { font-size: 10px; letter-spacing: .3em; }
    .scene-7 .content p { font-size: 9px; }

    .project-card {
        width: 190px;
        height: 270px;
        margin: -135px 0 0 -95px;
        border-radius: 20px;
        padding: 20px;
    }

    .project-info h3 { font-size: 18px; }
}
