/* Rende animabile il colore del progetto attivo */
@property --tint {
  syntax: "<color>";
  inherits: true;
  initial-value: #888888;
}

:root {
  --bg: #070707;
  --fg: #ececec;
  --dim: #7a7a7a;
  --line: #1f1f1f;
  --surface: #101010;
  --surface-2: #1a1a1a;
  --overlay: rgba(7, 7, 7, 0.88);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: 16px;
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}
/* Il colore del progetto (--tint) sfuma solo dove si vede (alone e titolone, vedi le loro regole):
   animarlo qui sulla radice costringeva il browser a ricalcolare lo stile di tutta la pagina */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ---------- Puntatore del mouse (solo CSS, niente script che insegue il mouse) ---------- */
:root {
  /* punto bianco con bordo scuro: si vede sia sul nero sia sulle immagini chiare */
  --cur-dot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='4.5' fill='white' stroke='black' stroke-opacity='.55' stroke-width='1.5'/%3E%3C/svg%3E") 10 10, auto;
  /* anello con punto: su link, pulsanti e card */
  --cur-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='12' fill='none' stroke='black' stroke-opacity='.35' stroke-width='3.5'/%3E%3Ccircle cx='16' cy='16' r='12' fill='none' stroke='white' stroke-width='1.5'/%3E%3Ccircle cx='16' cy='16' r='2.6' fill='white' stroke='black' stroke-opacity='.5'/%3E%3C/svg%3E") 16 16, pointer;
  /* punto schiacciato con due frecce: trascinamento */
  --cur-drag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cellipse cx='16' cy='16' rx='7' ry='3.6' fill='white' stroke='black' stroke-opacity='.55' stroke-width='1.5'/%3E%3Cpath d='M3 16l5-3.5v7zM29 16l-5-3.5v7z' fill='white' stroke='black' stroke-opacity='.45'/%3E%3C/svg%3E") 16 16, grab;
}
html, body { cursor: var(--cur-dot); }
a, button, .card, .cmdk__item, .site__link { cursor: var(--cur-ring); }
input, textarea, [contenteditable] { cursor: text; }

/* Puntatore disegnato dalla pagina (common.js): i puntatori sopra restano solo come riserva */
html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 2147483000;
  pointer-events: none;
  mix-blend-mode: difference; /* inverte i colori sotto: bianco sul nero, scuro sulle immagini chiare */
  will-change: transform;
  transition: opacity 0.3s ease;
}
.cursor-dot {
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
}
.cursor-ring {
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  transition: opacity 0.3s ease, background 0.35s ease, border-radius 0.35s ease, width 0.35s var(--ease), height 0.35s var(--ease), margin 0.35s var(--ease), border-width 0.35s ease;
}
.cursor-ring[data-mode="link"] { background: rgba(255, 255, 255, 0.14); border-width: 1px; }
.cursor-ring[data-mode="text"] { width: 2px; height: 26px; margin: -13px 0 0 -1px; border: 0; border-radius: 1px; background: #fff; }
.cursor-dot[data-mode="text"] { opacity: 0; }
html.cursor-hidden .cursor-dot, html.cursor-hidden .cursor-ring { opacity: 0; }
.cursor-label { mix-blend-mode: normal; }

/* barra di scorrimento sottile e scura (nella home non c'è) */
html { scrollbar-width: thin; scrollbar-color: #2e2e36 transparent; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: var(--cur-ring); letter-spacing: inherit; }
ul, ol { list-style: none; }
kbd { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0; }
:focus-visible { outline: 1px solid var(--tint); outline-offset: 3px; }

.filter, .btn { transition: background 0.3s, color 0.3s, border-color 0.3s, opacity 0.3s; }

body.home { height: 100vh; overflow: hidden; }

/* ---------- Home: copertina del progetto attivo sullo sfondo ---------- */

.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.backdrop img {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  opacity: 0;
  filter: blur(56px) saturate(1.35) brightness(0.55);
  transform: scale(1.12);
  transition: opacity 1.4s var(--ease); /* niente zoom lento: obbligava a ricalcolare la sfocatura a ogni fotogramma */
  will-change: opacity;
}
.backdrop img.is-on { opacity: 0.32; }
.backdrop.is-strong img.is-on { opacity: 0.62; }
.backdrop::after { /* vignettatura: i bordi restano scuri, il centro respira */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 65% at 50% 50%, transparent 0%, var(--bg) 100%);
}
.list-view .backdrop img.is-on { opacity: 0.12; }

/* ---------- Home: nome del progetto attivo, enorme, sullo sfondo ---------- */

.bigtitle { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bigtitle__word {
  position: absolute;
  /* poco sopra il centro: la metà bassa resta coperta dalle card, per dare profondità */
  left: 0; right: 0; top: 43%;
  transform: translateY(-50%);
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.05em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.16);
  transition: -webkit-text-stroke-color 0.8s var(--ease), color 0.8s var(--ease), --tint 0.9s var(--ease);
}
body.is-tinted .bigtitle__word:not(.is-leaving) {
  -webkit-text-stroke-color: color-mix(in srgb, var(--tint) 75%, white 10%);
  color: color-mix(in srgb, var(--tint) 9%, transparent);
}
@media (max-width: 700px) { .bigtitle__word { top: 40%; } }
/* lettere che salgono e compaiono (senza sfocatura: su lettere così grandi era molto costosa) */
.bigtitle__word span {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.35em);
  animation: bigIn 0.9s var(--ease) forwards;
  animation-delay: calc(var(--i) * 28ms);
}
@keyframes bigIn { to { opacity: 1; transform: none; } }
.bigtitle__word.is-leaving span { animation: bigOut 0.5s var(--ease) forwards; animation-delay: calc(var(--i) * 12ms); }
@keyframes bigOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-0.3em); } }
.list-view .bigtitle, body.is-intro .bigtitle { opacity: 0; }
.bigtitle { transition: opacity 0.8s var(--ease); }
@media (prefers-reduced-motion: reduce) { .bigtitle__word span { animation: none; opacity: 1; transform: none; } }

