/* Movimento e 3D condivisi (vedi js/motion.js e js/fx3d.js). Le regole sotto .mo valgono solo con JS attivo e movimento consentito. */

/* header che si compatta */
.top { transition: box-shadow .3s ease, background-color .3s ease; }
.top .wrap { transition: padding .3s ease; }
.top.scrolled { box-shadow: 0 10px 30px rgba(8, 40, 78, .08); }
.top.scrolled .wrap { padding-block: 7px; }

/* canvas WebGL */
.gl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; animation: gl-in 1.4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes gl-in { from { opacity: 0; transform: scale(.92); } }
.hero.gl-on::before, .hero.gl-on::after { opacity: .28; }
.hero.gl-on .blob { opacity: .3; }

/* titoli parola per parola */
.mo .wsplit .wd { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .16em; margin-bottom: -.16em; }
.mo .wsplit .wi { display: inline-block; transform: translate3d(0, 105%, 0) rotate(6deg); transform-origin: 0 100%; transition: transform .9s cubic-bezier(.16,.84,.24,1); }
.mo .wsplit.seen .wi { transform: none; }
.mo .hero .wsplit .wi { transition-duration: 1.1s; }

/* blocchi che salgono in 3D */
.mo .up { opacity: 0; transform: perspective(900px) translate3d(0, 46px, 0) rotateX(12deg); transform-origin: 50% 100%; transition: opacity .8s ease var(--d, 0ms), transform 1s cubic-bezier(.16,.84,.24,1) var(--d, 0ms); }
.mo .up.seen { opacity: 1; transform: none; }

/* card inclinabili con riflesso: dopo l'ingresso il transform passa alle variabili del puntatore */
.mo .tilt.live, .mo .tilt:not(.up) { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: opacity .8s ease, transform .35s cubic-bezier(.2,.7,.2,1); }
.tilt { position: relative; transform-style: preserve-3d; }
.tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s ease; background: radial-gradient(420px circle at var(--px, 50%) var(--py, 50%), rgba(255,255,255,.38), transparent 45%); mix-blend-mode: soft-light; }
.tilt:hover::after { opacity: 1; }
.tilt h3, .tilt b, .tilt .viz { transform: translateZ(28px); }
.pnl.tilt .viz { transform: translateZ(60px); transition: transform .35s ease; }

/* pulsanti magnetici */
.mo .btn, .mo .arr { transform: translate3d(var(--bx, 0px), var(--by, 0px), 0); transition: transform .25s cubic-bezier(.2,.7,.2,1), background-color .2s ease, color .2s ease, box-shadow .25s ease; }
.mo .btn:hover { transform: translate3d(var(--bx, 0px), calc(var(--by, 0px) - 2px), 0) scale(1.04); box-shadow: 0 14px 30px rgba(8, 40, 78, .22); }

/* cursore */
.cur-ring { position: fixed; left: 0; top: 0; z-index: 100; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 1.5px solid var(--teal-deep); pointer-events: none; opacity: 0; transition: opacity .3s, width .3s cubic-bezier(.2,.7,.2,1), height .3s cubic-bezier(.2,.7,.2,1), margin .3s cubic-bezier(.2,.7,.2,1), background-color .3s, border-color .3s; }
.cur-ring.on { opacity: 1; }
.cur-ring.big { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(245, 138, 99, .16); border-color: var(--coral); }
.cur-ring.dark { border-color: var(--aqua); }
.cur-ring.press { width: 24px; height: 24px; margin: -12px 0 0 -12px; }

/* barra di avanzamento che brilla */
.bar { box-shadow: 0 0 14px rgba(110, 181, 187, .8); }

@media (prefers-reduced-motion: reduce) {
  .gl-canvas { animation: none; }
  .cur-ring { display: none; }
}

