/* =========================================================
   WEBSITE 2.0 — header nero, nastro giallo, home con vignette,
   pagina Work a scorrimento continuo, cursore DRAG.
   Si carica dopo style.css. Misure in unità della tavola 1366
   (var(--u)) sopra i 1024px; in px sotto.
   ========================================================= */

@font-face {
  font-family: "Anton";
  src: url("../fonts/anton-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --yellow: #fff200;
  --ease: cubic-bezier(.65, 0, .15, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --sh-h: calc(200 * var(--u));        /* altezza della banda nera chiusa */
  --band-h: calc(58.4 * var(--u));     /* altezza del nastro giallo */
}

/* ---------------------------------------------------------
   HEADER
   --------------------------------------------------------- */
.sh { position: relative; z-index: 20; }
.sh-bar {
  position: relative;
  height: var(--sh-h);
  background: #000;
  color: #fff;
  overflow: hidden;
  transition: height .75s var(--ease);
}
.sh.no-anim .sh-bar { transition: none; }

.sh-logo {
  position: absolute;
  left: calc(46 * var(--u));
  top: calc(52 * var(--u));
  width: calc(74 * var(--u));
  height: calc(87 * var(--u));
  color: #fff;
  z-index: 2;
  transition: transform .5s var(--ease-out);
}
.sh-logo svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.sh-logo:hover { transform: translateY(calc(-6 * var(--u))); }

.sh-nav {
  position: absolute;
  left: calc(490 * var(--u));
  right: 0;
  top: calc(53 * var(--u));
  display: flex;
  gap: calc(28 * var(--u));
  padding: calc(12 * var(--u)) calc(27 * var(--u)) 0 calc(7 * var(--u));
  border-top: 1px solid #fff;
  font-weight: 700;
  font-size: calc(12.2 * var(--u));
  line-height: 1.2;
  letter-spacing: .01em;
  text-transform: uppercase;
  z-index: 2;
}
.sh-nav a { transition: color .2s ease; }
.sh-nav a:nth-child(2) { margin-left: calc(27 * var(--u)); }
.sh-nav a:nth-child(3) { margin-left: auto; }
.sh-nav a:hover,
.sh-nav a[aria-current="page"],
.sh-nav a.is-active { color: var(--yellow); }
.sh-nav a:focus-visible, .sh-logo:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; }

/* testo introduttivo nella banda nera (pagina Work) */
.sh-intro {
  position: absolute;
  left: calc(497 * var(--u));
  right: calc(40 * var(--u));
  top: calc(140 * var(--u));
  max-width: calc(850 * var(--u));
  font-weight: 700;
  font-size: calc(12.2 * var(--u));
  line-height: calc(14.64 * var(--u));
}

/* nastro giallo che scorre */
.sh-band {
  height: var(--band-h);
  background: var(--yellow);
  color: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: calc(40 * var(--u));
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;
  user-select: none;
}
/* Inter Bold compresso in orizzontale, come nella reference */
.sh-band-sq { flex: none; transform: scaleX(.46); transform-origin: left center; }
.sh-band-in { display: inline-flex; animation: ticker 90s linear infinite; will-change: transform; }
.sh-band-in span { padding-right: .35em; }

/* ---------- pannelli a discesa About / Contact (home) ---------- */
.sh-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(115 * var(--u));
  padding: 0 calc(39 * var(--u)) calc(38 * var(--u));
  visibility: hidden;
  opacity: 0;
  transition: opacity .35s ease, visibility 0s linear .35s;
}
.sh-panel.is-current { visibility: visible; }
.sh.is-open .sh-panel.is-current { opacity: 1; transition: opacity .45s ease .2s, visibility 0s; }

/* entrata a cascata degli elementi del pannello */
.sh-panel [data-in] {
  opacity: 0;
  transform: translateY(calc(18 * var(--u)));
  transition: opacity .5s ease, transform .7s var(--ease-out);
}
.sh.is-open .sh-panel.is-current [data-in] { opacity: 1; transform: none; }
.sh.is-open .sh-panel.is-current [data-in="2"] { transition-delay: .3s; }
.sh.is-open .sh-panel.is-current [data-in="3"] { transition-delay: .38s; }
.sh.is-open .sh-panel.is-current [data-in="4"] { transition-delay: .46s; }