/* ---------- Home: riflesso di luce che attraversa la card quando ci entri ---------- */

.card__inner::after {
  content: "";
  position: absolute;
  inset: -10% -40%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.07) 45%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0.07) 55%, transparent 62%);
  mix-blend-mode: screen;
  transform: translateX(-75%);
  opacity: 0;
}
.card.is-hover .card__inner::after { animation: sweep 1.15s cubic-bezier(0.3, 0.6, 0.2, 1) 0.08s; }
@keyframes sweep {
  0% { transform: translateX(-75%); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateX(75%); opacity: 0; }
}
.card.is-wip .card__inner::after { display: none; }

/* ---------- Home: intro e entrata delle card ---------- */

.intro { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg); transition: background 0.9s var(--ease); }
.intro.is-leaving { background: transparent; }
.intro__name { font-size: clamp(34px, 6vw, 84px); font-weight: 500; letter-spacing: -0.045em; line-height: 1; transform-origin: 0 0; white-space: nowrap; }
.intro__name span { display: inline-block; opacity: 0; transform: translateY(0.5em); filter: blur(8px); animation: introChar 0.8s var(--ease) forwards; animation-delay: calc(var(--i) * 35ms + 150ms); }
@keyframes introChar { to { opacity: 1; transform: none; filter: none; } }
.intro__role { color: var(--dim); opacity: 0; animation: introRole 0.8s var(--ease) 0.7s forwards; }
@keyframes introRole { to { opacity: 1; } }
.intro.is-leaving .intro__role { opacity: 0; transition: opacity 0.3s; animation: none; }
body.is-intro .nav__name { visibility: hidden; }
body.is-intro .meta, body.is-intro .pager, body.is-intro .filters, body.is-intro .readout { opacity: 0; }
.meta, .pager, .filters, .readout { transition: opacity 0.8s var(--ease) 0.4s; }

/* Entrata delle card: arrivano dal basso e dalla profondità, leggermente ruotate e sfocate,
   e si mettono a fuoco una dopo l'altra da sinistra a destra */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(110px) scale(0.78) rotate(-5deg); }
  60% { opacity: 1; }
}
@keyframes tagIn { from { opacity: 0; transform: translateY(8px); } }
.track.cards-in .card__inner { animation: cardIn 1.4s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: calc(var(--k, 0) * 120ms); }
.track.cards-in .card__tag { animation: tagIn 0.9s var(--ease) backwards; animation-delay: calc(var(--k, 0) * 120ms + 450ms); }
body.intro-hold .card__inner, body.intro-hold .card__tag { opacity: 0; }

/* ---------- Alone colorato ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(55% 50% at 50% 50%, var(--tint), transparent 70%);
  opacity: 0.1;
  transition: opacity 0.9s var(--ease), --tint 0.9s var(--ease);
}
body.is-tinted .ambient { opacity: 0.26; }
.page-project .ambient {
  position: absolute;
  height: 120vh;
  opacity: 0.14;
  background: radial-gradient(70% 60% at 50% 0%, var(--tint), transparent 75%);
}

/* ---------- Grana ---------- */

/* ferma: animata costringeva il browser a ricomporre tutto lo schermo a ogni fotogramma,
   e con un'opacità così bassa il movimento non si notava */
.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 70px;
  z-index: 95;
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--fg);
  color: var(--bg);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.96);
  transition: opacity 0.35s var(--ease), transform 0.5s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- Navigazione ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px var(--pad);
  font-size: 13px;
}
.page-project .nav { background: linear-gradient(var(--bg) 35%, transparent); padding-bottom: 28px; }
.nav__left { display: flex; align-items: baseline; gap: 14px; }
.nav__name { font-weight: 500; }
.nav__clock b { font-weight: 400; color: var(--fg); }
.nav__clock i { font-style: normal; animation: blink 2s steps(1) infinite; }
.nav__center { display: flex; gap: 22px; }
.nav__right { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.nav__link { position: relative; }
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }

/* Scelta della lingua: due pulsanti uniti in una piccola pillola, la lingua attiva è piena */
.lang { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 99px; font-size: 10px; }
.lang__btn { padding: 3px 7px; border-radius: 99px; color: var(--dim); letter-spacing: 0.04em; transition: color 0.3s, background 0.3s; }
.lang__btn:hover { color: var(--fg); }
.lang__btn.is-active { background: var(--fg); color: var(--bg); }

@media (max-width: 800px) {
  .nav__clock { display: none; }
  .nav { font-size: 12px; }
  .nav__center { gap: 14px; }
  .nav__right { gap: 12px; }
}

