/* =========================================================
   SINAPSI — foglio di stile
   Nessuna risorsa di terze parti: font di sistema, nessun CDN.
   ========================================================= */

:root {
  --navy-950: #061224;
  --navy-900: #0b1b33;
  --navy-800: #12284a;
  --navy-700: #1c3a66;
  --accent: #5fd4ff;
  --accent-strong: #1f9fd6;
  --accent-ink: #0a6d99;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #0e1a2b;
  --text-muted: #4a5a70;
  --border: #d9e0ea;
  --link: #0a6d99;
  --focus: #1f9fd6;
  --todo-bg: #fff3c4;
  --todo-text: #5c4300;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgb(6 18 36 / .06), 0 8px 24px rgb(6 18 36 / .06);
  --max: 1160px;
  --gutter: clamp(16px, 4vw, 32px);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070f1d;
    --surface: #0d1a2e;
    --surface-2: #11223b;
    --text: #e7eef8;
    --text-muted: #a3b2c7;
    --border: #1f3352;
    --link: #7fdcff;
    --focus: #5fd4ff;
    --todo-bg: #4a3a00;
    --todo-text: #ffe9a3;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; margin: 0 0 .6em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.9rem); font-weight: 750; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 650; }
p { margin: 0 0 1em; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: .6em 1em; border-radius: 10px;
  box-shadow: var(--shadow);
}
.skip-link:focus { top: 12px; }

.container { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Segnaposto da completare (ben visibili, da rimuovere prima della pubblicazione) */
.todo {
  background: var(--todo-bg); color: var(--todo-text);
  padding: .05em .4em; border-radius: 6px; font-family: var(--font-mono); font-size: .88em;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(11 27 51 / .86);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgb(255 255 255 / .08);
  color: #fff;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; font-weight: 750; letter-spacing: .14em; font-size: 1.05rem; }
.brand img { width: 38px; height: 38px; }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  background: transparent; color: #fff; border: 1px solid rgb(255 255 255 / .25);
  border-radius: 10px; padding: .5rem .8rem; font: inherit; font-size: .95rem; cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }

/* Menu mobile: popover nativo (top layer, light-dismiss, Esc) */
#site-menu {
  margin: 0; padding: 1rem; list-style: none;
  inset: 76px 12px auto auto; width: min(320px, calc(100vw - 24px));
  background: var(--navy-900); color: #fff;
  border: 1px solid rgb(255 255 255 / .12); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgb(0 0 0 / .35);
}
#site-menu a {
  display: block; padding: .7rem .8rem; border-radius: 10px;
  color: #fff; text-decoration: none; font-weight: 550;
}
#site-menu a:hover, #site-menu a[aria-current="page"] { background: rgb(255 255 255 / .08); }
#site-menu .nav-cta a { background: var(--accent); color: var(--navy-950); text-align: center; margin-top: .4rem; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  /* Le regole d'autore prevalgono sul foglio UA del popover: menu sempre visibile su desktop */
  #site-menu {
    display: flex; position: static; inset: auto; width: auto; padding: 0; gap: .25rem;
    background: transparent; border: 0; box-shadow: none; overflow: visible; align-items: center;
  }
  #site-menu a { padding: .5rem .8rem; font-size: .97rem; }
  #site-menu .nav-cta a { margin: 0 0 0 .5rem; padding: .55rem 1.05rem; }
}

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 650; font-size: 1rem; line-height: 1.2;
  padding: .85rem 1.35rem; border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer; transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--navy-950); }
.btn-primary:hover { background: #8be1ff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgb(255 255 255 / .35); }
.btn-ghost:hover { background: rgb(255 255 255 / .08); }
.btn-dark { background: var(--navy-900); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-dark { background: var(--accent); color: var(--navy-950); } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: clip; color: #fff;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgb(95 212 255 / .18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgb(31 159 214 / .16), transparent 60%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  padding-block: clamp(4rem, 10vw, 8rem) clamp(4rem, 9vw, 7rem);
  margin-top: -73px; padding-top: calc(clamp(4rem, 10vw, 8rem) + 73px);
}
.hero-grid { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.15fr .85fr; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1.2rem;
  font-size: .82rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); background: rgb(95 212 255 / .1); border: 1px solid rgb(95 212 255 / .25);
  padding: .35rem .8rem; border-radius: 999px;
}
.hero h1 span { color: var(--accent); }
.hero .lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: #c9d6e8; max-width: 38em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.hero-visual { position: relative; max-width: 460px; margin-inline: auto; width: 100%; }
.hero-visual .mark { position: absolute; inset: 31%; width: 38%; filter: drop-shadow(0 0 30px rgb(95 212 255 / .35)); }

