/* =====================================================================
   Primo Sito · Foglio di stile
   ---------------------------------------------------------------------
   Stile: scuro ed elegante, accento ambra-champagne, titoli in serif.
   1. Variabili (colori, font, spaziature, raggi): MODIFICA QUI
   2. Base e reset
   3. Componenti comuni (pulsanti, browser, card, effetti)
   4. Header e menu
   5. Sezioni della Home
   6. Pagina Progetti
   7. Pagina Preventivo (form)
   8. Footer
   9. Animazioni e preferenze di movimento
   Approccio mobile first: gli stili base sono per il telefono,
   le @media (min-width) aggiungono le varianti per schermi più grandi.
   ===================================================================== */


/* =====================================================================
   1. VARIABILI
   ===================================================================== */
:root {
  /* --- Colori: parte scura (sfondo principale) --- */
  --color-bg:         #0B0C0A;  /* nero caldo */
  --color-surface:    #141612;  /* card su fondo scuro */
  --color-surface-2:  #1C1F1A;  /* barre del browser, campi */
  --color-text:       #F2EDE4;  /* testo chiaro */
  --color-text-soft:  #A8A59C;  /* testo secondario */
  --color-line:       rgba(242, 237, 228, .12);

  /* --- Colori: sezioni chiare --- */
  --color-light:      #F4EFE6;  /* sfondo crema */
  --color-light-card: #FBF8F2;
  --color-ink:        #14150F;  /* testo scuro */
  --color-ink-soft:   #55544C;
  --color-line-light: #E2DACB;

  /* --- COLORE D'ACCENTO (ambra-champagne) --- */
  --color-accent:       #E9B872;  /* pulsanti e dettagli su fondo scuro */
  --color-accent-hover: #F3CC93;
  --color-on-accent:    #14150F;  /* testo sopra l'accento */
  --color-accent-ink:   #8A5A12;  /* accento leggibile su fondo chiaro */
  --color-glow-1:       rgba(233, 184, 114, .30);  /* luce ambra */
  --color-glow-2:       rgba(46, 125, 102, .32);   /* luce verde petrolio */

  --color-error:      #FF8A7A;  /* errori su fondo scuro */
  --color-error-ink:  #B42318;  /* errori su fondo chiaro */
  --color-error-soft: #FDECEA;

  /* --- Font --- */
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body:    "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* --- Scala tipografica (fissa, si adatta allo schermo) --- */
  --text-xs:   0.8125rem;                                   /* 13px */
  --text-sm:   0.9375rem;                                   /* 15px */
  --text-base: 1.0625rem;                                   /* 17px */
  --text-lg:   clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);  /* 18 → 20 */
  --text-xl:   clamp(1.5rem, 1.3rem + 0.8vw, 2rem);         /* 24 → 32 */
  --text-2xl:  clamp(2.25rem, 1.7rem + 2.4vw, 3.75rem);     /* 36 → 60 */
  --text-3xl:  clamp(3rem, 1.9rem + 5vw, 6.25rem);          /* 48 → 100 */

  /* --- Scala delle spaziature --- */
  --space-1: 0.25rem;  /*  4px */
  --space-2: 0.5rem;   /*  8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 3rem;     /* 48px */
  --space-8: 4rem;     /* 64px */
  --space-9: 6rem;     /* 96px */
  --section-y: clamp(5rem, 3rem + 7vw, 9rem);

  /* --- Raggi degli angoli --- */
  --radius-sm:   10px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-pill: 999px;

  /* --- Varie --- */
  --container: 1240px;
  --gutter: clamp(1rem, 0.5rem + 2.4vw, 2.5rem);
  --header-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}


/* =====================================================================
   2. BASE E RESET
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Grana leggerissima su tutta la pagina: dà un tocco "di carta" */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
/* Parola chiave in corsivo e colore d'accento */
h1 em, h2 em { font-style: italic; color: var(--color-accent); }
.section--light h2 em { color: var(--color-accent-ink); }

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

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 6px;
}
.section--light :focus-visible,
.form-card :focus-visible { outline-color: var(--color-accent-ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 400;
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--space-4); }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}


/* =====================================================================
   3. COMPONENTI COMUNI
   ===================================================================== */

