/* ==========================================================================
   UNSHAPED — stile
   Nero dominante, un solo colore d'accento per sezione, tipografia Inter
   con spaziature larghe (dal logo) e JetBrains Mono per i dettagli tecnici.
   ========================================================================== */

@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #9DB38A;
}

:root {
  /* palette dalla brand board */
  --bg: #0B0F14;
  --bg-2: #10161C;
  --slate: #2E3A46;
  --sage: #556B4F;
  --bone: #C9C2B3;
  --ink: #F4F4F2;
  --ink-2: #B9BCBE;
  --muted: #80868C;
  --line: rgba(244, 244, 242, 0.10);
  --line-2: rgba(244, 244, 242, 0.20);

  /* un accento per sezione */
  --c-home: #9DB38A;
  --c-visual: #E08A5B;
  --c-code: #6FA8DC;
  --c-lab: #6FA8DC;
  --c-info: #D8CFBE;
  --accent: var(--c-home);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --pad: clamp(20px, 4vw, 56px);
  --maxw: 1440px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-section='visual'] { --accent: var(--c-visual); }
body[data-section='code']   { --accent: var(--c-code); }
body[data-section='lab']    { --accent: var(--c-lab); }
body[data-section='info']   { --accent: var(--c-info); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--slate) var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: --accent 1.2s var(--ease);
}

/* grana fotografica su tutto */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}
h1:focus { outline: none; }

.skip {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.3s var(--ease);
}
.skip:focus { transform: none; }

/* ---------- la macchia ---------- */
#blob {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: block;
}

.blob-fallback { display: none; }
.no-webgl #blob { display: none; }
.no-webgl .blob-fallback {
  display: block;
  position: fixed;
  z-index: -1;
  top: 10vh; right: -5vw;
  width: 60vmin; height: 50vmin;
  background: radial-gradient(circle at 70% 30%, var(--accent), var(--slate) 60%, transparent 72%);
  filter: blur(30px);
  opacity: 0.55;
  border-radius: 42% 58% 63% 37% / 45% 40% 60% 55%;
  animation: morph 16s ease-in-out infinite alternate;
}
@keyframes morph {
  50%  { border-radius: 60% 40% 35% 65% / 55% 60% 40% 45%; transform: translate(-6vw, 8vh) rotate(20deg); }
  100% { border-radius: 38% 62% 55% 45% / 35% 50% 50% 65%; transform: translate(-2vw, 20vh) rotate(-10deg); }
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad);
  pointer-events: none;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0 0 -40px;
  z-index: -1;
  background: linear-gradient(var(--bg) 10%, rgba(11, 15, 20, 0));
  opacity: 0.85;
}
.site-header a, .site-header button { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand__mark { width: 40px; height: 25px; transition: opacity 0.25s, transform 0.25s var(--ease); }
.brand__mark:hover { transform: scale(1.06); }
.brand__word {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  margin-right: -0.42em;
}

.nav { display: flex; gap: clamp(14px, 2.6vw, 36px); }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  transition: color 0.3s;
}
.nav a i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c);
  opacity: 0.35;
  transform: scale(0.6);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.nav a[data-nav='visual'] { --c: var(--c-visual); }
.nav a[data-nav='code']   { --c: var(--c-code); }
.nav a[data-nav='lab']    { --c: var(--c-lab); }
.nav a[data-nav='info']   { --c: var(--c-info); }
.nav a:hover, .nav a[aria-current='page'] { color: var(--ink); }
.nav a:hover i, .nav a[aria-current='page'] i { opacity: 1; transform: scale(1); }

/* ---------- HUD (indice sezione + progresso scroll) ---------- */
.hud {
  position: fixed;
  bottom: 26px;
  z-index: 40;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.hud--left { left: var(--pad); display: flex; align-items: center; gap: 12px; }
.hud__index { color: var(--accent); }
.hud__line { width: 32px; height: 1px; background: var(--line-2); }
.hud--right { right: var(--pad); }
.hud__progress {
  display: block;
  width: 1px; height: 72px;
  background: var(--line);
  overflow: hidden;
}
.hud__progress b {
  display: block;
  width: 100%; height: 100%;
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(0);
}

/* ---------- vista e transizioni di pagina ---------- */
main { display: block; }
main:focus { outline: none; }

.view {
  padding: 0 var(--pad);
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease), filter 0.5s var(--ease);
}
.is-leaving .view {
  opacity: 0;
  transform: translateY(-24px);
  filter: blur(8px);
  pointer-events: none;
}
.is-entering .view {
  opacity: 0;
  transform: translateY(28px);
  transition: none;
}

