/* Landing di www.digital-twins.app. Colori e font presi dal tema dell'app
   (app/lib/theme/app_theme.dart, chart_colors.dart). */

@font-face {
  font-family: "Rajdhani";
  src: url("assets/fonts/Rajdhani-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("assets/fonts/Rajdhani-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/IBMPlexSans-Variable.ttf") format("truetype");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --brand-blue: #3572ec;
  --brand-lime: #8fd13f;
  --bg: #000000;
  --bg-alt: #0a0c10;
  --surface: #12151b;
  --text: #e9ecf2;
  --muted: #a3abba;
  --border: #232832;
  --accent-text: #7ea6f5;
  --lime-text: #8fd13f;
  --btn-text: #ffffff;
  --c-pow: #3572ec;
  --c-hr: #ef6b74;
  --c-wb: #8fd13f;
  --c-alt: #c98a55;
  --c-alt-fill: rgba(201, 138, 85, 0.14);
  --hero-glow: rgba(53, 114, 236, 0.22);
  /* Solo tema scuro, come l'app. */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 64px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .btn, .eyebrow {
  font-family: "Rajdhani", "IBM Plex Sans", system-ui, sans-serif;
}

h1, h2, h3 { line-height: 1.1; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.5rem, 6vw, 4.25rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); font-weight: 700; }
h3 { font-size: 1.35rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 720px) {
  .wrap { padding: 0 32px; }
}

/* Barra in alto */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.3rem;
}
.brand img { border-radius: 8px; }

/* Bottoni */
.btn {
  display: inline-block;
  padding: 0.7em 1.5em;
  border-radius: 999px;
  background: var(--brand-blue);
  color: var(--btn-text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 2px solid var(--brand-blue);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); background: #2a62d4; }
.btn:focus-visible { outline: 3px solid var(--brand-lime); outline-offset: 3px; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); }
.btn-small { padding: 0.4em 1.1em; font-size: 1rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--lime-text);
  margin-bottom: 0.6em;
}

/* Hero */
.hero {
  padding: 56px 0 72px;
  background: radial-gradient(ellipse 70% 60% at 75% 40%, var(--hero-glow), transparent 70%);
}
.hero-grid {
  display: grid;
  gap: 40px;
  align-items: center;
}
.lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 16px; }
.hero-visual { display: flex; justify-content: center; }
.hero-visual img {
  width: min(100%, 420px);
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border), 0 30px 80px -20px rgba(53, 114, 236, 0.45);
}
@media (min-width: 880px) {
  .hero { padding: 88px 0 104px; }
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; }
}

/* Sezioni */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
@media (min-width: 880px) { .section { padding: 96px 0; } }

.split { display: grid; gap: 40px; align-items: start; margin-top: 24px; }
@media (min-width: 880px) {
  .split { grid-template-columns: 0.9fr 1.1fr; }
  .split-even { grid-template-columns: 1fr 1fr; gap: 64px; }
}

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 56px;
  margin-bottom: 28px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--btn-text);
  background: var(--brand-blue);
}
.steps p { color: var(--muted); }

