/* Pietro Saviotti Web Studio
   Sistema del marchio: 4 colori (Primario, Accento, Neutro, Scuro), 2 famiglie
   (Bricolage Grotesque per i titoli, Geist per testi e interfaccia).
   Movimento: solo CSS e poche righe in main.js, nessuna libreria. */

@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-swd.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-pswd.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* Fallback di sistema con metriche tarate: niente salti mentre i font arrivano */
@font-face {
  font-family: "Bricolage Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Roboto");
  size-adjust: 104%;
  ascent-override: 89%;
  descent-override: 26%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Geist Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Roboto");
  size-adjust: 101.7%;
  ascent-override: 98.8%;
  descent-override: 29%;
  line-gap-override: 0%;
}

:root {
  /* Primario: il blu dei link. Azioni, link, elementi attivi. */
  --primary: #2f3dff;
  --primary-hover: #1f2bdc;
  --primary-tint: #e8eaff;
  --primary-on-dark: #8e98ff;
  /* Accento: il cursore del monogramma. Solo grafica e testo grande (4.2:1 sullo scuro). */
  --accent: #5865ff;
  /* Neutro: carta, superfici, linee, testo secondario. */
  --paper: #f5f6f8;
  --surface: #ffffff;
  --warm: #f7f5f0;
  --line: #dde0e7;
  --line-strong: #8a90a0;
  --sketch: #c5cad6;
  --muted: #575d70;
  /* Scuro: inchiostro per testi e dettagli. */
  --ink: #0e1220;
  --ink-soft: #1c2236;
  --muted-on-ink: #a8aec0;
  --error: #b42318;

  /* nomi storici usati nel foglio */
  --blue: var(--primary);
  --blue-hover: var(--primary-hover);
  --blue-tint: var(--primary-tint);
  --blue-on-ink: var(--primary-on-dark);

  --font-display: "Bricolage", "Bricolage Fallback", system-ui, sans-serif;
  --font-text: "Geist", "Geist Fallback", system-ui, sans-serif;
  --font-ui: var(--font-text);
  --font: var(--font-display);


  --step--1: 0.875rem;
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);
  --step-2: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.45rem + 1.4vw, 2.5rem);
  --step-4: clamp(2.125rem, 1.6rem + 2.4vw, 3.5rem);
  --step-5: clamp(2.375rem, 1.55rem + 3.9vw, 4.75rem);

  --gutter: clamp(20px, 5vw, 48px);
  --section: clamp(80px, 11vw, 148px);
  --radius: 10px;

  /* Una sola scala di movimento per tutto il sito (anche per il motore) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 160ms;
  --dur-ui: 240ms;
  --dur-enter: 620ms;
  --dur-reveal: 1000ms;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
picture {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
blockquote {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

:where(ul[role="list"], ol[role="list"]) {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--blue);
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.section-dark :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--blue-on-ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -200px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 560;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 1200px);
  margin-inline: auto;
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
  font-weight: 560;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    transform 160ms var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

.btn[aria-disabled="true"] {
  opacity: 0.7;
  cursor: progress;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 560;
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.3em;
  transition:
    color 180ms ease,
    text-underline-offset 180ms ease;
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--blue);
  font-weight: 560;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.3em;
}

.ext-link svg {
  width: 18px;
  height: 18px;
  transition: transform 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: var(--blue-hover);
  }

  .text-link:hover {
    color: var(--blue);
    text-underline-offset: 0.42em;
  }

  .ext-link:hover svg {
    transform: translate(2px, -2px);
  }
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgb(245 246 248 / 0.97);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-height: 44px;
  font-weight: 560;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-decoration: none;
}

.brand svg {
  width: 36px;
  height: 36px;
  flex: none;
}

.brand-name span {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0;
}

.lang {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 560;
}

.lang a,
.lang-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 44px;
  padding: 0 6px;
}

.lang-current {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.lang a {
  color: var(--muted);
  text-decoration: none;
  transition: color 180ms ease;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  margin-right: -12px;
  border: 0;
  background: none;
  font-weight: 560;
  cursor: pointer;
}

.menu-icon {
  position: relative;
  width: 18px;
  height: 12px;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 200ms var(--ease-out);
}

.menu-icon::before {
  top: 1px;
}

.menu-icon::after {
  bottom: 1px;
}

.menu-toggle[aria-expanded="true"] .menu-icon::before {
  transform: translateY(4px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-icon::after {
  transform: translateY(-4px) rotate(-45deg);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
}

.header-cta {
  display: none;
}

/* Menu mobile: pannello sotto la barra */
@media (max-width: 959.98px) {
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px -24px rgb(14 18 32 / 0.25);
  }

  .site-nav[data-open="true"] {
    display: block;
    animation: menu-in 220ms var(--ease-out);
  }

  .site-nav ul {
    width: min(100% - 2 * var(--gutter), 1200px);
    margin-inline: auto;
    padding: 8px 0 24px;
  }

  .site-nav li a:not(.btn) {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-bottom: 1px solid var(--line);
    font-size: 1.125rem;
    font-weight: 500;
  }

  .site-nav .nav-cta {
    margin-top: 20px;
  }

  .site-nav .nav-cta .btn {
    width: 100%;
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (min-width: 960px) {
  .header-inner {
    min-height: 76px;
    gap: 12px;
  }

  .menu-toggle,
  .site-nav .nav-cta {
    display: none;
  }

  .site-nav {
    margin-right: 12px;
  }

  .site-nav ul {
    display: flex;
    gap: 4px;
  }

  .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    background: linear-gradient(var(--blue), var(--blue)) no-repeat 12px calc(100% - 8px) / 0 2px;
    transition:
      background-size 220ms var(--ease-out),
      color 180ms ease;
  }

  .header-cta {
    display: inline-flex;
    margin-left: 12px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .lang a:hover {
    color: var(--blue);
  }

  .site-nav a:not(.btn):hover {
    background-size: calc(100% - 24px) 2px;
  }
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--section);
}

