/* ════════════════════════════════════════════════════════════════════════════
   UV-K5 V3 Firmware IJV — Manual Stylesheet
   Design: moderno, leggibile, animazioni fluide, mobile-first
   ════════════════════════════════════════════════════════════════════════════ */

/* ─── Custom Properties ──────────────────────────────────────────────────── */
:root {
  /* Brand */
  --navy:          #1e3a5f;
  --navy-dark:     #0d1e35;
  --navy-light:    #2d5a8e;
  --red:           #e94560;
  --blue:          #4a9edd;
  --blue-light:    #7ec8f8;
  --gold:          #f0c040;
  --green:         #48bb78;

  /* Superfici */
  --bg-page:       #f0f4f9;
  --bg-card:       #ffffff;
  --bg-sidebar:    #162236;
  --bg-topbar:     #0d1a2e;
  --bg-code:       #f0f4f8;

  /* Testo */
  --text-primary:  #1a2a3a;
  --text-secondary:#4a5a6a;
  --text-muted:    #8a9bb0;
  --text-white:    #f0f4f8;

  /* Bordi e ombre */
  --border:        #dde4ee;
  --shadow-xs:     0 1px 4px rgba(0,0,0,0.06);
  --shadow-sm:     0 2px 10px rgba(0,0,0,0.08);
  --shadow-md:     0 6px 24px rgba(0,0,0,0.12);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.18);
  --shadow-glow:   0 0 30px rgba(74,158,221,0.25);

  /* Raggi */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  28px;

  /* Font */
  --font:  'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono:  'Consolas', 'Fira Code', 'Cascadia Code', monospace;

  /* Layout */
  --topbar-h:   64px;
  --sidebar-w:  264px;

  /* Animazioni */
  --ease:  cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.15s;
  --t-mid:  0.25s;
  --t-slow: 0.4s;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--navy); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-code);
  padding: 2px 7px;
  border-radius: var(--r-sm);
  color: #c0392b;
  border: 1px solid var(--border);
}

/* ─── Top Navigation Bar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 1000;
  box-shadow: 0 2px 16px rgba(0,0,0,0.35);
  gap: 12px;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--navy-light), var(--blue), var(--red));
  opacity: 0.6;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-white);
  font-weight: 700;
  font-size: 1.05em;
  flex-shrink: 0;
}
.topbar-logo:hover { color: var(--blue-light); text-decoration: none; }

.logo-icon { font-size: 1.5em; filter: drop-shadow(0 0 6px rgba(74,158,221,0.5)); }

.logo-fw {
  color: var(--blue);
  font-weight: 400;
  font-size: 0.82em;
  opacity: 0.9;
}

.topbar-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.topbar-nav a {
  color: rgba(255,255,255,0.65);
  padding: 7px 16px;
  border-radius: var(--r-sm);
  font-size: 0.875em;
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
}
.topbar-nav a:hover {
  color: white;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  font-size: 1.2em;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  margin-left: 8px;
  transition: background var(--t-fast) var(--ease);
}
.menu-toggle:hover { background: rgba(255,255,255,0.15); }

/* ─── Language Switcher ──────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  border-left: 1px solid rgba(255,255,255,0.12);
  padding-left: 14px;
  margin-left: 6px;
  flex-shrink: 0;
}

.lang-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 8px;
  line-height: 1;
  padding: 6px;
  cursor: pointer;
  opacity: 0.45;
  transition:
    opacity  var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
  position: relative;
}

.lang-btn:hover {
  opacity: 0.9;
  transform: scale(1.2);
}

.lang-btn.active {
  opacity: 1;
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.08);
}

.lang-flag {
  display: block;
  width: 32px;
  height: 22px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18);
}

/* Tooltip con nome lingua */
.lang-btn::after {
  content: attr(title);
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: white;
  font-size: 0.6em;
  font-family: var(--font);
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  z-index: 10;
}
.lang-btn:hover::after { opacity: 1; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  overflow-y: auto;
  padding: 20px 0 40px;
  z-index: 100;
  transition: transform var(--t-mid) var(--ease);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidebar::-webkit-scrollbar       { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-header {
  color: rgba(255,255,255,0.35);
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  color: rgba(255,255,255,0.6);
  font-size: 0.875em;
  font-weight: 400;
  transition: all var(--t-fast) var(--ease);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar a:hover {
  color: white;
  background: rgba(255,255,255,0.06);
  border-left-color: rgba(74,158,221,0.5);
  text-decoration: none;
}
.sidebar a.active {
  color: white;
  background: rgba(74,158,221,0.12);
  border-left-color: var(--blue);
  font-weight: 600;
}

/* ─── Main Content Area ──────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

/* ─── Page Hero ──────────────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(
    135deg,
    var(--hero-color, var(--navy)) 0%,
    color-mix(in srgb, var(--hero-color, var(--navy)) 55%, #000) 100%
  );
  padding: 52px 48px;
  display: flex;
  align-items: center;
  gap: 28px;
  color: white;
  position: relative;
  overflow: hidden;
}

/* Effetto luce radiale di sfondo */
.page-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 65%);
  animation: hero-pulse 5s ease-in-out infinite;
}
.page-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 30%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(74,158,221,0.08) 0%, transparent 65%);
  animation: hero-pulse 7s ease-in-out infinite reverse;
}