/* --- Etichetta sopra i titoli --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}
.section--light .eyebrow { color: var(--color-accent-ink); }

/* --- Pulsanti --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease),
              transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn span { transition: transform .25s var(--ease); }
.btn:hover span { transform: translateX(3px); }

.btn--accent {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: 0 0 0 0 var(--color-glow-1);
}
.btn--accent:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 34px -8px var(--color-glow-1);
}

.btn--ghost {
  background: rgba(242, 237, 228, .04);
  border-color: var(--color-line);
  color: var(--color-text);
}
.btn--ghost:hover { border-color: rgba(242, 237, 228, .4); background: rgba(242, 237, 228, .08); }

.btn--lg {
  min-height: 56px;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}
.btn--block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; transform: none; }

/* --- Link con freccia --- */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-line);
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.link-arrow:hover { color: var(--color-accent); border-color: currentColor; }
.link-arrow span { transition: transform .25s var(--ease); }
.link-arrow:hover span { transform: translateX(4px); }

/* --- Etichetta del settore --- */
.tag {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 3px 10px;
  border: 1px solid rgba(233, 184, 114, .35);
  border-radius: var(--radius-pill);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.5;
}

/* --- Lista con spunte --- */
.checklist { display: grid; gap: var(--space-3); color: var(--color-text-soft); }
.checklist li { display: flex; gap: var(--space-3); align-items: flex-start; }
.checklist li::before {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 3px;
  border-radius: 50%;
  background: rgba(233, 184, 114, .14) no-repeat center / 12px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23E9B872' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* --- Cornice "finestra del browser" --- */
.browser {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
}
.browser__bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-3);
  height: 32px;
  padding-inline: var(--space-3);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-line);
}
.browser__dots { display: flex; gap: 6px; }
.browser__dots i { width: 9px; height: 9px; border-radius: 50%; background: #E5786D; }
.browser__dots i:nth-child(2) { background: #E8B84E; }
.browser__dots i:nth-child(3) { background: #6CBF7E; }
.browser__url {
  flex: 1;
  max-width: 60%;
  margin-inline: auto;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  background: rgba(242, 237, 228, .06);
  color: var(--color-text-soft);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-20px);
}
.browser__viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--color-surface);
}
/* L'immagine è appoggiata in alto: l'altezza la decide la cornice */
.browser__viewport img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 1.8s var(--ease);
}

/* --- Effetto "riflettore": una luce segue il mouse sulle card --- */
.spotlight { position: relative; isolation: isolate; }
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -20%), var(--spot, rgba(233, 184, 114, .12)), transparent 60%);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.spotlight:hover::before { opacity: 1; }

/* --- Luci morbide animate ("aurora") dietro hero e invito finale --- */
.aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora span {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-glow-1), transparent 62%);
  top: -35vmax;
  right: -20vmax;
  animation: drift 18s ease-in-out infinite alternate;
}
.aurora span:nth-child(2) {
  background: radial-gradient(circle, var(--color-glow-2), transparent 62%);
  top: auto;
  right: auto;
  bottom: -40vmax;
  left: -25vmax;
  animation-duration: 22s;
  animation-direction: alternate-reverse;
}
.aurora--soft { opacity: .7; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-8vmax, 6vmax, 0) scale(1.15); }
}

/* --- Sezioni --- */
.section { position: relative; padding-block: var(--section-y); }
.section--tight { padding-block: clamp(3rem, 2rem + 4vw, 5rem); }
.section--light { background: var(--color-light); color: var(--color-ink); }
.section__head { max-width: 720px; margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem); }
.section__head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  max-width: none;
}
.section__title { font-size: var(--text-2xl); }
.section__lead { margin-top: var(--space-5); font-size: var(--text-lg); color: var(--color-text-soft); max-width: 52ch; }
.section--light .section__lead { color: var(--color-ink-soft); }


/* =====================================================================
   4. HEADER E MENU
   ===================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
/* Sfondo sfocato su uno strato a parte (così il menu mobile può
   occupare tutto lo schermo) */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(11, 12, 10, .9);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.site-header.is-scrolled { border-color: var(--color-line); }
.site-header.is-scrolled::before { opacity: 1; }

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--header-h);
  transition: height .3s var(--ease);
}
.site-header.is-scrolled .header__inner { height: 62px; }