/* ---------- Filtri ---------- */

.filters {
  position: fixed;
  top: 58px;
  left: 50%;
  z-index: 40;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  width: max-content;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
}
.filter {
  flex: none;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--dim);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}
.filter sup { margin-left: 4px; font-size: 9px; opacity: 0.7; }
.filter:hover { color: var(--fg); border-color: var(--dim); }
.filter.is-active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.list-view .filters { opacity: 1; }

/* ---------- Carosello curvo ---------- */

.carousel {
  position: fixed;
  inset: 0;
  z-index: 1;
  cursor: var(--cur-dot);
  user-select: none;
  touch-action: pan-y;
  perspective: 1300px;
  transition: opacity 0.6s var(--ease), filter 0.6s var(--ease);
}
.carousel.is-dragging, .carousel.is-dragging .card { cursor: var(--cur-drag); }

.track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.card {
  position: absolute;
  top: 50%;
  left: 0;
  display: block;

  transition: opacity 0.6s var(--ease);
}

.card__tag {
  position: absolute;
  left: 0; right: 0; bottom: 100%;
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  transition: color 0.4s, transform 0.9s var(--ease);
}

.card__inner {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
  transition: transform 0.9s var(--ease), border-radius 0.6s var(--ease), box-shadow 0.9s var(--ease);
}
/* le card a riposo sono un po' più scure: un velo nero invece di un filtro (i filtri su card che si
   muovono in 3D vanno ricalcolati a ogni fotogramma e rendono il carosello a scatti) */
.card__inner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: #000;
  opacity: 0.3;
  transition: opacity 0.6s var(--ease);
}
.card.is-hover .card__inner::before { opacity: 0; }
.card__inner img,
.card__inner video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.card__inner video { opacity: 0; transition: opacity 0.5s; }

/* Hover: la card si ingrandisce, si illumina e si stacca; le altre si spengono */
.track.has-hover .card:not(.is-hover) { opacity: 0.22; }
.card.is-hover .card__inner {
  transform: scale(1.1);
  border-radius: 8px;
  box-shadow: 0 30px 80px -20px color-mix(in srgb, var(--tint) 55%, transparent);
}
.card.is-hover .card__tag { color: var(--fg); transform: translateY(-10%); }
.card.is-hover .card__inner video { opacity: 1; }
.carousel.is-dragging .card__inner { transform: scale(0.96); }

/* Progetti in corso: etichetta con pallino e piccolo rimbalzo al click */
.wip-dot {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 6px;
  vertical-align: 1px;
  border-radius: 50%;
  animation: blink 1.4s steps(1) infinite;
}
.card.is-wip .card__tag span:last-child { color: var(--fg); }
.card.is-nudged .card__inner { animation: nudge 0.45s var(--ease); }
@keyframes nudge { 25% { translate: -8px 0; } 50% { translate: 6px 0; } 75% { translate: -3px 0; } }
.list__items a.is-wip .list__year { color: var(--fg); }

/* Card escluse dal filtro */
.card.is-out { opacity: 0.1; cursor: var(--cur-dot); }
.card.is-out .card__inner { transform: scale(0.82); }

/* ---------- Espansione verso la pagina progetto ---------- */

.expander {
  position: fixed;
  z-index: 90;
  overflow: hidden;
  border-radius: 8px;
  pointer-events: none;
}
.expander.is-open {
  border-radius: 0;
  transition: left 0.9s var(--ease), top 0.9s var(--ease), width 0.9s var(--ease), height 0.9s var(--ease), border-radius 0.9s var(--ease);
}
.expander img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.9s var(--ease); }

body.is-expanding .carousel,
body.is-expanding .meta,
body.is-expanding .pager,
body.is-expanding .filters,
body.is-expanding .readout { opacity: 0; transition: opacity 0.4s; }

/* ---------- Etichetta che segue il mouse ---------- */

