/* Stile del sito allineato al logo e al design system dell'app.
   I valori vengono da lib/core/theme/mw_colors.dart, mw_tokens.dart e
   mw_type.dart: per cambiarli, cambia prima lì. */

:root {
  /* Colori del logo: identici nei due temi. */
  --brand-deep: #2f41a7;
  --brand-indigo: #544bc1;
  --brand-violet: #8352e0;
  --brand-gradient: linear-gradient(45deg, var(--brand-deep) 0%, var(--brand-indigo) 50%, var(--brand-violet) 100%);

  --canvas: #f4f3fa;
  --surface: #ffffff;
  --surface-muted: #eeecf6;
  --border: #e4e1ee;
  --border-strong: #8a8699;
  --ink: #1c1b22;
  --ink-muted: #56536b;
  --primary: #544bc1;
  --primary-hover: #4038a8;
  --on-primary: #ffffff;
  --primary-soft: #ede9fb;
  --on-primary-soft: #4038a8;
  --ai: #7442d6;
  --positive: #0b7285;
  --danger: #c0362c;
  --aura-indigo: rgba(84, 75, 193, 0.14);
  --aura-violet: rgba(131, 82, 224, 0.12);
  --glass: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(228, 225, 238, 0.9);
  --card-shadow: 0 1px 2px rgba(28, 27, 34, 0.04), 0 16px 40px -12px rgba(47, 65, 167, 0.14);
  --brand-shadow: 0 24px 60px -24px rgba(47, 65, 167, 0.55);

  --font-display: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-text: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 14px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --maxw: 1040px;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0d0c12;
    --surface: #1a1922;
    --surface-muted: #26242f;
    --border: #2f2d3c;
    --border-strong: #77738c;
    --ink: #ececf2;
    --ink-muted: #a5a2b8;
    --primary: #a99bff;
    --primary-hover: #c9c0ff;
    --on-primary: #1b1640;
    --primary-soft: #241f3d;
    --on-primary-soft: #c9c0ff;
    --ai: #c4a8ff;
    --positive: #5cc7d4;
    --danger: #ff8f80;
    --aura-indigo: rgba(84, 75, 193, 0.3);
    --aura-violet: rgba(131, 82, 224, 0.22);
    --glass: rgba(32, 30, 44, 0.62);
    --glass-edge: rgba(255, 255, 255, 0.08);
    /* Nel tema scuro le card si staccano con un filetto, non con l'ombra. */
    --card-shadow: 0 0 0 1px var(--border);
    --brand-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }

/* Nessun elemento deve poter allargare il documento oltre il viewport:
   sul telefono l'header a flex lo faceva, trascinando tutta la pagina. */
html, body { max-width: 100%; overflow-x: hidden; }

body {
  position: relative;
  min-height: 100vh; /* l'aura non va tagliata sulle pagine corte */
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* L'aura dell'app: i due bagliori del logo in alto, indaco da sinistra e
   viola da destra, che svaniscono scendendo. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 560px;
  background:
    radial-gradient(130% 100% at 0% 0%, var(--aura-indigo), transparent 72%),
    radial-gradient(110% 90% at 100% 0%, var(--aura-violet), transparent 72%);
  pointer-events: none;
  z-index: -1;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a {
  color: var(--primary);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--primary-hover); }

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

/* ---- Testata: vetro sopra il contenuto, come la navigazione dell'app ---- */

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--canvas); /* fallback senza backdrop-filter */
  border-bottom: 1px solid var(--glass-edge);
}
@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
  header.site {
    background: var(--glass);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    backdrop-filter: blur(12px) saturate(1.4);
  }
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }

/* La tessera del logo ufficiale: stesso raggio dell'icona (114/512). */
.brand .mark {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 22.3%;
  box-shadow: 0 4px 12px -4px rgba(47, 65, 167, 0.5);
}

/* Il margine negativo compensa il padding delle voci: il testo resta
   allineato ai bordi del contenuto. */