.sh-about {
  display: flex;
  align-items: flex-start;
  margin-left: calc(211 * var(--u));
}
.sh-ph { position: relative; flex: none; margin: 0; overflow: hidden; background: #111; }
.sh-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sh-ph1 { width: calc(372 * var(--u)); height: calc(256 * var(--u)); }
.sh-ph2 { width: calc(244 * var(--u)); height: calc(256 * var(--u)); margin-left: calc(12 * var(--u)); }
.sh-ph2 img { filter: grayscale(1); }
.sh-about-txt {
  flex: 1;
  min-width: 0;
  margin-left: calc(34 * var(--u));
  padding-top: calc(70 * var(--u));
  font-weight: 500;
  font-size: calc(12.2 * var(--u));
  line-height: calc(15 * var(--u));
}
.sh-about-txt h2 {
  font-weight: 700;
  font-size: calc(40 * var(--u));
  line-height: 1;
  text-transform: uppercase;
  margin-bottom: calc(14 * var(--u));
}
.sh-about-txt p + p { margin-top: calc(9 * var(--u)); }

.sh-contact {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: calc(40 * var(--u));
  min-height: calc(256 * var(--u));
}
.sh-contact-info {
  margin-left: calc(211 * var(--u));
  font-weight: 500;
  font-size: calc(12.2 * var(--u));
  line-height: calc(15 * var(--u));
  max-width: calc(330 * var(--u));
}
.sh-contact-info a { border-bottom: 1px solid currentColor; }
.sh-contact ul {
  list-style: none;
  text-align: right;
  font-weight: 700;
  font-size: calc(78 * var(--u));
  line-height: .98;
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.sh-contact ul a { display: inline-block; transition: color .2s ease, transform .35s var(--ease-out); }
.sh-contact ul a:hover, .sh-contact ul a:focus-visible { color: var(--yellow); transform: translateX(calc(-10 * var(--u))); outline: none; }

/* ---------------------------------------------------------
   HOME
   --------------------------------------------------------- */
.home2 { position: relative; }
.h-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(500 * var(--u));
  column-gap: calc(40 * var(--u));
  align-items: end;
  min-height: calc(596 * var(--u));
  padding: calc(90 * var(--u)) calc(31 * var(--u)) calc(28 * var(--u)) calc(47 * var(--u));
}
.h-intro { padding-bottom: calc(30 * var(--u)); }
.h-name {
  font-weight: 700;
  font-size: calc(44 * var(--u));
  line-height: .93;
  letter-spacing: -.005em;
  text-transform: uppercase;
}
.h-kicker {
  margin-top: calc(10 * var(--u));
  font-weight: 700;
  font-size: calc(14 * var(--u));
  text-transform: uppercase;
}
.h-lead {
  margin-top: calc(40 * var(--u));
  max-width: calc(370 * var(--u));
  font-weight: 500;
  font-size: calc(14 * var(--u));
  line-height: calc(17.6 * var(--u));
}
.h-links {
  display: flex;
  gap: calc(22 * var(--u));
  margin-top: calc(12 * var(--u));
  font-weight: 700;
  font-size: calc(10.5 * var(--u));
  text-transform: uppercase;
}
.h-links a { display: inline-flex; gap: .25em; }
.h-links a span { transition: transform .3s var(--ease-out); }
.h-links a:hover span { transform: translateX(.3em); }

.h-foot {
  margin: 0 calc(31 * var(--u)) 0 calc(6 * var(--u));
  border-top: 1px solid #000;
  padding: calc(14 * var(--u)) 0 calc(28 * var(--u)) calc(41 * var(--u));
  font-weight: 500;
  font-size: calc(10.5 * var(--u));
  line-height: calc(13 * var(--u));
}
.h-foot p { max-width: calc(1100 * var(--u)); }
.h-foot a { border-bottom: 1px solid currentColor; }
.h-foot a:hover { border-bottom-color: transparent; }

/* ---------- vignette animate ---------- */
.vg { position: relative; width: 100%; user-select: none; pointer-events: none; }
.vg-ai { aspect-ratio: 2360 / 1640; }
.vg-pc { aspect-ratio: 533 / 379; width: 92%; margin-left: auto; }
.vg img { display: block; width: 100%; height: 100%; object-fit: contain; }

.vg-l { position: absolute; inset: 0; opacity: 0; }
.vg-l img { position: absolute; inset: 0; }
/* tratto "vivo": due disegni che si alternano */
.vg-l .f2 { animation: vg-swap var(--boil, .36s) steps(1, end) infinite; }
@keyframes vg-swap { 0% { opacity: 0; } 50% { opacity: 1; } }

/* la tavola "Ai?" divisa in tre pezzi */
.vg-ai .vg-b1 { clip-path: polygon(0 0, 42% 0, 42% 46%, 45% 46%, 45% 62%, 0 62%); transform-origin: 44% 54%; }
.vg-ai .vg-b2 { clip-path: polygon(71% 0, 100% 0, 100% 50%, 71% 50%); transform-origin: 74% 44%; }
.vg-ai .vg-man {
  clip-path: polygon(42% 0, 71% 0, 71% 50%, 100% 50%, 100% 100%, 0 100%, 0 62%, 45% 62%, 45% 46%, 42% 46%);
  transform-origin: 62% 100%;
}

/* omino al computer + nuvolette */
.vg-pc .vg-man { left: 30.6%; top: 42.5%; width: 69.4%; height: 57.5%; inset: auto; transform-origin: 50% 100%; }
.vg-pc .vg-man img { animation: vg-boil var(--boil, .4s) steps(1, end) infinite; }
@keyframes vg-boil {
  0%   { transform: none; }
  33%  { transform: rotate(.35deg) translate(.15%, 0); }
  66%  { transform: rotate(-.3deg) translate(0, .2%); }
}
.vg-cloud { position: absolute; opacity: 0; }
.vg-cloud.c1 { left: 0; top: 14%; width: 37.7%; height: 53%; transform-origin: 62% 92%; }
.vg-cloud.c2 { left: 58.2%; top: 0; width: 35.3%; height: 49.6%; transform-origin: 38% 92%; }
.vg-cloud.c2 > .vg-float > img { transform: scaleX(-1); }
.vg-float { position: absolute; inset: 0; animation: vg-float var(--fd, 5s) ease-in-out var(--fdel, 0s) infinite; }
.vg-float > img { position: absolute; inset: 0; }
@keyframes vg-float { 50% { transform: translate(var(--fx, 1%), var(--fy, -4%)); } }
.vg-think {
  position: absolute;
  left: 31%; top: 34%; width: 38%; height: 32%;
  display: flex; align-items: center; justify-content: center;
}
.vg-think img {
  width: 100%; height: 100%; object-fit: contain;
  transition: opacity .35s ease, transform .5s var(--ease-out);
}
.vg-think img.is-out { opacity: 0; transform: scale(.6) rotate(-8deg); }

/* ---------------------------------------------------------
   PAGINE A TELA: spostamento sotto il nuovo header
   --------------------------------------------------------- */
@media (min-width: 1025px) {
  .canvas[style*="--dy"] { margin-top: calc(var(--dy) * var(--u)); }

  /* gallerie dei progetti: entrano nello schermo insieme al nastro giallo.
     48 = distanza tra nastro e galleria; 24px di respiro sotto */
  .project .track {
    --tu: max(calc(var(--u) * .6), min(var(--u), calc((100vh - var(--sh-h) - var(--band-h) - 48 * var(--u) - 24px) / 690)));
  }
  .project .track.no-fit { --tu: var(--u); }

  /* sotto i 1280 il testo non scende sotto gli 11.5px */
  .canvas .txt { font-size: max(calc(12.2 * var(--u)), 11.5px); line-height: max(calc(14.64 * var(--u)), 14px); }
}

/* ---------------------------------------------------------
   WORK: righe che scorrono di continuo
   --------------------------------------------------------- */
.track.is-loop {
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}
.track.is-loop .loop { position: absolute; inset: 0; will-change: transform; }
.track.is-loop .track-inner { position: absolute; top: 0; left: 0; }
.track.is-loop iframe { pointer-events: none !important; }
.track.is-loop.is-dragging a { pointer-events: none; }
.track.is-loop img { -webkit-user-drag: none; user-select: none; }

/* ---------- cursore DRAG ---------- */
.has-drag-cursor .track.is-loop,
.has-drag-cursor .track.is-loop *,
.has-drag-cursor .track[data-wheel]:not(.is-static),
.has-drag-cursor .track[data-wheel]:not(.is-static) a,
.has-drag-cursor .track[data-wheel]:not(.is-static) button { cursor: none; }
.has-drag-cursor .track[data-wheel] .builder,
.has-drag-cursor .track[data-wheel] .builder * { cursor: auto; }

.drag-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 300;
  pointer-events: none;
  will-change: transform;
}
.drag-cursor-in {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px 10px;
  margin: -21px 0 0 -58px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .14);
  font: 500 17px/1 "Inter", system-ui, sans-serif;
  white-space: nowrap;
  transform: scale(.2);
  opacity: 0;
  transition: transform .35s var(--ease-out), opacity .2s ease;
}
.drag-cursor i { font-style: normal; display: inline-block; transition: transform .3s var(--ease-out); }
.drag-cursor.is-on .drag-cursor-in { transform: scale(1); opacity: 1; }
.drag-cursor.is-down .drag-cursor-in { transform: scale(.9); }
.drag-cursor.is-down i:first-child { transform: translateX(-4px); }
.drag-cursor.is-down i:last-child { transform: translateX(4px); }