.cursor-label {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  pointer-events: none;
  margin: 12px 0 0 16px;
  padding: 4px 8px;
  white-space: nowrap;
  color: #fff;
  background: color-mix(in srgb, var(--tint) 70%, #000);
  border-radius: 3px;
  opacity: 0;
  scale: 0.8;
  transform-origin: 0 0;
  transition: opacity 0.25s, scale 0.4s var(--ease);
}
.cursor-label.is-visible { opacity: 1; scale: 1; }
.caret {
  display: inline-block;
  width: 6px;
  height: 11px;
  margin-left: 3px;
  vertical-align: -1px;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (hover: none) { .cursor-label { display: none; } }

/* ---------- Credits in basso a sinistra ---------- */

.meta {
  position: fixed;
  left: var(--pad);
  bottom: 16px;
  z-index: 10;
  pointer-events: none;
}
.meta div { opacity: 0; transform: translateY(6px); }
.meta.is-in div { animation: rise 0.6s var(--ease) forwards; }
.meta.is-in div:nth-child(2) { animation-delay: 0.04s; }
.meta.is-in div:nth-child(3) { animation-delay: 0.08s; }
.meta.is-in div:nth-child(4) { animation-delay: 0.12s; }
.meta.is-in div:nth-child(5) { animation-delay: 0.16s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Tacche + contatore (top calcolato in script.js) ---------- */

.pager {
  position: fixed;
  left: 50%;
  top: 75%;
  z-index: 10;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ticks { display: flex; align-items: flex-end; }
.ticks button { padding: 0 3px; height: 26px; display: flex; align-items: flex-end; }
.ticks span {
  display: block;
  width: 1px;
  height: 12px;
  background: var(--dim);
  transition: height 0.5s var(--ease), background 0.3s;
}
.ticks button:hover span { height: 18px; background: var(--fg); }
.ticks button.is-active span { height: 26px; background: var(--tint); width: 2px; }
.counter { color: var(--dim); }
.counter [data-counter-current] { color: var(--fg); }

/* ---------- Coordinate in basso a destra ---------- */

.readout {
  position: fixed;
  right: var(--pad);
  bottom: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--dim);
}
.readout b { font-weight: 400; color: var(--fg); display: inline-block; min-width: 4ch; }
.readout__key { color: var(--dim); }
.readout__key:hover { color: var(--fg); }
@media (max-width: 700px) { .readout { display: none; } }

.list-view .meta, .list-view .pager, .list-view .readout { opacity: 0; pointer-events: none; }

/* ---------- Vista elenco ---------- */

.list {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}
.list-view .list { opacity: 1; pointer-events: auto; }
.list-view .carousel { opacity: 0.06; filter: blur(8px); pointer-events: none; }

.list__items { width: 100%; position: relative; z-index: 2; }
.list__items a {
  display: grid;
  grid-template-columns: 50px 1fr 1fr 60px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: clamp(18px, 2.4vw, 30px);
  font-weight: 500;
  letter-spacing: -0.03em;
  transition: padding 0.5s var(--ease), opacity 0.3s;
}
.list__items:hover a { opacity: 0.3; }
.list__items a:hover { opacity: 1; padding-left: 14px; }
.list__num, .list__credit, .list__year { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.list__year { text-align: right; }

.list__preview {
  position: fixed;
  top: 50%;
  left: 62%;
  width: min(34vw, 480px);
  transform: translate(-50%, -50%) scale(0.95) rotate(-2deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.7s var(--ease);
}
.list__preview.is-visible { opacity: 0.9; transform: translate(-50%, -50%) scale(1) rotate(0); }
.list__preview img { width: 100%; display: block; border-radius: 6px; }

@media (max-width: 700px) {
  .list__items a { grid-template-columns: 34px 1fr 44px; }
  .list__credit { display: none; }
}

/* ---------- Pulsanti ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 13px;
}
.btn:hover { border-color: var(--dim); }
.btn--primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--primary:hover { background: var(--tint); border-color: var(--tint); color: #fff; }
.btn__label, .btn__done { display: block; transition: transform 0.5s var(--ease); }
.btn__done { position: absolute; inset: 0; display: grid; place-items: center; transform: translateY(120%); }
.btn.is-copied { background: #3fcf6e; border-color: #3fcf6e; color: #07170c; }
.btn.is-copied .btn__label { transform: translateY(-160%); }
.btn.is-copied .btn__done { transform: none; }

/* ---------- Pannello about ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  overflow-y: auto;
  background: rgba(7, 7, 7, 0.95); /* quasi pieno invece della sfocatura: dietro il carosello continua a muoversi */
  padding: 80px var(--pad) 60px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.overlay.is-open { opacity: 1; visibility: visible; }
.overlay__close { position: fixed; top: 18px; right: var(--pad); z-index: 2; }
.overlay__close:hover { opacity: 0.5; }

.about {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: 56px;
  align-items: start;
}
.about > * { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.9s var(--ease); }
.overlay.is-open .about > * { opacity: 1; transform: none; }
.overlay.is-open .about > :nth-child(2) { transition-delay: 0.08s; }

.about__photo { position: sticky; top: 0; }
.about__avatar { width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--surface); }
/* leggermente ingrandita, così gli angoli bianchi della foto restano fuori dal cerchio */
.about__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.09); }
.about__photo figcaption { text-align: center; }
.about__photo figcaption { margin-top: 8px; }

.about__role { margin-bottom: 14px; }
.about__bio { font-size: clamp(20px, 2.3vw, 28px); line-height: 1.22; letter-spacing: -0.03em; margin-bottom: 24px; }
.about__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.about__h { font-weight: 400; text-transform: uppercase; margin: 0 0 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.about__skills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 36px; }
.about__skills li { border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
.about__tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin-bottom: 36px; font-size: 13px; }
.about__tools li { display: flex; align-items: center; gap: 10px; }
.tool-icon {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--c);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: transform 0.5s var(--ease);
}
.about__tools li:hover .tool-icon { transform: rotate(-8deg) scale(1.1); }
.about__timeline { margin-bottom: 36px; }
.about__timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.about__links { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; }
.about__links a { border-bottom: 1px solid var(--dim); }
.about__links a:hover { border-color: var(--fg); }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about__photo { position: static; max-width: 170px; }
}

/* ---------- Palette di comandi ---------- */

