:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #0284c7;
  --blue-hover: #0369a1;
  --blue-soft: #e0f2fe;
  --blue-border: rgba(2, 132, 199, 0.2);
  --red: #e11d48;
  --red-hover: #be123c;
  --red-soft: #ffe4e6;
  --hero: #090d16;
  --hero-fg: #f8fafc;
  --hero-muted: #94a3b8;
  --hero-line: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 32px -8px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07090e;
    --surface: #0e131d;
    --surface-alt: #141b29;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --line: #1e293b;
    --blue: #38bdf8;
    --blue-hover: #7dd3fc;
    --blue-soft: rgba(56, 189, 248, 0.12);
    --blue-border: rgba(56, 189, 248, 0.25);
    --red: #fb7185;
    --red-hover: #fda4af;
    --red-soft: rgba(251, 113, 133, 0.12);
    --hero: #04060a;
    --hero-line: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 12px 32px -8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.65 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.025em;
  line-height: 1.22;
  color: var(--fg);
  font-weight: 700;
}
h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); margin: 0 0 .4em; font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.85rem); margin: 1.8em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.2em 0 .4em; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Intestazione */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand {
  font-weight: 800;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.brand:hover { text-decoration: none; }
.brand span {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.main-nav { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  white-space: nowrap;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: .93rem;
  font-weight: 600;
  transition: all .15s ease;
}
.main-nav a:hover { color: var(--fg); background: var(--blue-soft); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--fg); background: var(--blue-soft); }
.lang select {
  font: inherit; font-size: .88rem; font-weight: 500;
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  cursor: pointer; outline: none; transition: border-color .15s ease;
}
.lang select:focus { border-color: var(--blue); }
@media (max-width: 760px) {
  .header-row { gap: 10px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .main-nav { order: 3; flex-basis: 100%; }
}

/* Badge ed etichette */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 99px;
  line-height: 1.4;
  margin-bottom: 6px;
}
.badge-blue { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.badge-sky { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.badge-red { background: rgba(225, 29, 72, 0.12); color: #e11d48; }
.badge-dark { background: rgba(30, 41, 59, 0.85); color: #f1f5f9; }
.badge-indigo { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.badge-emerald { background: rgba(16, 185, 129, 0.12); color: #059669; }

.section-head { margin: 52px 0 28px; }
.section-head.center { text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3.8vw, 2.3rem); margin: 8px 0 8px; font-weight: 800; }
.section-sub { font-size: 1.05rem; color: var(--muted); margin: 0 auto; max-width: 38em; line-height: 1.5; }

/* Hero */
.hero {
  background: var(--hero);
  color: var(--hero-fg);
  padding: 56px 0;
  min-height: 420px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.hero .wrap { width: 100%; }
.hero h1 { color: #ffffff; margin: 0 0 .35em; }
.hero .lead { color: var(--hero-muted); font-size: 1.15rem; max-width: 38em; line-height: 1.6; }
.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 12px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 40px;
  align-items: center;
  min-height: 300px;
}
.hero-media {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-art {
  max-height: 270px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  display: block;
}
.hero-icon {
  width: 140px;
  height: 140px;
  border-radius: 32px;
  margin: 0 auto;
  display: block;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
.hero-blue {
  background:
    radial-gradient(900px 420px at 85% 45%, rgba(2, 132, 199, 0.28), transparent 65%),
    radial-gradient(600px 300px at 15% 10%, rgba(56, 189, 248, 0.15), transparent 50%),
    var(--hero);
}
.hero-red {
  background:
    radial-gradient(900px 420px at 85% 45%, rgba(225, 29, 72, 0.28), transparent 65%),
    radial-gradient(600px 300px at 15% 10%, rgba(251, 113, 133, 0.15), transparent 50%),
    var(--hero);
}
.hero-home {
  padding: 68px 0 88px;
  min-height: 420px;
  background:
    radial-gradient(1000px 450px at 25% 15%, rgba(2, 132, 199, 0.32), transparent 60%),
    radial-gradient(1000px 450px at 85% 85%, rgba(225, 29, 72, 0.22), transparent 60%),
    var(--hero);
}
.hero-content.center .lead { margin-left: auto; margin-right: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.actions.center { justify-content: center; }

@media (max-width: 860px) {
  .hero { padding: 48px 0; min-height: auto; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; min-height: auto; }
  .hero-media { order: -1; max-width: 440px; margin: 0 auto; }
  .hero-art { max-height: 220px; }
  .hero-icon { width: 100px; height: 100px; border-radius: 22px; }
}

/* Pulsanti */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: .96rem;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.25;
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-blue {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}
.btn-blue:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}
.btn-red {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #fff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.3);
}
.btn-red:hover {
  background: linear-gradient(135deg, #be123c, #e11d48);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
}
.btn-ghost {
  border: 1px solid var(--line);
  color: var(--fg);
  background: var(--surface);
}
.btn-ghost:hover { background: var(--surface-alt); }
.hero .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}
.hero .btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }
.btn-disabled {
  background: rgba(127, 127, 127, 0.14);
  color: var(--muted);
  cursor: default;
}
.btn-disabled:hover { transform: none; }
.hero .btn-disabled { color: var(--hero-muted); background: rgba(255,255,255,0.08); }

/* App Cards (Home Page) */
.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  margin-top: -40px;
  position: relative;
  z-index: 10;
}
.app-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .22s ease, border-color .22s ease;
  position: relative;
  overflow: hidden;
}
.app-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-blue:hover { border-color: var(--blue); }
.card-red:hover { border-color: var(--red); }
.app-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.card-blue::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.card-red::before { background: linear-gradient(90deg, #e11d48, #fb7185); }
.app-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.app-card img {
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.app-card h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.app-card p {
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.55;
}
.app-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-weight: 700;
  font-size: .92rem;
}
.card-blue .app-card-bottom { color: var(--blue); }
.card-red .app-card-bottom { color: var(--red); }
.app-card-bottom .arrow { transition: transform .18s ease; }
.app-card:hover .arrow { transform: translateX(4px); }

/* Sezione Mockup e Gallerie: massimo 2 affiancati per perfetta simmetria */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 28px 0;
}
.gallery-grid-4 {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 760px) {
  .gallery,
  .gallery-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Showcase organizzato per tipo (Smartphone vs Android Auto) */
.showcase-group {
  margin-top: 36px;
}
.showcase-label {
  margin-bottom: 18px;
}
.showcase-label h3 {
  font-size: 1.25rem;
  margin: 6px 0 0;
  color: var(--fg);
}
.gallery-duo-phones {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  max-width: 760px;
  margin: 0 auto;
}
.gallery-duo-cars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin: 0 auto;
}
@media (max-width: 720px) {
  .gallery-duo-phones,
  .gallery-duo-cars {
    grid-template-columns: 1fr;
  }
}

.gallery-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .25s ease, border-color .25s ease;
}
.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(2, 132, 199, 0.3);
}
.gallery-wide {
  grid-column: 1 / -1;
}

/* Mockup Smartphone */
.mockup-phone {
  position: relative;
  background: #090d16;
  border: 8px solid #1a2233;
  border-radius: 36px;
  overflow: hidden;
  box-shadow: 0 16px 36px -10px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08);
  margin: 0 auto;
  max-width: 245px;
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .25s ease;
}
.mockup-phone::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 4px;
  background: #334155;
  border-radius: 99px;
  z-index: 2;
}
.mockup-phone img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 26px;
}
.gallery-card:hover .mockup-phone {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px -10px rgba(15, 23, 42, 0.4), 0 0 0 1px var(--blue);
}

/* Mockup Infotainment Auto (Android Auto) */
.mockup-car {
  position: relative;
  background: #090d16;
  border: 8px solid #182030;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .25s ease;
}
.mockup-car img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}
.gallery-card:hover .mockup-car {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px -10px rgba(2, 132, 199, 0.35), 0 0 0 1px var(--blue);
}

.gallery-card figcaption {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.gallery-card figcaption h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 6px 0 4px;
  color: var(--fg);
  letter-spacing: -0.015em;
}
.gallery-card figcaption p {
  font-size: .88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}
.gallery-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Sezioni & card informative */
.band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 28px 28px;
  margin-top: 36px;
  box-shadow: var(--shadow-sm);
}
.intro { font-size: 1.15rem; line-height: 1.6; margin-top: 32px; color: var(--fg); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-top: 24px; }
@media (max-width: 840px) { .two-col { grid-template-columns: 1fr; gap: 0; } }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 20px 0; }
@media (max-width: 680px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease;
}
.feature:hover { border-color: rgba(2, 132, 199, 0.3); }
.band .feature { background: var(--bg); }
.feature h3 { margin-top: 0; font-size: 1.15rem; color: var(--fg); }
.feature p { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.55; }
.checks { padding-left: 1.2em; }
.checks li { margin: .5em 0; line-height: 1.55; }
.steps li { margin: .6em 0; line-height: 1.55; }