.view > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- elementi ricorrenti ---------- */
.eyebrow, .label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--c, var(--accent));
}

.page-head {
  padding: clamp(140px, 24vh, 240px) 0 clamp(60px, 10vh, 120px);
}
.page-head--center { min-height: 100vh; }
.page-title {
  margin: 0 0 32px;
  font-size: clamp(44px, 8vw, 128px);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.lede {
  max-width: 34em;
  margin: 0;
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 300;
  color: var(--ink-2);
}

.more {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  transition: color 0.3s;
}
.more:hover { color: var(--accent); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.section-head .label { margin: 0; }

/* ---------- home: hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.hero__eyebrow { justify-content: center; margin-bottom: 36px; }
.hero__title {
  margin: 0 -0.2em 0 0;
  font-size: clamp(40px, 11.2vw, 184px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.2em;
  color: #F4F4F2;
  text-shadow: 0 4px 32px rgba(11, 15, 20, 0.6);
}
.hero__letters {
  display: inline-block;
}
.hero__letters span {
  display: inline-block;
  animation: cinematicBlurIn 0.95s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i) * 55ms + 0.08s);
  will-change: filter, opacity, transform;
}
@keyframes cinematicBlurIn {
  0% {
    opacity: 0;
    filter: blur(22px);
    transform: translateX(-28px);
  }
  50% {
    opacity: 0.85;
    filter: blur(6px);
  }
  85% {
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: translateX(0);
  }
}
.hero__tag {
  margin: 28px 0 0;
  font-size: clamp(10px, 1vw, 13px);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-right: -0.5em;
  animation: fade 1.4s 1.1s var(--ease) both;
}
.hero__dash {
  width: 40px; height: 1px;
  margin-top: 28px;
  background: var(--accent);
  animation: fade 1.4s 1.3s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }

.scroll-cue {
  position: absolute;
  bottom: 28px; left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  animation: fade 1.4s 1.6s var(--ease) both;
}
.scroll-cue::after {
  content: '';
  width: 1px; height: 44px;
  background: linear-gradient(var(--ink-2), transparent);
  transform-origin: top;
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue {
  0%   { transform: scaleY(0); opacity: 1; }
  60%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- home: manifesto ---------- */
.manifesto { padding: clamp(100px, 22vh, 220px) 0; }
.manifesto__text {
  max-width: 19em;
  margin: 0;
  font-size: clamp(28px, 4vw, 60px);
  font-weight: 300;
  line-height: 1.16;
  letter-spacing: -0.02em;
}
.tint {
  color: var(--c);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 92%;
  background-repeat: no-repeat;
  transition: background-size 0.5s var(--ease);
}
.tint:hover { background-size: 0 1px; background-position: 100% 92%; }

/* ---------- home: porte sulle sezioni ---------- */
.doors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(24px, 4vw, 56px);
  padding-bottom: clamp(100px, 20vh, 200px);
}
.door {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 24px 0 28px;
  border-top: 1px solid var(--line-2);
  text-decoration: none;
  transition: border-color 0.5s var(--ease);
}
.door::before {
  content: '';
  position: absolute;
  top: -1px; left: 0;
  width: 100%; height: 1px;
  background: var(--c);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease);
}
.door:hover::before, .door:focus-visible::before { transform: scaleX(1); }
.door__top {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.door__top .dot { background: var(--c); opacity: 0.4; transition: opacity 0.4s; }
.door:hover .door__top .dot { opacity: 1; }
.door__title {
  margin-top: auto;
  font-size: clamp(40px, 5vw, 80px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  transition: color 0.4s;
}
.door:hover .door__title { color: var(--c); }
.door__desc { margin-top: 12px; color: var(--ink-2); font-weight: 300; }
.door__foot {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.door__arrow { transition: transform 0.5s var(--ease), color 0.3s; }
.door:hover .door__arrow { transform: translateX(8px); color: var(--c); }

/* ---------- home: spotlight video principale (Showreel) ---------- */
.spotlight {
  margin-bottom: clamp(90px, 16vh, 180px);
}
.spotlight .section-head {
  margin-bottom: 24px;
}
.spotlight__hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.spotlight__card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
  outline: none;
  transition: border-color 0.4s, transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.spotlight__card:hover {
  border-color: var(--accent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}
.spotlight__card:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}
.spotlight__media {
  position: relative;
  aspect-ratio: 21 / 9;
  min-height: 320px;
  overflow: hidden;
  background: #000;
}
@media (max-width: 760px) {
  .spotlight__media { aspect-ratio: 16 / 9; min-height: 220px; }
  .spotlight__hint { display: none; }
}
.spotlight__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}
.spotlight__card:hover .spotlight__media img {
  transform: scale(1.03);
}
.spotlight__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(24px, 4.5vw, 56px);
  background: linear-gradient(0deg, rgba(11, 15, 20, 0.95) 0%, rgba(11, 15, 20, 0.45) 55%, rgba(11, 15, 20, 0.15) 100%);
}
.spotlight__tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.spotlight__title {
  margin: 0;
  font-size: clamp(26px, 3.6vw, 56px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.spotlight__desc {
  margin: 12px 0 0;
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 300;
  color: var(--ink-2);
  max-width: 44em;
  line-height: 1.5;
}
.spotlight__prompt {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}
.spotlight__prompt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 9px;
  padding-left: 2px;
}
.spotlight__card:hover .play {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 22%, transparent);
  transform: translate(-50%, -50%) scale(1.1);
}

/* ---------- home: selezione ---------- */
.featured { padding-bottom: clamp(60px, 10vh, 120px); }
.featured__works {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: clamp(20px, 4vw, 64px);
  align-items: start;
  margin-bottom: clamp(80px, 14vh, 160px);
}
.featured__works .work:nth-child(2) { margin-top: 18vh; }

/* ---------- card video / foto ---------- */
.work {
  display: block;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  position: relative;
}
.work[hidden] { display: none; }
.work:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 6px;
  border-radius: 4px;
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  background: var(--bg-2);
  isolation: isolate;
}
/* placeholder: una piccola "macchia" sfocata nei colori del lavoro */
.thumb::before {
  content: '';
  position: absolute;
  inset: -12%;
  z-index: -1;
  background:
    radial-gradient(42% 52% at 34% 42%, var(--t1) 0%, transparent 70%),
    radial-gradient(40% 46% at 70% 64%, var(--t2) 0%, transparent 72%),
    radial-gradient(18% 22% at 84% 26%, var(--t1) 0%, transparent 70%);
  filter: blur(18px) saturate(0.85);
  opacity: 0.75;
  transition: transform 1.2s var(--ease), opacity 0.6s;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}