.cmdk {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16vh var(--pad) 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.cmdk.is-open { opacity: 1; visibility: visible; }
.cmdk__box {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.6);
  transform: translateY(-8px) scale(0.97);
  transition: transform 0.4s var(--ease);
}
.cmdk.is-open .cmdk__box { transform: none; }
.cmdk__search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk__search input { flex: 1; background: none; border: 0; outline: none; color: var(--fg); font: inherit; font-size: 16px; letter-spacing: -0.02em; }
.cmdk__search input::placeholder { color: var(--dim); }
.cmdk__list { max-height: 330px; overflow-y: auto; padding: 6px; }
.cmdk__group { padding: 10px 10px 4px; font-size: 10px; text-transform: uppercase; }
.cmdk__item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: var(--cur-ring); font-size: 14px; }
.cmdk__item.is-selected { background: var(--surface-2); }
.cmdk__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cmdk__hint { margin-left: auto; }
.cmdk__empty { padding: 20px 10px; text-align: center; }
.cmdk__foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 10px; }

/* ---------- Transizioni di pagina ---------- */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s var(--ease);
}
body.is-ready .curtain { opacity: 0; }
body.is-leaving .curtain { opacity: 1; transition-duration: 0.4s; }
html.from-expand .curtain { display: none; }

.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1s var(--ease), transform 1.2s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Pagina progetto ---------- */

.project { position: relative; z-index: 1; padding: 96px var(--pad) 110px; }
.project > * { max-width: 1400px; margin-left: auto; margin-right: auto; }

.project__hero { width: 100%; aspect-ratio: 16 / 10; background: var(--surface); overflow: hidden; }
.project__hero img, .project__hero video, .project__hero iframe { width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.project__hero img { animation: heroIn 1.4s var(--ease) both; }
html.from-expand .project__hero img { animation: none; }
@keyframes heroIn { from { transform: scale(1.06); opacity: 0; } }

.project__head { margin-top: 22px; margin-bottom: 100px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.project__index { margin-bottom: 8px; }
.project__title { font-size: clamp(30px, 4.4vw, 64px); font-weight: 500; line-height: 1; letter-spacing: -0.045em; }
.project__desc { max-width: 400px; font-size: 15px; line-height: 1.4; }
.project__visit { margin-top: 18px; }

.project__section {
  display: grid;
  grid-template-columns: 60px 220px 1fr;
  gap: 16px;
  padding-top: 14px;
  margin-bottom: 80px;
  border-top: 1px solid var(--line);
}
.project__section h2 { font-weight: 400; text-transform: uppercase; }
.project__section-body > p { font-size: clamp(19px, 2vw, 28px); line-height: 1.25; letter-spacing: -0.03em; max-width: 760px; }

/* Personas */
.personas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 26px; }
.persona {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--pc) 5%, var(--surface));
}
.persona__top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.persona__avatar {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--pc);
  color: #121318;
  font-size: 20px; font-weight: 600;
}
.persona h3 { font-size: 19px; font-weight: 500; letter-spacing: -0.02em; }
.persona__text { font-size: 14px; line-height: 1.5; color: var(--dim); }
.persona__needs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.persona__needs li { padding: 3px 9px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--pc) 45%, transparent); color: var(--pc); font-size: 10px; }

/* Tabella dei pain point */
.pains { margin-top: 26px; overflow-x: auto; }
.pains table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pains th { text-align: left; font-weight: 400; padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pains td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; line-height: 1.4; }
.pains td:nth-child(2) { width: 100%; min-width: 240px; }
.pains__dot { text-align: center; }
.pains__dot i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.pains th:nth-child(n + 3) { text-align: center; padding-right: 12px; }

.is-visible .persona { animation: riseIn 0.9s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 110ms + 150ms); }
@keyframes riseSoft { from { opacity: 0; transform: translateY(12px); } }
.is-visible .pains tr { animation: riseSoft 0.7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 50ms + 200ms); }
.reveal:not(.is-visible) .persona, .reveal:not(.is-visible) .pains tbody tr { opacity: 0; }

.block { margin-bottom: 110px; }
.block__head { display: flex; justify-content: space-between; padding-top: 14px; margin-bottom: 16px; border-top: 1px solid var(--line); }
.block__head h2 { font-weight: 400; text-transform: uppercase; }

/* Confronto prima/dopo */
.compare { position: relative; overflow: hidden; border-radius: 6px; user-select: none; --pos: 50%; background: var(--surface); }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.compare__before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare__handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}
.compare__handle span {
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 15px;
  letter-spacing: 0.1em;
  transition: transform 0.4s var(--ease);
}
.compare:hover .compare__handle span { transform: translate(-50%, -50%) scale(1.12); }
.compare__range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: var(--cur-drag); margin: 0; }
.compare__range:focus-visible ~ .compare__handle span, .compare:focus-within .compare__handle span { outline: 2px solid var(--tint); outline-offset: 3px; }
.compare__label { position: absolute; top: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); color: #fff; pointer-events: none; }
.compare__label--l { left: 12px; }
.compare__label--r { right: 12px; }

/* Palette e font */
.palette { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.swatch {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  height: 170px;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--c);
  text-align: left;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.swatch:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -20px var(--c); }
.swatch__copy { opacity: 0; transition: opacity 0.3s; }
.swatch:hover .swatch__copy { opacity: 0.7; }
.swatch.is-copied .swatch__copy { opacity: 1; }
.swatch.is-copied .swatch__copy::after { content: " ✓"; }

