/* =====================================================================
   DIGYPAY — FOGLIO DI STILE DEL NUOVO SITO
   =====================================================================
   Come leggere questo file: è diviso in sezioni numerate. Ogni sezione
   spiega cosa fa e perché. Nessun framework: CSS semplice, così il sito
   resta leggero (importante per Google e per chi naviga da telefono).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. VARIABILI DI COLORE E TIPOGRAFIA
   Tutti i colori stanno qui, in "variabili". Se un giorno cambi il blu
   del marchio, lo cambi in UN solo punto e si aggiorna tutto il sito.
   I colori vengono dal logo DigyPay (blu #2E58A6, arancio #FF6204).
   --------------------------------------------------------------------- */
:root {
  --ink: #0E1116;          /* testo principale e sezioni scure */
  --ground: #F5F4EF;       /* sfondo caldo della pagina */
  --white: #FFFFFF;
  --line: #E2E0D8;         /* bordi sottili */
  --muted: #4A4F5A;        /* testo secondario (contrasto AA su fondo chiaro) */
  --muted-dark: #B4B9C3;   /* testo secondario su fondo scuro */
  --card-dark: #161A22;
  --line-dark: #262B35;
  --blue: #2E58A6;         /* blu del logo */
  --orange: #FF6204;       /* arancio del logo */
  --green-bg: #E3F6EA; --green-fg: #136B3A;
  --radius: 22px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

/* ---------------------------------------------------------------------
   2. BASE
   Azzeriamo i margini del browser e impostiamo il testo di base.
   "box-sizing: border-box" fa sì che padding e bordi stiano DENTRO la
   larghezza dichiarata: i calcoli del layout diventano prevedibili.
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); }
a:hover { color: var(--blue); }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.03em; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(40px, 6vw, 76px); line-height: 1.0; }
h2 { font-size: clamp(32px, 4vw, 52px); }
h3 { font-size: clamp(22px, 2.4vw, 32px); }
p { margin: 0; }

/* Testo leggibile solo dagli screen reader (accessibilità). */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Chi ha chiesto al sistema "meno animazioni" non le vede. */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------------------------------------------------------------------
   3. CONTENITORI E GRIGLIE RIUTILIZZABILI
   .wrap centra il contenuto a max 1200px con 24px di margine laterale
   (16px su telefono). .grid-auto crea colonne che si adattano da sole:
   tante quante ci stanno, ognuna larga almeno --min.
   --------------------------------------------------------------------- */
.wrap { max-width: 1520px; margin: 0 auto; padding-left: clamp(16px, 4vw, 64px); padding-right: clamp(16px, 4vw, 64px); }
/* Il contenuto si allarga fino a 1520 px: sugli schermi grandi niente fasce vuote ai lati,
   mentre i margini laterali crescono e calano con la larghezza dello schermo (da 16 a 64 px). */
.section { padding-top: 104px; padding-bottom: 104px; }
.section-sm { padding-top: 64px; padding-bottom: 64px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-direction: row; flex-wrap: wrap; gap: 40px; align-items: center; }
.row > * { flex: 1 1 440px; min-width: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--min, 260px), 1fr)); gap: 16px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 40px; }
.head > div { max-width: 700px; display: flex; flex-direction: column; gap: 14px; }
.head > p { max-width: 380px; color: var(--muted); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); }
.lead { font-size: 19px; color: var(--muted); max-width: 600px; }
.bg-white { background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bg-dark { background: var(--ink); color: var(--white); }
.bg-dark .eyebrow { color: var(--orange); }
.bg-dark .lead, .bg-dark .muted { color: var(--muted-dark); }
.bg-blue { background: var(--blue); color: var(--white); }

/* ---------------------------------------------------------------------
   4. PULSANTI E PILLOLE
   Tutti i pulsanti sono alti almeno 44px: è la misura minima comoda per
   un dito su telefono.
   --------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 14px 24px; border-radius: 999px; font-weight: 600; text-decoration: none; border: 1px solid transparent; transition: transform .15s, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-dark { background: var(--ink); color: var(--white); }
.btn-dark:hover { color: var(--white); }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover { color: var(--white); }
.btn-orange { background: var(--orange); color: var(--ink); }
.btn-ghost { background: var(--white); border-color: #D6D3C8; color: var(--ink); }
.btn-outline-light { border-color: rgba(255,255,255,.6); color: var(--white); }
.btn-outline-light:hover { color: var(--white); }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; align-self: flex-start; }
.chip { display: inline-block; font-size: 14px; padding: 6px 12px; border-radius: 99px; background: var(--ground); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.checks { display: flex; flex-direction: column; gap: 10px; font-size: 15px; padding: 0; margin: 0; list-style: none; }
.checks li::before { content: "✓ "; color: var(--green-fg); font-weight: 700; }
.bg-dark .checks li::before { color: #9FE3BF; }

/* ---------------------------------------------------------------------
   5. CARD
   --------------------------------------------------------------------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.card p { color: var(--muted); font-size: 15px; }
.card-dark { background: var(--card-dark); border: 1px solid var(--line-dark); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.card-dark p { color: var(--muted-dark); }
/* Una card che è anche .row deve disporre i figli in orizzontale (vince sull'impostazione a colonna). */
.card-dark.row, .card.row { flex-direction: row; }
.bg-dark .head > p { color: var(--muted-dark); }
.card img.icon { width: 132px; height: 132px; object-fit: contain; }

/* ---------------------------------------------------------------------
   6. INTESTAZIONE (TOP BAR + MENU)
   Il menu è "sticky": resta in alto mentre scorri. Su telefono le voci
   si nascondono dietro il pulsante "Menu" per non occupare lo schermo.
   --------------------------------------------------------------------- */
.topbar { background: var(--ink); color: #C9CCD3; font-size: 13px; }
.topbar .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 10px; padding-bottom: 10px; }
.topbar a { color: #C9CCD3; text-decoration: none; }
.topbar .hl { color: var(--orange); font-weight: 600; }
.nav { position: sticky; top: 0; z-index: 50; background: rgba(245,244,239,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.nav .logo img { height: 42px; width: auto; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 15px; font-weight: 500; }
.nav-links a { text-decoration: none; padding: 10px 0; }
.nav-cta { display: flex; gap: 10px; }
.nav-cta .btn { min-height: 44px; padding: 10px 18px; font-size: 15px; }
.nav-toggle { display: none; min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--ink); background: transparent; font-weight: 600; }
@media (max-width: 1020px) {
  .nav-toggle { display: inline-flex; }
  .nav-links, .nav-cta { display: none; }
  .nav.open .wrap { flex-wrap: wrap; }
  .nav.open .nav-links { display: flex; flex-direction: column; width: 100%; order: 3; }
  .nav.open .nav-cta { display: flex; width: 100%; order: 4; padding-bottom: 8px; }
}

/* ---------------------------------------------------------------------
   7. ANIMAZIONI
   Entrata dolce delle slide e barra di avanzamento dei caroselli.
   --------------------------------------------------------------------- */
@keyframes dpIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes dpImg { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dpBar { from { width: 0; } to { width: 100%; } }
@keyframes dpScan { from { top: 0; } to { top: 100%; } }
@keyframes dpPulse { 0% { box-shadow: 0 0 0 0 rgba(255,98,4,.55); } 100% { box-shadow: 0 0 0 14px rgba(255,98,4,0); } }
.anim-in { animation: dpIn .6s ease both; }
.anim-img { animation: dpImg .8s ease both; }

/* ---------------------------------------------------------------------
   8. CAROSELLO DELL'APERTURA (HERO)
   Solo la slide con classe .is-active è visibile. Le altre restano nel
   codice HTML: Google le legge comunque (testo vero, non immagini).
   --------------------------------------------------------------------- */
.hero { padding-top: 56px; padding-bottom: 40px; }
.slide { display: none; min-height: 500px; }
.slide.is-active { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.slide.is-active .slide-text { animation: dpIn .6s ease both; }
.slide.is-active .slide-img { animation: dpImg .8s ease both; }
.slide-text { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.slide-media { flex: 1 1 480px; min-width: 0; display: flex; justify-content: center; }
.slide-media img { max-height: 520px; width: auto; }
.car-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; }
.car-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.car-tab { min-width: 120px; min-height: 44px; padding: 10px 4px 0; border: 0; background: transparent; text-align: left; font-size: 13px; font-weight: 600; color: #6B707A; display: flex; flex-direction: column; gap: 8px; }
.car-tab[aria-selected="true"] { color: var(--ink); }
.car-tab .bar { display: block; height: 3px; width: 100%; background: #DEDCD3; border-radius: 3px; overflow: hidden; }
.car-tab .bar span { display: block; height: 3px; width: 0; background: var(--c, var(--blue)); }
.car-tab[aria-selected="true"] .bar span { width: 100%; }
.is-playing .car-tab[aria-selected="true"] .bar span { animation: dpBar var(--dur, 7s) linear both; }
.car-arrows { display: flex; gap: 8px; }
.car-arrows button { width: 48px; height: 48px; border-radius: 99px; border: 1px solid #D6D3C8; background: var(--white); display: flex; align-items: center; justify-content: center; }
.car-arrows button.next { background: var(--ink); border-color: var(--ink); }

/* ---------------------------------------------------------------------
   9. SCHEDE A TAB (settori, prodotti, metodo, energia)
   Stessa logica del carosello: un solo pannello visibile alla volta.
   --------------------------------------------------------------------- */
[data-tab-panel] { display: none; }
[data-tab-panel].is-active { display: flex; animation: dpIn .5s ease both; }
.tab-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tab-btn { min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 1px solid #D6D3C8; background: var(--white); font-weight: 600; transition: all .25s; }
.tab-btn[aria-selected="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 28px; padding: 36px; flex-wrap: wrap; gap: 36px; align-items: flex-start; }
.panel > * { flex: 1 1 400px; min-width: 0; }
@media (max-width: 600px) { .panel { padding: 22px; } }

/* Menu verticale dei prodotti DIGYPOS con pannello colorato. */
.prod { display: flex; flex-wrap: wrap; gap: 20px; }
.prod-menu { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.prod-btn { text-align: left; border: 1px solid var(--line); background: var(--white); border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.prod-btn .t { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.prod-btn .n { font-family: var(--font-display); font-weight: 700; opacity: .7; margin-right: 12px; }
.prod-btn .bar { display: none; height: 3px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; }
.prod-btn .bar span { display: block; height: 3px; width: 100%; background: var(--white); }
.prod-btn[aria-selected="true"] { background: var(--c); border-color: var(--c); color: var(--white); }
.prod-btn[aria-selected="true"] .bar { display: block; }
.is-playing .prod-btn[aria-selected="true"] .bar span { animation: dpBar 7s linear both; }
.prod-panels { flex: 999 1 560px; min-width: 0; display: flex; }
.prod-panel { width: 100%; background: var(--c); color: var(--white); border-radius: 28px; padding: 40px; flex-wrap: wrap; gap: 32px; align-items: center; }
.prod-panel > div:first-child { flex: 1 1 320px; display: flex; flex-direction: column; gap: 18px; }
.prod-panel > div:last-child { flex: 0 1 260px; display: flex; justify-content: center; }
.prod-panel img { max-height: 460px; width: auto; }
.step-row { display: flex; align-items: center; gap: 14px; background: rgba(0,0,0,.18); border-radius: 14px; padding: 12px 14px; }
.step-row b { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 99px; background: var(--white); color: var(--c); display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------------
   10. COMPONENTI DIMOSTRATIVI (sala, varianti, flussi, cursori)
   --------------------------------------------------------------------- */
.demo-box { background: var(--ground); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.tables { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.table-btn { aspect-ratio: 1; min-height: 52px; border-radius: 14px; border: 0; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: background .25s; }
.table-btn small { font-size: 10px; font-weight: 600; }
.table-btn[data-state="0"] { background: #CDEFD9; color: var(--green-fg); }
.table-btn[data-state="1"] { background: var(--blue); color: var(--white); }
.table-btn[data-state="2"] { background: var(--orange); color: var(--ink); }
.vgrid { display: grid; gap: 6px; font-size: 13px; text-align: center; }
.vgrid span { padding: 6px 0; border-radius: 8px; background: var(--white); }
.vgrid .out { background: #FDE2E2; color: #A8000A; font-weight: 700; }
.vgrid .h { background: transparent; font-weight: 700; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.flow-node { flex: 1 1 180px; background: var(--card-dark); border: 1px solid var(--line-dark); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; color: var(--white); transition: all .4s; }
.flow-node .k { font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.flow-node .k.trigger { color: #FF9A55; } .flow-node .k.azione { color: #9FE3BF; } .flow-node .k.attesa { color: var(--muted-dark); } .flow-node .k.condizione { color: #9FC2FF; }
.flow-node.is-on { border-color: var(--orange); background: #1F2430; box-shadow: 0 0 0 0 rgba(255,98,4,.5); animation: dpPulse 1.2s ease-out infinite; }
.range { display: flex; flex-direction: column; gap: 10px; font-weight: 600; }
.range input { width: 100%; accent-color: var(--orange); }
.split { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line-dark); }
.split span { display: block; transition: width .2s; }
.stepper { position: relative; }
.stepper .track, .stepper .fill { position: absolute; left: 0; top: 27px; height: 2px; }
.stepper .track { right: 0; background: var(--line); }
.stepper .fill { background: var(--blue); transition: width .6s; }
.stepper .steps { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stepper button { border: 0; background: transparent; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.stepper .dot { width: 56px; height: 56px; border-radius: 99px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; background: var(--white); border: 2px solid #D6D3C8; transition: all .3s; }
.stepper button[aria-selected="true"] .dot, .stepper button.done .dot { background: var(--blue); border-color: var(--blue); color: var(--white); }
.stepper button[aria-selected="true"] .dot { box-shadow: 0 0 0 6px rgba(46,88,166,.18); }
.stepper .t { font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.stepper button:not([aria-selected="true"]) .t, .stepper button:not([aria-selected="true"]) .s { opacity: .6; }
.stepper .s { font-size: 15px; color: var(--muted); }

/* ---------------------------------------------------------------------
   11. PREZZI, MODULI, PIÈ DI PAGINA, COOKIE
   --------------------------------------------------------------------- */
.price { font-family: var(--font-display); font-size: 44px; font-weight: 700; letter-spacing: -0.03em; }
.price-card { flex-grow: 1; }
.price-card ul { flex-grow: 1; }
.form { background: var(--white); color: var(--ink); border-radius: 22px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.form input, .form select { padding: 12px 14px; border-radius: 12px; border: 1px solid #D6D3C8; font: inherit; font-weight: 400; background: var(--white); }
.form .hp { position: absolute; left: -9999px; }
.footer { background: var(--ink); color: var(--muted-dark); font-size: 14px; }
.footer a { color: var(--muted-dark); text-decoration: none; }
.footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; padding-top: 64px; padding-bottom: 32px; }
.footer .cols div { display: flex; flex-direction: column; gap: 8px; }
.footer strong { color: var(--white); }
.footer .legal { border-top: 1px solid var(--line-dark); padding-top: 20px; padding-bottom: 32px; font-size: 13px; color: #8A909B; }
.cookie { display: none; position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100; max-width: 760px; margin: 0 auto; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 20px 40px -20px rgba(14,17,22,.4); }
.cookie p { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
