/* ==========================================================================
   Font
   OTF forniti dal cliente (da convertire in WOFF2 quando ci sarà un tool).
   Vengono scaricati solo i pesi effettivamente usati.
   ========================================================================== */
@font-face {
  font-family: "Gotham";
  src: url("assets/fonts/Gotham-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gotham";
  src: url("assets/fonts/Gotham-Book.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gotham";
  src: url("assets/fonts/Gotham-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gotham";
  src: url("assets/fonts/Gotham-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pink Champagne";
  src: url("assets/fonts/Pink%20Champagne_pandora.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design token
   ========================================================================== */
:root {
  --pink: #FF93A0;
  --brown: #211810;
  --white: #FFFFFF;
  --purple: #B95088;
  --red: #E4261B;
  --backdrop: rgba(33, 24, 16, 0.6); /* --brown al 60%, sfondo della finestra sovrapposta */
  --brown-15: rgba(33, 24, 16, 0.15); /* --brown al 15%: traccia delle barre, linee delle tabelle */

  --font-main: "Gotham", Montserrat, Arial, sans-serif;
  --font-script: "Pink Champagne", cursive;

  /* Le slide sono 1389×868: 1 --u = 1px della slide, scalato sul viewport */
  --u: min(100vw / 1389, 100vh / 868);

  --border: 1.5px;
  --radius-input: calc(10 * var(--u));
  --radius-btn: max(8px, calc(11.35 * var(--u)));
  --touch-min: 48px;
}

@supports (height: 100dvh) {
  :root { --u: min(100vw / 1389, 100dvh / 868); }
}

/* ==========================================================================
   Base / kiosk
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--pink);
  color: var(--brown);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  font-family: var(--font-main);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

input, button { font: inherit; color: inherit; }

input[type="text"], input[type="email"] {
  -webkit-user-select: text;
  user-select: text;
}

[hidden] { display: none !important; }

/* Palco a proporzioni della slide, centrato nel viewport */
.stage {
  position: relative;
  width: calc(1389 * var(--u));
  min-height: calc(868 * var(--u));
  margin: auto; /* centra senza tagliare il contenuto se eccede il viewport */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(80 * var(--u));
  padding-bottom: calc(80 * var(--u));
}

.logo {
  position: relative;
  z-index: 2; /* resta sopra alle schermate che scorrono */
  display: block;
  width: calc(267 * var(--u));
  height: auto;
  pointer-events: none;
}

.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Tipografia comune
   ========================================================================== */
.title {
  margin: calc(60 * var(--u)) 0 0;
  font-size: calc(43.4 * var(--u));
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
}

.subtitle {
  margin: calc(6 * var(--u)) 0 0;
  font-size: calc(25.3 * var(--u));
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
}

/* ==========================================================================
   Pulsanti
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: calc(234.7 * var(--u));
  min-height: max(var(--touch-min), calc(73.7 * var(--u)));
  padding: 0 calc(22 * var(--u));
  border: var(--border) solid var(--brown);
  border-radius: var(--radius-btn);
  font-size: max(18px, calc(32.6 * var(--u)));
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--brown);
  color: var(--white);
}

.btn--secondary {
  background: transparent;
  color: var(--brown);
}

.btn[aria-disabled="true"] { opacity: 0.5; }
.btn[aria-disabled="true"]:active { transform: none; }

/* ==========================================================================
   1 · Registrazione
   ========================================================================== */
.reg-form {
  width: calc(1138 * var(--u));
  margin-top: calc(40 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: calc(90 * var(--u));
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: max(19px, calc(15 * var(--u))); /* spazio per il messaggio sotto il campo */
}

.field__label {
  margin-bottom: calc(5 * var(--u));
  font-size: max(13px, calc(18 * var(--u)));
  font-weight: 500;
  line-height: 1.2;
}

.field__input {
  width: 100%;
  /* min 16px: sotto questa soglia Safari iOS zooma al focus */
  height: max(var(--touch-min), calc(47 * var(--u)));
  padding: 0 calc(16 * var(--u));
  font-size: max(16px, calc(20 * var(--u)));
  background: var(--white);
  border: var(--border) solid var(--brown);
  border-radius: var(--radius-input);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field__input:focus {
  box-shadow: 0 0 0 1.5px var(--brown);
}

.field.is-invalid .field__input {
  border-color: var(--red);
  box-shadow: 0 0 0 1.5px var(--red);
}

/* Messaggio sotto il campo: posizionato in assoluto per non spostare il layout */
.field__msg {
  position: absolute;
  top: 100%;
  left: calc(4 * var(--u));
  margin: 2px 0 0;
  font-size: max(12px, calc(14 * var(--u)));
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.field__msg:empty { display: none; }

.suggestion {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Consensi */
.consent {
  position: relative;
  margin-right: calc(-14 * var(--u)); /* nella slide il testo sborda oltre gli input */
  display: flex;
  align-items: flex-start;
  gap: calc(10 * var(--u));
  margin-top: calc(6 * var(--u));
  padding: calc(4 * var(--u)) 0;
  cursor: pointer;
}

.consent + .consent { margin-top: calc(10 * var(--u)); }

.consent__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.consent__box {
  position: relative;
  flex: none;
  width: max(20px, calc(23 * var(--u)));
  height: max(20px, calc(23 * var(--u)));
  margin-top: calc(1 * var(--u));
  border: var(--border) solid var(--brown);
  border-radius: calc(5 * var(--u));
  background: transparent;
  transition: background-color 0.15s;
}

.consent__box::after {
  content: "";
  position: absolute;
  left: 34%;
  top: 14%;
  width: 28%;
  height: 52%;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.consent__input:checked + .consent__box { background: var(--brown); }
.consent__input:checked + .consent__box::after { opacity: 1; }
.consent__input:focus-visible + .consent__box { box-shadow: 0 0 0 2px var(--white); }
.consent.is-invalid .consent__box {
  border-color: var(--red);
  box-shadow: 0 0 0 1.5px var(--red);
}

.consent__body {
  display: flex;
  flex-direction: column;
  font-size: max(12px, calc(15.2 * var(--u)));
  line-height: 1.2;
}

.consent__title { font-weight: 500; }
.consent__text { font-weight: 300; }

.link {
  padding: 0;
  border: 0;
  background: none;
  font-weight: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.form-msg {
  min-height: calc(20 * var(--u));
  margin: calc(14 * var(--u)) 0 calc(10 * var(--u));
  font-size: max(13px, calc(16 * var(--u)));
  font-weight: 500;
  text-align: center;
}

.reg-form .btn { align-self: center; }

/* ==========================================================================
   2 · Scorri per scoprire
   Durante lo swipe la schermata 3 viene sovrapposta (is-incoming) e le due
   schermate si spostano con transform; il logo resta fermo.
   ========================================================================== */
html, body { overflow-x: hidden; }

.is-swipe-active,
.is-swipe-active body { touch-action: none; }

.screens {
  position: relative;
  width: 100%;
}

.screen.is-incoming {
  position: absolute;
  top: 0;
  left: 0;
}

/* Durata = DURATION in app.js */
.screen.is-animating { transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1); }

.screen--swipe,
.screen--discount { will-change: transform; }

.swipe-text {
  margin: calc(197.6 * var(--u)) 0 0;
  font-size: calc(57.9 * var(--u));
  font-weight: 500;
  line-height: calc(69.4 * var(--u));
  text-align: center;
  white-space: pre-line;
}

/* ==========================================================================
   3 · Sconto
   ========================================================================== */
.discount-badge {
  position: relative;
  width: calc(612.9 * var(--u));
  height: calc(269.2 * var(--u));
  margin-top: calc(72.4 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
}

.discount-badge__brush {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.discount-badge__value {
  position: relative;
  margin: calc(4 * var(--u)) 0 0;
  font-size: calc(139.1 * var(--u));
  font-weight: 700;
  line-height: 1;
}

.discount-text {
  margin: calc(30.4 * var(--u)) 0 0;
  font-size: calc(25.3 * var(--u));
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  white-space: pre-line;
}

.discount-text--where { margin-top: calc(59 * var(--u)); }

.screen--discount .btn { margin-top: calc(57 * var(--u)); }

/* ==========================================================================
   4 · Newsletter
   ========================================================================== */
.newsletter-text {
  margin: calc(55 * var(--u)) 0 0;
  font-size: calc(36.2 * var(--u));
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  white-space: pre-line;
}

.newsletter-note {
  margin: calc(27 * var(--u)) 0 0;
  font-size: calc(25.3 * var(--u));
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
}

.newsletter-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(21.1 * var(--u));
  margin-top: calc(83.8 * var(--u));
}

/* Larghezze fisse come nella slide 4 */
.newsletter-actions .btn--primary { min-width: calc(346.4 * var(--u)); }
.newsletter-actions .btn--secondary { min-width: calc(555.4 * var(--u)); }

/* ==========================================================================
   5 · Grazie
   ========================================================================== */
/* Scritta corsiva tolta il 04/12: il testo resta all'altezza della slide
   (19 + 108.5 della scritta + 142 di spazio) */
.thanks-text {
  margin: calc(269.5 * var(--u)) 0 0;
  font-size: calc(57.9 * var(--u));
  font-weight: 500;
  line-height: calc(69.4 * var(--u));
  text-align: center;
  white-space: pre-line;
}

.screen--thanks .btn { margin-top: calc(170.9 * var(--u)); }

/* ==========================================================================
   Link nel testo: area di tocco più alta della riga (≈ 48px) senza
   cambiare l'impaginazione
   ========================================================================== */
.link { position: relative; }

.link::after {
  content: "";
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: -4px;
  right: -4px;
}

/* ==========================================================================
   Finestra sovrapposta (informative)
   ========================================================================== */
.overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--backdrop);
  animation: overlay-in 0.2s ease-out;
}

.overlay__panel {
  width: min(100%, calc(760 * var(--u)));
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(48 * var(--u)) calc(56 * var(--u));
  background: var(--pink);
  border-radius: calc(20 * var(--u));
  text-align: center;
}

.overlay__title {
  margin: 0;
  font-size: calc(36 * var(--u));
  font-weight: 500;
  line-height: 1.2;
}

.overlay__text {
  margin: calc(18 * var(--u)) 0 0;
  max-width: calc(560 * var(--u));
  font-size: max(16px, calc(22 * var(--u)));
  font-weight: 400;
  line-height: 1.3;
}

/* QR: moduli brown su bianco, con margine bianco (quiet zone) per la lettura */
.overlay__qr {
  width: max(200px, calc(280 * var(--u)));
  height: max(200px, calc(280 * var(--u)));
  margin-top: calc(28 * var(--u));
  padding: calc(14 * var(--u));
  background: var(--white);
  border-radius: calc(10 * var(--u));
  color: var(--brown);
}

.overlay__qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay__url {
  margin: calc(18 * var(--u)) 0 0;
  max-width: 100%;
  font-size: max(13px, calc(16 * var(--u)));
  font-weight: 300;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.overlay .btn { margin-top: calc(32 * var(--u)); }

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Solo DEMO: anteprima email
   Pulsante in basso a destra della schermata 5, fuori dall'impaginazione della slide
   ========================================================================== */
.demo-preview {
  position: absolute;
  right: calc(40 * var(--u));
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.demo-preview__btn {
  min-height: var(--touch-min);
  padding: 0 18px;
  border: var(--border) solid var(--brown);
  border-radius: var(--radius-btn);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.demo-preview__note {
  margin: 0;
  font-size: 12px;
  font-weight: 300;
}

.overlay__panel--email {
  width: min(100%, 680px);
  padding: 20px;
}

.email-frame {
  display: block;
  flex: none; /* il pannello non deve schiacciarlo: si scorre il pannello */
  width: 100%;
  max-width: 600px;
  height: 70vh;
  border: 0;
  border-radius: 8px;
  pointer-events: none; /* niente link cliccabili; si scorre il pannello */
}

/* ==========================================================================
   Informative (informativa-privacy.html)
   .doc = il "foglio" con il testo: uguale nella pagina aperta da sola
   (es. dal link nell'email) e dentro la finestra sovrapposta del tablet.
   Misure in px: è un documento da leggere, non una slide.
   ========================================================================== */
.doc {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px clamp(20px, 5vw, 48px) 40px;
  background: var(--white);
  color: var(--brown);
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
}

.doc__head {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.doc__logo {
  display: block;
  width: 180px;
  height: auto;
  margin-bottom: 16px;
}

.doc__company {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.45;
}

.doc__title {
  margin: 28px 0 8px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.doc h2 {
  margin: 28px 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.doc p { margin: 0 0 12px; }

.doc ul {
  margin: 0 0 12px;
  padding-left: 28px;
}

.doc li { margin-bottom: 6px; }

/* Elenchi "a) … h)": la lettera è nel testo, rientro sporgente come nel PDF */
.doc .doc__letters {
  list-style: none;
  padding-left: 28px;
}

.doc .doc__letters li {
  padding-left: 1.4em;
  text-indent: -1.4em;
}

.doc__error {
  margin: 0;
  padding: 32px 16px;
  font-size: 18px;
  text-align: center;
}

/* Pagina aperta da sola: pagina normale, scorrevole e selezionabile (niente blocchi kiosk) */
body.doc-page {
  display: block;
  padding: clamp(0px, 3vw, 32px) 0;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
  overscroll-behavior: auto;
}

body.doc-page .doc { border-radius: clamp(0px, 1.5vw, 12px); }

/* Sul tablet: il foglio scorre dentro la finestra, il pulsante CHIUDI resta sempre visibile sotto */
.overlay__panel--doc {
  width: min(100%, 900px);
  height: 100%;
  overflow: hidden;
  padding: 16px 16px 20px;
}

.doc-box {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--white);
  border-radius: 8px;
}

.overlay .overlay__panel--doc .btn { margin-top: 16px; }

/* ==========================================================================
   admin.html – pagina riservata
   Stessi token e font della landing, ma pagina "normale": niente blocchi kiosk
   ========================================================================== */
body.admin {
  display: block;
  min-height: 100vh;
  padding: 24px max(16px, 4vw) 48px;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
  overscroll-behavior: auto;
}

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

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-header__logo { width: 140px; height: auto; align-self: center; }

.admin-header__title {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.admin-header__updated {
  margin: 0 0 0 auto;
  font-size: 14px;
  font-weight: 300;
}

.admin-banner {
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 12px 16px;
  border: var(--border) dashed var(--brown);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.admin-main { max-width: 1200px; margin: 24px auto 0; }

/* Riga di riquadri numerici */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi {
  padding: 20px;
  background: var(--white);
  border-radius: 12px;
}

.kpi__label {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.kpi__value {
  margin: 8px 0 0;
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Valore con un problema: icona + colore, mai solo colore */
.kpi__value.has-issue::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
}

.kpi__detail {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 300;
}

.meter {
  height: 8px;
  margin-top: 14px;
  border-radius: 4px;
  background: var(--brown-15);
  overflow: hidden;
}

.meter__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--brown);
}

/* Tabella */
.admin-panel {
  margin-top: 24px;
  padding: 20px;
  background: var(--white);
  border-radius: 12px;
}

.admin-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-panel__title { margin: 0; font-size: 18px; font-weight: 500; }

.admin-export {
  min-width: 0;
  min-height: var(--touch-min);
  padding: 0 20px;
  font-size: 15px;
}

.admin-status {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
}

.table-wrap { overflow-x: auto; margin-top: 8px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--brown-15);
  text-align: left;
  vertical-align: middle;
}

.admin-table th { font-weight: 500; white-space: nowrap; }
.admin-table td { font-weight: 300; }
.admin-table .is-nowrap { white-space: nowrap; }
.admin-table .is-code { font-variant-numeric: tabular-nums; letter-spacing: 0.03em; white-space: nowrap; }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brown);
}
.status--error::before { background: var(--red); }

.admin-link {
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}
