:root {
  --bg: #131313;
  --card: #1c1c1c;
  --line: #2a2a2a;
  --fg: #ffffff;
  --muted: #8b8b8b;
  --dim: #6b6b6b;
  --accent: #ff6a1a;
  --pad: clamp(20px, 4vw, 48px);
  --max: 1320px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Manrope, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; text-transform: uppercase; letter-spacing: .01em; }
h2 { font-size: clamp(34px, 5vw, 64px); line-height: 1.02; }
.lead { color: var(--muted); font-size: clamp(16px, 1.3vw, 19px); max-width: 52ch; margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

/* ---------- pill buttons ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 10px 0 26px;
  border: 1.5px solid var(--fg); border-radius: 999px;
  font-size: 16px; font-weight: 500;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.pill svg { width: 30px; height: 30px; transition: transform .4s var(--ease); }
.pill:hover svg { transform: rotate(45deg); }
.pill:hover { background: var(--fg); color: var(--bg); }
.pill--light { background: var(--fg); color: var(--bg); }
.pill--light:hover { background: transparent; color: var(--fg); }
.pill--sm { height: 42px; padding: 0 6px 0 18px; font-size: 14px; gap: 10px; }
.pill--sm svg { width: 26px; height: 26px; }

/* ---------- header ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad);
  background: linear-gradient(var(--bg) 30%, rgba(19,19,19,0));
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .08em; font-size: 18px; }
.brand img { filter: invert(1); width: 34px; height: 34px; }
.top__right { display: flex; align-items: center; gap: 18px; }
.burger { width: 34px; height: 34px; background: none; border: 0; padding: 0; cursor: pointer; display: grid; place-content: center; gap: 7px; }
.burger span { display: block; width: 26px; height: 2px; background: var(--fg); transition: transform .35s var(--ease); }
.menu-open .burger span:first-child { transform: translateY(4.5px) rotate(45deg); }
.menu-open .burger span:last-child { transform: translateY(-4.5px) rotate(-45deg); }

.menu {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  padding: 0 var(--pad);
  clip-path: inset(0 0 100% 0);
  transition: clip-path .7s var(--ease);
}
.menu a { font-size: clamp(44px, 9vw, 120px); font-weight: 600; text-transform: uppercase; line-height: 1.05; color: var(--dim); transition: color .25s; }
.menu a:hover { color: var(--fg); }
.menu-open .menu { clip-path: inset(0 0 0 0); }
.menu-open { overflow: hidden; }

/* ---------- hero ---------- */
.hero { position: relative; height: 340vh; }
.hero__stick {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: grid; place-items: center; text-align: center;
  padding: 0 var(--pad); z-index: 1;
}
.hero__title {
  font-size: clamp(38px, 8.6vw, 132px);
  line-height: .98; letter-spacing: .01em;
}
[data-drift], .hero__copy { will-change: transform, opacity; }
.line { display: block; overflow: hidden; }
.line > span { display: inline-block; }
.hero__sub { color: var(--muted); margin: 26px auto 30px; max-width: 40ch; }
.hero__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.js .line > span { transform: translateY(105%); transition: transform 1.1s var(--ease); }
.js .line:nth-child(2) > span { transition-delay: .08s; }
.js .line:nth-child(3) > span { transition-delay: .16s; }
.js .fade { opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease) .45s, transform .9s var(--ease) .45s; }
.loaded .line > span, .loaded .fade { transform: none; opacity: 1; }

.floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fl.back { z-index: 0; filter: brightness(.62) saturate(.8); }
.fl.front { z-index: 2; }
.fl {
  position: absolute; margin: 0;
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,.45);
  will-change: transform;
}
.fl img { width: 100%; height: 100%; object-fit: cover; }
.fl--1 { left: 3%;   top: 90vh;  width: min(27vw, 400px); aspect-ratio: 2574/1628; }
.fl--2 { right: 8%;  top: 75vh;  width: min(24vw, 340px); }
.fl--3 { left: 24%;  top: 125vh; width: min(24vw, 350px); aspect-ratio: 2688/1557; }
.fl--4 { right: 4%;  top: 165vh; width: min(23vw, 330px); }
.fl--5 { left: 34%;  top: 250vh; width: min(30vw, 440px); aspect-ratio: 2000/1138; }
.fl--6 { left: 6%;   top: 235vh; width: min(19vw, 260px); }

