/* =========================================================
   Green Service — foglio di stile
   Palette: 85% chiaro, il verde su barre e pulsanti,
   l'ambra solo sugli accenti.
   ========================================================= */

/* Palette "notte, sole e acqua".
   I nomi delle variabili restano quelli originali per non toccare
   tutto il foglio: cambiano solo i valori.
   --green      base autorevole (blu notte)
   --green-mid  accento tecnico (teal), usato per i link
   --amber      energia e azione (sole) */
:root {
  --green:      #0B1B2B;
  --green-mid:  #0E8577;
  --green-soft: #E4F1EF;
  --amber:      #FFB020;
  --amber-ink:  #7A4E00;

  --ink:        #101820;
  --ink-soft:   #55616E;
  --line:       #E3E8ED;
  --bg:         #F8FAFB;
  --bg-alt:     #EDF2F6;
  --sage:       #E8EDF1;
  --white:      #FFFFFF;

  --radius:     12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 2px rgba(11,27,43,.05), 0 6px 16px rgba(11,27,43,.05);
  --shadow-md:  0 14px 34px rgba(11,27,43,.12);

  --wrap:       1140px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 82px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); }
h2 { font-size: clamp(1.55rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }
a  { color: var(--green-mid); }

img { max-width: 100%; height: auto; display: block; }

.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: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--green); color: #fff; padding: .7rem 1.1rem;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2.5rem, 780px); }
.center { text-align: center; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .97rem; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-green  { background: var(--green); color: #fff; }
.btn-green:hover { background: #06111C; }
.btn-amber  { background: var(--amber); color: #3A2600; }
.btn-amber:hover { background: #F0A011; }
.btn-outline { border-color: #CBD5DE; color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--sage); }
.btn-wa { background: #1F8F4E; color: #fff; }
.btn-wa:hover { background: #19783f; }
.btn-sm { padding: .55rem 1.1rem; font-size: .88rem; }
.btn-block { width: 100%; }

.link-more {
  display: inline-block; margin-top: .6rem; font-size: .9rem; font-weight: 600;
  text-decoration: none;
}
.link-more::after { content: " →"; }
.link-more:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--green); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 70px; }

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .95rem; letter-spacing: .06em; color: #fff; font-weight: 600; }
.brand-text em { font-style: normal; font-size: .68rem; color: #9DB3C7; letter-spacing: .04em; }

.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav a { color: #D3DFEA; text-decoration: none; font-size: .93rem; }
.nav a:hover { color: #fff; }
.nav a.btn-amber { color: #3A2600; }

.nav-toggle {
  display: none; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; background: transparent; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block; width: 19px; height: 2px; background: #fff; border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero a tutta larghezza ----------
   La foto sta sotto, il testo sopra. Il velo scuro non è un vezzo:
   senza, il testo bianco sul cielo chiaro diventa illeggibile. */
.hero {
  position: relative;
  display: flex; align-items: flex-end;
  min-height: clamp(470px, 72vh, 700px);
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2.5rem, 5vw, 3.5rem);
  isolation: isolate;
}

.hero-sfondo { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-sfondo img {
  width: 100%; height: 100%; object-fit: cover; object-position: 60% 55%;
  transform: scale(1.04);
  animation: respiro 26s ease-in-out infinite alternate;
}
@keyframes respiro { to { transform: scale(1.12) translate3d(-1%, -1%, 0); } }

/* due strati: uno da sinistra per il testo, uno dal basso per il raccordo */
.hero-velo {
  position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(6,14,23,.94) 0%, rgba(6,14,23,.82) 34%, rgba(6,14,23,.42) 62%, rgba(6,14,23,.18) 100%),
    linear-gradient(to top, var(--bg) 0%, rgba(11,27,43,0) 22%);
}
/* trama finissima: toglie l'effetto "foto compressa" sulle zone piatte */
.hero-grana {
  position: absolute; inset: 0; opacity: .35; mix-blend-mode: overlay;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.045) 0 1px, transparent 1px 3px);
}

.hero-inner { position: relative; z-index: 1; }
.hero-copy { max-width: 44rem; }
.hero h1 { color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,.35); }
.hero .lead { font-size: 1.08rem; color: #D6DEE7; max-width: 50ch; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.hero .eyebrow { color: var(--amber); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.6rem 0 1.3rem; }

.eyebrow {
  text-transform: uppercase; letter-spacing: .15em; font-size: .72rem;
  font-weight: 700; color: var(--amber-ink); margin: 0 0 .7rem;
}

.hero-badges { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; }
.hero-badges li {
  font-size: .8rem; padding: .35rem .85rem; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #EAF0F6;
  border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(6px);
}

.hero-firma {
  display: flex; align-items: center; gap: .5rem;
  margin: 1.4rem 0 0; font-size: .78rem; color: #9DB3C7;
}

.btn-chiaro {
  background: rgba(255,255,255,.14); color: #fff;
  border-color: rgba(255,255,255,.28); backdrop-filter: blur(6px);
}
.btn-chiaro:hover { background: rgba(255,255,255,.24); }

/* ---------- Fascia sotto l'hero ---------- */
.sotto-hero { padding: 0 0 clamp(1.5rem, 4vw, 2.5rem); }
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem;
  margin-top: -3.5rem; position: relative; z-index: 2;
}
.stat { box-shadow: var(--shadow-md); }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--amber); letter-spacing: -.02em; }
.stat p { margin: .1rem 0 0; font-size: .87rem; color: var(--ink-soft); line-height: 1.45; }

/* ---------- Sezioni ---------- */
.section { padding: clamp(3rem, 6.5vw, 5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 66ch; margin-bottom: 2.4rem; }
.section-sub { color: var(--ink-soft); margin: 0; }
.center .section-sub, .center .pill-list { margin-inline: auto; }

/* ---------- Card ---------- */
.grid { display: grid; gap: 1.1rem; }
.cards { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card p { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.card h3 { margin-bottom: .4rem; }

/* ---------- Split ---------- */
.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 5vw, 3.5rem); align-items: start; }
.split-copy > p { color: var(--ink-soft); }
.split-media img { border-radius: var(--radius-lg); box-shadow: var(--shadow-md); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.split-media figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .6rem; }
.split-media figure { margin: 0; }

/* ---------- Selettore casa / azienda ---------- */
.segmento {
  display: inline-flex; gap: .25rem; padding: .25rem; margin-bottom: 1.6rem;
  background: var(--sage); border-radius: 999px; border: 1px solid var(--line);
}
.seg-btn {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: .9rem; font-weight: 600; color: var(--ink-soft);
  padding: .55rem 1.2rem; border-radius: 999px;
  transition: background-color .25s ease, color .25s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: var(--green); color: #fff; }

/* ---------- Pillole di risparmio ---------- */
.pillole { grid-template-columns: repeat(3, 1fr); }
.pillole.is-nascosto { display: none; }

.pill {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; position: relative; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pill:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--amber); }
.pill h3 { font-size: 1.02rem; line-height: 1.3; margin: .5rem 0 .5rem; }
.pill p { margin: 0; font-size: .93rem; color: var(--ink-soft); }
.pill-num {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  color: var(--amber-ink); background: var(--green-soft);
  padding: .2rem .5rem; border-radius: 4px;
}

/* la prima pillola di ogni gruppo pesa di più: è quella che deve restare in testa */
.pill:first-child { background: var(--green); border-color: var(--green); }
.pill:first-child h3 { color: #fff; }
.pill:first-child p { color: #C6D4E2; }
.pill:first-child .pill-num { background: rgba(255,255,255,.14); color: var(--amber); }
.pill:first-child:hover { border-color: var(--amber); }

@media (max-width: 1000px) { .pillole { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .pillole { grid-template-columns: 1fr; } .segmento { width: 100%; } .seg-btn { flex: 1; } }

/* ---------- Passaggi del calcolo ---------- */
.calc-steps { list-style: none; padding: 0; margin: 1.8rem 0; display: grid; gap: 1.3rem; }
.calc-steps li { display: grid; grid-template-columns: 40px 1fr; gap: 1rem; align-items: start; }
.calc-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem;
}
.calc-steps h3 { margin-bottom: .2rem; }
.calc-steps p { margin: 0; color: var(--ink-soft); font-size: .94rem; }

.note {
  font-size: .9rem; color: var(--ink-soft);
  border-left: 3px solid var(--amber); padding-left: 1rem; margin-top: 1.6rem;
}

/* Riquadro dei conti in chiaro */
.math-box {
  background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 1.2rem 1.4rem; margin: 1.4rem 0;
}
.math-box p { margin: 0 0 .5rem; font-size: .95rem; color: var(--ink-soft); }
.math-box p:last-child { margin-bottom: 0; }
.math-box p:nth-child(2) { font-size: 1.05rem; color: var(--ink); }
.math-box strong { color: var(--ink); }

/* ---------- Elenco con spunta ---------- */
.check-list { list-style: none; padding: 0; margin: 1.5rem 0 1.9rem; display: grid; gap: .85rem; }
.check-list li { position: relative; padding-left: 2rem; color: var(--ink-soft); font-size: .95rem; }
.check-list li strong { color: var(--ink); }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: .3rem;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: var(--green-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1B2B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.quote-card { background: var(--green); color: #DCE6F0; border-radius: var(--radius-lg); padding: 1.9rem; }
.quote-card blockquote { margin: 0; }
.quote-card p { font-size: 1.1rem; line-height: 1.5; color: #fff; }
.quote-card footer { font-size: .85rem; color: var(--amber); font-weight: 600; }

/* ---------- Galleria ---------- */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.gallery figure { margin: 0; }
.gallery img { border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; box-shadow: var(--shadow-sm); }
.gallery figcaption { font-size: .82rem; color: var(--ink-soft); margin-top: .5rem; }

/* Segnaposto per le foto non ancora caricate */
img.is-missing {
  background: repeating-linear-gradient(45deg, var(--sage), var(--sage) 10px, #E4EAE6 10px, #E4EAE6 20px);
  border: 1px dashed #C3D2CA; min-height: 160px;
}

/* ---------- Pillole zone ---------- */
.pill-list { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.pill-list li { font-size: .87rem; padding: .35rem .9rem; border-radius: 999px; background: var(--white); border: 1px solid var(--line); }

/* ---------- Contatti e form ---------- */
.section-contact { background: var(--bg-alt); }
.split-contact { grid-template-columns: .95fr 1.05fr; }
.contact-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.4rem 0 1.6rem; }
.btn-wa svg { flex: none; }

.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.contact-list li { display: grid; gap: .1rem; }
.contact-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--ink-soft); }
.contact-list a { text-decoration: none; font-weight: 600; }
.contact-list a:hover { text-decoration: underline; }

.form {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.3rem, 3vw, 1.9rem); box-shadow: var(--shadow-sm); display: grid; gap: .9rem;
}
.field { display: grid; gap: .3rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.field label { font-size: .86rem; font-weight: 600; }
.field label span { color: #C0392B; }

.form input, .form select, .form textarea {
  font: inherit; font-size: .94rem; padding: .68rem .8rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--green-mid); }
.form [aria-invalid="true"] { border-color: #C0392B; background: #FFF7F6; }

.error { margin: 0; font-size: .79rem; color: #C0392B; }
.error:empty { display: none; }

.field-check .check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .85rem; color: var(--ink-soft); }
.field-check input { width: auto; margin-top: .2rem; flex: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-feedback { margin: 0; font-size: .88rem; font-weight: 600; }
.form-feedback.ok  { color: var(--green-mid); }
.form-feedback.err { color: #C0392B; }

/* ---------- Footer ---------- */
.site-footer { background: var(--green); color: #9DB3C7; padding: 2.8rem 0 1.4rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.4rem; }
.footer-brand { color: #fff; font-weight: 600; letter-spacing: .06em; margin: 0 0 .2rem; }
.footer-brand span { font-weight: 400; letter-spacing: 0; font-size: .85rem; color: #9DB3C7; }
.footer-meta { margin: 0; font-size: .83rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: flex-start; }
.footer-nav a { color: #D3DFEA; text-decoration: none; font-size: .88rem; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.copyright { margin: 2rem 0 0; padding-top: 1.1rem; font-size: .78rem; text-align: center; border-top: 1px solid rgba(255,255,255,.14); color: #7C90A5; }

/* ---------- Pagine di testo ---------- */
.page { padding: clamp(2.2rem, 5vw, 3.6rem) 0; }
.page h2 { margin-top: 2rem; font-size: 1.3rem; }
.page ul { color: var(--ink-soft); }
.page .updated { color: var(--ink-soft); font-size: .86rem; }

/* ---------- Tabella abilitazioni ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--white); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { background: var(--green-soft); color: var(--green); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.data-table td:first-child { font-weight: 700; color: var(--amber-ink); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }

/* ---------- Osservatorio ---------- */
.news-list { display: grid; gap: 1rem; }
.news-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.5rem; }
.news-item h3 { margin-bottom: .3rem; }
.news-item p { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.news-meta { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--amber-ink); font-weight: 700; margin-bottom: .4rem; }
.news-img { width: 100%; border-radius: var(--radius); margin: .9rem 0 1rem; aspect-ratio: 16 / 9; object-fit: cover; }
.news-title { font-size: 1rem; margin-bottom: .8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 700; }

/* Griglia dell'osservatorio in home */
.osservatorio-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 1.4rem; margin-top: 1.4rem; align-items: start; }

/* Pillola settimanale generata dal modello locale */
.pillola {
  background: var(--green); color: #DCE6F0; border-radius: var(--radius-lg);
  padding: 1.6rem; position: relative; overflow: hidden;
}
.pillola::after {
  content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  right: -70px; top: -80px; background: radial-gradient(circle, rgba(255,176,32,.35), transparent 70%);
  animation: drift-c 16s ease-in-out infinite alternate;
}
.pillola > * { position: relative; z-index: 1; }
.pillola h3 { color: #fff; font-size: 1.15rem; margin-bottom: .6rem; }
.pillola-kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--amber); margin-bottom: .5rem; }
.pillola-testo { font-size: .95rem; line-height: 1.6; margin-bottom: .9rem; }
.pillola-nota { font-size: .74rem; color: #93A9BE; margin: 0; border-top: 1px solid rgba(255,255,255,.15); padding-top: .7rem; }

/* Card dei problemi tipici */
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.card-warn { border-left: 3px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0; }
.card-warn h3 { font-size: 1rem; }

@media (max-width: 1000px) {
  .osservatorio-grid { grid-template-columns: 1fr; }
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .cards-4 { grid-template-columns: 1fr; }
}
.news-item { transition: transform .25s ease, box-shadow .25s ease; }
.news-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ---------- Pulsanti rapidi (mobile) ---------- */
.quick-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none; }
.qa {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .95rem 0; font-weight: 600; font-size: .95rem; text-decoration: none; color: #fff;
}
.qa svg { width: 20px; height: 20px; }
.qa-call { background: var(--green); }
.qa-wa { background: #1F8F4E; }

/* ---------- Chat ---------- */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--green); color: #fff; box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
}
.chat-fab svg { width: 26px; height: 26px; }
.chat-fab .dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); border: 2px solid var(--green); }

.chat-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 71;
  width: min(380px, calc(100vw - 40px)); height: min(560px, calc(100vh - 130px));
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.is-open { display: flex; }

.chat-head { background: var(--green); color: #fff; padding: .85rem 1rem; display: flex; align-items: center; gap: .6rem; }
.chat-head .t { font-size: .95rem; font-weight: 600; line-height: 1.1; }
.chat-head .t small { display: block; font-size: .68rem; color: #9DB3C7; font-weight: 400; }
.chat-close { margin-left: auto; background: transparent; border: 0; color: #D3DFEA; cursor: pointer; font-size: 1.3rem; line-height: 1; padding: .2rem .4rem; }

.chat-body { flex: 1; overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .6rem; background: var(--bg); }
.msg { max-width: 84%; padding: .65rem .85rem; border-radius: 14px; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--amber); border-top-left-radius: 4px; }
.msg.me  { align-self: flex-end; background: var(--green); color: #fff; border-top-right-radius: 4px; }
.msg.sys { align-self: center; background: transparent; color: var(--ink-soft); font-size: .78rem; text-align: center; max-width: 92%; }
.msg.sys a { font-weight: 600; }

.typing { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; border-top-left-radius: 4px; padding: .75rem .9rem; display: flex; gap: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); opacity: .5; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.chat-bar { display: flex; gap: .5rem; padding: .6rem; background: #fff; border-top: 1px solid var(--line); }
.chat-bar textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: .6rem .9rem; font: inherit; font-size: .93rem; max-height: 110px; background: var(--bg); color: var(--ink); }
.chat-bar textarea:focus { outline: none; border-color: var(--green-mid); }
.chat-send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--green); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chat-send:disabled { opacity: .45; cursor: default; }
.chat-send svg { width: 18px; height: 18px; }
.chat-foot { text-align: center; font-size: .68rem; color: var(--ink-soft); padding: 0 0 .5rem; background: #fff; }

/* ---------- Animazione di comparsa ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s cubic-bezier(.22,.61,.36,1), transform .6s cubic-bezier(.22,.61,.36,1); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal { transition-delay: calc(var(--i, 0) * 70ms); }

/* Entrata del hero, senza attendere lo scroll */
.fade-up, .fade-in { animation: fadeUp .8s cubic-bezier(.22,.61,.36,1) both; }
.fade-in { animation-name: fadeIn; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .16s; }
.d3 { animation-delay: .24s; } .d4 { animation-delay: .32s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Barra di avanzamento della lettura ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 80;
  background: linear-gradient(90deg, var(--amber), #FFD37A);
  transform: scaleX(0); transform-origin: 0 50%; will-change: transform;
}

/* ---------- Luci in movimento dietro l'hero ---------- */
.hero { position: relative; overflow: hidden; }
.lights { position: absolute; inset: -20% -10% auto; height: 130%; pointer-events: none; z-index: -1; }
.light {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(80px); opacity: .34; will-change: transform;
}
.light-a { width: 46vw; height: 46vw; max-width: 620px; max-height: 620px; top: -8%; right: -6%;
  background: radial-gradient(circle, rgba(255,176,32,.55), rgba(255,176,32,0) 70%);
  animation: drift-a 22s ease-in-out infinite alternate; }
.light-b { width: 40vw; height: 40vw; max-width: 540px; max-height: 540px; top: 18%; left: -12%;
  background: radial-gradient(circle, rgba(14,133,119,.40), rgba(14,133,119,0) 70%);
  animation: drift-b 26s ease-in-out infinite alternate; }
.light-c { width: 30vw; height: 30vw; max-width: 380px; max-height: 380px; bottom: -6%; left: 42%;
  background: radial-gradient(circle, rgba(90,169,255,.30), rgba(90,169,255,0) 70%);
  animation: drift-c 19s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate3d(-70px, 60px, 0) scale(1.12); } }
@keyframes drift-b { to { transform: translate3d(80px, -50px, 0) scale(1.08); } }
@keyframes drift-c { to { transform: translate3d(-50px, -70px, 0) scale(1.15); } }
.hero-inner, .stat-row, .marquee { position: relative; z-index: 1; }

/* Parola in evidenza nel titolo */
.hl {
  display: inline;
  background-image: linear-gradient(90deg, rgba(255,176,32,.55), rgba(255,176,32,.18));
  background-repeat: no-repeat;
  background-position: 0 88%;
  background-size: 0% .3em;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
  animation: swipe 1.1s cubic-bezier(.22,.61,.36,1) .45s forwards;
}
@keyframes swipe { to { background-size: 100% .3em; } }

/* Etichetta sulla foto dell'hero */
.hero-media { position: relative; margin: 0; }
.hero-tag {
  position: absolute; left: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.82); backdrop-filter: blur(8px);
  border-radius: 999px; padding: .45rem .9rem; font-size: .8rem; font-weight: 600; color: var(--green);
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); position: relative; }
.pulse-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--amber); animation: pulse 2s ease-out infinite; opacity: 0;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.4); opacity: 0; } }

/* ---------- Striscia scorrevole ---------- */
.marquee {
  margin-top: clamp(1.8rem, 4vw, 2.6rem);
  border-block: 1px solid var(--line); background: var(--white);
  overflow: hidden; padding: .7rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; gap: 1.6rem; width: max-content; animation: slide 38s linear infinite; }
.marquee-track span { font-size: .84rem; letter-spacing: .1em; text-transform: uppercase; color: var(--green); font-weight: 600; white-space: nowrap; }
.marquee-track i { color: var(--amber); font-style: normal; }
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- Titoli con sottolineatura animata ---------- */
h2.underline { position: relative; padding-bottom: .35rem; }
h2.underline::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 68px; border-radius: 3px;
  background: linear-gradient(90deg, var(--amber), rgba(255,176,32,.15));
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .7s cubic-bezier(.22,.61,.36,1) .1s;
}
.center h2.underline::after { left: 50%; transform: translateX(-50%) scaleX(0); }
h2.underline.is-visible::after { transform: scaleX(1); }
.center h2.underline.is-visible::after { transform: translateX(-50%) scaleX(1); }

/* ---------- Icone delle card ---------- */
.card { position: relative; overflow: hidden; }
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255,176,32,.12), transparent 60%);
  opacity: 0; transition: opacity .35s ease;
}
.card:hover::before { opacity: 1; }
.card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-bottom: .9rem; border-radius: 12px;
  background: var(--green-soft); color: var(--green);
  transition: transform .3s ease, background-color .3s ease;
}
.card:hover .card-icon { transform: translateY(-2px) rotate(-4deg); background: var(--amber); }
.card-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Riflesso sui pulsanti ---------- */
.shine { position: relative; overflow: hidden; }
.shine::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); transition: left .6s ease;
}
.shine:hover::after { left: 130%; }

/* ---------- Galleria cliccabile ---------- */
.gallery figure { margin: 0; }
.shot {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden; position: relative; line-height: 0;
}
.shot img { transition: transform .6s cubic-bezier(.22,.61,.36,1), filter .4s ease; }
.shot:hover img { transform: scale(1.06); filter: saturate(1.08); }
.shot::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(11,27,43,.45));
  opacity: 0; transition: opacity .35s ease;
}
.shot:hover::after { opacity: 1; }
.shot-zoom {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; background: var(--amber); color: #3A2600;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; line-height: 1;
  opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .3s ease;
}
.shot:hover .shot-zoom { opacity: 1; transform: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(9,26,20,.92); padding: 4vh 4vw; animation: fadeIn .25s ease both;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
.lb-figure img { max-height: 82vh; max-width: 100%; border-radius: var(--radius); margin-inline: auto; }
.lb-figure figcaption { color: #C6D4E2; font-size: .88rem; margin-top: .8rem; }
.lb-close, .lb-nav {
  position: absolute; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #fff; cursor: pointer; border-radius: 50%; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; line-height: 1;
  transition: background-color .2s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-close { top: 18px; right: 18px; font-size: 1.9rem; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* ---------- Riquadro dei conti, versione evidenziata ---------- */
.math-label { font-size: .74rem !important; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--amber-ink) !important; }
.math-line { font-size: 1.15rem !important; color: var(--ink) !important; }

/* ---------- Header allo scroll ---------- */
.site-header { transition: box-shadow .3s ease, background-color .3s ease; }
.site-header.is-stuck { box-shadow: 0 8px 26px rgba(11,27,43,.22); background: rgba(11,27,43,.94); backdrop-filter: blur(10px); }

/* ---------- Bolla della chat ---------- */
.chat-fab::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(255,176,32,.55); animation: pulse 2.6s ease-out infinite;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab { transition: transform .2s ease; }
.chat-panel { animation: fadeUp .3s ease both; }

/* Invito accanto alla bolla */
.chat-teaser {
  position: fixed; right: 88px; bottom: 26px; z-index: 69;
  max-width: 230px; text-align: left; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  border-bottom-right-radius: 4px; padding: .7rem .9rem;
  box-shadow: var(--shadow-md); font: inherit; color: var(--ink);
  opacity: 0; transform: translateX(12px) scale(.96); pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.chat-teaser.is-on { opacity: 1; transform: none; pointer-events: auto; }
.chat-teaser span { display: block; font-weight: 600; font-size: .9rem; }
.chat-teaser small { display: block; font-size: .78rem; color: var(--ink-soft); margin-top: .1rem; }
.chat-teaser:hover { border-color: var(--amber); }

/* Su mobile l'invito coprirebbe il testo: bastano la bolla e la barra in basso. */
@media (max-width: 760px) {
  .chat-teaser { display: none; }
}

@media (max-width: 760px) {
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .lb-close { top: 10px; right: 10px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .hero-inner, .split, .split-contact { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .quote-card { order: -1; }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .header-inner { position: relative; }
  .nav {
    position: absolute; top: 100%; left: -1.25rem; right: -1.25rem;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--green); padding: .3rem 1.25rem 1.1rem; display: none;
    box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.12); }
  .nav a.btn-amber { margin-top: .8rem; border-bottom: 0; justify-content: center; }

  .stat-row { grid-template-columns: 1fr; }
  .quick-actions { display: flex; }
  body { padding-bottom: 54px; }
  .chat-fab { bottom: 66px; }
  .chat-panel { bottom: 130px; height: min(500px, calc(100vh - 180px)); }
}

@media (max-width: 620px) {
  .cards, .gallery { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .hero-actions .btn, .contact-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
