/* =========================================================================
   cilhome — landing con hero scroll-scrubbing
   Palette e tipografia identiche al brand: un accento terracotta per blocco.
   COSE FACILI DA TUNARE:
   - --tour-len: altezza della hero → velocità dello scrub (più alta = più lento)
   - le soglie dei testi sono in script.js (CFG.steps)
   ========================================================================= */

:root {
  --avorio: #F5F0E8;
  --avorio-scuro: #EAE3D6;
  --antracite: #2B3038;
  --terracotta: #C26B43;
  --terracotta-scuro: #A85733;
  --bianco: #FFFFFF;

  --max: 1120px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 14px;
  --header-h: 64px;

  --tour-len: 500vh;   /* ← altezza hero: 5 schermate di scroll */
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  color: var(--antracite);
  background: var(--avorio);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
section { scroll-margin-top: calc(var(--header-h) + 10px); }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

h1, h2, h3 { font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h3 { font-size: 1.15rem; }
p { margin: 0; }

.section { padding-block: clamp(56px, 9vw, 110px); }
.section--alt { background: var(--avorio-scuro); }
.section__intro { max-width: 720px; }
.section__intro p { margin-top: 18px; color: #4a505a; font-size: 1.08rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.72rem; font-weight: 600;
  color: var(--terracotta); margin-bottom: 14px;
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: inherit; font-weight: 600; font-size: 1rem;
  text-decoration: none; padding: 14px 26px; border-radius: 999px;
  border: 1.5px solid transparent; cursor: pointer;
  transition: background .2s ease, transform .12s ease, border-color .2s ease;
}
.btn--primary { background: var(--terracotta); color: var(--bianco); }
.btn--primary:hover { background: var(--terracotta-scuro); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--antracite); border-color: rgba(43,48,56,.25); }
.btn--ghost:hover { border-color: var(--antracite); }
.btn--sm { padding: 10px 20px; font-size: 0.92rem; }
.btn:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex; align-items: center;
  font-weight: 600; font-size: 1.5rem; letter-spacing: -0.02em;
  text-decoration: none; color: var(--antracite); line-height: 1;
}
.logo__diaframma { width: .74em; height: .74em; margin: 0 .02em; position: relative; top: .04em; }

/* =========================================================================
   LOADER — fondo avorio, wordmark, barra terracotta sottile
   ========================================================================= */
#loader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--avorio);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  transition: opacity .45s ease;
}
#loader.is-done { opacity: 0; pointer-events: none; }
.logo--loader { font-size: 2rem; }
.loader__track { width: min(240px, 60vw); height: 3px; background: var(--avorio-scuro); border-radius: 2px; overflow: hidden; }
.loader__bar { height: 100%; width: 0%; background: var(--terracotta); border-radius: 2px; transition: width .2s ease; }

/* =========================================================================
   HEADER
   ========================================================================= */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center;
  background: rgba(245,240,232,.88);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgba(43,48,56,.07);
}
.header__row { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; }
.header__nav { display: flex; gap: 22px; }
.header__nav a {
  text-decoration: none; font-size: .92rem; font-weight: 600;
  border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.header__nav a:hover { color: var(--terracotta); border-color: var(--terracotta); }
@media (max-width: 640px) { .header__nav { display: none; } } /* su mobile: logo + CTA */

/* =========================================================================
   HERO SCROLL-SCRUBBING
   ========================================================================= */
.tour { height: var(--tour-len); position: relative; }
.tour__sticky {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h));
  overflow: hidden;
  /* primo frame come sfondo: mai schermo vuoto, anche senza JS */
  background: var(--antracite) url("frames/desktop/frame_0001.webp") center / cover no-repeat;
}
.tour__canvas { position: absolute; inset: 0; width: 100%; height: 100%; will-change: contents; }
.tour__fallbackimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* IMPORTANTE: la regola globale "img { display:block }" sovrascriverebbe
   l'attributo hidden, facendo comparire il poster SOPRA il canvas.
   Questa riga garantisce che l'immagine di riserva resti nascosta
   finché lo script non la attiva (modalità "Riduci movimento"). */
.tour__fallbackimg[hidden] { display: none; }

/* micro-etichetta trasparenza */
.tour__demo {
  position: absolute; top: 14px; right: 16px; z-index: 6;
  font-size: .7rem; font-weight: 600; letter-spacing: .05em;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(43,48,56,.55); color: rgba(255,255,255,.92);
  backdrop-filter: blur(3px);
}