/* finte interfacce, fatte in CSS */
.card-ui { background: #f4f4f2; color: #111; padding: 14px 16px 18px; font-size: 13px; }
.ui-bar { display: flex; gap: 6px; margin-bottom: 14px; }
.ui-bar i { width: 9px; height: 9px; border-radius: 50%; background: #d4d4d0; }
.ui-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid #e3e3df; }
.ui-row b { font-weight: 600; }
.ok, .wip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.ok { background: #dff3e4; color: #1d7a3a; }
.wip { background: #ffe7d6; color: #b4480b; }
.ui-chart { display: flex; align-items: end; gap: 7px; height: 70px; margin-top: 16px; }
.ui-chart i { flex: 1; height: var(--h); background: #111; border-radius: 3px 3px 0 0; }
.ui-chart i:last-child { background: var(--accent); }

.card-flow { background: var(--accent); color: #111; padding: 18px 20px; }
.fl-k { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.card-flow ol { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.card-flow li { counter-increment: s; display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.18); font-weight: 600; font-size: 15px; }
.card-flow li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #111; color: var(--accent); font-size: 12px; }

.card-code { background: #1e1e1e; border: 1px solid var(--line); padding: 18px 20px; }
.card-code pre { margin: 0; font: 13px/1.7 ui-monospace, Menlo, monospace; color: #d6d6d6; white-space: pre-wrap; }
.card-code .c { color: #6f6f6f; } .card-code .k { color: #ff9a5c; } .card-code .f { color: #8ecbff; } .card-code .s { color: #b5e08c; }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- studio ---------- */
.studio { position: relative; z-index: 3; background: var(--bg); padding: 80px 0 140px; }
.studio .split { margin-bottom: 72px; }
.studio__copy { display: grid; gap: 28px; justify-items: start; justify-self: end; max-width: 46ch; }
.reel { display: grid; gap: 18px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.reel__row { overflow: hidden; }
.reel__track { display: flex; gap: 18px; width: max-content; animation: slide 60s linear infinite; }
.reel__row--rev .reel__track { animation-direction: reverse; animation-duration: 70s; }
.reel__track img { height: clamp(150px, 22vw, 340px); width: auto; border-radius: 6px; flex: none; }
@keyframes slide { to { transform: translateX(calc(-50% - 9px)); } }

/* ---------- servizi ---------- */
.servizi { padding: 60px 0 140px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: end; margin-bottom: 64px; }
.split .lead { justify-self: end; max-width: 42ch; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--card); border-radius: 8px; padding: 32px; min-height: 380px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.card__n { margin: 0; font-size: clamp(56px, 6vw, 84px); font-weight: 500; line-height: 1; letter-spacing: -.02em; }
.card h3 { font-size: 22px; margin-bottom: 10px; }
.card p:not(.card__n) { margin: 0; color: var(--muted); font-size: 16px; }

/* ---------- lavori ---------- */
.lavori { padding: 40px 0 120px; overflow-x: clip; }
.lavori__head { text-align: center; display: grid; gap: 20px; justify-items: center; margin-bottom: 80px; }
.lavori__head h2 { font-size: clamp(40px, 6.4vw, 92px); }
.lavori__title span { display: inline-block; will-change: transform; }
.dim { color: var(--dim); }
.grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 36px 28px; }
.work:nth-child(odd) { grid-column: 1; }
.work:nth-child(even) { grid-column: 2; }
/* a scala: ogni scheda parte a metà della precedente (righe da mezza scheda) */
.work:nth-child(1) { grid-row: 1 / span 2; }
.work:nth-child(2) { grid-row: 2 / span 2; }
.work:nth-child(3) { grid-row: 3 / span 2; }
.work:nth-child(4) { grid-row: 4 / span 2; }
.work:nth-child(5) { grid-row: 5 / span 2; }
.work:nth-child(6) { grid-row: 6 / span 2; }
.work:nth-child(7) { grid-row: 7 / span 2; }
.work:nth-child(8) { grid-row: 8 / span 2; }
.work { display: grid; gap: 14px; will-change: transform, opacity; }
.work figure { margin: 0 0 8px; overflow: hidden; border-radius: 8px; background: var(--card); aspect-ratio: 16/10; }
.work img { width: 100%; height: 100%; object-fit: cover; object-position: top; will-change: transform; }
.work h3 { font-size: 26px; text-transform: none; font-weight: 600; }
.work p { margin: 0; color: var(--muted); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 4px 0 0; padding: 0; }
.tags li { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: #2a2a2a; color: #cfcfcf; }

/* ---------- nastro ---------- */
.ribbon { padding: 40px 0 120px; overflow: hidden; }
.ribbon__row { white-space: nowrap; font-size: clamp(64px, 10vw, 150px); font-weight: 600; text-transform: uppercase; line-height: 1.05; will-change: transform; }
.ribbon__row--dim { color: var(--dim); }
.ribbon__row span { display: inline-block; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding-top: 100px; overflow: hidden; }
.foot__cta { display: grid; gap: 22px; justify-items: start; padding-bottom: 100px; }
.foot__cta .hero__cta { justify-content: flex-start; margin-top: 10px; }
.foot__grid { display: grid; grid-template-columns: 1.4fr 1.2fr .7fr .7fr; gap: 40px; padding: 48px 0 56px; border-top: 1px solid var(--line); }
.foot__col { display: grid; align-content: start; gap: 10px; color: var(--muted); font-size: 15px; }
.foot__col h3 { font-size: 12px; font-weight: 600; letter-spacing: .14em; color: var(--dim); margin-bottom: 8px; line-height: 34px; }
.foot__col p { margin: 0; }
.foot__col a { width: fit-content; transition: color .2s; }
.foot__col a:hover { color: var(--fg); }
.foot__col--brand .brand { color: var(--fg); margin-bottom: 8px; }
.foot__col--brand p { max-width: 26ch; }
.foot__legal { display: flex; justify-content: space-between; gap: 20px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot__giant {
  margin: 0 0 -.42em; padding: 0 var(--pad);
  font-size: 9.2vw; font-weight: 500; line-height: 1; letter-spacing: -.035em;
  white-space: nowrap; text-align: center;
}
.foot__giant span {
  display: inline-block;
  background: linear-gradient(180deg, #e0e0e0, #3a3a3a 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .hero { height: 300vh; }
  .fl--1 { width: 62vw; left: -6%;  top: 85vh; }
  .fl--2 { width: 58vw; right: -8%; top: 70vh; }
  .fl--3 { width: 56vw; left: 4%;   top: 120vh; }
  .fl--4 { width: 62vw; right: -6%; top: 160vh; }
  .fl--5 { width: 72vw; left: 14%; top: 235vh; }
  .fl--6 { width: 52vw; left: 0;    top: 215vh; }
  .card-code pre { font-size: 11px; }
  .card-ui { font-size: 11px; }
  .split, .grid { grid-template-columns: 1fr; }
  .studio__copy { justify-self: start; }
  .split .lead { justify-self: start; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 280px; }
  .grid { gap: 56px; grid-auto-rows: auto; }
  .grid .work { grid-column: auto; grid-row: auto !important; }
  .foot__grid { grid-template-columns: 1fr 1fr; gap: 36px 24px; }
  .foot__col--brand, .foot__col:nth-child(2) { grid-column: 1 / -1; }
  .pill--sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .fade, .js .line > span { opacity: 1; transform: none; }
}