.logo {
  position: relative;
  z-index: 102;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-right: auto;
  font-family: var(--font-display);
  font-size: 1.375rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
/* "Sito" in corsivo dorato */
.logo em { font-style: italic; color: var(--color-accent); }
/* Simbolo del logo: un "1" (il primo sito) dentro un cerchio con riflesso ambra */
.logo__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding-top: 1px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: normal;
  line-height: 1;
  color: var(--color-on-accent);
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--color-accent), #6FB59D, var(--color-accent));
  box-shadow: 0 0 18px -2px var(--color-glow-1);
}

.header__cta { display: none; min-height: 42px; }

.nav-toggle {
  position: relative;
  z-index: 102;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-right: -10px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(242, 237, 228, .08); }
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 22px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--color-text);
  transition: transform .35s var(--ease), background-color .2s;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { transform: translateY(-6px); }
.nav-toggle__bars::after  { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after  { transform: rotate(-45deg); }

/* Menu mobile a schermo intero, con voci numerate */
.nav {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-7);
  padding: calc(var(--header-h) + var(--space-5)) var(--gutter) var(--space-7);
  background: var(--color-bg);
  visibility: hidden;
  opacity: 0;
  transition: opacity .35s var(--ease), visibility 0s linear .35s;
}
.nav.is-open { visibility: visible; opacity: 1; transition: opacity .35s var(--ease); }
.nav__list { display: grid; gap: var(--space-1); counter-reset: voce; }
.nav__link {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding-block: var(--space-2);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 3vw, 3.5rem);
  line-height: 1.1;
  text-decoration: none;
  transition: color .25s var(--ease);
}
.nav__link::before {
  counter-increment: voce;
  content: "0" counter(voce);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}
.nav__link:hover, .nav__link[aria-current="page"] { color: var(--color-accent); }
body.menu-open { overflow: hidden; }

@media (min-width: 560px) {
  .header__cta { display: inline-flex; }
}

@media (min-width: 960px) {
  .nav-toggle, .nav__cta { display: none; }
  .nav {
    position: static;
    z-index: auto;
    flex-direction: row;
    padding: 0;
    background: none;
    visibility: visible;
    opacity: 1;
    transition: none;
    margin-left: auto;
    margin-right: var(--space-4);
  }
  .nav__list { display: flex; gap: var(--space-2); }
  .nav__link {
    position: relative;
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-soft);
  }
  .nav__link::before { content: none; }
  /* Sottolineatura che si allarga all'hover */
  .nav__link::after {
    content: "";
    position: absolute;
    left: var(--space-3);
    right: var(--space-3);
    bottom: 2px;
    height: 1px;
    background: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s var(--ease);
  }
  .nav__link:hover, .nav__link[aria-current="page"] { color: var(--color-text); }
  .nav__link:hover::after, .nav__link[aria-current="page"]::after { transform: scaleX(1); }
  .logo { margin-right: 0; }
}


/* =====================================================================
   5. HOME
   ===================================================================== */

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--header-h) + clamp(2.5rem, 1rem + 6vw, 6rem));
  padding-bottom: clamp(3rem, 2rem + 5vw, 6rem);
}
.hero__inner {
  position: relative;
  display: grid;
  gap: clamp(3rem, 2rem + 4vw, 4rem);
  align-items: center;
}
.hero__title {
  font-size: var(--text-3xl);
  line-height: .95;
  letter-spacing: -0.03em;
  max-width: 11ch;
}
.hero__lead {
  max-width: 44ch;
  margin-top: var(--space-6);
  font-size: var(--text-lg);
  color: var(--color-text-soft);
}
.hero__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-7);
}
@media (min-width: 560px) {
  .hero__actions { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Pila di finestre in 3D ---------- */
.stack {
  position: relative;
  aspect-ratio: 1 / 0.92;
  perspective: 1800px;
}
.stack__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  /* --rx e --ry sono aggiornate da main.js quando muovi il mouse */
  transform: rotateX(calc(12deg + var(--rx, 0deg))) rotateY(calc(-16deg + var(--ry, 0deg))) rotateZ(2deg);
  transition: transform .8s var(--ease);
}
.stack__win {
  position: absolute;
  width: 74%;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(242, 237, 228, .04);
}
.stack__win--back  { top: 0;   left: 0;   transform: translateZ(-120px); opacity: .55; }
.stack__win--mid   { top: 14%; right: 0;  transform: translateZ(-40px);  opacity: .8; }
.stack__win--front { bottom: 4%; left: 10%; transform: translateZ(60px); }
.stack__win--front .browser__viewport { aspect-ratio: 16 / 11; }
.stack:hover .stack__win--front img { transform: translateY(-18%); }

/* Etichette "di vetro" che galleggiano sopra le finestre */
.chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border: 1px solid rgba(242, 237, 228, .16);
  border-radius: var(--radius-pill);
  background: rgba(20, 22, 18, .6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
}
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 10px var(--color-accent); }
.chip--a { top: 8%;  right: 4%;  transform: translateZ(140px); }
.chip--b { bottom: 0; left: 10%; transform: translateZ(160px); }
.chip--b .chip__dot { background: #6FB59D; box-shadow: 0 0 10px #6FB59D; }
/* Su schermi stretti la pila è più piccola e le etichette restano dentro lo schermo */
@media (max-width: 1023.98px) {
  .stack { width: 88%; margin-inline: auto; }
  .chip--b { left: 14%; }
}

@media (min-width: 1024px) {
  .hero { min-height: min(100svh, 920px); display: flex; align-items: center; }
  .hero > .container { width: 100%; }
  .hero__inner { grid-template-columns: 1.05fr 1fr; }
}

/* ---------- Nastro scorrevole dei settori ---------- */
.marquee {
  overflow: hidden;
  padding-block: var(--space-5);
  border-block: 1px solid var(--color-line);
  background: var(--color-bg);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: scorri 40s linear infinite;
}
.marquee__track span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  padding-right: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-style: italic;
  color: var(--color-text-soft);
  white-space: nowrap;
}
.marquee__track span::after { content: "✦"; font-style: normal; font-size: .6em; color: var(--color-accent); }
@keyframes scorri { to { transform: translateX(-50%); } }