/* intro della home: sipario con simbolo e contatore */
.intro { position: fixed; inset: 0; z-index: 200; background: var(--night); color: #fff; display: grid; place-items: center; clip-path: inset(0 0 0 0); transition: clip-path 1s cubic-bezier(.76,0,.24,1); animation: intro-safe 0s 4s forwards; }
.intro.gone { clip-path: inset(0 0 100% 0); }
@keyframes intro-safe { to { visibility: hidden; } }
.intro-in { display: grid; justify-items: center; gap: 16px; transition: transform .6s ease, opacity .6s ease; }
.intro.gone .intro-in { transform: translateY(-60px); opacity: 0; }
.intro-mark { width: 88px; aspect-ratio: 252 / 230; background: url(/img/simbolo.png) center / contain no-repeat; filter: brightness(0) invert(1); animation: intro-spin 1.1s cubic-bezier(.2,.7,.2,1) both; }
@keyframes intro-spin { from { transform: perspective(600px) rotateY(-200deg) scale(.4); opacity: 0; } }
.intro-name { font-family: var(--logo); font-weight: 500; letter-spacing: .32em; font-size: .9rem; }
.intro-name i { font-style: normal; font-weight: 300; color: var(--aqua); }
.intro-n { font-family: var(--mono); color: var(--aqua); font-size: .85rem; }
.intro-n b { font-family: var(--display); font-weight: 800; font-size: 3rem; color: #fff; font-variant-numeric: tabular-nums; }
html.intro-on { overflow: hidden; }

/* invito a scorrere */
.scroll-hint { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; font: 500 .66rem var(--mono); letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.scroll-hint::after { content: ""; width: 1px; height: 40px; background: linear-gradient(var(--aqua), transparent); transform-origin: top; animation: hint 1.8s ease-in-out infinite; }
@keyframes hint { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@media (max-width: 960px) { .scroll-hint { display: none; } }

/* scritte giganti */
.kine { overflow: hidden; padding-block: clamp(36px, 7vw, 96px); display: grid; gap: .1em; }
.kine-row { white-space: nowrap; font-family: var(--display); font-weight: 800; font-size: clamp(3.2rem, 11vw, 10.5rem); line-height: .95; letter-spacing: -.045em; color: var(--ink); }
.kine-row span { display: inline-block; will-change: transform; }
.kine-row.out { color: transparent; -webkit-text-stroke: 1.5px var(--teal-deep); }

/* sezione che si apre a tutto schermo */
.mo [data-clip] { clip-path: inset(0 var(--ci, 0px) round var(--cr, 0px)); }

/* lavori agganciati allo scroll */
#lavori.pin-on { padding-top: 0; }
.pin-on .pin-in { position: sticky; top: var(--pin-top, 70px); height: calc(100vh - var(--pin-top, 70px)); display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.pin-on .rail { overflow: hidden; scroll-snap-type: none; }
.rail-prog { display: none; height: 3px; margin: 4px max(16px, calc((100vw - 1160px) / 2 + 32px)) 0; background: var(--line); border-radius: 3px; overflow: hidden; }
.pin-on .rail-prog { display: block; }
.rail-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--coral)); transform-origin: 0 50%; transform: scaleX(var(--rp, 0)); }

/* cursore "Apri" sui lavori */
.cur-ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 .8rem var(--body); color: var(--ink); opacity: 0; transition: opacity .2s; }
.cur-ring.view { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--coral); border-color: var(--coral); }
.cur-ring.view span { opacity: 1; }
.mo .shot { cursor: none; }

/* grande invito finale */
.cta-big { position: relative; overflow: hidden; isolation: isolate; background: var(--night); color: #fff; border-radius: 36px; margin-top: clamp(40px, 6vw, 80px); padding: clamp(40px, 8vw, 110px) clamp(20px, 5vw, 64px); min-height: min(80svh, 680px); display: flex; flex-direction: column; justify-content: center; }
.cta-big .eyebrow { color: var(--mint); }
.cta-word { display: inline-block; margin-top: 14px; font-family: var(--mono); font-weight: 500; font-size: clamp(2.4rem, 10.5vw, 9.5rem); line-height: 1; letter-spacing: -.06em; text-decoration: none; color: #fff; width: fit-content; }
.cta-word i { display: inline-block; margin-left: .12em; font-style: normal; color: var(--coral); font-size: .6em; transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.cta-word:hover i { transform: translateX(.18em) rotate(-12deg); }
.cta-word:hover { color: var(--mint); }
.cta-sub { margin-top: 22px; max-width: 30em; color: #BFD3DD; font-size: 1.1rem; }


/* numeri del metodo che ruotano quando il passo si attiva */
.mo #steps .n { display: inline-block; transform: perspective(500px) rotateX(-85deg); transform-origin: 50% 100%; opacity: .25; transition: transform .8s cubic-bezier(.2,.7,.2,1), opacity .5s ease; }
.mo #steps li.on .n { transform: none; opacity: 1; }

/* transizioni tra le pagine (Chrome ed Edge recenti; gli altri browser cambiano pagina normalmente) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .45s cubic-bezier(.7,0,.3,1) both; }
::view-transition-new(root) { animation: vt-in .7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.94); filter: blur(8px); } }
@keyframes vt-in { from { clip-path: inset(100% 0 0 0 round 40px); } to { clip-path: inset(0 0 0 0 round 0); } }

/* grana leggera su tutta la pagina */
body::after { content: ""; position: fixed; inset: -50%; z-index: 150; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); animation: grain 1s steps(4) infinite; }
@keyframes grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  body::after { animation: none; }
}

/* su desktop "Parliamone" lascia spazio al fumetto di particelle a destra */
@media (min-width: 961px) { .cta-word { font-size: clamp(4rem, 7.2vw, 7.4rem); } .cta-big > :not(canvas) { max-width: 62%; } }
