/* ==========================================================================
   CG Digital Solutions — foglio di stile
   1. Font   2. Variabili   3. Base   4. Utility   5. Componenti
   6. Sezioni   7. Animazioni   8. Responsive
   ========================================================================== */

/* 1. FONT (self-hosted: nessuna chiamata a Google, ok GDPR) ---------------- */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/anton-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/instrument-sans-latin.woff2') format('woff2');
}

/* 2. VARIABILI ------------------------------------------------------------- */
:root {
  --bg: #0c0c0c;
  --surface: #121212;
  --surface-2: #161616;
  --light: #f4f4f2;
  --white: #ffffff;
  --accent: #153bfe;
  --accent-soft: #8fa2ff;
  --accent-rgb: 21, 59, 254;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text-muted: rgba(255, 255, 255, 0.72);
  --text-soft: rgba(255, 255, 255, 0.74);

  --font-display: 'Anton', 'Impact', sans-serif;
  --font-body: 'Instrument Sans', 'Helvetica Neue', system-ui, sans-serif;

  --gutter: clamp(20px, 4vw, 56px);
  --max: 1320px;
  --section-y: 128px;
  --radius-card: 24px;
  --header-h: 81px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 3. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--white); text-decoration: none; transition: color 0.2s; }
@media (hover: hover) { a:hover { color: var(--accent-soft); } }

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; }

:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--white);
  padding: 10px 16px; border-radius: 999px; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* 4. UTILITY --------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.stack-18, .stack-20, .stack-28, .stack-32, .stack-64 { display: flex; flex-direction: column; }
.stack-18 { gap: 18px; }
.stack-20 { gap: 20px; }
.stack-28 { gap: 28px; }
.stack-32 { gap: 32px; }
.stack-64 { gap: 64px; }

.accent { color: var(--accent); }
.ink { color: var(--bg); }

/* 5. COMPONENTI ------------------------------------------------------------ */

/* Titoli display */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.95;
}
.display > span.reveal,
.hero__title > span { display: block; }
.display--xl { font-size: clamp(44px, 6.6vw, 104px); }
.display--lg { font-size: clamp(44px, 5.6vw, 88px); }
.display--about { font-size: clamp(44px, 5.2vw, 84px); }
.display--contact { font-size: clamp(52px, 6.4vw, 104px); line-height: 0.92; }

/* Occhielli */
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-soft);
}
.eyebrow--muted { color: rgba(255, 255, 255, 0.64); }
.eyebrow--white { color: var(--white); font-weight: 700; }
.eyebrow--accent { color: var(--accent); font-weight: 700; }

.label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Bottoni */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 18px 30px;
  border-radius: 999px;
  border: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s, background-color 0.25s, border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { transition: transform 0.25s var(--ease-out); flex-shrink: 0; }
.btn--accent { background: var(--accent); color: var(--white); }
.btn--ghost { border: 1px solid rgba(255, 255, 255, 0.28); color: var(--white); }
.btn--sm { min-height: 44px; padding: 13px 22px; font-size: 14px; gap: 10px; }
.btn--block { width: 100%; }
.btn--center { align-self: center; }
.btn:active { transform: scale(0.97); }
@media (hover: hover) {
  .btn--accent:hover { color: var(--white); box-shadow: 0 10px 40px rgba(var(--accent-rgb), 0.5); transform: translateY(-2px); }
  .btn--accent:hover svg { transform: translateX(4px); }
  .btn--ghost:hover { color: var(--white); border-color: var(--white); }
}
.btn-row { display: flex; gap: 16px; flex-wrap: wrap; }

/* Pillole */
.pills { display: flex; flex-wrap: wrap; gap: 12px; }
.pills--tight { gap: 10px; }
.pill {
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 16px;
  border: 1.5px solid transparent;
}
.pill--white { border-color: var(--white); }
.pill--ink { background: var(--bg); border-color: var(--bg); }
.pill--ink-outline { border-color: var(--bg); padding: 10px 18px; font-size: 17px; }

/* 6. SEZIONI --------------------------------------------------------------- */