nav.site {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 -12px;
}
nav.site a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
nav.site a:hover,
nav.site a[aria-current="page"] { color: var(--ink); background: var(--surface-muted); }

/* ---- Hero: il gradiente del logo, come la testata del login ---- */

.hero-wrap { padding-top: 32px; }

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 56px;
  padding: 0 56px; /* in verticale lo danno il testo e il telefono */
  border-radius: var(--radius-xl);
  background: var(--brand-gradient);
  box-shadow: var(--brand-shadow);
  color: #fff;
}
/* Il riflesso chiaro in alto a sinistra, come sulla tessera dell'icona. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 90% at 30% 20%, rgba(255, 255, 255, 0.1), transparent 100%);
  pointer-events: none;
}
.hero > * { position: relative; }

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  max-width: 16ch;
  color: #fff;
}
.hero p.lead {
  font-size: 1.15rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  max-width: 52ch;
  margin: 0;
}

.hero-copy { padding: 64px 0; }
.hero .glyph {
  display: block;
  width: 84px;
  height: auto;
  margin: -14px 0 12px -14px;
}

/* Il telefono sale dal bordo inferiore del riquadro e viene tagliato. */
.hero-phone { align-self: end; padding-top: 48px; }
.hero-phone .phone { width: 300px; margin-bottom: -190px; }

/* ---- Telefono: cornice disegnata attorno agli screenshot dell'app ---- */

.phone {
  container-type: inline-size;
  position: relative;
  width: 100%;
  margin: 0;
  background: #0d0c12;
  /* Angoli circolari su un rettangolo alto: raggio orizzontale e verticale. */
  border-radius: 15% / 7.2%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 30px 60px -24px rgba(13, 12, 18, 0.55);
}
.phone .screen {
  position: relative;
  overflow: hidden;
  margin: 10px;
  margin: 3.5cqw;
  border-radius: 12.5% / 5.75%;
  background: var(--canvas);
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
}
/* La Dynamic Island, che lo screenshot del simulatore non contiene. */
.phone .screen::after {
  content: "";
  position: absolute;
  top: 2.3cqw;
  left: 50%;
  width: 26.6cqw;
  height: 7.8cqw;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
}

/* ---- Galleria delle schermate ---- */

.shots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px 24px;
  margin-top: 32px;
}
.shot { margin: 0; }
.shot .phone { max-width: 236px; margin: 0 auto; }
.shot figcaption {
  max-width: 236px;
  margin: 20px auto 0;
  color: var(--ink-muted);
  font-size: 0.94rem;
  line-height: 1.5;
}
.shot figcaption strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

/* ---- Sezioni ---- */

section { padding: 48px 0; }
section > .wrap > h2 {
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 8px;
}
section > .wrap > p.sub {
  color: var(--ink-muted);
  margin: 0 0 28px;
  max-width: 62ch;
}
section > .wrap > h2 + .grid { margin-top: 24px; }

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 26px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.card p { margin: 0; color: var(--ink-muted); font-size: 0.97rem; }

/* La scintilla segna solo ciò che fa l'AI, come nell'app. */
.spark {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 6px;
  vertical-align: -0.12em;
  color: var(--ai);
  fill: currentColor;
}

.step-n {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--on-primary-soft);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 30px;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--ink-muted);
}
.checklist li {
  position: relative;
  padding-left: 34px;
  margin-bottom: 14px;
}
.checklist li:last-child { margin-bottom: 0; }
/* Cerchio chiaro con la spunta nel colore primario. */
.checklist li::before,
.checklist li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.checklist li::before { background: var(--primary-soft); }
.checklist li::after {
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.2 3.2L17 9' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background: var(--on-primary-soft);
  -webkit-mask: var(--check) center / 16px no-repeat;
  mask: var(--check) center / 16px no-repeat;
}
.checklist li strong { color: var(--ink); font-weight: 600; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn:active { transform: scale(0.98); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--surface-muted); color: var(--ink); }