/* hint di scroll */
.tour__hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 6;
  font-size: .85rem; font-weight: 600; color: #fff;
  text-shadow: 0 1px 8px rgba(43,48,56,.6);
  opacity: 1; transition: opacity .4s ease;
  animation: hint-float 2.2s ease-in-out infinite;
}
.tour__hint.is-off { opacity: 0; }
@keyframes hint-float { 50% { transform: translateX(-50%) translateY(6px); } }

/* ---------- Overlay testi (steps) ----------
   Un solo blocco visibile per volta; fade + leggera salita.
   Scrim in gradiente dietro al testo, mai box pieni. */
/* Niente transition: opacità e deriva sono guidate frame per frame dallo
   scroll (script.js styleStep), così i testi si muovono COL video. */
.step {
  position: absolute; z-index: 5;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* apertura: in basso a sinistra, sopra uno scrim dal bordo inferiore */
.step--intro {
  left: 0; right: 0; bottom: 0;
  padding: 0 var(--gutter) clamp(64px, 12vh, 120px);
}
.step--intro::before {
  content: ""; position: absolute; inset: -40% 0 0 0; z-index: -1;
  background: linear-gradient(to top, rgba(43,48,56,.62), rgba(43,48,56,.25) 45%, transparent 75%);
}
.step--intro h1 { color: #fff; max-width: 13ch; text-shadow: 0 2px 18px rgba(43,48,56,.35); margin-bottom: 20px; }

/* pannelli intermedi: testo grande centrato in basso */
.step--panel {
  left: 0; right: 0; bottom: 0;
  padding: 0 var(--gutter) clamp(72px, 14vh, 140px);
  text-align: center;
}
.step--panel::before {
  content: ""; position: absolute; inset: -30% 0 0 0; z-index: -1;
  background: linear-gradient(to top, rgba(43,48,56,.55), transparent 70%);
}
.step--panel p {
  color: #fff; font-weight: 600;
  font-size: clamp(1.3rem, 3.4vw, 2.1rem); line-height: 1.35;
  text-shadow: 0 2px 16px rgba(43,48,56,.4);
}

/* chiusura sul lago */
.step--outro {
  left: 0; right: 0; bottom: 0;
  padding: 0 var(--gutter) clamp(72px, 14vh, 140px);
  text-align: center;
}
.step--outro::before {
  content: ""; position: absolute; inset: -30% 0 0 0; z-index: -1;
  background: linear-gradient(to top, rgba(43,48,56,.5), transparent 70%);
}
.step__kicker {
  color: #fff; font-weight: 600;
  font-size: clamp(1.4rem, 3.6vw, 2.3rem);
  text-shadow: 0 2px 16px rgba(43,48,56,.45);
  margin-bottom: 22px;
}

/* =========================================================================
   REDUCED MOTION — niente scrubbing: immagine statica + testi normali
   ========================================================================= */
body.reduced .tour { height: auto; }
body.reduced .tour__sticky { position: static; height: min(78vh, 640px); }
body.reduced .tour__canvas, body.reduced .tour__hint { display: none; }
body.reduced .tour__fallbackimg[hidden] { display: block; }
/* resta solo la hero statica: immagine del soggiorno + headline + CTA.
   Le frasi del tour sono legate al video e qui sparirebbero dietro
   l'immagine: i loro concetti sono già nella landing sotto. */
body.reduced .step--intro { opacity: 1; transform: none; }
body.reduced .step--panel, body.reduced .step--outro { display: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tour__hint { animation: none; }
}

/* =========================================================================
   SEZIONI STATICHE
   ========================================================================= */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 44px; }
.card {
  background: var(--avorio);
  border: 1px solid rgba(43,48,56,.10);
  border-radius: var(--radius);
  padding: 30px 26px;
}
.card--featured { border-color: var(--terracotta); box-shadow: 0 8px 28px rgba(194,107,67,.12); }
.card__badge {
  display: inline-block; font-size: .68rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: 12px;
}
.card h3 { margin-bottom: 10px; }
.card p { color: #4a505a; font-size: .98rem; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }

.about__inner { max-width: 660px; margin-inline: auto; text-align: center; }
.about__text { margin-top: 18px; color: #4a505a; font-size: 1.08rem; }
.about__photo { border-radius: var(--radius); margin: 22px auto 0; max-width: 220px; }

/* Variante a due colonne (foto | testo) per il Chi sono.
   Le due colonne si attivano solo se la foto è presente:
   senza foto il testo resta centrato su una colonna. */
.about__grid {
  display: grid; grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 56px); align-items: center;
  max-width: 860px; margin-inline: auto;
}
.about__grid:has(.about__photo) { grid-template-columns: 240px 1fr; text-align: left; }
.about__grid .about__photo { margin: 0; max-width: 100%; width: 100%; box-shadow: 0 10px 30px rgba(43,48,56,.12); }
@media (max-width: 700px) {
  .about__grid:has(.about__photo) { grid-template-columns: 1fr; text-align: center; }
  .about__grid .about__photo { max-width: 220px; margin-inline: auto; }
}

/* =========================================================================
   SLIDER PRIMA / DOPO (sezione "La prova") — puntatore trascinabile
   ========================================================================= */
.ba {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  box-shadow: 0 10px 30px rgba(43,48,56,.10);
  background: var(--avorio-scuro);
  cursor: ew-resize;
}
.ba__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba__img--prima { z-index: 2; clip-path: inset(0 50% 0 0); }

.ba__tag {
  position: absolute; top: 14px; z-index: 3;
  font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(43,48,56,.72); color: #fff; backdrop-filter: blur(2px);
}
.ba__tag--prima { left: 14px; }
.ba__tag--dopo  { right: 14px; }

.ba__demo {
  position: absolute; bottom: 14px; left: 14px; z-index: 3;
  font-size: .7rem; letter-spacing: .04em; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(194,107,67,.92); color: #fff;
}

.ba__handle {
  position: absolute; top: 0; bottom: 0; left: 50%; z-index: 4;
  width: 2px; background: rgba(255,255,255,.9);
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(43,48,56,.12);
}
.ba__grip {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bianco);
  box-shadow: 0 4px 14px rgba(43,48,56,.28);
  display: grid; place-items: center;
  cursor: ew-resize;
}
.ba__grip svg { width: 22px; height: 22px; color: var(--terracotta); }
.ba__handle:focus-visible .ba__grip { outline: 3px solid var(--terracotta); outline-offset: 3px; }

.ba__caption { margin-top: 16px; color: #4a505a; font-size: .98rem; }

.ba-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.ba-thumb {
  border: 2px solid transparent; border-radius: 10px; padding: 0; overflow: hidden;
  width: 92px; aspect-ratio: 4 / 3; cursor: pointer; background: none;
  transition: border-color .2s ease, transform .12s ease;
}
.ba-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ba-thumb:hover { transform: translateY(-2px); }
.ba-thumb[aria-pressed="true"] { border-color: var(--terracotta); }
.ba-thumb:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 2px; }

/* =========================================================================
   COME FUNZIONA — 3 step numerati
   ========================================================================= */
.steps {
  list-style: none; padding: 0; margin: 44px 0 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 4vw, 44px);
}
.stepcard__num {
  display: block; font-size: 2rem; font-weight: 600;
  color: var(--terracotta); line-height: 1; margin-bottom: 14px;
}
.stepcard h3 { margin-bottom: 8px; font-size: 1.05rem; }
.stepcard p { color: #4a505a; font-size: .98rem; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 30px; } }

/* =========================================================================
   PERCHÉ CILHOME — 4 motivi
   ========================================================================= */
.reasons {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(26px, 4vw, 44px); margin-top: 44px;
}
.reason { display: flex; gap: 16px; align-items: flex-start; }
.reason__dot {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 3px;
  border: 2px solid var(--terracotta); border-radius: 50%;
}
.reason h3 { margin-bottom: 6px; font-size: 1.05rem; }
.reason p { color: #4a505a; font-size: .98rem; }
@media (max-width: 760px) { .reasons { grid-template-columns: 1fr; } }

/* =========================================================================
   FAQ — accordion nativo <details>, funziona anche senza JS
   ========================================================================= */
.faq { margin-top: 36px; display: grid; gap: 10px; }
.faq__item {
  border: 1px solid rgba(43,48,56,.12);
  border-radius: var(--radius);
  background: var(--avorio);
  overflow: hidden;
}
.faq__item[open] { border-color: var(--terracotta); }
.faq__item summary {
  list-style: none; cursor: pointer;
  padding: 18px 52px 18px 22px; position: relative;
  font-weight: 600; font-size: 1rem;
}
.faq__item summary::-webkit-details-marker { display: none; }
/* segno + / × a destra */
.faq__item summary::after {
  content: "+"; position: absolute; right: 22px; top: 50%;
  transform: translateY(-50%);
  color: var(--terracotta); font-size: 1.3rem; font-weight: 400; line-height: 1;
}
.faq__item[open] summary::after { content: "×"; }
.faq__item summary:focus-visible { outline: 3px solid var(--terracotta); outline-offset: -3px; }
.faq__body { padding: 0 22px 20px; }
.faq__body p { color: #4a505a; font-size: .98rem; }

/* =========================================================================
   CTA FINALE + FORM
   ========================================================================= */
.final { background: var(--antracite); color: var(--avorio); }
.final h2 { color: var(--avorio); }
.final__grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 64px); align-items: start;
}
.final__text p { margin-top: 18px; color: rgba(245,240,232,.82); font-size: 1.08rem; }
.ticks { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 26px; color: rgba(245,240,232,.9); }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--terracotta); font-weight: 600; }
.final__alt { font-size: .95rem; }
.final__alt a { color: var(--avorio); text-decoration: underline; text-underline-offset: 3px; }
.final__alt a:hover { color: var(--terracotta); }
@media (max-width: 860px) { .final__grid { grid-template-columns: 1fr; } }