.fonts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; margin-top: 8px; }
.font-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px 22px; padding: 22px; border: 1px solid var(--line); border-radius: 6px; }
.font-card__aa { font-size: 88px; line-height: 0.9; letter-spacing: -0.05em; }
.font-card__name { font-size: 20px; letter-spacing: -0.02em; }
.font-card__abc { grid-column: 1 / -1; color: var(--dim); font-size: 15px; line-height: 1.35; }

.prototype { aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.prototype iframe { width: 100%; height: 100%; border: 0; display: block; }

.project__gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 12px; }
.project__gallery img { width: 100%; display: block; border-radius: 4px; }
.project__gallery figure:first-child { grid-column: 1 / -1; }
.project__gallery figcaption { margin-top: 8px; }

/* ---------- Scena "alla Apple": telefono fermo, schermate guidate dallo scorrimento ---------- */

.scrolly__track { position: relative; height: calc(var(--steps) * 42vh + 100vh); }
.scrolly__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6vw;
  perspective: 1400px;
}
.scrolly__text { position: relative; height: min(64vh, 620px); }
.scrolly__count { position: absolute; top: 0; left: 0; color: var(--dim); }
.scrolly__count b { font-weight: 400; color: var(--fg); }
.scrolly__caps { position: absolute; inset: 12% 0 18% 0; }
.scrolly__cap {
  position: absolute;
  left: 0; right: 0; top: 18%;
  max-width: 520px;
  font-size: clamp(22px, 2.6vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.03em;

}
.scrolly__big {
  display: block;
  margin-bottom: 14px;
  font-size: clamp(64px, 9vw, 140px);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--tint) 70%, var(--fg));
}
.scrolly__progress { position: absolute; left: 0; bottom: 0; display: flex; gap: 4px; }
.scrolly__progress button { position: relative; width: 26px; height: 18px; }
.scrolly__progress button::before, .scrolly__progress span {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--line);
}
.scrolly__progress span { background: var(--tint); transform: scaleX(0); transform-origin: left; }

.scrolly__device {
  height: min(78vh, 760px);
  aspect-ratio: 440 / 956;
  margin-right: 4vw;
  padding: 11px;
  border-radius: 52px;
  background: #0e0e12;
  box-shadow:
    0 0 0 1px #2c2c36,
    inset 0 0 0 2px #1b1b22,
    0 60px 120px -40px color-mix(in srgb, var(--tint) 60%, transparent);

}
.scrolly__screen { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 42px; background: #101014; }
.scrolly__screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scrolly__cap { }
.scrolly__intro { position: absolute; top: 30px; left: 0; max-width: 440px; font-size: 14px; line-height: 1.45; color: var(--dim); }
.scrolly__text:has(.scrolly__intro) .scrolly__caps { top: 26%; }

/* ---------- Scena TV ---------- */

.scrolly--tv .scrolly__track { height: calc(var(--steps) * 55vh + 100vh); }
.scrolly--tv .scrolly__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding-top: 64px; /* spazio per il menu in alto */
  perspective: 1600px;
}
.tv { position: relative; width: min(84vw, 1040px, calc((100vh - 360px) * 16 / 9)); transform-origin: 50% 100%; }

/* luce ambientale: copia sfocata della schermata dietro la TV */
.tv__ambient { position: absolute; inset: -8% -10%; z-index: 0; opacity: 0.85; pointer-events: none; }
/* la sfocatura sta su ogni immagine (non sul contenitore): così viene calcolata una volta sola
   e durante lo scorrimento cambia solo l'opacità */
.tv__ambient img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: blur(70px) saturate(1.6); will-change: opacity; }
.tv__ambient img.is-tiny { filter: blur(16px) saturate(1.6); } /* immagine già ridotta a pochi pixel (vedi project.js) */

.tv__set {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0;
  padding: 7px;
  border-radius: 12px;
  background: #0b0b0e;
  box-shadow: 0 0 0 1px #2a2a33, inset 0 0 0 1px #1b1b22, 0 50px 90px -40px rgba(0, 0, 0, 0.9);
}
.tv__set::after { /* piedistallo */
  content: "";
  position: absolute;
  left: 50%; top: 100%;
  width: 18%; height: 16px;
  transform: translateX(-50%);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(#1c1c23, #0c0c10);
}
.tv__screen { border-radius: 6px; background: #000; transform-origin: 50% 50%; }
.tv__screen img { transition: none; }
.tv__sweep {
  position: absolute; top: -20%; bottom: -20%; left: 0;
  width: 35%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  mix-blend-mode: screen;
}
.tv__flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; mix-blend-mode: screen; }

/* riflesso sul pavimento */
.tv__reflection {
  position: relative;
  z-index: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin-top: 18px;
  transform: scaleY(-1);
  opacity: 0.22;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 28%);
          mask-image: linear-gradient(to top, #000 0%, transparent 28%);
  pointer-events: none;
  margin-bottom: calc(-56.25% + 40px); /* il riflesso occupa solo una striscia sotto la TV */
}
.tv__reflection img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: blur(3px); will-change: opacity; }