/* Grafico di esempio */
.chart-card {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.chart-card svg { display: block; width: 100%; height: auto; }
.chart-card path { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.c-alt { stroke: var(--c-alt); stroke-width: 2 !important; }
.c-alt-fill { fill: var(--c-alt-fill) !important; stroke: none; }
.c-pow { stroke: var(--c-pow); }
.c-hr { stroke: var(--c-hr); }
.c-wb { stroke: var(--c-wb); }
.c-crit { fill: var(--c-hr); stroke: var(--surface); stroke-width: 3; }
.c-crit-label { fill: var(--text); font-family: "IBM Plex Sans", sans-serif; font-size: 14px; font-weight: 600; }
figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}
.key { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.k-pow { background: var(--c-pow); }
.k-hr { background: var(--c-hr); }
.k-wb { background: var(--c-wb); }
.k-alt { background: var(--c-alt); }

/* Card */
.cards { display: grid; gap: 20px; margin-top: 24px; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.card p { color: var(--muted); margin: 0; }

.offline {
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-lime);
  background: var(--surface);
}
.offline p { color: var(--muted); }
.offline p:last-child { margin-bottom: 0; }

.footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.footer a { color: var(--muted); }

/* Modulo di iscrizione */
.muted-small { font-size: 0.95rem; color: var(--muted); }
.signup {
  display: grid;
  gap: 18px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.signup fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.signup legend, .field > span {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.signup small { font-weight: 400; color: var(--muted); }
.choice { display: grid; gap: 10px; }
@media (min-width: 520px) { .choice { grid-template-columns: 1fr 1fr; } }
.choice legend { grid-column: 1 / -1; }
.choice-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.choice-card:has(input:checked) { border-color: var(--brand-blue); background: rgba(53, 114, 236, 0.1); }
.choice-card input { margin-top: 5px; accent-color: var(--brand-blue); }
.choice-card strong { display: block; }
.choice-card small { display: block; font-size: 0.9rem; }
.field input, .field select {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.field input:focus, .field select:focus, .signup input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
}
.devices { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.devices legend { width: 100%; }
.devices label, .consent { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.devices input, .consent input { margin-top: 6px; accent-color: var(--brand-blue); }
.consent { font-size: 0.95rem; color: var(--muted); }
.signup .btn { justify-self: start; cursor: pointer; font-family: "Rajdhani", sans-serif; }
.signup .btn:disabled { opacity: 0.6; cursor: wait; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0; min-height: 1.6em; }
.form-status.success { color: var(--lime-text); }
.form-status.error { color: var(--c-hr); }
.form-status.pending { color: var(--muted); }

/* Pagine di esito e informativa */
.narrow { max-width: 720px; }
.page-title { font-size: clamp(2rem, 5vw, 3rem); }
.legal h2 { font-size: 1.6rem; margin-top: 1.6em; }
.legal ul { padding-left: 1.2em; }

/* Admin */
.admin .wrap { max-width: 1280px; }
.admin-stats { display: grid; gap: 16px; margin-bottom: 24px; }
@media (min-width: 720px) { .admin-stats { grid-template-columns: 1fr 1fr; } }
.admin-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 12px; }
.admin-filters a[aria-current] { color: var(--text); font-weight: 600; text-decoration: none; }
.admin-filters .sep { width: 1px; height: 20px; background: var(--border); }
.admin-count { color: var(--muted); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th { color: var(--muted); font-weight: 600; background: var(--surface); }
.link-button { background: none; border: 0; padding: 0; color: var(--c-hr); font: inherit; cursor: pointer; text-decoration: underline; }
.link-button.invite { color: var(--accent-text); }

/* Lingua: selettore IT/EN e barra di proposta (lang.js) */
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.lang-switch { display: flex; gap: 2px; font-family: "Rajdhani", sans-serif; font-weight: 700; font-size: 0.95rem; }
.lang-switch a {
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.lang-switch a:hover { color: var(--text); }
.lang-switch a[aria-current] { color: var(--text); background: var(--surface); }
.lang-banner { background: var(--surface); border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.lang-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.lang-banner a { color: var(--accent-text); font-weight: 600; }
.lang-banner button {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

/* Sezione "Allenamento su misura" */
.section-lead { margin-bottom: 8px; }
.section-note { margin-top: 20px; }
@media (min-width: 960px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

/* Elenco funzioni (sezione preparatori) */
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.feature-list li {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-blue);
  border-radius: 12px;
  color: var(--muted);
}
.feature-list strong { color: var(--text); }

/* Banner di consenso alle statistiche (consent.js) */
.consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
}
.consent-banner p { margin: 0; flex: 1 1 300px; }
.consent-banner a { color: var(--accent-text); }
.consent-actions { display: flex; gap: 10px; }
.consent-actions .btn { cursor: pointer; font-family: "Rajdhani", sans-serif; }
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

/* Admin: programma inviti */
.admin-h2 { margin-top: 48px; }
.admin-quota { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 16px 0; }
.admin-quota label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.admin-quota input { padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }

/* Badge degli store (Google Play, TestFlight): stile classico nero */
.store-badges { display: flex; flex-wrap: wrap; gap: 12px; }
.store-badges-hero { margin-top: 4px; }
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  padding: 7px 16px 7px 12px;
  background: #000;
  color: #fff;
  border: 1px solid #a6a6a6;
  border-radius: 10px;
  text-decoration: none;
  line-height: 1.1;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.store-badge:hover { transform: translateY(-1px); border-color: #fff; }
.store-badge:focus-visible { outline: 3px solid var(--brand-lime); outline-offset: 3px; }
.store-badge-icon { width: 26px; height: 26px; flex: none; }
.store-badge small {
  display: block;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.store-badge strong {
  display: block;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.app-download { display: flex; align-items: center; min-height: 100%; }