/* --- Card del form --- */
.formcard {
  background: var(--bianco);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 30px);
  box-shadow: 0 14px 40px rgba(0,0,0,.18);
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .9rem; font-weight: 600; color: var(--antracite); margin-bottom: 6px; }
.field .opt { font-weight: 400; color: #8a8f98; }
.field input, .field textarea {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--antracite);
  background: var(--bianco);
  border: 1.5px solid rgba(43,48,56,.18); border-radius: 10px;
  padding: 12px 14px; transition: border-color .2s ease;
}
.field input::placeholder, .field textarea::placeholder { color: #a8adb5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--terracotta); }
.field textarea { resize: vertical; min-height: 84px; }
.field--check { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; }
.field--check input { width: auto; margin-top: 3px; accent-color: var(--terracotta); }
.field--check label { font-weight: 400; font-size: .92rem; color: #4a505a; margin: 0; }
.field--check a { color: var(--terracotta); }
.btn--block { width: 100%; justify-content: center; margin-top: 20px; }
.btn[disabled] { opacity: .6; cursor: default; }
.hp { position: absolute; left: -9999px; }  /* honeypot antispam */
.form__error { margin-top: 12px; font-size: .9rem; color: #b3261e; }
.form__error a { color: #b3261e; }

/* Messaggio di successo */
.form__ok { text-align: center; padding: 24px 6px; }
.form__okmark {
  display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--terracotta); color: #fff; font-size: 1.5rem;
}
.form__ok h3 { margin-bottom: 8px; }
.form__ok p { color: #4a505a; font-size: .98rem; }
.form__ok a { color: var(--terracotta); }

/* =========================================================================
   FREEBIE — rete di sicurezza, visivamente più leggera del form principale
   ========================================================================= */
/* Fondo alternato: sta fra due sezioni avorio, così si stacca da solo
   senza dover alzare la voce con colori forti. */
.freebie { background: var(--avorio-scuro); padding-block: clamp(44px, 7vw, 80px); }
.freebie__grid {
  display: grid; grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 5vw, 56px); align-items: center;
}
.eyebrow--muted { color: #8a8f98; }
.freebie h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.freebie__text { margin-top: 14px; color: #4a505a; max-width: 52ch; }
.freebie__form { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.freebie__form input[type="email"] {
  flex: 1 1 240px; font-family: inherit; font-size: 1rem;
  border: 1.5px solid rgba(43,48,56,.18); border-radius: 999px;
  padding: 12px 20px; background: var(--bianco); color: var(--antracite);
}
.freebie__form input[type="email"]:focus { outline: none; border-color: var(--terracotta); }
.freebie__micro { margin-top: 10px; font-size: .82rem; color: #8a8f98; }

/* Anteprima checklist */
.checklist {
  background: var(--bianco); border-radius: var(--radius);
  padding: 24px 26px; box-shadow: 0 8px 26px rgba(43,48,56,.08);
}
.checklist__title {
  display: flex; align-items: center; gap: 8px;
  font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: #8a8f98; margin-bottom: 14px;
}
.checklist__mark { width: 16px; height: 16px; }
.checklist__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.checklist__list li { font-size: .95rem; color: var(--antracite); }
.checklist__list span { color: var(--terracotta); font-weight: 600; margin-right: 8px; }
@media (max-width: 760px) { .freebie__grid { grid-template-columns: 1fr; } }

/* Utility */
.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;
}

/* Footer */
.footer { padding-block: 48px; font-size: .92rem; color: #4a505a; background: var(--avorio-scuro); }
.footer .logo { font-size: 1.25rem; }
.footer__line { margin-top: 14px; }
.footer__row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 10px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--terracotta); }
.footer__legal { margin-top: 18px; font-size: .82rem; color: #8a8f98; }

/* Pagina legale (privacy) */
.legal { max-width: 760px; }
.legal h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 8px; }
.legal__date { color: #8a8f98; font-size: .9rem; margin-bottom: 32px; }
.legal h2 { font-size: 1.2rem; margin-top: 34px; margin-bottom: 10px; }
.legal p, .legal li { color: #4a505a; font-size: 1rem; }
.legal ul { padding-left: 1.2em; margin: 8px 0; }
.legal a { color: var(--terracotta); }