@keyframes hero-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.15); opacity: 0.7; }
}

.hero-icon {
  font-size: 4.5em;
  line-height: 1;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  animation: float-icon 4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0px);  }
  50%       { transform: translateY(-8px); }
}

.hero-text { position: relative; z-index: 1; }

.hero-title {
  font-size: 2.2em;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.05em;
  opacity: 0.75;
  font-weight: 300;
}

/* ─── TOC rapido ─────────────────────────────────────────────────────────── */
.page-toc {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  box-shadow: var(--shadow-xs);
}

.toc-label {
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-basis: 100%;
  margin-bottom: 4px;
}

.page-toc a {
  font-size: 0.875em;
  color: var(--blue);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(74,158,221,0.3);
  transition: all var(--t-fast) var(--ease);
}
.page-toc a:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  text-decoration: none;
}

/* ─── Content Body ───────────────────────────────────────────────────────── */
.content-body {
  padding: 36px 48px;
  max-width: 920px;
}

/* ─── Manual Section Card ────────────────────────────────────────────────── */
.manual-section {
  background: var(--bg-card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 32px;
  margin-bottom: 28px;
  border: 1px solid var(--border);

  /* Animazione scroll reveal */
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-slow) var(--ease),
              transform var(--t-slow) var(--ease);
}

.manual-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Linea colorata superiore al hover */
.manual-section {
  position: relative;
  overflow: hidden;
}
.manual-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--navy-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}
.manual-section:hover::before { transform: scaleX(1); }

.section-title {
  font-size: 1.45em;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  line-height: 1.3;
}

.section-subtitle {
  font-weight: 400;
  font-size: 0.78em;
  color: var(--text-muted);
}