/* ---------------------------------------------------------
   TABLET E TELEFONO (fino a 1024px)
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  :root { --sh-h: auto; --band-h: 46px; }

  .sh-bar { height: auto; min-height: 104px; padding: 104px 16px 0; }
  .sh-logo { left: 16px; top: 18px; width: 52px; height: 61px; }
  .sh-nav {
    left: 86px; top: 30px;
    gap: 22px;
    padding: 10px 16px 0 0;
    font-size: 12px;
  }
  .sh-nav a:nth-child(2) { margin-left: 0; }
  .sh-intro {
    position: static;
    max-width: 640px;
    padding: 0 0 22px 70px;
    font-size: 13px;
    line-height: 17px;
  }
  .sh-band { font-size: 28px; }
  .sh-band-in { animation-duration: 45s; }

  .sh-panel { top: 104px; padding: 0 16px 28px; }
  .sh-about { flex-wrap: wrap; margin-left: 0; gap: 8px; }
  .sh-ph1 { width: calc(60% - 4px); height: auto; aspect-ratio: 3 / 2; }
  .sh-ph2 { width: calc(40% - 4px); height: auto; aspect-ratio: 1 / 1; margin-left: 0; }
  .sh-about-txt { flex-basis: 100%; margin: 14px 0 0; padding: 0; font-size: 13px; line-height: 17px; max-width: 640px; }
  .sh-about-txt h2 { font-size: 34px; margin-bottom: 10px; }
  .sh-about-txt p + p { margin-top: 9px; }
  .sh-contact { min-height: 0; }
  .sh-contact ul { font-size: clamp(40px, 12.5vw, 96px); }
  .sh-contact-info { margin-left: 0; align-self: flex-start; font-size: 13px; line-height: 17px; max-width: 420px; }
  .sh-contact ul a:hover { transform: none; }

  .h-hero {
    grid-template-columns: 1fr;
    min-height: calc(100svh - 150px - 96px);
    align-content: center;
    padding: 36px 16px 28px;
    row-gap: 28px;
  }
  .h-intro { padding-bottom: 0; order: 2; }
  .vg { order: 1; }
  .vg-ai { width: min(100%, 620px); margin: 0 auto; }
  .vg-pc { width: min(94%, 580px); margin: 0 auto; }
  .h-name { font-size: clamp(40px, 11vw, 64px); }
  .h-kicker { font-size: 14px; margin-top: 8px; }
  .h-lead { margin-top: 22px; max-width: 520px; font-size: 15px; line-height: 20px; }
  .h-links { font-size: 12px; margin-top: 14px; gap: 20px; }
  .h-foot { margin: 0 8px; padding: 14px 8px 28px; font-size: 12px; line-height: 16px; }

  .track.is-loop { position: relative; top: auto; left: auto; right: auto; }
  .page-works { padding-top: 28px; }

  /* gallerie dei progetti: mai più alte dello schermo */
  .project.canvas { --tu: min(calc(100vw / 760), calc((100svh - 150px) / 690)); }
}