.work:hover .thumb::before { transform: scale(1.08) rotate(-3deg); opacity: 0.95; }
.work:hover .thumb img { transform: scale(1.04); }

/* Anteprima video silente su hover */
.work__preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s var(--ease);
  overflow: hidden;
  background: #000;
}
.work__preview.is-playing {
  opacity: 1;
}
.work__preview iframe,
.work__preview video,
.work__preview-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(-50%, -50%) scale(1.02);
  border: 0;
  pointer-events: none;
}

/* Stato placeholder per progetti senza video (Industrial, Documentary) */
.work--placeholder {
  cursor: default;
  opacity: 0.75;
  transition: opacity 0.3s;
}
.work--placeholder:hover {
  opacity: 1;
}
.work--placeholder .thumb {
  border: 1px dashed var(--line-2);
}
.work--placeholder .play {
  display: none;
}
.work__badge-coming {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 6px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(16, 22, 28, 0.85);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.play {
  position: absolute;
  top: 50%; left: 50%;
  width: 58px; height: 58px;
  border: 1px solid rgba(244, 244, 242, 0.45);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: border-color 0.4s, background-color 0.4s, transform 0.6s var(--ease);
  z-index: 3;
}
.play::after {
  content: '';
  position: absolute;
  top: 50%; left: 53%;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent var(--ink);
  transform: translate(-50%, -50%);
}
.work:hover .play {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 18%, transparent);
  transform: translate(-50%, -50%) scale(1.08);
}
.play--lg { width: 88px; height: 88px; }
.play--lg::after { border-width: 10px 0 10px 16px; }