/* Prezzo */
.price-band { text-align: center; padding: 36px 24px; }
.price { display: flex; flex-direction: column; align-items: center; }
.price .amount {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--fg), var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.price .muted { font-size: .95rem; margin-top: 4px; }

/* Documentazione */
.docs-head { padding-top: 40px; }
.search { position: relative; max-width: 640px; margin: 18px 0; }
.search input {
  width: 100%; font: inherit; padding: 13px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  box-shadow: var(--shadow-sm); transition: all .15s ease;
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); }
#search-status { min-height: 1.6em; margin: 6px 0 0; font-size: .93rem; }
.docs-grid { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start; margin-top: 16px; }
.toc { position: sticky; top: 88px; max-height: calc(100vh - 108px); overflow: auto; font-size: .93rem; padding-bottom: 24px; }
.toc summary { font-weight: 700; cursor: pointer; margin-bottom: 8px; }
.toc ol { list-style: none; padding-left: 0; margin: 0; }
.toc > details > ol > li { margin: 12px 0; }
.toc > details > ol > li > a { font-weight: 700; color: var(--fg); }
.toc ol ol { padding-left: 14px; border-left: 2px solid var(--line); margin-top: 6px; }
.toc ol ol li { margin: 4px 0; }
.toc a { color: var(--muted); text-decoration: none; transition: color .15s ease; }
.toc a:hover, .toc a.active { color: var(--blue); }
.toc li.hidden { display: none; }
.doc-group > h2 { margin-top: 1.4em; padding-top: 12px; border-top: 1px solid var(--line); }
.doc-group:first-child > h2 { border-top: 0; }
.doc-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 24px 18px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.doc-section.hidden, .doc-group.hidden { display: none; }
.doc-section h3 { position: relative; font-size: 1.25rem; }
.doc-section .anchor { position: absolute; left: -18px; color: var(--muted); text-decoration: none; opacity: 0; }
.doc-section h3:hover .anchor { opacity: 1; }
.doc-section table { border-collapse: collapse; width: 100%; font-size: .95rem; margin: 16px 0; }
@media (max-width: 600px) { .doc-section table { display: block; overflow-x: auto; } }
.doc-section th, .doc-section td { text-align: left; border-bottom: 1px solid var(--line); padding: 8px 12px 8px 0; vertical-align: top; }
.note { border-left: 4px solid var(--blue); background: var(--blue-soft); padding: 10px 16px; border-radius: 0 10px 10px 0; margin: 14px 0; }
.warn { border-left: 4px solid var(--red); background: var(--red-soft); padding: 10px 16px; border-radius: 0 10px 10px 0; margin: 14px 0; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); vertical-align: middle; }
mark { background: rgba(255, 196, 0, .35); color: inherit; border-radius: 3px; }

@media (max-width: 900px) {
  .docs-grid { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; background: var(--surface); }
  .doc-section { padding: 6px 18px 14px; }
}

/* Box Adattatore consigliato (Amazon) */
.adapter-box {
  display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid #ff9900;
  border-radius: var(--radius); padding: 18px 24px; margin: 24px 0;
  box-shadow: var(--shadow-sm);
}
.adapter-box h3 { margin: 0 0 .3em; font-size: 1.15rem; }
.adapter-box p { margin: .25em 0; font-size: .93rem; }
.doc-section .adapter-box, .band .adapter-box { background: var(--bg); }
.small { font-size: .83rem; }
.btn-amazon {
  background: #ff9900;
  color: #111;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(255, 153, 0, 0.3);
}
.btn-amazon:hover { background: #f08c00; transform: translateY(-1px); }

/* Piè di pagina */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  font-size: .92rem;
  background: var(--surface);
}
.site-footer p { margin: .45em 0; }