/* ─── Trigger Box ────────────────────────────────────────────────────────── */
.trigger-box {
  background: linear-gradient(135deg, #e8f4fd 0%, #dbeeff 100%);
  border: 1px solid #aed6f5;
  border-left: 4px solid var(--blue);
  border-radius: var(--r-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.trigger-label {
  display: block;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #1e6fa0;
  margin-bottom: 6px;
}

.trigger-text {
  color: var(--text-primary);
  font-size: 0.95em;
  line-height: 1.5;
}

/* ─── Description Block ──────────────────────────────────────────────────── */
.desc-block {
  margin-bottom: 20px;
}

.desc-block p {
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.75;
  font-size: 0.95em;
}

/* ─── Keys Box ───────────────────────────────────────────────────────────── */
.keys-box {
  background: #111d2e;
  border-radius: var(--r-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid #1e3050;
}

.keys-label {
  display: block;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 14px;
}

.keys-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Tasto fisico animato */
kbd.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 12px;
  background: linear-gradient(180deg, #f8f9fa 0%, #e8ecf0 100%);
  color: #1a2332;
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #c8cdd5;
  border-bottom: 3px solid #a0a8b4;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.8);
  white-space: nowrap;
  cursor: default;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              border-bottom-width var(--t-fast) var(--ease);
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

kbd.key:hover {
  transform: translateY(2px);
  border-bottom-width: 1px;
  box-shadow: 0 0 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.6);
}

kbd.key:active {
  transform: translateY(3px);
  border-bottom-width: 0;
}

.key-action {
  color: rgba(255,255,255,0.85);
  font-size: 0.9em;
  line-height: 1.4;
  flex: 1;
}

.key-note {
  color: rgba(255,255,255,0.45);
  font-size: 0.82em;
  font-style: italic;
}

/* ─── Screenshot Box ─────────────────────────────────────────────────────── */
.screenshot-box {
  margin-bottom: 20px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}

.screen-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  margin: 0 auto;
  border: 1px solid var(--border);
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease);
}
.screen-img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

/* ─── Page Image (immagini illustrative nelle pagine) ────────────────────── */
/* Dimensione fissa: le immagini non si espandono oltre 280px.               */
/* Usare sempre class="page-img" dentro un div class="page-img-wrap".        */
.page-img-wrap {
  text-align: center;
  margin: 18px 0;
}
.page-img {
  width: 280px;          /* larghezza fissa — non dipende dal viewport       */
  max-width: 100%;       /* mai più larga del contenitore su schermi piccoli */
  height: auto;
  display: block;        /* override img globale — necessario per margin auto */
  margin: 0 auto;        /* centra l'immagine nel wrapper                    */
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

/* ─── Notes Box ──────────────────────────────────────────────────────────── */
.notes-box {
  background: #fffbeb;
  border: 1px solid #f6d860;
  border-left: 4px solid #e6a817;
  border-radius: var(--r-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.notes-label {
  display: block;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8a6a00;
  margin-bottom: 8px;
}

.note-text {
  color: #5c4a00;
  font-size: 0.9em;
  margin-bottom: 5px;
  line-height: 1.65;
}

/* ─── Source Reference ───────────────────────────────────────────────────── */
.source-ref {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 0.72em;
  color: var(--text-muted);
}
.source-ref code {
  background: none;
  color: var(--text-muted);
  border: none;
  padding: 0;
  font-size: 1em;
}

/* ─── Coming Soon ────────────────────────────────────────────────────────── */
.coming-soon { opacity: 1 !important; transform: none !important; }

.coming-soon-box {
  text-align: center;
  padding: 72px 24px;
}

.cs-icon {
  font-size: 4.5em;
  margin-bottom: 20px;
  opacity: 0.6;
  animation: float-icon 3s ease-in-out infinite;
}

.coming-soon-box h2 {
  color: var(--text-muted);
  font-size: 1.4em;
  margin-bottom: 14px;
  font-weight: 600;
}

.coming-soon-box p {
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ─── Page Navigation ────────────────────────────────────────────────────── */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 48px;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 0.875em;
  font-weight: 600;
  transition: all var(--t-mid) var(--ease);
  box-shadow: var(--shadow-xs);
  gap: 6px;
}
.nav-btn:hover {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-next { margin-left: auto; }

/* ─── Page Footer ────────────────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 28px 48px 48px;
  color: var(--text-muted);
  font-size: 0.78em;
  border-top: 1px solid var(--border);
  margin: 0 48px;
}

/* ════════════════════════════════════════════════════════════════════════════
   INDEX PAGE
   ════════════════════════════════════════════════════════════════════════════ */

body.index-page { padding-top: var(--topbar-h); }

/* ─── Index Hero ─────────────────────────────────────────────────────────── */
.index-hero {
  position: relative;
  background: linear-gradient(150deg, #060e1a 0%, #0d1e35 40%, #102a48 100%);
  padding: 100px 40px 80px;
  text-align: center;
  color: white;
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sfondo animato con onde radio */
.index-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 55%, rgba(30,58,95,0.5) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 40%, rgba(74,158,221,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 80%, rgba(233,69,96,0.06) 0%, transparent 60%);
  animation: bg-drift 10s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  0%   { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1.0; transform: scale(1.04); }
}

/* Onde radio CSS (cerchi animati) */
.radio-waves {
  position: absolute;
  right: 6%;
  top: 50%;
  transform: translateY(-50%);
  width: 180px;
  height: 180px;
  opacity: 0.08;
}

.radio-waves span {
  display: block;
  position: absolute;
  inset: 0;
  border: 2px solid white;
  border-radius: 50%;
  animation: wave-expand 3s ease-out infinite;
}
.radio-waves span:nth-child(2) { animation-delay: 1s; }
.radio-waves span:nth-child(3) { animation-delay: 2s; }

@keyframes wave-expand {
  0%   { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Stella/icona decorativa grande */
.index-hero::after {
  content: '📻';
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9em;
  opacity: 0.055;
  animation: float-icon 5s ease-in-out infinite;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-badge {
  display: inline-block;
  background: rgba(74,158,221,0.15);
  border: 1px solid rgba(74,158,221,0.35);
  color: var(--blue-light);
  padding: 7px 18px;
  border-radius: 30px;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.index-hero-title {
  font-size: 4em;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 30%, #7ec8f8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.index-hero-subtitle {
  font-size: 1.15em;
  opacity: 0.7;
  font-weight: 300;
  margin-bottom: 48px;
  letter-spacing: 0.01em;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--blue-light);
  line-height: 1;
}

.stat-label {
  font-size: 0.7em;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* CTA Button */
.hero-cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--blue) 0%, var(--navy-light) 100%);
  color: white !important;
  font-weight: 700;
  font-size: 1em;
  padding: 14px 32px;
  border-radius: 30px;
  transition: all var(--t-mid) var(--ease);
  text-decoration: none !important;
  box-shadow: 0 4px 20px rgba(74,158,221,0.4);
}
.hero-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(74,158,221,0.5);
  color: white !important;
}

/* ─── Index Content ──────────────────────────────────────────────────────── */
.index-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 40px;
}

.category-section {
  margin-bottom: 56px;
}

.category-title {
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

/* ─── Feature Card ───────────────────────────────────────────────────────── */
.card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: 26px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  overflow: hidden;

  /* Scroll reveal */
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity  var(--t-slow) var(--ease),
    transform var(--t-slow) var(--ease),
    box-shadow var(--t-mid) var(--ease),
    border-color var(--t-mid) var(--ease);
}

.card.visible { opacity: 1; transform: translateY(0); }

/* Staggered reveal */
.card:nth-child(1) { transition-delay: 0.05s; }
.card:nth-child(2) { transition-delay: 0.10s; }
.card:nth-child(3) { transition-delay: 0.15s; }
.card:nth-child(4) { transition-delay: 0.20s; }
.card:nth-child(5) { transition-delay: 0.25s; }
.card:nth-child(6) { transition-delay: 0.30s; }

/* Barra colorata in alto (appare al hover) */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--navy));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}

.card:hover {
  transform: translateY(-5px) !important;
  box-shadow: var(--shadow-lg);
  border-color: rgba(74,158,221,0.25);
  text-decoration: none;
}

.card:hover::before { transform: scaleX(1); }

.card-icon {
  font-size: 2.4em;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--card-color, var(--navy)) 12%, white);
  border-radius: var(--r-md);
  transition: transform var(--t-mid) var(--ease);
}

.card:hover .card-icon {
  transform: scale(1.12) rotate(-6deg);
}

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-size: 1.02em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-subtitle {
  font-size: 0.78em;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.card-summary {
  font-size: 0.855em;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.68em;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-ok  { background: #d1fae5; color: #065f46; }
.badge-wip { background: #fef3c7; color: #92400e; }

/* ─── Index Footer ───────────────────────────────────────────────────────── */
.index-footer {
  background: var(--bg-topbar);
  color: rgba(255,255,255,0.4);
  text-align: center;
  padding: 28px;
  font-size: 0.8em;
  line-height: 2;
}

/* ─── Fade-in utility (per elementi generici) ────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--t-slow) var(--ease),
              transform var(--t-slow) var(--ease);
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }
  .menu-toggle  { display: block; }

  .page-hero {
    padding: 36px 24px;
    flex-direction: column;
    text-align: center;
  }

  .content-body     { padding: 24px; }
  .page-nav         { padding: 20px 24px; }
  .page-footer      { padding: 20px 24px 36px; margin: 0 24px; }

  .index-hero       { padding: 72px 24px 60px; min-height: 340px; }
  .index-hero::after { display: none; }
  .index-hero-title { font-size: 2.8em; }

  .index-content    { padding: 32px 20px; }
  .cards-grid       { grid-template-columns: 1fr; }
  .hero-stats       { gap: 28px; }
}

@media (max-width: 480px) {
  .index-hero-title { font-size: 2.2em; }
  .topbar           { padding: 0 16px; }
  .hero-stats       { gap: 20px; }
  .stat-value       { font-size: 1.1em; }
}

/* ─── Credit Cards (pagina Ringraziamenti) ───────────────────────────────── */
.credit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.credit-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease);
}

.credit-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.credit-icon {
  font-size: 2.2em;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--navy) 10%, white);
  border-radius: var(--r-md);
}

.credit-info { flex: 1; min-width: 0; }

.credit-name {
  font-weight: 700;
  font-size: 1.05em;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.credit-role {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.credit-info p {
  font-size: 0.875em;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

/* ─── Download Cards (pagina Download) ───────────────────────────────────── */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
  margin-top: 20px;
}

.dl-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease);
  position: relative;
  overflow: hidden;
}

.dl-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--dl-color, var(--blue));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}