/* ---------- Cosa facciamo ---------- */
.services {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--color-line-light);
}
.service {
  --spot: rgba(138, 90, 18, .08);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-2);
  border-bottom: 1px solid var(--color-line-light);
}
.service__num { font-size: var(--text-xs); font-weight: 600; letter-spacing: .1em; color: var(--color-accent-ink); }
.service__title { font-size: var(--text-xl); }
.service__text { color: var(--color-ink-soft); max-width: 36ch; }

@media (min-width: 640px) {
  .services { grid-template-columns: repeat(2, 1fr); }
  .service { padding: var(--space-7) var(--space-6) var(--space-7) 0; }
  .service:nth-child(even) { padding-left: var(--space-6); border-left: 1px solid var(--color-line-light); }
}
@media (min-width: 1024px) {
  .services { grid-template-columns: repeat(4, 1fr); }
  .service, .service:nth-child(even) {
    padding: var(--space-7) var(--space-5);
    border-left: 1px solid var(--color-line-light);
    min-height: 300px;
    align-content: start;
  }
  .service:first-child { border-left: 0; padding-left: 0; }
  .service__num { margin-bottom: var(--space-8); }
}

/* ---------- Card progetto ---------- */
.projects {
  display: grid;
  grid-template-columns: 1fr;                    /* telefono: 1 colonna */
  gap: var(--space-5);
}
@media (min-width: 640px)  { .projects { grid-template-columns: repeat(2, 1fr); } }  /* tablet */
@media (min-width: 1024px) { .projects { grid-template-columns: repeat(3, 1fr); gap: var(--space-6); } } /* desktop */

.project-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  transition: transform .45s var(--ease), border-color .45s var(--ease), box-shadow .45s var(--ease);
}
.project-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-3) var(--space-3);
}
.project-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.project-card__title { font-size: var(--text-xl); }
.project-card__desc { color: var(--color-text-soft); font-size: var(--text-sm); }
.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  align-self: flex-start;
  min-height: 44px;
  margin-top: auto;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.project-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* tutta la card è cliccabile */
.project-card__link span { transition: transform .25s var(--ease); }
.project-card:hover .project-card__link span { transform: translateX(4px); }

.project-card:hover,
.project-card:focus-within {
  transform: translateY(-6px);
  border-color: rgba(233, 184, 114, .35);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), 0 0 40px -20px var(--color-glow-1);
}
.project-card:hover .browser__viewport img,
.project-card:focus-within .browser__viewport img { transform: translateY(-22%); }