/* didascalie come sottotitoli, sotto la TV */
.tv__subs { position: relative; width: min(760px, 90vw); height: 96px; text-align: center; }
.tv__subs .scrolly__count { left: 50%; transform: translateX(-50%); top: 0; }
.tv__subs .scrolly__caps { inset: 22px 0 22px 0; }
.tv__subs .scrolly__cap { top: 0; max-width: none; font-size: clamp(17px, 1.6vw, 22px); line-height: 1.3; }
.tv__subs .scrolly__progress { left: 50%; transform: translateX(-50%); }

/* ---------- Mazzo di volantini a ventaglio ---------- */

.deck__track { position: relative; height: calc(var(--steps) * 36vh + 100vh); }
.deck__stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.deck__intro { position: absolute; top: 96px; left: 0; max-width: 560px; font-size: 15px; line-height: 1.45; color: var(--dim); z-index: 2; }
.deck__cards { position: absolute; inset: 0; }
.deck__card {
  position: absolute;
  left: 50%; top: 58%;
  height: min(44vh, 420px);
  aspect-ratio: 1414 / 2000;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.8);

}
.deck__caption { position: absolute; left: 0; right: 0; bottom: 84px; text-align: center; z-index: 200; }
.deck__caption p { margin-top: 6px; font-size: clamp(17px, 1.8vw, 24px); letter-spacing: -0.02em; }
.deck__caption.is-changing p { animation: capIn 0.5s var(--ease); }
@keyframes capIn { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } }

@media (max-width: 760px) {
  .scrolly--tv .scrolly__track { height: calc(var(--steps) * 45vh + 100vh); }
  .scrolly--tv .scrolly__stage { align-items: center; justify-content: center; padding: 0; }
  .tv { width: 92vw; }
  .tv__ambient img { filter: blur(40px) saturate(1.5); }
  .tv__subs { width: 92vw; height: 120px; }
  .tv__subs .scrolly__cap { font-size: 16px; }
  .scrolly__intro { display: none; }
  .scrolly__text:has(.scrolly__intro) .scrolly__caps { top: 22px; }
  .deck__intro { display: none; }
  .deck__card { height: 40vh; }
  .deck__caption { bottom: 90px; padding: 0 16px; }
}

/* ---------- Altre animazioni della pagina progetto ---------- */

/* Linee dei titoli di sezione che si disegnano */
.block__head, .project__section { border-top: 0; position: relative; }
.block__head::before, .project__section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.4s var(--ease);
}
.is-drawn::before { transform: scaleX(1); }

/* Colori della palette e siti della cartella: entrano uno dopo l'altro */
@keyframes riseIn { from { opacity: 0; transform: translateY(40px) rotate(-3deg); } }
.reveal:not(.is-visible) .swatch, .reveal:not(.is-visible) .site, .reveal:not(.is-visible) .screen { opacity: 0; }
.is-visible .swatch, .is-visible .site, .is-visible .screen { animation: riseIn 0.9s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms + 150ms); }

/* Copertina: le trasformazioni le guida lo scorrimento */
.project__hero { transform-origin: 50% 0; }

@media (prefers-reduced-motion: reduce) {
  .is-visible .swatch, .is-visible .site, .is-visible .screen { animation: none; }
  .block__head::before, .project__section::before { transform: none; }
}

@media (max-width: 760px) {
  .scrolly__track { height: calc(var(--steps) * 45vh + 100vh); }
  .scrolly__stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 12px; padding: 70px 0 16px; align-items: start; justify-items: center; }
  .scrolly__text { width: 100%; height: 22vh; }
  .scrolly__caps { inset: 22px 0 22px 0; }
  .scrolly__cap { top: 0; font-size: 17px; }
  .scrolly__big { display: none; }
  .scrolly__device { height: 58vh; margin: 0; padding: 8px; border-radius: 38px; }
  .scrolly__screen { border-radius: 31px; }
}

/* Cartella: griglia dei siti */
.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 40px 20px; }
.site__shot { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.site__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform 0.9s var(--ease); }
.site__link:hover .site__shot img { transform: scale(1.04); }
.site__meta { display: flex; justify-content: space-between; margin-top: 12px; text-transform: uppercase; font-size: 10px; }
.site__title { margin-top: 6px; font-size: 20px; font-weight: 500; letter-spacing: -0.03em; }
.site__desc { margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--dim); max-width: 460px; }
.site__stack { margin-top: 8px; }
.site__visit { display: inline-block; margin-top: 12px; border-bottom: 1px solid currentColor; }
.site__actions { display: flex; gap: 18px; flex-wrap: wrap; }
.project__index a { border-bottom: 1px solid var(--dim); }
.project__index a:hover { color: var(--fg); }
a.site__visit:hover { color: var(--tint); }

.block__text { max-width: 640px; margin: 0 0 22px; font-size: 15px; line-height: 1.45; color: var(--dim); }

/* Fila di schermate dell'app in cornici da telefono */
.screens {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 10px 2px 18px;
  cursor: var(--cur-drag);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.screens.is-dragging { cursor: var(--cur-drag); scroll-snap-type: none; }
.screens.is-dragging * { pointer-events: none; }
.project img { -webkit-user-drag: none; user-select: none; } /* niente "trascina immagine" nativo */
.screen { flex: 0 0 clamp(170px, 17vw, 230px); scroll-snap-align: start; user-select: none; }
.screen__phone {
  aspect-ratio: 440 / 956;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--tint) 45%, transparent);
  transition: transform 0.6s var(--ease);
}
.screen:hover .screen__phone { transform: translateY(-6px); }
.screen__phone img { width: 100%; height: 100%; object-fit: cover; display: block; }
.screen figcaption { margin-top: 12px; font-size: 13px; line-height: 1.35; color: var(--fg); }