/* tablet: più aria ai margini */
@media (min-width: 600px) and (max-width: 1024px) {
  :root { --lead: 32px; }
  .sh-bar { min-height: 128px; padding: 128px 32px 0; }
  .sh-logo { left: 32px; top: 22px; width: 68px; height: 80px; }
  .sh-nav { left: 130px; top: 40px; padding-right: 32px; font-size: 13px; gap: 28px; }
  .sh-intro { padding-left: 98px; }
  .sh-panel { top: 128px; padding: 0 32px 36px; }
  .sh-band { font-size: 34px; }
  :root { --band-h: 54px; }
  .txt { padding: 0 32px; }
  .h-hero { padding: 56px 32px 40px; grid-template-columns: 1fr 1fr; align-items: end; column-gap: 32px; }
  .h-intro { order: 0; }
  .vg { order: 0; }
  .vg-ai, .vg-pc { width: 100%; }
  .h-foot { margin: 0 24px; padding: 16px 8px 32px; }
  .sh-about-txt { flex-basis: auto; flex: 1; min-width: 280px; }
}

/* telefono piccolo */
@media (max-width: 380px) {
  .sh-nav { gap: 14px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .sh-band-in, .vg-l .f2, .vg-float, .vg-pc .vg-man img { animation: none; }
  .sh-bar { transition: none; }
}

/* con un pannello aperto si accende solo la sua voce */
.sh.is-open .sh-nav a[aria-current="page"]:not(.is-active):not(:hover) { color: #fff; }

/* ---------------------------------------------------------
   SOLO SMARTPHONE (sotto i 600px): logo piccolo sopra il menu,
   vignetta della home a tutta larghezza
   --------------------------------------------------------- */
@media (max-width: 599px) {
  .sh-bar { min-height: 96px; padding-top: 96px; }
  .sh-logo { left: 16px; top: 14px; width: 28px; height: 33px; }
  .sh-nav { left: 16px; right: 16px; top: 58px; padding: 9px 0 0; gap: 18px; }
  .sh-panel { top: 96px; }

  .h-hero .vg-ai,
  .h-hero .vg-pc { width: 100vw; max-width: none; margin-left: -16px; margin-right: -16px; }
}

/* ---------------------------------------------------------
   PROGETTI 3D: niente immagini provvisorie durante il caricamento
   --------------------------------------------------------- */
.live-lockin:not(.is-live):not(.is-fallback) > a { opacity: 0; }

/* P spugna: il builder occupa tutta la larghezza */
@media (min-width: 1025px) {
  /* altezza adattata allo schermo, larghezza piena fino al bordo destro */
  .spugna-track .track-inner { width: calc(1008 * var(--u)); }
  .spugna-track .item.builder { width: calc(989.3 * var(--u)); }
}
@media (max-width: 1024px) {
  .spugna-track .track-inner { width: 100%; }
  .spugna-track .item.builder { left: var(--lead); width: calc(100% - 2 * var(--lead)); }
}
/* smartphone verticale: builder a tutta larghezza e alto quasi uno schermo */
@media (max-width: 599px) {
  .project.canvas .spugna-track { height: calc(100svh - 120px); min-height: 520px; }
  .spugna-track .item.builder { height: 100%; left: 0; width: 100%; }
}