/* Frase + pulsante dopo i progetti */
.after-projects {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
  margin-top: clamp(3rem, 2rem + 3vw, 5rem);
  padding-top: var(--space-7);
  border-top: 1px solid var(--color-line);
}
.after-projects p { font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.15; }
.after-projects em { color: var(--color-accent); }
@media (min-width: 768px) {
  .after-projects { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- Come lavoriamo ---------- */
.steps {
  display: grid;
  gap: var(--space-7);
  counter-reset: passo;
}
.step { position: relative; padding-top: var(--space-6); border-top: 1px solid var(--color-line-light); }
.step__num {
  display: block;
  margin-bottom: var(--space-5);
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 3rem + 6vw, 8rem);
  font-style: italic;
  line-height: .8;
  color: transparent;
  -webkit-text-stroke: 1px var(--color-accent-ink);
}
.step__title { font-size: var(--text-xl); margin-bottom: var(--space-3); }
.step__text { color: var(--color-ink-soft); max-width: 34ch; }
/* Linea che si "riempie" quando il passaggio compare */
.step::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-accent-ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease) .2s;
}
.step.is-visible::before, html:not(.js) .step::before { transform: scaleX(1); }
@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
}

/* ---------- Invito finale ---------- */
.final-cta {
  position: relative;
  overflow: hidden;
  padding-block: clamp(6rem, 4rem + 8vw, 11rem);
  text-align: center;
}
.final-cta__inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.final-cta__title {
  max-width: 14ch;
  margin-bottom: var(--space-7);
  font-size: var(--text-3xl);
  line-height: .98;
  letter-spacing: -0.03em;
}
.final-cta__note { margin-top: var(--space-5); font-size: var(--text-sm); color: var(--color-text-soft); }


/* =====================================================================
   6. PAGINA PROGETTI
   ===================================================================== */
.page-hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--header-h) + clamp(3rem, 2rem + 5vw, 6rem));
  padding-bottom: clamp(3rem, 2rem + 4vw, 5rem);
}
.page-hero > .container { position: relative; }
.page-hero__title {
  font-size: var(--text-3xl);
  line-height: .95;
  letter-spacing: -0.03em;
  max-width: 14ch;
}
.page-hero__lead { max-width: 52ch; margin-top: var(--space-6); font-size: var(--text-lg); color: var(--color-text-soft); }

/* Filtri per settore */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-7);
}
.filter {
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-soft);
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.filter:hover { color: var(--color-text); border-color: rgba(242, 237, 228, .4); }
.filter[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.projects__empty { color: var(--color-text-soft); }


/* =====================================================================
   7. PAGINA PREVENTIVO
   ===================================================================== */
.page-hero--form { padding-bottom: var(--section-y); }
.page-hero--form .page-hero__title { font-size: var(--text-2xl); line-height: 1.02; max-width: 16ch; }
.contact { display: grid; gap: var(--space-7); align-items: start; }
.contact__intro .checklist { margin-top: var(--space-6); }
@media (min-width: 1024px) {
  .contact { grid-template-columns: 1fr 1.1fr; gap: var(--space-9); }
  .contact__intro { position: sticky; top: calc(var(--header-h) + var(--space-6)); }
}

/* Riquadro email */
.mail-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--space-4);
  margin-top: var(--space-7);
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: rgba(242, 237, 228, .03);
  text-decoration: none;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.mail-card:hover { border-color: rgba(233, 184, 114, .45); background: rgba(233, 184, 114, .06); }
.mail-card__label { font-size: var(--text-sm); color: var(--color-text-soft); }
.mail-card__addr { grid-column: 1; font-family: var(--font-display); font-size: clamp(1.05rem, 5.2vw, var(--text-xl)); overflow-wrap: anywhere; }
.mail-card__arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
  transition: transform .25s var(--ease);
}
.mail-card:hover .mail-card__arrow { transform: translateX(4px); }