/* --- Header / Nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 12, 12, 0);
  transition: background-color 0.3s;
}
.site-header.is-scrolled {
  background: rgba(12, 12, 12, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 20px;
  padding-bottom: 20px;
}
.nav__brand { display: flex; align-items: center; position: relative; z-index: 2; }
.nav__brand img { height: 40px; width: auto; }
.nav__menu {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav__toggle { display: none; }

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 820px;
  display: flex;
  align-items: center;
  overflow: hidden;
  margin-top: calc(var(--header-h) * -1);
  padding-top: var(--header-h);
}
.hero__glow,
.hero__ring {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.hero__glow {
  right: -18%;
  width: 1100px; height: 1100px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.38) 0%, rgba(var(--accent-rgb), 0.10) 38%, rgba(12, 12, 12, 0) 66%);
}
.hero__ring--inner { right: -6%; width: 760px; height: 760px; border: 1px solid rgba(var(--accent-rgb), 0.45); }
.hero__ring--outer { right: -16%; width: 1080px; height: 1080px; border: 1px solid rgba(var(--accent-rgb), 0.22); }

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(560px, 100%), 1fr));
  gap: 56px;
  align-items: center;
  padding-top: 80px;
  padding-bottom: 96px;
}
.hero__copy { display: flex; flex-direction: column; gap: 32px; }
.hero__title {
  font-size: clamp(56px, 8.4vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.005em;
}
.hero__visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 520px;
}
.hero__fallback {
  width: min(440px, 80%);
  filter: drop-shadow(0 30px 60px rgba(var(--accent-rgb), 0.45));
  transition: opacity 0.8s;
}
.hero__canvas {
  position: absolute;
  inset: -10% -10%;
  width: 120%;
  height: 120%;
  max-width: none;
  opacity: 0;
  transition: opacity 1s var(--ease-out);
  touch-action: pan-y;
}
.hero__visual.is-3d .hero__canvas { opacity: 1; }
.hero__visual.is-3d .hero__fallback { opacity: 0; }

/* --- Clienti (marquee) --- */
.clients {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 48px 0 56px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  align-items: center;
  gap: 88px;
  width: max-content;
  padding-right: 88px;
  animation: cg-marquee 45s linear infinite;
}
/* pausa al passaggio solo con il mouse: su touch il tocco lascerebbe il nastro bloccato */
@media (hover: hover) and (pointer: fine) {
  .marquee:hover .marquee__track { animation-play-state: paused; }
}
.marquee__track li { flex-shrink: 0; }
.marquee__track img { opacity: 0.82; } /* dimensioni dagli attributi width/height di ogni logo */
.marquee__track img.is-color { opacity: 1; } /* loghi a colori: piena intensità */
.client-mark {
  display: flex;
  align-items: center;
  height: 72px;
  font-family: var(--font-display);
  font-size: 30px;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.82);
}

/* --- Manifesto --- */
.manifesto { background: var(--accent); }
.manifesto__inner {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding-top: 120px;
  padding-bottom: 120px;
}
.manifesto__bottom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 48px;
  align-items: end;
}
.lead { font-size: 20px; line-height: 1.5; max-width: 560px; text-wrap: pretty; }

/* --- Sezioni generiche --- */
.section { position: relative; }
.section > .container { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.section--border { border-top: 1px solid var(--line); }
.section-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr));
  gap: 32px;
  align-items: end;
}
.section-head__text { font-size: 18px; color: var(--text-soft); max-width: 520px; text-wrap: pretty; }
.section-head__text--narrow { max-width: 480px; }

/* --- Servizi --- */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  gap: 20px;
  perspective: 1200px;
}
.card {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 340px;
  background: var(--surface);
  overflow: hidden;
  transform-style: preserve-3d;
}
.card__num { font-family: var(--font-display); font-size: 22px; color: var(--accent-soft); }
.card__title { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1.05; text-transform: uppercase; }
.card__text { color: var(--text-muted); }
.card--accent { background: var(--accent); border-color: var(--accent); }
.card--accent .card__num,
.card--accent .card__text { color: var(--white); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.tags li { background: var(--bg); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; }

/* Effetto 3D tilt (attivato da JS solo su dispositivi con mouse) */
.tilt { transition: transform 0.5s var(--ease-out), border-color 0.3s; will-change: transform; }
.tilt.is-tilting { transition: transform 0.1s linear, border-color 0.3s; }
.tilt::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.10), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.tilt.is-tilting::after { opacity: 1; }
@media (hover: hover) {
  .card:not(.card--accent):hover { border-color: rgba(var(--accent-rgb), 0.6); }
}