.network line { stroke: rgb(95 212 255 / .35); stroke-width: 1.2; }
.network .pulse { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 10 190; stroke-linecap: round; }
.network circle { fill: #9fe6ff; }
.network circle.hub { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .network .pulse { animation: travel 4.5s linear infinite; }
  .network .pulse:nth-of-type(2n) { animation-duration: 6s; animation-delay: -2s; }
  .network .pulse:nth-of-type(3n) { animation-duration: 5.2s; animation-delay: -3.4s; }
  .network circle { animation: glow 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .network circle:nth-of-type(2n) { animation-delay: -1.2s; }
  .network circle:nth-of-type(3n) { animation-delay: -2.4s; }
}
@keyframes travel { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }
@keyframes glow { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.25); } }

/* ---------- Sezioni ---------- */
.section { padding-block: clamp(4rem, 8vw, 6.5rem); }
.section-alt { background: var(--surface-2); }
.section-head { max-width: 46rem; margin-bottom: 2.75rem; }
.kicker { color: var(--accent-ink); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .82rem; margin-bottom: .6rem; }
@media (prefers-color-scheme: dark) { .kicker { color: var(--accent); } }
.cta .kicker, .badge-panel .kicker { color: var(--accent); }
.cta a { color: var(--accent); }
.section-head p { color: var(--text-muted); font-size: 1.12rem; }

.grid { display: grid; gap: 1.25rem; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 700px) and (max-width: 999px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.75rem; box-shadow: var(--shadow); height: 100%;
}
.card p { color: var(--text-muted); margin-bottom: 0; }
.card .icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 1.1rem;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); color: var(--accent);
}
.card .icon svg { width: 24px; height: 24px; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 3.6rem; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: .15rem; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 750; font-size: .9rem;
  background: var(--navy-900); color: var(--accent);
}

.split { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; gap: 4rem; } }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.checklist li { position: relative; padding-left: 2rem; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: .35em; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--accent-strong) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23fff' d='M8 13.6 4.4 10l-1.4 1.4L8 16.4l9-9L15.6 6z'/%3E%3C/svg%3E") center/72% no-repeat;
}