.chip {
  position: absolute;
  right: 14px; bottom: 12px;
  z-index: 3;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}

.work__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}
.work__title {
  margin: 0;
  font-size: clamp(20px, 1.8vw, 28px);
  font-weight: 400;
  letter-spacing: -0.015em;
  transition: color 0.3s;
}
.work:hover .work__title { color: var(--accent); }
.work__year { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.work__sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.work__kind {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.work__cat-badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.work__link {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s;
}
.work__link:hover {
  color: var(--accent);
}

/* griglia asimmetrica pagina Visual */
.works {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(56px, 10vh, 120px) clamp(20px, 3vw, 48px);
  padding-bottom: clamp(60px, 10vh, 120px);
}
.works .work { grid-column: span 6; }
@media (min-width: 900px) {
  .works .work:nth-child(4n + 1) { grid-column: 1 / span 7; }
  .works .work:nth-child(4n + 2) { grid-column: 9 / span 4; margin-top: 16vh; }
  .works .work:nth-child(4n + 3) { grid-column: 2 / span 5; }
  .works .work:nth-child(4n + 4) { grid-column: 7 / span 6; margin-top: 8vh; }
}

.filters { display: flex; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.filters button {
  padding: 9px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}
.filters button:hover { border-color: var(--accent); color: var(--ink); }
.filters button[aria-pressed='true'] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--ink);
}

/* ---------- lista progetti (Code) ---------- */
.projects { border-bottom: 1px solid var(--line); }
.projects--full { padding-bottom: 0; margin-bottom: clamp(60px, 10vh, 120px); }
.project {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1.3fr 0.9fr 1.3fr 130px 24px;
  align-items: center;
  gap: 20px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: padding 0.6s var(--ease);
}
.project::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.5s;
}
.project:hover { padding-left: 16px; }
.project:hover::before { opacity: 1; }
.project__idx, .project__stack, .project__kind {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.project__kind { color: var(--ink-2); }
.project__title {
  font-size: clamp(24px, 2.6vw, 40px);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.1;
  transition: color 0.3s;
}
.project:hover .project__title { color: var(--accent); }
.project__arrow { color: var(--muted); transition: transform 0.5s var(--ease), color 0.3s; }
.project:hover .project__arrow { transform: translateX(6px); color: var(--accent); }

.status {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--muted);
}
.status[data-status='live']::before { background: #9DB38A; box-shadow: 0 0 8px #9DB38A; }
.status[data-status='beta']::before { background: #E0B85B; }
.status[data-status='dev']::before  { background: var(--c-code); }
.status[data-status='oss']::before  { background: var(--c-info); }
.status[data-status='exp']::before  { background: var(--c-lab); }

.terminal {
  margin: 36px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
}
.terminal span { color: var(--accent); }
.terminal i {
  display: inline-block;
  width: 8px; height: 15px;
  margin-left: 6px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Lab: Strumenti & Quaderno ---------- */
.lab-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: clamp(48px, 8vh, 84px) 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.lab-subhead__title {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lab-subhead__count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.lab-list { border-bottom: 1px solid var(--line); margin-bottom: clamp(60px, 10vh, 120px); }
.note { border-top: 1px solid var(--line); }
.note summary {
  display: grid;
  grid-template-columns: 110px 1fr 180px 24px;
  align-items: center;
  gap: 20px;
  padding: 28px 0;
  cursor: pointer;
  list-style: none;
}
.note summary::-webkit-details-marker { display: none; }
.note__date, .note__tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.note__tag { color: var(--accent); }
.note__title {
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.15;
  transition: color 0.3s;
}
.note summary:hover .note__title { color: var(--accent); }
.note__toggle { position: relative; width: 14px; height: 14px; justify-self: end; }
.note__toggle::before, .note__toggle::after {
  content: '';
  position: absolute;
  top: 50%; left: 0;
  width: 100%; height: 1px;
  background: var(--ink-2);
  transition: transform 0.4s var(--ease);
}
.note__toggle::after { transform: rotate(90deg); }
.note[open] .note__toggle::after { transform: rotate(0); }
.note p {
  max-width: 40em;
  margin: -8px 0 32px 130px;
  font-size: 17px;
  font-weight: 300;
  color: var(--ink-2);
}

/* ---------- Info ---------- */
.info-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(40px, 8vw, 140px);
  padding-bottom: clamp(60px, 10vh, 120px);
}
.info__bio p {
  margin: 0 0 1em;
  font-size: clamp(22px, 2.3vw, 34px);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.info__bio p + p { color: var(--ink-2); }
.info__block { padding: 24px 0; border-top: 1px solid var(--line); }
.info__block ul { margin: 0; padding: 0; list-style: none; }
.info__block li { padding: 4px 0; font-weight: 300; color: var(--ink-2); }

/* ---------- pagine di dettaglio ---------- */
.detail { padding-top: clamp(120px, 20vh, 200px); }
.back {
  display: inline-block;
  margin-bottom: 48px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.3s;
}
.back:hover { color: var(--accent); }

.player { aspect-ratio: 16 / 9; margin: 48px 0 0; }
.player iframe,
.player video,
.detail__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  border: 0;
}
.player__empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-2);
  border: 1px dashed var(--line-2);
  border-radius: 4px;
  gap: 8px;
}
.player__empty p {
  margin: 0;
  font-size: 18px;
  font-weight: 300;
  color: var(--ink);
}
.player__empty span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  margin: 48px 0 0;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts dt {
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { margin: 0; font-size: 15px; color: var(--ink-2); }

.detail__body { max-width: 38em; margin: 64px 0 0 auto; }
.detail__body p { margin: 0; font-size: clamp(19px, 1.6vw, 24px); font-weight: 300; line-height: 1.5; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.tags > span:not(.status) {
  padding: 5px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}

.screens {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 32px);
  margin-top: 64px;
}
.screens div {
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(60% 40% at 50% 30%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    var(--bg-2);
}
.screens div:nth-child(2) { transform: translateY(48px); }

.detail__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 120px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.features, .links { margin: 0; padding: 0; list-style: none; }
.features li, .links li { padding: 6px 0; font-weight: 300; color: var(--ink-2); }
.links a { text-decoration: none; transition: color 0.3s; }
.links a:hover { color: var(--accent); }

.next {
  display: block;
  margin-top: clamp(100px, 18vh, 180px);
  padding: 28px 0;
  border-top: 1px solid var(--line-2);
  text-decoration: none;
}
.next__title {
  display: block;
  font-size: clamp(36px, 6vw, 96px);
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 1;
  transition: color 0.4s, transform 0.6s var(--ease);
}
.next:hover .next__title { color: var(--accent); transform: translateX(12px); }

/* ---------- footer ---------- */
.site-footer { padding: clamp(100px, 20vh, 200px) 0 40px; }
.footer__mail {
  display: inline-block;
  font-size: clamp(30px, 6.4vw, 104px);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.4s, background-size 0.7s var(--ease);
  overflow-wrap: anywhere;
}
.footer__mail:hover { color: var(--accent); background-size: 100% 2px; }
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}
.socials a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  transition: color 0.3s;
}
.socials a:hover { color: var(--accent); }
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(80px, 14vh, 140px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.noscript { padding: 40vh var(--pad); text-align: center; color: var(--ink-2); }

/* ---------- Cinema Mode: arretramento 3D interfaccia e oscuramento ---------- */
body.cinema-active {
  overflow: hidden;
}
#main,
.site-header,
.hud,
#blob,
.blob-fallback {
  transform-origin: center 42vh;
  transition:
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
body.cinema-active #main,
body.cinema-active .site-header,
body.cinema-active .hud,
body.cinema-active #blob,
body.cinema-active .blob-fallback {
  transform: scale(0.92) translateY(14px);
  filter: brightness(0.18) blur(7px);
  pointer-events: none;
  user-select: none;
}

/* ---------- Modal Cinema Theater ---------- */
.theater {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3.5vw, 48px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s;
}
body.cinema-active .theater,
.theater.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.theater__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 13, 18, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
}
.theater__container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
body.cinema-active .theater__container {
  transform: scale(1) translateY(0);
}
.theater__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}
.theater__badge {
  display: flex;
  align-items: baseline;
  gap: 12px;
  overflow: hidden;
}
.theater__category {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.theater__sep {
  color: var(--muted);
  font-size: 12px;
}
.theater__title {
  margin: 0;
  font-size: clamp(17px, 1.8vw, 24px);
  font-weight: 400;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theater__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theater__direct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(16, 22, 28, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}
.theater__direct:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--bg-2);
}
.theater__close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(16, 22, 28, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s, transform 0.3s;
}
.theater__close:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--bg-2);
  transform: scale(1.03);
}
.theater__close svg {
  display: block;
}
.theater__player {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(244, 244, 242, 0.12);
}
.theater__ratio {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 cinematic aspect ratio */
}
#theaterEmbed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#theaterEmbed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.theater__video,
#cinemaVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.theater__fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(20, 26, 32, 0.98), rgba(6, 8, 10, 0.99));
  padding: 24px;
  text-align: center;
  z-index: 5;
}
.theater__fallback-card {
  max-width: 480px;
  width: 100%;
  padding: 32px 24px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(16, 22, 28, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}
.theater__fallback-icon {
  font-size: 38px;
  display: block;
  margin-bottom: 12px;
}
.theater__fallback-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
}
.theater__fallback-text {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.theater__fallback-text code {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
.theater__fallback-sub {
  margin: 0 0 20px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.theater__fallback-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.25s var(--ease), background-color 0.25s, border-color 0.25s, filter 0.25s;
}
.btn--copy {
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 0;
}
.btn--copy:hover {
  filter: brightness(1.15);
  transform: scale(1.03);
}
.btn--yt {
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.btn--yt:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  color: var(--ink);
  transform: scale(1.03);
}
.theater__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 2px 4px 0;
}
.theater__info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.theater__detail-link {
  color: var(--accent);
  text-decoration: none;
  margin-left: 6px;
  transition: color 0.3s;
}
.theater__detail-link:hover {
  text-decoration: underline;
}
.theater__tip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.theater__tip b {
  color: var(--accent);
}

/* ---------- toast notifiche ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  z-index: 1000;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(16, 22, 28, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s var(--ease);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .project { grid-template-columns: 40px 1fr auto 24px; }
  .project__kind, .project__stack { display: none; }
  .facts { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .hud { display: none; }
  .doors { grid-template-columns: 1fr; gap: 0; }
  .door { min-height: 200px; }
  .featured__works { grid-template-columns: 1fr; }
  .featured__works .work:nth-child(2) { margin-top: 0; }
  .works .work { grid-column: 1 / -1; }
  .info-grid { grid-template-columns: 1fr; }
  .note summary { grid-template-columns: 1fr 24px; gap: 6px 16px; }
  .note__date { grid-column: 1; grid-row: 1; }
  .note__title { grid-column: 1; grid-row: 2; }
  .note__tag { display: none; }
  .note__toggle { grid-column: 2; grid-row: 1 / span 2; }
  .note p { margin-left: 0; }
  .project { grid-template-columns: 1fr auto; gap: 10px; }
  .project__idx, .project__arrow { display: none; }
  .detail__cols { grid-template-columns: 1fr; }
  .screens div:nth-child(2) { transform: none; }
}

@media (max-width: 440px) {
  .brand__word { display: none; }
  .nav { gap: 16px; }
  .nav a { letter-spacing: 0.12em; font-size: 11px; }
  .nav a i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero__letters span { opacity: 1 !important; filter: none !important; transform: none !important; }
}