/* Riquadro del form: chiaro, per staccare dal fondo scuro */
.form-card {
  padding: clamp(1.5rem, 1rem + 2.5vw, 3rem);
  background: var(--color-light-card);
  color: var(--color-ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .9), 0 0 80px -40px var(--color-glow-1);
}
.form { display: grid; gap: var(--space-5); }
.form__row { display: grid; gap: var(--space-5); }
@media (min-width: 640px) { .form__row { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: var(--space-2); }
.field__label { font-size: var(--text-sm); font-weight: 600; }
.field__req { color: var(--color-error-ink); }
.field__input {
  width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  background: #FFFFFF;
  border: 1px solid var(--color-line-light);
  border-radius: var(--radius-sm);
  font-size: 1rem; /* 16px: evita lo zoom automatico su iPhone */
  color: var(--color-ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field__input--area { min-height: 140px; resize: vertical; line-height: 1.5; }
.field__input::placeholder { color: #6B6A62; }
.field__input:hover { border-color: #C9BFAD; }
.field__input:focus {
  outline: none;
  border-color: var(--color-accent-ink);
  box-shadow: 0 0 0 4px rgba(138, 90, 18, .14);
}
.field__input[aria-invalid="true"] { border-color: var(--color-error-ink); background: var(--color-error-soft); }
.field__error { font-size: var(--text-xs); font-weight: 500; color: var(--color-error-ink); }
.field__error:empty { display: none; }
.form__note { font-size: var(--text-xs); color: var(--color-ink-soft); margin-top: calc(-1 * var(--space-2)); }

/* Sul fondo chiaro del form il pulsante diventa scuro, per un contrasto netto */
.form-card .btn--accent { background: var(--color-ink); color: var(--color-light); }
.form-card .btn--accent:hover { background: #2A2B24; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); }

.form__alert {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-error-soft);
  color: var(--color-error-ink);
  font-size: var(--text-sm);
}
.form__alert strong { display: block; }
.form__alert a { color: inherit; font-weight: 600; }

.form-success { text-align: center; padding-block: var(--space-7); outline: none; }
.form-success__icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-5);
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-accent);
}
.form-success__title { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
.form-success p { color: var(--color-ink-soft); max-width: 40ch; margin-inline: auto; }
.form-success a { color: var(--color-accent-ink); font-weight: 600; }


/* =====================================================================
   8. FOOTER
   ===================================================================== */
.site-footer {
  padding-top: clamp(3rem, 2rem + 4vw, 5rem);
  padding-bottom: var(--space-6);
  border-top: 1px solid var(--color-line);
  font-size: var(--text-sm);
  color: var(--color-text-soft);
}
.footer__grid { display: grid; gap: var(--space-7); }
.footer__tagline { margin-top: var(--space-3); max-width: 30ch; }
.footer__label { margin-bottom: var(--space-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text); }
.footer__links { display: grid; gap: var(--space-1); }
.footer__links a, .footer__email {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  text-decoration: none;
  transition: color .2s var(--ease);
}
.footer__links a:hover, .footer__email:hover { color: var(--color-accent); }
.footer__email { font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-text); }
.footer__copy { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--color-line); font-size: var(--text-xs); }
@media (min-width: 768px) {
  .footer__grid { grid-template-columns: 2fr 1fr 1.4fr; }
}

/* Pulsante fisso in basso (solo telefono) */
.mobile-cta { display: none; }
@media (max-width: 559.98px) {
  .js .mobile-cta {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 90;
    display: block;
    padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom));
    background: rgba(11, 12, 10, .8);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--color-line);
    transform: translateY(110%);
    transition: transform .35s var(--ease);
  }
  .js .mobile-cta.is-visible { transform: none; }
  .site-footer { padding-bottom: 96px; }
}


/* =====================================================================
   9. ANIMAZIONI
   ===================================================================== */
/* Entrata degli elementi dell'hero al caricamento (--d = ordine) */
.js .intro {
  animation: sali 1s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 110ms + 80ms);
}
@keyframes sali {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
/* La pila 3D entra con una leggera rotazione */
.js .stack.intro { animation-name: sali-3d; animation-duration: 1.4s; }
@keyframes sali-3d {
  from { opacity: 0; transform: translateY(40px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* Comparsa allo scroll */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
/* Le card si alzano comunque all'hover dopo essere comparse */
.js .project-card.reveal.is-visible:hover,
.js .project-card.reveal.is-visible:focus-within {
  transform: translateY(-6px);
  transition: transform .45s var(--ease), border-color .45s var(--ease), box-shadow .45s var(--ease);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Chi preferisce meno movimento: niente animazioni */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
  .js .reveal, .js .intro { opacity: 1; transform: none; }
  .js .project-card.reveal.is-visible:hover,
  .js .project-card.reveal.is-visible:focus-within,
  .project-card:hover { transform: none; }
  .project-card:hover .browser__viewport img,
  .project-card:focus-within .browser__viewport img,
  .stack:hover .stack__win--front img { transform: none; }
  .step::before { transform: scaleX(1); }
}