.badge-panel {
  border-radius: var(--radius-lg); padding: 2rem; color: #fff;
  background: linear-gradient(145deg, var(--navy-800), var(--navy-950));
  border: 1px solid rgb(95 212 255 / .2);
}
.badge-panel h3 { color: var(--accent); }
.badge-panel p, .badge-panel li { color: #c9d6e8; }
.badge-panel a { color: var(--accent); }

/* ---------- CTA / Contatti ---------- */
.cta {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff; border-radius: var(--radius-lg); padding: clamp(2rem, 5vw, 3.5rem);
}
.cta p { color: #c9d6e8; }

.form { display: grid; gap: 1.1rem; }
@media (min-width: 700px) { .form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; } }
.field { display: grid; gap: .4rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--text-muted); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: .75rem .9rem; width: 100%;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:user-invalid, .field textarea:user-invalid, .field select:user-invalid { border-color: #c62828; }
.form-note { font-size: .9rem; color: var(--text-muted); }
.form-status { min-height: 1.5em; font-weight: 600; }

/* ---------- Pagine legali ---------- */
.page-hero { background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: #fff; padding-block: 3.5rem 3rem; }
.page-hero p { color: #c9d6e8; margin: 0; }
.legal { padding-block: 3rem 5rem; }
.legal .prose { max-width: 50rem; }
.prose h2 { font-size: 1.45rem; margin-top: 2.4rem; padding-top: .4rem; }
.prose h3 { margin-top: 1.6rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .96rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: .7rem .8rem; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface-2); font-weight: 650; }
.table-wrap { overflow-x: auto; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 2rem; }
.toc ol { margin: .4rem 0 0; }
.callout { border-left: 4px solid var(--accent-strong); background: var(--surface); padding: 1rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; }
.meta { color: var(--text-muted); font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); color: #b7c5d9; font-size: .95rem; padding-block: 4rem 2rem; }
.site-footer a { color: #e6eef9; }
.footer-grid { display: grid; gap: 2.5rem; }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 750; letter-spacing: .14em; margin-bottom: 1rem; }
.footer-brand img { width: 34px; height: 34px; }
.site-footer h2 { font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: #fff; margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: #e6eef9; text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }
.legal-data { border-top: 1px solid rgb(255 255 255 / .1); margin-top: 3rem; padding-top: 1.5rem; font-size: .87rem; line-height: 1.7; }
.legal-data p { margin: 0 0 .4rem; }

/* ---------- Dialog privacy (nativo) ---------- */
dialog.privacy-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 0 / .4);
}
dialog.privacy-dialog:modal { overscroll-behavior: contain; }
dialog.privacy-dialog::backdrop { background: rgb(6 18 36 / .6); overflow: hidden; overscroll-behavior: contain; }
.dialog-body { padding: 1.6rem 1.6rem 1rem; }
.dialog-body h2 { font-size: 1.35rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; padding: 0 1.6rem 1.4rem; }
.pref { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--border); }
.pref:last-of-type { border-bottom: 1px solid var(--border); }
.pref strong { display: block; }
.pref span { font-size: .9rem; color: var(--text-muted); }
.pref .state { white-space: nowrap; font-weight: 650; font-size: .85rem; color: var(--text); }

/* ---------- Scroll reveal progressivo (solo dove supportato) ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
    @keyframes reveal { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  }
}

@media print {
  .site-header, .site-footer, .hero-visual, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Applicazioni ---------- */
.app-card { display: flex; flex-direction: column; gap: 1rem; }
.app-card > p { margin: 0; }
.app-head { display: flex; gap: 1rem; align-items: center; }
.app-head .icon { margin: 0; flex: none; }
.app-head h3 { margin: 0; font-size: 1.4rem; }
.app-tag { margin: .15rem 0 0; font-size: .92rem; font-weight: 600; color: var(--accent-ink) !important; }
@media (prefers-color-scheme: dark) { .app-tag { color: var(--accent) !important; } }
.app-features { margin: 0; padding-left: 1.15rem; color: var(--text-muted); font-size: .97rem; }
.app-features li { margin-bottom: .3rem; }
.app-link { margin-top: auto; align-self: flex-start; }
.app-link svg { width: 16px; height: 16px; }
.app-soon { border-style: dashed; box-shadow: none; background: transparent; }
.btn-ghost-dark { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost-dark:hover { background: var(--surface-2); }
.app-logo { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); height: 96px; display: grid; place-items: center; padding: 1rem 1.5rem; }
.app-logo img { max-height: 56px; width: auto; max-width: 100%; }
.app-logo-soon { background: transparent; border-style: dashed; }
.app-card h3 { margin: 0; font-size: 1.35rem; }

/* ---------- Storia / timeline ---------- */
.story p:first-child { font-size: 1.15rem; color: var(--text); }
.story p { color: var(--text-muted); }
.timeline { list-style: none; margin: 3.5rem 0 0; padding: 0; display: grid; gap: 1.25rem; counter-reset: none; }
@media (min-width: 800px) { .timeline { grid-template-columns: repeat(4, 1fr); } }
.timeline li { position: relative; padding: 1.5rem 1.4rem 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); border-top: 4px solid var(--accent-strong); }
.timeline .when { display: inline-block; font-weight: 750; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: .5rem; }
@media (prefers-color-scheme: dark) { .timeline .when { color: var(--accent); } }
.timeline h3 { margin-bottom: .4rem; }
.timeline p { margin: 0; color: var(--text-muted); font-size: .97rem; }