/* --- Testimonianze --- */
.testimonials { overflow: hidden; }
.testimonials__glow {
  position: absolute;
  left: 50%;
  bottom: -20%;
  width: 1200px;
  height: 800px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(var(--accent-rgb), 0.26) 0%, rgba(12, 12, 12, 0) 64%);
  pointer-events: none;
}
.testimonials__inner { position: relative; }
.testimonials__list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
/* schermi medi: 2 + 2 invece di 3 + 1 */
@media (max-width: 1180px) and (min-width: 641px) {
  .testimonials__list { grid-template-columns: repeat(2, 1fr); max-width: 760px; margin: 0 auto; width: 100%; }
}
.testimonial { display: flex; flex-direction: column; gap: 18px; }
.testimonial__media {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-card);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--surface-2) center / cover no-repeat;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.testimonial__placeholder {
  position: absolute;
  top: 20px; left: 20px; right: 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
}
.testimonial__media.has-poster .testimonial__placeholder { display: none; }
.play-btn {
  position: relative;
  z-index: 1;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.55);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.play-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb), 0.7);
  animation: cg-pulse 2.4s var(--ease-out) infinite;
}
@media (hover: hover) {
  .play-btn:hover { transform: scale(1.08); box-shadow: 0 0 60px rgba(var(--accent-rgb), 0.8); }
}
.testimonial__brand {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 110px;
  padding: 0 20px 20px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(to top, rgba(12, 12, 12, 0.92), rgba(12, 12, 12, 0));
}
.testimonial__brand img { height: 52px; width: auto; }
.testimonial__brand span { font-family: var(--font-display); font-size: 24px; line-height: 1.05; text-transform: uppercase; }
.testimonial__body { display: flex; flex-direction: column; gap: 6px; }
.testimonial__body p { font-size: 17px; line-height: 1.45; }
.testimonial__name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.carousel-dots { display: none; }

/* Lettore video */
.video-modal {
  padding: 0;
  border: 0;
  background: transparent;
  width: min(420px, 92vw);
  max-height: 92vh;
  max-height: 92dvh;
  overflow: visible;
}
.video-modal::backdrop { background: rgba(0, 0, 0, 0.86); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.video-modal__player {
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-card);
  background: #000;
  object-fit: contain;
}
.video-modal__close {
  position: absolute;
  top: -56px;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(12, 12, 12, 0.6);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* --- Metodo --- */
.method__head { max-width: 900px; }
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
  gap: 20px;
}
.step {
  position: relative;
  border-top: 3px solid var(--accent);
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.step__num { font-family: var(--font-display); font-size: 56px; line-height: 1; color: rgba(255, 255, 255, 0.18); }
.step__title { font-size: 22px; font-weight: 700; }
.step p { color: var(--text-muted); }

/* --- Chi siamo --- */
.about { background: var(--light); color: var(--bg); }
.about a { color: var(--accent); }
.about__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr));
  gap: 72px;
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.about__text { font-size: 18px; color: rgba(12, 12, 12, 0.78); max-width: 560px; text-wrap: pretty; }
.about__side { display: flex; flex-direction: column; gap: 48px; justify-content: center; }
.areas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
}
.area {
  background: var(--bg);
  color: var(--white);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.4s var(--ease-out);
}
@media (hover: hover) { .area:hover { transform: translateY(-4px); } }
.area--accent { background: var(--accent); }
.area__name { font-family: var(--font-display); font-size: 30px; text-transform: uppercase; line-height: 1.2; }
.area__sub { font-size: 14px; color: rgba(255, 255, 255, 0.7); }
.area--accent .area__sub { color: rgba(255, 255, 255, 0.86); }