/* Variante per volantini e pagine stampate: bordi appena arrotondati, più larghi */
.screens--poster .screen { flex-basis: clamp(210px, 22vw, 300px); }
.screens--poster .screen__phone { aspect-ratio: 1414 / 2000; border-radius: 6px; }

/* Variante per schermate TV (16:9) */
.screens--tv .screen { flex-basis: clamp(300px, 42vw, 620px); }
.screens--tv .screen__phone { aspect-ratio: 16 / 9; border-radius: 8px; }
/* Variante per schermate desktop (16:10) in una finestra del browser */
.screens--browser .screen { flex-basis: clamp(300px, 46vw, 680px); }
.screens--browser .screen__phone {
  position: relative;
  aspect-ratio: auto;
  padding-top: 26px;
  border-radius: 10px;
  background: #1c1f26;
}
.screens--browser .screen__phone::before {
  content: "";
  position: absolute; top: 9px; left: 12px;
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  box-shadow: 13px 0 rgba(255,255,255,.25), 26px 0 rgba(255,255,255,.25);
}
.screens--browser .screen__phone img { aspect-ratio: 16 / 10; height: auto; }
.screen figcaption .mono { margin-right: 4px; }

/* ---------- Schermate spiegate: immagine e testo alternati ---------- */
.features .block__text { margin-bottom: 40px; }
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  margin-bottom: clamp(56px, 9vw, 120px);
}
.feature--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
.feature--flip .feature__media { order: 2; }
.feature__media {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 40px 80px -40px color-mix(in srgb, var(--tint) 50%, transparent);
}
.feature__media img { display: block; width: 100%; height: auto; }
.feature__media--browser { padding-top: 28px; background: #1c1f26; }
.feature__media--browser::before {
  content: "";
  position: absolute; top: 10px; left: 13px;
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  box-shadow: 13px 0 rgba(255,255,255,.25), 26px 0 rgba(255,255,255,.25);
}
/* variante con le schermate da telefono: cornice stretta e centrata, colonne alla pari */
.feature.feature--phone { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.feature--phone .feature__media { justify-self: center; width: min(300px, 72vw); aspect-ratio: 440 / 956; border-radius: 34px; }
.feature--phone .feature__media img { height: 100%; object-fit: cover; }
.feature--phone .feature__text p { max-width: 460px; }
.feature__text h3 { margin: 10px 0 12px; font-size: clamp(22px, 2.2vw, 30px); font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; }
.feature__text p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--dim); max-width: 420px; }

/* entrata: l'immagine scivola dal proprio lato, il testo arriva poco dopo */
.feature.reveal { opacity: 1; transform: none; }
.feature__media, .feature__text { transition: opacity 1s var(--ease), transform 1.2s var(--ease); }
.feature__text { transition-delay: 0.12s; }
.feature:not(.is-visible) .feature__media { opacity: 0; transform: translateX(-40px) scale(0.97); }
.feature--flip:not(.is-visible) .feature__media { transform: translateX(40px) scale(0.97); }
.feature:not(.is-visible) .feature__text { opacity: 0; transform: translateY(20px); }
.feature__media img { transition: transform 0.8s var(--ease); }
.feature:hover .feature__media img { transform: scale(1.015); }

@media (max-width: 800px) {
  .feature, .feature--flip, .feature.feature--phone { grid-template-columns: 1fr; gap: 20px; }
  .feature--flip .feature__media { order: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .feature:not(.is-visible) .feature__media, .feature:not(.is-visible) .feature__text { opacity: 1; transform: none; }
}

.project__next {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.project__next-link { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; font-size: 18px; letter-spacing: -0.02em; }
.project__next-link img { width: 260px; border-radius: 4px; filter: brightness(0.6); transition: filter 0.6s var(--ease), transform 0.9s var(--ease); }
.project__next-link:hover img { filter: brightness(1); transform: scale(1.04); }

/* Barra dei capitoli */
.chapters {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 8px 7px 16px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}
.chapters.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.chapters__label { min-width: 150px; white-space: nowrap; color: var(--dim); }
.chapters__label b { font-weight: 400; color: var(--fg); margin-right: 6px; }
.chapters__track { display: flex; gap: 4px; }
.chapters__seg { position: relative; width: 34px; height: 20px; }
.chapters__seg::before, .chapters__seg span {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--line);
}
.chapters__seg span { background: var(--fg); transform: scaleX(0); transform-origin: left; }
.chapters__seg.is-active span { background: var(--tint); }
.chapters__seg em {
  position: absolute;
  bottom: 150%;
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--fg);
  color: var(--bg);
  font-style: normal;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease);
}
.chapters__seg:hover em { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .project__head { grid-template-columns: 1fr; margin-bottom: 60px; }
  .project__section { grid-template-columns: 1fr; gap: 6px; margin-bottom: 50px; }
  .project__gallery { grid-template-columns: 1fr; }
  .project__next-link img { width: 150px; }
  .chapters__label { min-width: 0; }
  .chapters__label span { display: none; }
  .chapters__seg { width: 22px; }
}