.dl-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.dl-item:hover::before { transform: scaleX(1); }

.dl-item-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dl-item-icon {
  font-size: 2em;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--dl-color, var(--blue)) 12%, white);
  border-radius: var(--r-sm);
}

.dl-item-title {
  font-weight: 700;
  font-size: 1em;
  color: var(--text-primary);
  line-height: 1.3;
}

.dl-item-badge {
  display: inline-block;
  font-size: 0.68em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: color-mix(in srgb, var(--dl-color, var(--blue)) 15%, transparent);
  color: var(--dl-color, var(--blue));
  margin-top: 4px;
}

.dl-item-desc {
  font-size: 0.86em;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--dl-color, var(--blue));
  color: #fff;
  border-radius: var(--r-sm);
  text-decoration: none;
  font-size: 0.88em;
  font-weight: 600;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  align-self: flex-start;
}

.dl-btn:hover    { opacity: 0.88; transform: translateX(2px); text-decoration: none; color: #fff; }
.dl-btn-ext      { background: var(--text-secondary); }
.dl-btn-ext:hover { opacity: 0.78; }

.dl-section-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.dl-section-title:first-child { margin-top: 0; }

/* Varianti colore per .dl-item (sostituiscono --dl-color inline) */
.dl-c-fw-k5   { --dl-color: #1a6ebd; }   /* firmware UV-K5 V3  */
.dl-c-fw-k1   { --dl-color: #2a6ebd; }   /* firmware UV-K1     */
.dl-c-fw-hex  { --dl-color: #5a3aaa; }   /* firmware HEX       */
.dl-c-flash   { --dl-color: #2d8a3e; }   /* flash script       */
.dl-c-batch   { --dl-color: #1a7a6e; }   /* upload.bat         */
.dl-c-chirp   { --dl-color: #c0392b; }   /* CHIRP              */
.dl-c-python  { --dl-color: #7d3c98; }   /* Python             */
.dl-c-schema  { --dl-color: #e67e22; }   /* schematic PDF      */
.dl-c-xls     { --dl-color: #27ae60; }   /* BK4829 XLSX        */
.dl-c-log     { --dl-color: #16a085; }   /* changelog          */
.dl-c-tg      { --dl-color: #229ED9; }   /* Telegram           */
.dl-c-linux   { --dl-color: #e95420; }   /* Linux / Ubuntu     */

/* Utility margini */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

/* ─── Card color variants (--card-color via class, no inline style) ─────── */
.card-c-navy    { --card-color: #1e3a5f; }
.card-c-purple  { --card-color: #5a2d82; }
.card-c-green   { --card-color: #1a5f3a; }
.card-c-blue    { --card-color: #0d4a6e; }
.card-c-orange  { --card-color: #8a4000; }
.card-c-brown   { --card-color: #5f3a00; }
.card-c-slate   { --card-color: #3a3a5f; }
.card-c-red     { --card-color: #c0392b; }
.card-c-darkred { --card-color: #5f1e1e; }
.card-c-gold    { --card-color: #5f4a00; }
.card-c-teal    { --card-color: #1e5f5f; }
.card-c-midblue { --card-color: #2d5a8e; }

/* ─── Hero color variants (--hero-color via class, no inline style) ──────── */
.hero-c-navy    { --hero-color: #1e3a5f; }
.hero-c-teal    { --hero-color: #1a3a4a; }
.hero-c-blue    { --hero-color: #0d4a6e; }
.hero-c-green   { --hero-color: #1a5f3a; }
.hero-c-purple  { --hero-color: #5a2d82; }
.hero-c-orange  { --hero-color: #8a4000; }
.hero-c-slate   { --hero-color: #3a3a5f; }
.hero-c-red     { --hero-color: #5f1e1e; }
.hero-c-gold    { --hero-color: #5f4a00; }
.hero-c-brown   { --hero-color: #1a3a4a; }

/* ─── Card modifiers ─────────────────────────────────────────────────────── */
/* Card statica: già visibile, non soggetta ad animazione scroll-reveal       */
.card--static           { opacity: 1; transform: none; }
/* Icona grande (es. ✅ / ❌ nelle card riepilogo)                            */
.card-icon--lg          { font-size: 1.6em; }
/* Titolo colorato per card "aggiunto" / "rimosso"                            */
.card-title--added      { color: #1a5f3a; }
.card-title--removed    { color: #c0392b; }
/* Card summary con margine top quando segue direttamente il titolo           */
.card-summary--mt       { margin-top: 8px; }
/* Cards grid con bottom margin ridotto                                       */
.cards-grid--compact    { margin-bottom: 8px; }

/* ─── Feature list (lista puntata dentro card) ───────────────────────────── */
.feature-list           { padding-left: 16px; line-height: 2; }
.feature-list-note      { margin-top: 12px; font-size: 0.85em; color: #888; }

/* ─── Danger notes box (avvisi gravi, es. limiti di trasmissione) ────────── */
.notes-box--danger                  { background: #fff5f5; border-color: #e74c3c; border-left-color: #c0392b; }
.notes-box--danger .notes-label     { color: #7b0000; }
.notes-box--danger .note-text       { color: #5a0000; }

/* ─── kbd inline (shortcut nel testo corrente, senza effetto tasto 3D) ───── */
kbd.kbd-inline {
  background:    #eee;
  color:         #333;
  padding:       1px 5px;
  border-radius: 3px;
  font-size:     0.9em;
  border:        1px solid #ccc;
  box-shadow:    none;
}

/* ─── Link dentro key-action box ─────────────────────────────────────────── */
.key-action a { color: rgba(255,255,255,0.85); }

/* ─── Warn-box generica (avvisi inline nelle pagine) ─────────────────────── */
.warn-box {
  background:    rgba(200, 80, 30, .10);
  border-left:   3px solid #c85020;
  border-radius: 6px;
  padding:       .55rem .85rem;
  line-height:   1.55;
  color:         var(--text-primary);
}
.warn-box--small { margin: .6rem 0 0; font-size: .85rem; }
.dl-btn--mt      { margin-top: .5rem; }

/* ─── Banner registrazioni sospese (pagina download) ────────────────────── */
.dl-reg-closed-banner {
  display:       flex;
  align-items:   flex-start;
  gap:           .8rem;
  background:    #2a1a00;
  border:        1px solid #7a4500;
  border-left:   4px solid #f59e0b;
  border-radius: 10px;
  padding:       1rem 1.2rem;
  margin-bottom: 1.6rem;
}
.dl-reg-closed-banner__icon  { font-size: 1.6rem; flex-shrink: 0; }
.dl-reg-closed-banner__title { color: #f59e0b; font-size: 1rem; }
.dl-reg-closed-banner__desc  { margin: .35rem 0 0; color: #c8b080; font-size: .9rem; line-height: 1.5; }

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .topbar, .sidebar, .menu-toggle, .page-nav, .radio-waves { display: none !important; }
  .main-content  { margin-left: 0; }
  .page-hero     { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .manual-section { opacity: 1 !important; transform: none !important; box-shadow: none; }
}