/* --- Contatti --- */
.contact { position: relative; overflow: hidden; }
.contact__glow {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1200px;
  height: 700px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(var(--accent-rgb), 0.28) 0%, rgba(12, 12, 12, 0) 65%);
  pointer-events: none;
}
.contact__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr));
  gap: 64px;
  padding-top: 136px;
  padding-bottom: 112px;
}
.contact__list { display: flex; flex-direction: column; gap: 14px; font-size: 18px; }
.contact__row { display: flex; gap: 14px; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.contact__label {
  flex-shrink: 0;
  width: 96px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.form {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 18, 18, 0.9);
  border-radius: 28px;
  padding: clamp(24px, 3vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.field input,
.field textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--bg);
  color: var(--white);
  font: inherit;
  font-size: max(16px, 1em); /* evita lo zoom automatico su iOS */
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.field input { height: 52px; padding: 0 16px; }
.field textarea { padding: 14px 16px; resize: vertical; min-height: 120px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.35);
}
.field.is-invalid input,
.field.is-invalid textarea { border-color: #ff6b6b; }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.consent a { text-decoration: underline; text-underline-offset: 2px; }
.consent.is-invalid { color: #ff9b9b; }
.form__status { font-size: 15px; min-height: 1.5em; color: var(--accent-soft); }
.form__status.is-error { color: #ff9b9b; }
.form__status a { color: var(--white); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.form__status:empty { display: none; }
/* campo anti-spam: fuori dallo schermo, non con display:none (alcuni bot lo riconoscono) */
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form { position: relative; }
.form__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}
.form__wa svg { color: #25d366; flex-shrink: 0; }
@media (hover: hover) { .form__wa:hover { color: var(--white); } }
.contact__role {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--line); }
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 40px;
  padding-bottom: 40px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.64);
}
.footer__logo { height: 32px; width: auto; }
.footer__links { display: flex; gap: 28px; flex-wrap: wrap; }

/* 7. ANIMAZIONI ------------------------------------------------------------ */
@keyframes cg-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes cg-pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Comparsa allo scroll: attiva solo se JS è caricato (classe .js su <html>) */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee__track { animation: none; }
  .play-btn::before { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* 8. RESPONSIVE ------------------------------------------------------------ */

/* Tablet e smartphone: menu a scomparsa */
@media (max-width: 960px) {
  :root { --header-h: 73px; }

  .nav { padding-top: 16px; padding-bottom: 16px; }
  .nav__brand img { height: 36px; }

  .nav__toggle {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 7px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav__toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--white);
    transition: transform 0.35s var(--ease-out);
  }
  .nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(4.5px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:last-child { transform: translateY(-4.5px) rotate(-45deg); }

  .nav__menu {
    position: fixed;
    inset: 0;
    z-index: 1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: calc(var(--header-h) + 24px) var(--gutter) calc(32px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    font-family: var(--font-display);
    font-size: clamp(40px, 11vw, 64px);
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.15;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease-out), visibility 0s linear 0.35s;
  }
  .nav__menu::before {
    content: '';
    position: absolute;
    right: -40%;
    bottom: -20%;
    width: 120vw;
    height: 120vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.35), transparent 65%);
    pointer-events: none;
  }
  .nav__menu a { position: relative; transform: translateY(16px); opacity: 0; transition: transform 0.5s var(--ease-out), opacity 0.5s var(--ease-out); }
  .nav__menu .btn {
    margin-top: 28px;
    font-family: var(--font-body);
    font-size: 15px;
    letter-spacing: 0.08em;
    min-height: 56px;
    padding: 18px 30px;
    width: 100%;
  }
  .nav-open .nav__menu {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s var(--ease-out);
  }
  .nav-open .nav__menu a { transform: none; opacity: 1; }
  .nav-open .nav__menu a:nth-child(2) { transition-delay: 0.05s; }
  .nav-open .nav__menu a:nth-child(3) { transition-delay: 0.1s; }
  .nav-open .nav__menu a:nth-child(4) { transition-delay: 0.15s; }
  .nav-open .nav__menu a:nth-child(5) { transition-delay: 0.2s; }
  .nav-open { overflow: hidden; }
  /* niente backdrop-filter a menu aperto: renderebbe l'header il riferimento del menu fixed */
  .nav-open .site-header { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }

  /* Hero: titolo e bottoni prima, monogramma 3D sotto */
  .hero { min-height: auto; }
  .hero__grid { gap: 8px; padding-top: 56px; padding-bottom: 64px; }
  .hero__visual { min-height: 0; aspect-ratio: 4 / 3; max-height: 460px; }
  .hero__glow { right: auto; left: 50%; top: 68%; width: 900px; height: 900px; transform: translate(-50%, -50%); }
  .hero__ring--inner { right: auto; left: 50%; top: 68%; width: 520px; height: 520px; transform: translate(-50%, -50%); }
  .hero__ring--outer { right: auto; left: 50%; top: 68%; width: 780px; height: 780px; transform: translate(-50%, -50%); }
}

/* Smartphone */
@media (max-width: 640px) {
  :root { --section-y: 88px; --radius-card: 20px; }
  body { font-size: 16px; }

  .nav__brand img { height: 32px; }
  :root { --header-h: 69px; }

  .hero__grid { padding-top: 40px; padding-bottom: 48px; }
  .hero__copy { gap: 28px; }
  .hero__title { font-size: clamp(50px, 15.5vw, 80px); }
  .btn-row { flex-direction: column; gap: 12px; }
  .btn-row .btn { width: 100%; }
  .hero__visual { aspect-ratio: 1 / 0.85; }

  .clients { padding: 36px 0 40px; gap: 24px; }
  .marquee__track { gap: 56px; padding-right: 56px; animation-duration: 32s; }
  .marquee__track li { zoom: 0.75; }
  .client-mark { height: 52px; font-size: 24px; }

  .manifesto__inner { padding-top: 88px; padding-bottom: 88px; gap: 36px; }
  .display--xl { font-size: clamp(40px, 11.5vw, 64px); }
  .display--lg,
  .display--about { font-size: clamp(40px, 11vw, 60px); }
  .display--contact { font-size: clamp(46px, 13vw, 72px); }
  .manifesto__bottom { gap: 32px; }
  .lead { font-size: 18px; }
  .pill { font-size: 15px; padding: 9px 16px; }
  .pill--ink-outline { font-size: 15px; }

  .stack-64 { gap: 44px; }
  .section-head { gap: 20px; }
  .section-head__text { font-size: 17px; }

  .card { padding: 30px 24px; min-height: 0; gap: 16px; }
  .card__title { font-size: 30px; }
  .card--accent .tags { margin-top: 8px; }

  /* Testimonianze: carosello orizzontale con scroll-snap */
  .testimonials__list {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 4px;
    scroll-padding: 0 var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .testimonials__list::-webkit-scrollbar { display: none; }
  .testimonial { flex: 0 0 76%; scroll-snap-align: start; }
  /* solo dissolvenza: una traslazione falserebbe i punti di aggancio dello scroll-snap */
  .js .testimonial.reveal { transform: none; }
  .play-btn { width: 64px; height: 64px; }
  .carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: -24px; }
  .carousel-dots span {
    width: 8px; height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    transition: width 0.3s var(--ease-out), background-color 0.3s;
  }
  .carousel-dots span.is-active { width: 24px; background: var(--accent); }
  .btn--center { width: 100%; }

  .steps { gap: 36px; }
  .step__num { font-size: 48px; }

  .about__grid { gap: 56px; }
  .about__text { font-size: 17px; }
  .about__side { gap: 40px; }
  .areas { grid-template-columns: 1fr 1fr; }
  .area--accent { grid-column: 1 / -1; }
  .area { padding: 18px; }
  .area__name { font-size: 26px; }

  .contact__grid { padding-top: 96px; padding-bottom: 80px; gap: 48px; }
  .contact__list { font-size: 17px; }
  .form { border-radius: 22px; gap: 18px; }
  .form__row { gap: 18px; }

  .footer__inner { flex-direction: column; align-items: flex-start; gap: 20px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  .footer__links { gap: 12px 24px; }
  .footer__links a { min-height: 32px; display: inline-flex; align-items: center; }
}

/* Schermi molto stretti */
@media (max-width: 360px) {
  .hero__title { font-size: 46px; }
  .testimonial { flex-basis: 84%; }
}

/* 9. PAGINE LEGALI (privacy.html, cookie.html) ------------------------------ */
.legal { padding-top: 72px; padding-bottom: 112px; max-width: 860px; }
.legal .display { font-size: clamp(44px, 8vw, 88px); margin: 20px 0 16px; }
.legal__updated { color: rgba(255, 255, 255, 0.6); font-size: 14px; margin-bottom: 48px; }
.legal h2 { font-size: 22px; font-weight: 700; margin: 40px 0 12px; }
.legal p, .legal li { color: var(--text-muted); margin-bottom: 12px; }
.legal ul { list-style: disc; padding-left: 22px; }
.legal a:not(.btn) { color: var(--accent-soft); text-decoration: underline; text-underline-offset: 2px; }
.legal .todo { background: rgba(var(--accent-rgb), 0.18); color: var(--white); padding: 1px 6px; border-radius: 6px; }
.header-simple .nav { justify-content: space-between; }

/* Link al reel Instagram sotto ogni testimonianza */
.testimonial__ig {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-soft);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
@media (hover: hover) { .testimonial__ig:hover { color: var(--white); } }