/* ---- Badge degli store (file ufficiali, non modificati) ---- */

.store-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 16px;
  margin-top: 28px;
}
.store-badge {
  display: block;
  line-height: 0;
  border-radius: 10px;
  transition: transform 0.2s var(--ease);
}
.store-badge:hover { transform: translateY(-2px); }
.store-badge img { display: block; width: auto; height: 56px; }
/* Il PNG di Google Play ha 29px trasparenti sopra e sotto su 250: l'immagine
   è più alta perché il badge visibile misuri 56px come quello di Apple. */
.store-badge--play img { height: 72.9px; margin: -8.45px 0; }

.trademarks {
  margin: 32px 0 0;
  max-width: 72ch;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* ---- Pagina Contatti ---- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 28px;
}
.doc .contact .panel { margin: 0; max-width: none; }
.contact-side { display: grid; gap: 20px; }
.doc .contact-side h2 { font-size: 1.1rem; margin: 0 0 8px; }
.contact-side p { margin: 0 0 8px; }
.contact-side p:last-child { margin-bottom: 0; }
.contact-email {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-all;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--ink);
}
.field .optional {
  margin-left: 4px;
  font-weight: 500;
  color: var(--ink-muted);
}
.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  /* 16px: sotto questa misura Safari su iPhone ingrandisce la pagina. */
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 12px 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%238a8699' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field [aria-invalid="true"] { border-color: var(--danger); }
.field .field-error {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--danger);
}

/* La trappola per i bot resta fuori dallo schermo. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-note { margin: 0 0 20px; font-size: 0.9rem; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.btn:disabled { opacity: 0.7; cursor: progress; }
.form-status { margin: 0; font-weight: 600; font-size: 0.95rem; }
.form-status:empty { display: none; }
.form-status.is-ok { color: var(--positive); }
.form-status.is-error { color: var(--danger); }

/* ---- Piè di pagina ---- */

footer.site {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 32px 0 56px;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
footer.site a { color: var(--ink-muted); }
footer.site a:hover { color: var(--ink); }

/* ---- Pagine di testo ---- */

/* Solo sopra e sotto: il padding laterale resta quello di .wrap. */
.doc { padding-top: 56px; padding-bottom: 8px; }
.doc h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 18px 0 14px;
}
.doc h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 40px 0 10px; }
.doc p { color: var(--ink-muted); max-width: 66ch; }
.doc p strong { color: var(--ink); }
.doc .panel { margin: 20px 0; max-width: 760px; }
.doc .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 1000px) {
  .hero { gap: 0 36px; padding: 0 40px; }
  .hero-phone .phone { width: 250px; margin-bottom: -150px; }
}

@media (max-width: 900px) {
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 0 28px;
    border-radius: 30px;
  }
  .hero-copy { padding: 36px 0 0; }
  .hero .glyph { width: 76px; margin: -8px 0 8px -10px; }
  .hero-phone { justify-self: center; padding-top: 32px; }
  .hero-phone .phone { width: 250px; margin-bottom: -230px; }
  .contact { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero-wrap { padding-top: 16px; }
  .hero { padding: 0 22px; border-radius: 26px; }
  .hero-copy { padding-top: 28px; }
  .hero p.lead { font-size: 1.05rem; }
  .hero-phone .phone { width: 230px; margin-bottom: -220px; }
  /* Le schermate scorrono in orizzontale, fino ai bordi dello schermo. */
  .shots {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    margin: 28px -16px 0;
    padding: 4px 16px 12px;
    scrollbar-width: none;
  }
  .shots::-webkit-scrollbar { display: none; }
  .shot { flex: 0 0 66%; scroll-snap-align: start; }
  .shot .phone, .shot figcaption { max-width: none; }
  .shot figcaption { text-align: left; }
  section { padding: 32px 0; }
  .panel { padding: 22px; }
  .card { padding: 22px; }
  .doc { padding-top: 36px; }
  .btn { width: 100%; }
  footer.site .wrap { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