.section + .section:not(.section-dark) {
  border-top: 1px solid var(--line);
}

.section-dark {
  background: var(--ink);
  color: #fff;
}

.section-dark + .section {
  border-top: 0;
}

.section-head {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin-bottom: clamp(44px, 6vw, 80px);
}

.section-head h2,
.page-title {
  font-size: var(--step-4);
  font-weight: 470;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

.section-head p {
  max-width: 54ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.55;
}

.section-dark .section-head p {
  color: var(--muted-on-ink);
}

/* ---------- Hero: tavola a livelli ---------- */

.hero {
  position: relative;
  padding-block: clamp(36px, 7vw, 96px) clamp(48px, 7vw, 96px);
  overflow: clip;
}

.hero-grid {
  display: grid;
  gap: 24px;
}

.hero-title {
  max-width: 19ch;
  font-size: var(--step-5);
  font-weight: 430;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

/* Il titolo entra parola per parola, in ordine di lettura: riga dopo riga */
.hero-title .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.hero-title .wi {
  display: inline-block;
}

.hero-lead {
  max-width: 40ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  margin-top: 32px;
}

.btn-lg {
  min-height: 56px;
  padding: 0 28px;
}

.hero-stage {
  position: relative;
  width: 100%;
  max-width: 660px;
  aspect-ratio: 660 / 520;
  margin-top: 16px;
}

.hs-plane {
  position: absolute;
}

/* Piano di fondo: la carta millimetrata della tavola */
.hs-grid {
  inset: -14% -18% -10% -8%;
  background-image:
    linear-gradient(var(--primary-tint) 1px, transparent 1px),
    linear-gradient(90deg, var(--primary-tint) 1px, transparent 1px),
    linear-gradient(rgb(47 61 255 / 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgb(47 61 255 / 0.06) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent);
  mask-image: radial-gradient(closest-side, #000 55%, transparent);
}

.hs-site {
  left: 0;
  top: 4%;
  width: 86%;
}

/* Ombre statiche: il riquadro non si muove, quindi l'ombra non viene ricalcolata */
.hs-tilt {
  border-radius: 2.4% / 3.5%;
  box-shadow: 0 30px 50px -28px rgb(14 18 32 / 0.35);
}

.hs-browser,
.hs-phone {
  width: 100%;
  height: auto;
}

.hs-front {
  inset: 0;
  pointer-events: none;
}

.hs-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 28%;
}

/* ombra a terra del telefono, già sfocata (nessun filtro) */
.hs-front::before {
  content: "";
  position: absolute;
  right: 1%;
  bottom: -3%;
  width: 27%;
  height: 7%;
  background: radial-gradient(closest-side, rgb(14 18 32 / 0.3), transparent);
}

.chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 10px 24px -14px rgb(14 18 32 / 0.4);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.chip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip--https {
  left: -2.3%;
  top: -5.5%;
}

.chip--google {
  left: 51%;
  top: 96%;
}

.chip--size {
  right: 2%;
  bottom: -7%;
}

@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(40px, 5vw, 80px);
    row-gap: 40px;
    align-items: start;
  }

  .hero-title {
    grid-column: 1 / -1;
    max-width: 26ch;
  }

  .hero-lead {
    margin-top: 8px;
  }

  .hero-stage {
    justify-self: end;
    margin-top: -24px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-title .wi {
    animation: word-in 760ms var(--ease-out) both;
  }

  .hero-title .wi-1 { animation-delay: 45ms; }
  .hero-title .wi-2 { animation-delay: 90ms; }
  .hero-title .wi-3 { animation-delay: 135ms; }
  .hero-title .wi-4 { animation-delay: 180ms; }
  .hero-title .wi-5 { animation-delay: 225ms; }
  .hero-title .wi-6 { animation-delay: 270ms; }
  .hero-title .wi-7 { animation-delay: 315ms; }
  .hero-title .wi-8 { animation-delay: 360ms; }
  .hero-title .wi-9 { animation-delay: 405ms; }
  .hero-title .wi-10 { animation-delay: 450ms; }
  .hero-title .wi-11 { animation-delay: 495ms; }
}

@keyframes word-in {
  from {
    transform: translateY(108%);
  }
}

/* Colori dei disegni (mockup, 404) */
.mk-paper,
.bp-white,
.mk-white,
.mk-paperfill {
  fill: #fff;
}

.mk-frame,
.bp-outline {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
}

.mk-ink,
.bp-ink,
.mk-inkframe {
  fill: var(--ink);
}

.mk-inksoft,
.bp-ink-soft {
  fill: #232a40;
}

.mk-gray {
  fill: #cfd3dc;
}

.mk-gray2 {
  fill: #e4e7ee;
}

.mk-sketch {
  fill: var(--sketch);
}

.mk-blue {
  fill: var(--primary);
}

.mk-tint {
  fill: var(--primary-tint);
}

.mk-tint2 {
  fill: #c9ceff;
}

.mk-tint3 {
  fill: #a3abff;
}

.mk-sky {
  fill: #dfe3ff;
}

.mk-shelf {
  fill: #3a4262;
}

.mk-door {
  fill: #2a3150;
}

.mk-open {
  fill: #1f8a5b;
}

.mk-mapline {
  fill: none;
  stroke: #c9ceff;
  stroke-width: 1;
}

.mk-lock,
.bp-lock {
  fill: var(--primary-on-dark);
}

.mk-lockarc {
  fill: none;
  stroke: var(--primary-on-dark);
  stroke-width: 1.5;
}

.mk-url,
.bp-text {
  fill: #e3e6ee;
  font-family: var(--font-text);
  font-size: 11px;
}

.mk-url--s {
  font-size: 8.5px;
}

.mk-brand {
  fill: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.mk-brand--s {
  font-size: 9px;
}

.mk-head {
  fill: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.mk-head--s {
  font-size: 15px;
}

.mk-btntext {
  fill: #fff;
  font-family: var(--font-text);
  font-size: 10px;
  font-weight: 600;
}

.mk-pencil path,
.bp-dim {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.25;
}

.mk-pencil .mk-gridline {
  stroke: rgb(142 152 255 / 0.35);
  stroke-width: 1;
}

.mk-dim path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
}

.mk-dimtext {
  fill: var(--primary-on-dark);
  font-family: var(--font-text);
  font-size: 11px;
  font-weight: 600;
}

/* ---------- Fascia di testo: si muove solo con lo scroll ---------- */

.band {
  overflow: hidden;
  padding-block: clamp(28px, 4vw, 44px);
  border-block: 1px solid var(--line);
}

.band-track {
  display: flex;
  width: max-content;
  gap: clamp(32px, 4vw, 56px);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 430;
  letter-spacing: -0.03em;
  line-height: 1.1;
  white-space: nowrap;
}

.band-track span {
  display: inline-flex;
  align-items: center;
  gap: clamp(32px, 4vw, 56px);
}

.band-track span::after {
  content: "";
  width: 0.28em;
  height: 0.28em;
  border-radius: 2px;
  background: var(--accent);
}

/* Scorre da sola, lineare e infinita; un giro = un terzo della traccia (contenuto ripetuto 3 volte) */
@media (prefers-reduced-motion: no-preference) {
  .band-track {
    animation: band 36s linear infinite;
    animation-play-state: paused;
  }

  .band.in-view .band-track {
    animation-play-state: running;
    will-change: transform;
  }

  @media (hover: hover) and (pointer: fine) {
    .band:hover .band-track {
      animation-play-state: paused;
    }
  }
}

@keyframes band {
  to {
    transform: translate3d(-33.333%, 0, 0);
  }
}

/* ---------- Da bozza a sito online: la scena firma ----------
   Cinque fasi discrete (data-phase 0–4, scritte da main.js quando una soglia attraversa
   il centro dello schermo). Si animano solo i 5 livelli del mockup, con transizioni CSS.
   Senza data-phase (niente JS o movimento ridotto) si vede il sito finito e i 4 passi in elenco. */

.method {
  position: relative;
  background: var(--ink);
  color: #fff;
}

.method-stage {
  display: flex;
  align-items: center;
  padding-block: clamp(72px, 9vw, 120px);
}

.method-grid {
  display: grid;
  gap: 32px;
}

.method-copy h2 {
  font-size: var(--step-4);
  font-weight: 470;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

.method-lead {
  max-width: 40ch;
  margin-top: 14px;
  color: var(--muted-on-ink);
  font-size: var(--step-1);
}

.msteps {
  display: grid;
  gap: 28px;
  margin-top: clamp(28px, 4vw, 48px);
}

.mstep {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.mstep-num {
  flex: none;
  min-width: 1.2ch;
  color: var(--primary-on-dark);
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 330;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
}

.mstep h3 {
  font-size: var(--step-2);
  font-weight: 520;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.mstep p {
  max-width: 38ch;
  margin-top: 8px;
  color: var(--muted-on-ink);
}

.mprogress {
  margin-top: clamp(28px, 4vw, 44px);
}

.mprogress-bar {
  height: 3px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.14);
  overflow: hidden;
}

.mprogress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
}

.mprogress-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
}

.mphase {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Il mockup: 5 livelli impilati */
.mv {
  position: relative;
}

.mv-desk {
  position: relative;
  aspect-ratio: 600 / 400;
  width: 100%;
  transform-origin: left center;
}

.mv-mob {
  display: none;
}

.mv-l {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mv-desk .mv-phone {
  inset: auto -18% -12% auto;
  width: 30%;
  height: auto;
  aspect-ratio: 170 / 340;
}

.method .mk-paper,
.method .mk-paperfill {
  fill: #fff;
}

.method .mk-frame {
  stroke: #3a4262;
}

@media (min-width: 960px) {
  .method-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(40px, 6vw, 96px);
    align-items: center;
  }

  .mv {
    padding-right: 12%;
  }
}

@media (max-width: 959.98px) {
  .mv-desk {
    display: none;
  }

  .mv-mob {
    display: block;
    position: relative;
    width: min(56vw, 240px);
    aspect-ratio: 170 / 340;
    margin-inline: auto;
  }

  .mstep-num {
    font-size: var(--step-3);
  }

  .mstep h3 {
    font-size: var(--step-1);
  }

  .mstep p {
    font-size: 0.9375rem;
    line-height: 1.5;
  }
}

/* --- Scena attiva (main.js ha scritto data-phase) --- */

.method[data-phase] .mv-l,
.method[data-phase] .mv-desk,
.method[data-phase] .mprogress-bar span,
.method[data-phase] .mprogress-labels li {
  transition:
    opacity 450ms var(--ease-out),
    transform 600ms var(--ease-in-out);
}

/* i livelli vivono su un layer proprio solo mentre la scena è in vista */
.method.in-view[data-phase] .mv-l {
  will-change: opacity, transform;
}

/* fase 0: solo la bozza a matita */
.method[data-phase="0"] .mv-struct { opacity: 0; }
.method:is([data-phase="0"], [data-phase="1"]) .mv-color { opacity: 0; }
.method:is([data-phase="0"], [data-phase="1"], [data-phase="2"]) .mv-content { opacity: 0; }
.method:not([data-phase="4"])[data-phase] .mv-desk .mv-phone {
  opacity: 0;
  transform: translate3d(0, 12%, 0);
}

/* telefono: lo stesso telefono diventa il sito finito, senza un secondo telefono che sale */
.method:not([data-phase="4"])[data-phase] .mv-online {
  opacity: 0;
}

.method[data-phase="4"] .mv-desk {
  transform: translate3d(-7%, 0, 0) scale(0.92);
}

.method[data-phase="0"] .mprogress-bar span { transform: scaleX(0.25); }
.method[data-phase="1"] .mprogress-bar span { transform: scaleX(0.5); }
.method:is([data-phase="2"], [data-phase="3"]) .mprogress-bar span { transform: scaleX(0.75); }

.method[data-phase="0"] .mprogress-labels li:nth-child(n + 2),
.method[data-phase="1"] .mprogress-labels li:nth-child(n + 3),
.method:is([data-phase="2"], [data-phase="3"]) .mprogress-labels li:nth-child(4) {
  opacity: 0.5;
}

/* Desktop: la sezione si ferma per circa 1 schermo (pin in CSS) e i passi si alternano */
@media (min-width: 960px) {
  .method[data-phase] {
    height: 200svh;
  }

  .method[data-phase] .method-stage {
    position: sticky;
    top: 0;
    height: 100svh;
    padding-block: 76px 0;
  }

  .method[data-phase] .msteps {
    gap: 0;
    min-height: 9.5em;
  }

  .method[data-phase] .mstep {
    grid-area: 1 / 1;
    opacity: 0;
    transform: translate3d(0, 10px, 0);
    transition:
      opacity 300ms var(--ease-out),
      transform 300ms var(--ease-out);
  }

  .method[data-phase="0"] .mstep--1,
  .method[data-phase="1"] .mstep--2,
  .method:is([data-phase="2"], [data-phase="3"]) .mstep--3,
  .method[data-phase="4"] .mstep--4 {
    opacity: 1;
    transform: none;
  }

  /* soglie lungo la corsa del pin: il centro dello schermo è al 25% della sezione all'inizio
     della corsa e al 75% alla fine, quindi 25% + 50% × avanzamento (0.2, 0.4, 0.6, 0.8) */
  .mphase--0 { top: 0; }
  .mphase--1 { top: 35%; }
  .mphase--2 { top: 45%; }
  .mphase--3 { top: 55%; }
  .mphase--4 { top: 65%; }
}

/* Telefono: nessun pin. I passi uno sotto l'altro, il telefono resta a lato e cambia fase */
@media (max-width: 959.98px) {
  .mphase {
    display: none;
  }

  .method[data-phase] .method-grid {
    grid-template-columns: minmax(0, 1fr) 32vw;
    column-gap: 16px;
  }

  .method[data-phase] .method-copy {
    display: contents;
  }

  .method[data-phase] .method-copy > :is(h2, .method-lead),
  .method[data-phase] .mprogress {
    grid-column: 1 / -1;
  }

  .method[data-phase] .mprogress {
    display: none;
  }

  .method[data-phase] .msteps {
    grid-column: 1;
    gap: 22svh;
    padding-bottom: 12svh;
  }

  .method[data-phase] .mv {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    position: sticky;
    top: 96px;
    margin-top: clamp(28px, 4vw, 48px);
  }

  .method[data-phase] .mv-mob {
    width: 100%;
  }
}

/* Telefono: il mockup prende forma in modo continuo mentre i passi scorrono (animato dal browser) */
@supports (timeline-scope: --a) and (animation-timeline: view()) {
  @media (max-width: 959.98px) and (prefers-reduced-motion: no-preference) {
    .method[data-phase] {
      timeline-scope: --s2, --s3, --s4;
    }

    .method[data-phase] .mstep--2 { view-timeline-name: --s2; }
    .method[data-phase] .mstep--3 { view-timeline-name: --s3; }
    .method[data-phase] .mstep--4 { view-timeline-name: --s4; }

    .method[data-phase] .mv-mob :is(.mv-struct, .mv-color, .mv-content, .mv-online) {
      animation: mv-in linear both;
      transition: none;
    }

    .method[data-phase] .mv-mob .mv-struct { animation-timeline: --s2; animation-range: entry 0% cover 45%; }
    .method[data-phase] .mv-mob .mv-color { animation-timeline: --s3; animation-range: entry 0% cover 30%; }
    .method[data-phase] .mv-mob .mv-content { animation-timeline: --s3; animation-range: cover 25% cover 50%; }
    .method[data-phase] .mv-mob .mv-online { animation-timeline: --s4; animation-range: entry 0% cover 45%; }
  }
}

@keyframes mv-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Servizi ---------- */

.services {
  display: grid;
  column-gap: clamp(28px, 4vw, 56px);
}

.service {
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
}

.service-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--blue-tint);
  color: var(--blue);
}

.service-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.service h3 {
  margin: 22px 0 8px;
  font-size: var(--step-1);
  font-weight: 580;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.service p {
  max-width: 40ch;
  color: var(--muted);
}

@media (min-width: 640px) {
  .services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .services {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- Lavori ---------- */

.projects {
  display: grid;
  gap: clamp(72px, 10vw, 128px);
}

/* Ogni progetto è un <li class="project">: basta duplicarlo */
.project {
  display: grid;
  gap: 36px;
  align-items: center;
}

.project-media {
  position: relative;
  padding: 0 11% 9% 0;
}

.device-browser {
  overflow: hidden;
  border-radius: 12px;
  background: var(--ink);
  box-shadow: 0 40px 70px -40px rgb(14 18 32 / 0.55);
}

.device-bar {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
}

.device-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px 2px 9px;
  border-radius: 6px;
  background: var(--ink-soft);
  color: #d5d9e4;
  font-size: 0.75rem;
  line-height: 1.6;
}

.device-url svg {
  width: 11px;
  height: 11px;
  fill: var(--blue-on-ink);
}





.device-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 25%;
  padding: 5px;
  border-radius: 22px;
  background: var(--ink);
  box-shadow:
    0 0 0 5px var(--paper),
    0 30px 50px -24px rgb(14 18 32 / 0.6);
}

.device-phone img {
  width: 100%;
  aspect-ratio: 390 / 820;
  object-fit: cover;
  object-position: top;
  border-radius: 17px;
}

.project-body h3 {
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.project-kind {
  margin-top: 6px;
  color: var(--muted);
}

.project-body > p:not(.project-kind) {
  max-width: 46ch;
  margin-top: 20px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.tags li {
  padding: 3px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--step--1);
  line-height: 1.6;
}

.project-body .ext-link {
  margin-top: 20px;
}

@media (min-width: 960px) {
  .project {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(48px, 6vw, 88px);
  }
}


/* ---------- Prezzi ---------- */

.price-range {
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.ruler {
  position: relative;
  height: 40px;
  margin-bottom: 40px;
  background:
    linear-gradient(90deg, var(--line-strong) 1px, transparent 1px) 0 0 / calc((100% - 1px) / 7) 100% repeat-x,
    linear-gradient(90deg, var(--sketch) 1px, transparent 1px) 0 100% / calc((100% - 1px) / 14) 45% repeat-x;
}

.ruler-band {
  position: absolute;
  inset: 0 calc(100% / 7) 0 calc(100% / 7);
  border-inline: 2px solid var(--blue);
  background: rgb(47 61 255 / 0.12);
  transform-origin: left center;
}

.ruler-band::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--blue);
}

.ruler-label {
  position: absolute;
  top: calc(100% + 10px);
  color: var(--blue);
  font-size: var(--step--1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ruler-label-start {
  left: calc(100% / 7);
  transform: translateX(-50%);
}

.ruler-label-end {
  left: calc(600% / 7);
  transform: translateX(-50%);
}

.price-range figcaption {
  max-width: 44ch;
  font-size: var(--step-2);
  font-weight: 440;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.price-range strong {
  font-weight: 600;
}

.price-notes {
  display: grid;
  gap: 32px;
  margin-top: clamp(40px, 5vw, 56px);
}

.price-notes h3 {
  margin-bottom: 8px;
  font-size: var(--step-1);
  font-weight: 580;
}

.price-notes p {
  max-width: 40ch;
  color: var(--muted);
}

@media (min-width: 900px) {
  .price-notes {
    grid-template-columns: 1fr 1fr auto;
    align-items: start;
    column-gap: clamp(32px, 4vw, 64px);
  }
}

/* ---------- FAQ ---------- */

.faq-layout {
  display: grid;
}

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 18px 0;
  font-size: var(--step-1);
  font-weight: 540;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:focus-visible {
  outline-offset: 2px;
}

.faq-icon {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition:
    background-color 180ms ease,
    border-color 180ms ease;
}

.faq-icon::before,
.faq-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  margin: -1px 0 0 -6px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 220ms var(--ease-out);
}

.faq-icon::after {
  transform: rotate(90deg);
}

.faq-item[open] .faq-icon {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.faq-item[open] .faq-icon::after {
  transform: rotate(0deg);
}

.faq-answer {
  padding-bottom: 26px;
}

.faq-answer p {
  max-width: 62ch;
  color: var(--muted);
}

@media (hover: hover) and (pointer: fine) {
  .faq-item summary:hover .faq-icon {
    border-color: var(--blue);
  }
}

@media (min-width: 960px) {
  .faq-layout {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(40px, 6vw, 96px);
  }

  .faq-layout .section-head {
    align-self: start;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (interpolate-size: allow-keywords) {
    .faq-list {
      interpolate-size: allow-keywords;
    }

    .faq-item::details-content {
      height: 0;
      overflow: clip;
      transition:
        height 260ms var(--ease-out),
        content-visibility 260ms allow-discrete;
    }

    .faq-item[open]::details-content {
      height: auto;
    }
  }
}

/* ---------- Contatti ---------- */

.contact-layout {
  display: grid;
  gap: 40px;
}

.contact-points {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.contact-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.contact-points svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form {
  display: grid;
  gap: 24px;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.form-note {
  color: var(--muted);
  font-size: var(--step--1);
}

.field {
  display: grid;
  gap: 8px;
}

.field-row {
  display: grid;
  gap: 24px;
}

.field label,
.field legend {
  font-weight: 560;
  font-size: 0.9375rem;
}

.optional,
.hint {
  color: var(--muted);
  font-weight: 400;
}

.hint {
  font-size: var(--step--1);
  margin-top: -4px;
}

.field input:not([type="radio"]):not([type="checkbox"]),
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 160ms ease;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
}

.field input:focus-visible,
.field textarea:focus-visible {
  border-color: var(--blue);
  outline: 2px solid var(--blue);
  outline-offset: 0;
}

.field [aria-invalid="true"] {
  border-color: var(--error) !important;
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

fieldset.field legend {
  padding: 0;
  margin-bottom: 8px;
}

.choices {
  display: grid;
  gap: 8px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.choice input,
.consent input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
}

.choice:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.choice:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.choice input:focus-visible {
  outline: none;
}

.choice:has(input[aria-invalid="true"]) {
  border-color: var(--error);
}

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9375rem;
  cursor: pointer;
}

.consent input {
  margin-top: 2px;
}

.consent a {
  color: var(--blue);
  text-underline-offset: 0.2em;
}

.field-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--error);
  font-size: 0.9375rem;
  font-weight: 500;
}

.field-error:empty {
  display: none;
}

.field-error::before {
  content: "!";
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.form-status {
  padding: 12px 14px;
  border-left: 3px solid var(--error);
  background: #fdf0ee;
  color: var(--error);
  font-weight: 500;
}

.form-status:empty {
  padding: 0;
  border: 0;
}

.form-hidden {
  display: none;
}

.form .btn {
  justify-self: start;
}

@media (hover: hover) and (pointer: fine) {
  .field input:not([type="radio"]):not([type="checkbox"]):hover,
  .field textarea:hover,
  .choice:hover {
    border-color: var(--ink);
  }
}

@media (max-width: 559.98px) {
  .form .btn {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  .choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .choice {
    align-items: flex-start;
  }

  .choice input {
    margin-top: 2px;
  }
}

@media (min-width: 960px) {
  .contact-layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(40px, 6vw, 96px);
  }

  .contact-layout .section-head {
    position: sticky;
    top: 120px;
    align-self: start;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 56px 44px;
  background: var(--ink);
  color: #fff;
}

.footer-inner {
  display: grid;
  gap: 28px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 560;
}

.footer-brand svg {
  width: 40px;
  height: 40px;
}

.footer-brand span {
  display: block;
  color: var(--muted-on-ink);
  font-weight: 400;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  color: var(--muted-on-ink);
  font-size: 0.9375rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 0.35);
  text-underline-offset: 0.3em;
  transition: text-decoration-color 180ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .footer-links a:hover {
    text-decoration-color: var(--blue-on-ink);
  }
}

@media (min-width: 760px) {
  .footer-inner {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* ---------- Pagine semplici (privacy, grazie, 404) ---------- */

.page {
  padding-block: clamp(56px, 9vw, 120px) var(--section);
}

.page-title {
  max-width: 20ch;
}

.page-lead {
  max-width: 52ch;
  margin-top: 20px;
  color: var(--muted);
  font-size: var(--step-1);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  margin-top: 36px;
}

.prose {
  max-width: 68ch;
  margin-top: 48px;
}

.prose h2 {
  margin: 2.4em 0 0.6em;
  font-size: var(--step-2);
  font-weight: 520;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.prose p,
.prose ul {
  margin-bottom: 1em;
}

.prose ul {
  padding-left: 1.2em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose a {
  color: var(--blue);
  text-underline-offset: 0.2em;
}

.prose .updated {
  color: var(--muted);
  font-size: var(--step--1);
}

.page-alt {
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.page-alt h2 {
  font-size: var(--step-2);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.page-alt p {
  margin-top: 10px;
  color: var(--muted);
}

.done-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 28px;
}

.done-mark circle {
  fill: var(--blue-tint);
}

.done-mark path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lost-mark {
  width: min(100%, 320px);
  margin-bottom: 32px;
}

@media (prefers-reduced-motion: no-preference) {
  .done-mark path {
    stroke-dasharray: 1;
    animation: bp-draw 600ms var(--ease-out) 200ms both;
  }
}

/* ---------- Tipografia del marchio ---------- */

h1,
h2,
h3,
.page-title,
.band-track,
.price-range figcaption,
.footer-brand p {
  font-family: var(--font-display);
}

.btn,
.site-nav,
.lang,
.menu-toggle,
.tags,
.form label,
.form legend,
.chip,
.mprogress-labels,
.skip-link {
  font-family: var(--font-ui);
}

.btn {
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ---------- Header: barra di lettura, si nasconde scendendo ---------- */

.site-header {
  transition: transform var(--dur-ui) var(--ease-out);
  will-change: transform;
}

.site-header.is-hidden {
  transform: translate3d(0, -100%, 0);
}

.read-bar {
  height: 3px;
  background: var(--accent);
}

.brand-name--short {
  display: none;
}

@media (max-width: 959.98px) {
  .brand-name--long {
    display: none;
  }

  .brand-name--short {
    display: block;
  }
}

/* ---------- Servizi: icone che si disegnano, luce che segue il puntatore ---------- */

/* La luce copre tutta la sezione e sfuma ai bordi, senza tagli netti sulle card */
.services-section[data-sc-spotlight] {
  position: relative;
  overflow: clip;
  isolation: isolate;
}

.services-section[data-sc-spotlight]::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
  inset: 0;
  z-index: 0;
  background: radial-gradient(30rem 30rem at calc(var(--sc-mx, 0.5) * 100%) calc(var(--sc-my, 0.5) * 100%), rgb(47 61 255 / 0.07), transparent 70%);
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}

.services-section > .wrap {
  position: relative;
  z-index: 1;
}

/* Telefono e touch: nessuna luce */
@media (hover: none), (pointer: coarse) {
  .services-section[data-sc-spotlight]::after {
    display: none;
  }
}

.service-icon svg * {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .js-reveal .service .service-icon svg * {
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 900ms var(--ease-in-out) 260ms;
  }

  .js-reveal .service.sc-in .service-icon svg * {
    stroke-dashoffset: 0;
  }
}

/* ---------- Lavori: schermata iniziale ferma ---------- */

.device-screen {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #1a1410;
}

.device-screen img {
  width: 100%;
  height: auto;
}

/* Sfondi fissi per sezione (niente colore di pagina interpolato durante lo scroll) */
.work-section {
  background: #eef0f6;
}

.contact-section {
  background: var(--warm);
}

/* Hero: 2 soli livelli in parallasse, animati dal browser con lo scroll (fuori dal thread principale) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .hs-grid,
    .hs-front {
      animation: plx-back linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }

    .hs-front {
      animation-name: plx-front;
    }

    .hero.in-view :is(.hs-grid, .hs-front) {
      will-change: transform;
    }
  }
}

@keyframes plx-back {
  to {
    transform: translate3d(0, 90px, 0);
  }
}

@keyframes plx-front {
  to {
    transform: translate3d(0, -120px, 0);
  }
}

/* Telefono: il telefono (con "360 px") sale più piano */
@media (max-width: 959.98px) {
  @keyframes plx-front {
    to {
      transform: translate3d(0, -56px, 0);
    }
  }
}

/* ---------- Prezzi: il range si stende, le cifre contano ---------- */

.price-num {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: no-preference) {
  .js-reveal .price-range .ruler-band {
    transform: scaleX(0);
    transition: transform var(--dur-reveal) var(--ease-in-out) 200ms;
  }

  .js-reveal .price-range.sc-in .ruler-band {
    transform: none;
  }
}

/* ---------- Modulo: pulsante con stato di caricamento ---------- */

.btn-submit {
  position: relative;
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / 0.35);
  border-top-color: #fff;
  border-radius: 50%;
}

.btn-submit[aria-busy="true"] .btn-spinner {
  display: inline-block;
  animation: spin 700ms linear infinite;
}

.btn-submit[aria-busy="true"] {
  cursor: progress;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* ---------- Privacy: ritorno al sito ---------- */

.back-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.back-bar--top {
  max-width: 68ch;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.back-bar--bottom {
  max-width: 68ch;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--primary);
  font-family: var(--font-ui);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.3em;
}

.back-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur-ui) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .back-link:hover svg {
    transform: translateX(-3px);
  }
}

/* ---------- Pagina grazie ---------- */

@media (prefers-reduced-motion: no-preference) {
  .done-mark path {
    stroke-dasharray: 1;
    animation: draw 600ms var(--ease-out) 200ms both;
  }
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }

  to {
    stroke-dashoffset: 0;
  }
}

/* ---------- Passaggio tra le pagine ---------- */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: var(--dur-ui);
    animation-timing-function: var(--ease-out);
  }

  .site-header {
    view-transition-name: site-header;
  }
}

/* ---------- Movimento ridotto: tutto subito visibile, stessa composizione ---------- */

@media (prefers-reduced-motion: reduce) {
  [data-sc-in],
  [data-sc-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .site-header,
  .site-header.is-hidden {
    transform: none;
  }
}

/* La barra di lettura vive sul bordo inferiore dell'header: main.js ne scrive solo il transform */
.read-bar {
  position: absolute;
  inset: auto 0 -2px 0;
  height: 3px;
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

/* Tocco: niente ritardo del doppio tap, niente lampo grigio di sistema */
a,
button,
summary,
label,
input,
textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Base che prima arrivava dal motore ---------- */

html {
  scroll-behavior: smooth;
}

/* in fondo alla pagina il rimbalzo dello scroll mostra il colore del footer, non una striscia chiara */
html.at-end {
  background: var(--ink);
}

body {
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  min-height: 100dvh;
}

body > * {
  flex-shrink: 0;
}

.site-footer {
  margin-top: auto;
}

@media (hover: hover) and (pointer: fine) {
  .services-section[data-sc-spotlight]:hover::after {
    opacity: 1;
  }
}

/* Rivelazioni all'entrata: solo con JS attivo e movimento non ridotto (main.js aggiunge .js-reveal) */
.js-reveal [data-sc-in],
.js-reveal [data-sc-stagger] > * {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity var(--dur-enter) var(--ease-out),
    transform var(--dur-enter) var(--ease-out);
}

.js-reveal [data-sc-in].sc-in,
.js-reveal [data-sc-stagger] > .sc-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Consenso statistiche (Google Analytics solo dopo "Accetta") ---------- */
.cookie-banner {
  position: fixed;
  z-index: 60;
  inset: auto 16px 16px;
  display: grid;
  gap: 14px;
  max-width: 560px;
  margin-inline: auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 48px -24px rgb(14 18 32 / 0.45);
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.cookie-banner p {
  margin: 0;
}

.cookie-banner a {
  color: var(--primary);
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.cookie-actions .btn {
  flex: 1 1 8rem;
}

.cookie-banner .cookie-no {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

@media (prefers-reduced-motion: no-preference) {
  .cookie-banner {
    animation: cookie-in 320ms var(--ease-out) both;
  }
}

@keyframes cookie-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
}

.footer-cookie,
.link-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.3em;
  cursor: pointer;
}

.footer-cookie {
  color: #fff;
  text-decoration-color: rgb(255 255 255 / 0.35);
}

.link-button {
  min-height: 0;
  color: var(--primary);
}

/* ---------- Hero: marchio grande sopra il titolo (le parole salgono dalla maschera) ---------- */
.wordmark {
  display: grid;
  margin-bottom: clamp(28px, 4vw, 56px);
  padding-bottom: clamp(24px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 11.2vw, 10.5rem);
  font-weight: 600;
  line-height: 0.82;
  letter-spacing: -0.055em;
  color: var(--ink);
}

.wm-row {
  display: block;
  /* maschera solo in verticale: la "i" finale non viene tagliata */
  overflow-x: visible;
  overflow-y: clip;
  white-space: nowrap;
  padding-block: 0.06em;
  margin-block: -0.06em;
}

.wm-row-1 {
  text-align: right;
}

.wm-in {
  display: block;
}

@media (max-width: 959.98px) {
  .wordmark {
    font-size: 15.5vw;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .wm-in {
    animation: wm-rise 700ms var(--ease-out) both;
  }

  .wm-in-2 {
    animation-delay: 70ms;
  }
}

@keyframes wm-rise {
  from {
    transform: translate3d(0, 55%, 0);
  }
}
