/* styles.css — Investire Ragionato */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #F7F7F7;
  --bg-elev: #ffffff;
  --bg-deep: #efefef;
  --bg-ink: #0a0a0a;
  --ink: #0a0a0a;
  --ink-2: #27272a;
  --ink-3: #52525b;
  --ink-4: #a1a1aa;
  --hairline: rgba(0,0,0,0.08);
  --hairline-2: rgba(0,0,0,0.14);

  --accent: #0066ff;
  --accent-soft: #e6efff;
  --accent-ink: #ffffff;
  --good: #10b981;
  --warn: #ef4444;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Inter Tight", "Inter", -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1240px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* Accent presets */
.accent-blue { --accent: #0066ff; --accent-soft: #e6efff; }
.accent-violet { --accent: #6366f1; --accent-soft: #ebebfd; }
.accent-emerald { --accent: #10b981; --accent-soft: #d6f5e8; }
.accent-ink { --accent: #0a0a0a; --accent-soft: #e9e9ec; }

/* ── Dark mode ──────────────────────────────────────────────────────── */
.dark {
  --bg: #0c0c0e;
  --bg-elev: #131316;
  --bg-deep: #1c1c20;
  --bg-ink: #f4f4f5;
  --ink: #f4f4f5;
  --ink-2: #d4d4d8;
  --ink-3: #a1a1aa;
  --ink-4: #52525b;
  --hairline: rgba(255,255,255,0.07);
  --hairline-2: rgba(255,255,255,0.13);
  --good: #34d399;
  --warn: #f87171;
}
.dark.accent-blue  { --accent: #4d94ff; --accent-soft: #0d2240; }
.dark.accent-violet { --accent: #818cf8; --accent-soft: #1e1b4b; }
.dark.accent-emerald { --accent: #34d399; --accent-soft: #052e1a; }
.dark.accent-ink { --accent: #e4e4e7; --accent-soft: #27272a; }

/* Ensure dark mode applies to html/body backgrounds */
html.dark, body.dark {
  background: var(--bg);
  color: var(--ink);
}

/* dark-specific overrides */
.dark .topnav {
  background: rgba(12,12,14,0.88);
  border-bottom-color: var(--hairline-2);
}
.dark .nav-mobile-menu {
  background: rgba(12,12,14,0.97);
}
.dark .lvl-base { background: #052e1a; color: #6ee7b7; }
.dark .lvl-intermedio { background: #2d1a00; color: #fcd34d; }
.dark .lvl-avanzato { background: #2d0a0a; color: #fca5a5; }
.dark .gloss-cat-strumenti  { background: var(--accent-soft); color: var(--accent); }
.dark .gloss-cat-portafoglio { background: #052e1a; color: #34d399; }
.dark .gloss-cat-tassazione  { background: #2d1a00; color: #fcd34d; }
.dark .gloss-cat-indicatori  { background: #1e1b4b; color: #a5b4fc; }
.dark .gloss-cat-costi       { background: #2d0a0a; color: #fca5a5; }
.dark .gloss-cat-indici      { background: #0a1f2e; color: #7dd3fc; }
.dark .gloss-cat-mercati     { background: #1c1c20; color: #a1a1aa; }

/* Dark mode toggle button */
.dark-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline-2);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.dark-toggle:hover { background: var(--bg-deep); color: var(--ink); }
.dark-toggle svg { display: block; }

/* ── Base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: var(--ink); background: transparent; border: 0; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

/* ── Top nav ────────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 16px var(--gutter);
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink);
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.brand-sub { display: none; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 999px;
  transition: background 0.15s;
}
.nav-links a:hover { background: var(--bg-deep); }
.nav-links a.active { background: var(--ink); color: var(--bg); }

.nav-progress { display: flex; align-items: center; gap: 10px; }
.np-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-deep);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.np-pill .np-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.np-pill b { font-weight: 600; }
.np-pill i { font-style: normal; color: var(--ink-4); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 0;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: -0.01em;
  font-family: inherit;
  transition: transform 0.06s, background 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--accent); color: white; }
.btn.accent { background: var(--accent); color: white; }
.btn.accent:hover { background: var(--ink); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline-2); }
.btn.ghost:hover { background: var(--bg-deep); }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: clamp(56px, 8vw, 110px) 0 clamp(64px, 9vw, 120px);
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--bg-deep);
  border-radius: 999px;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}
.dot-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); position: relative; }
.dot-pulse::after {
  content: ""; position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.5;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}
.hero-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 6.5vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 28px;
  max-width: 16ch;
  text-wrap: balance;
}
.hero-title em {
  font-style: normal;
  color: var(--accent);
}
.hero-lede {
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--ink-3);
  max-width: 56ch;
  margin: 0 0 36px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 32px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.hero-stat { display: flex; flex-direction: column; gap: 2px; }
.hs-val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hs-lbl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

/* ── Diagnostic question ────────────────────────────────────────────── */
.diagnostic {
  border: 1px solid var(--hairline);
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  padding: 36px;
  margin: 56px 0 0;
}
.diag-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.diag-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.diagnostic h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.1;
}
.diag-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 560px) {
  .diag-grid { grid-template-columns: 1fr; }
}
.diag-card {
  appearance: none;
  text-align: left;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  font-family: inherit;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.diag-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.diag-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.diag-card-icon { flex-shrink: 0; }
.diag-card h4 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.015em;
  margin: 0;
}
.diag-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.5;
}
.diag-suggest {
  margin-top: 24px;
  padding: 20px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}
.diag-suggest-meta {
  display: flex; flex-direction: column; gap: 4px;
}
.diag-suggest-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.diag-suggest h4 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  margin: 0;
  letter-spacing: -0.015em;
}
.diag-suggest p { margin: 0; color: color-mix(in srgb, var(--bg) 70%, transparent); font-size: 13px; }
.diag-suggest .btn { background: var(--accent); color: white; }
.diag-suggest .btn:hover { background: var(--bg); color: var(--ink); }
@media (max-width: 600px) {
  .diag-suggest { grid-template-columns: 1fr; }
  .diag-suggest .btn { justify-self: start; }
}

/* ── Sections ───────────────────────────────────────────────────────── */
.section { padding: 80px 0; border-top: 1px solid var(--hairline); }
.section-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
  align-items: end;
}
@media (max-width: 720px) { .section-head { grid-template-columns: 1fr; gap: 16px; } }
.sh-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
  max-width: 18ch;
  text-wrap: balance;
}
.sh-lede {
  font-size: 16px;
  color: var(--ink-3);
  margin: 0;
  max-width: 52ch;
  line-height: 1.55;
}

/* ── Path roadmap (horizontal stations — fintech style) ─────────────── */
.path-roadmap {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  background: var(--bg-elev);
  overflow-x: auto;
  scrollbar-width: thin;
}
.pr-rail {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
}
.pr-station {
  flex: 1 1 0;
  min-width: 140px;
  background: transparent;
  border: 0;
  color: var(--ink);
  text-align: left;
  padding: 16px;
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; gap: 6px;
  transition: background 0.15s;
  position: relative;
  font-family: inherit;
}
.pr-station:hover { background: var(--bg); }
.pr-st-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}
.pr-station.active .pr-st-num,
.pr-station.done .pr-st-num { color: var(--accent); }
.pr-st-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 4px;
}
.pr-st-sub {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.4;
  min-height: 2.8em;
}
.pr-st-progress {
  height: 3px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.pr-st-progress i { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.pr-st-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  margin-top: 10px;
}
.pr-edge {
  flex: 0 0 18px;
  display: flex; align-items: center;
  color: var(--ink-4);
}
.pr-edge.done { color: var(--accent); }
.pr-edge svg { width: 100%; height: 8px; }

/* ── Path: vertical list ────────────────────────────────────────────── */
.path-list {
  margin-top: 56px;
  display: flex;
  flex-direction: column;
}
.pl-chapter {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  padding: 32px 0;
  border-top: 1px solid var(--hairline);
}
@media (max-width: 720px) { .pl-chapter { grid-template-columns: 1fr; gap: 20px; } }
.pl-head { display: flex; gap: 16px; }
.pl-num-col { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.pl-num {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
}
.pl-line { flex: 1; width: 1px; background: var(--hairline); min-height: 40px; margin: 8px 0; }
.pl-meta h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.025em;
  margin: 0 0 4px;
}
.pl-meta p { margin: 0 0 8px; color: var(--ink-3); font-size: 14px; }
.pl-stats {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  display: flex; gap: 8px;
  letter-spacing: 0.02em;
}
.pl-articles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pl-articles li {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: padding 0.15s;
}
.pl-articles li:hover { padding-left: 8px; }
.pl-articles li:last-child { border-bottom: 0; }
.pl-articles .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-4);
  margin: 0 auto;
  opacity: 0.4;
}
.pl-art-title { font-size: 15px; color: var(--ink); line-height: 1.4; font-weight: 500; }
.pl-art-min, .pl-art-lvl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}
.pl-art-lvl {
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-size: 10px;
}

/* ── Modules grid (path variant) ────────────────────────────────────── */
.path-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.pm-card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex; flex-direction: column; gap: 10px;
  font-family: inherit;
  text-align: left;
}
.pm-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.pm-card header { display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.pm-num { color: var(--accent); }
.pm-card h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.025em;
  margin: 4px 0 0;
}
.pm-sub { margin: 0; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.pm-desc { margin: 0; color: var(--ink-3); font-size: 13px; line-height: 1.55; flex: 1; }
.pm-card footer { display: flex; gap: 6px; font-family: var(--mono); font-size: 10px;
  color: var(--ink-4); letter-spacing: 0.04em; }
.pm-bar { height: 3px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; }
.pm-bar i { display: block; height: 100%; background: var(--accent); }

/* ── Map variant (Duolingo-sober) ───────────────────────────────────── */
.path-map {
  position: relative;
  padding: 40px 0;
}
.path-map svg.pm-trail {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.path-map .pmap-stations {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.pmap-row {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}
.pmap-row.right { justify-content: flex-end; }
.pmap-row.center { justify-content: center; }
.pmap-node {
  appearance: none; border: 0;
  background: var(--bg);
  color: var(--ink);
  border: 2px solid var(--hairline-2);
  border-radius: 50%;
  width: 96px; height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: inherit; gap: 2px;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.pmap-node:hover { transform: scale(1.05); border-color: var(--accent); }
.pmap-node.active, .pmap-node.done {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.pmap-node .pmn-num { font-family: var(--mono); font-size: 11px; opacity: 0.7; }
.pmap-node .pmn-title { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.pmap-label {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 200px;
  line-height: 1.4;
}

/* ── How it works ───────────────────────────────────────────────────── */
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}
.how-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 28px;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}
.how-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.how-card h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.02em;
}
.how-card p { font-size: 14px; color: var(--ink-3); margin: 0; line-height: 1.55; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  padding: 48px 0 32px;
  border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Path view ──────────────────────────────────────────────────────── */
.pv-head { padding: 64px 0 32px; }
.pv-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
}
.pv-lede { font-size: 17px; color: var(--ink-3); max-width: 56ch; margin: 0 0 32px; line-height: 1.55; }
.pv-stats {
  display: flex; gap: 56px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 24px 0;
  flex-wrap: wrap;
}
.pv-stat { display: flex; flex-direction: column; gap: 4px; }
.pv-stat-val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.pv-stat-val i { font-style: normal; font-size: 16px; color: var(--ink-3); margin-left: 2px; font-weight: 400; }
.pv-stat-lbl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.pv-roadmap { margin: 32px 0 56px; }

/* ── Library ────────────────────────────────────────────────────────── */
.lib-head { padding: 64px 0 24px; }
.lib-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 5vw, 56px);
  letter-spacing: -0.035em;
  margin: 0 0 16px;
  line-height: 1.05;
}
.lib-toolbar {
  display: flex; flex-direction: column;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.lib-filter-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lib-filter-lbl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  width: 80px;
}
.lib-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-chip {
  appearance: none; border: 1px solid var(--hairline-2);
  background: transparent; color: var(--ink-2);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  font-family: inherit;
}
.lib-chip:hover { background: var(--bg-deep); }
.lib-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lib-count { position: absolute; right: 0; top: 20px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.lib-grid { display: grid; grid-template-columns: 1fr; margin: 0 0 80px; }

.art-row {
  display: grid;
  grid-template-columns: 1fr;
  padding: 22px 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: padding 0.15s;
}
.art-row:hover { padding-left: 8px; }
.art-row:hover h4 { color: var(--accent); }
.art-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.art-chap { color: var(--ink-2); font-weight: 500; }
.art-level {
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 500;
}
.lvl-base { background: #d6f5e8; color: #065f46; }
.lvl-intermedio { background: #fef3c7; color: #78350f; }
.lvl-avanzato { background: #fee2e2; color: #7f1d1d; }
.art-min { color: var(--ink-4); }
.art-row h4 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  transition: color 0.15s;
}
.art-row p { margin: 0; font-size: 14px; color: var(--ink-3); line-height: 1.55; }

/* ── Article ────────────────────────────────────────────────────────── */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.read-progress i {
  display: block; height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: transform 0.05s linear;
}
.art-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  padding: 32px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.art-breadcrumb a:hover { color: var(--accent); }
.article {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 0;
}
.art-header { margin-bottom: 48px; }
.art-header-meta {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 24px;
}
.art-header h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.art-subtitle {
  font-size: clamp(18px, 1.8vw, 22px);
  color: var(--ink-3);
  line-height: 1.4;
  margin: 0 0 28px;
  text-wrap: pretty;
  font-weight: 400;
}
.art-byline {
  display: flex; gap: 10px; align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.dot-sep { width: 3px; height: 3px; background: var(--ink-4); border-radius: 50%; }

.art-body-content > p {
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 22px;
  color: var(--ink);
}
.art-body-content > h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.025em;
  margin: 48px 0 16px;
  line-height: 1.15;
}
.pullquote {
  margin: 40px -24px;
  padding: 24px 32px;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.pullquote p {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* Profiles */
.profiles { margin: 32px 0 40px; border: 1px solid var(--hairline); border-radius: var(--radius-lg); overflow: hidden; }
.prof-tabs { display: flex; border-bottom: 1px solid var(--hairline); }
.prof-tab {
  flex: 1;
  appearance: none; border: 0;
  background: transparent;
  padding: 14px 16px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  letter-spacing: -0.015em;
}
.prof-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.prof-tab:hover { background: var(--bg-deep); }
.prof-body { padding: 28px; background: var(--bg-elev); }
.prof-bar { display: flex; height: 56px; border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.pb-seg { display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 12px; font-size: 12px; transition: width 0.3s ease; overflow: hidden; white-space: nowrap; }
.pb-seg i { font-style: normal; opacity: 0.7; font-size: 11px; }
.pb-seg b { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.pb-az { background: var(--accent); color: white; }
.pb-ob { background: var(--accent-soft); color: var(--ink); }
.pb-li { background: var(--bg-deep); color: var(--ink-3); }
.prof-desc { font-size: 14px; color: var(--ink-2); margin: 0; line-height: 1.55; }

/* Calculator */
.calc { margin: 40px 0; border: 1px solid var(--hairline); border-radius: var(--radius-lg); overflow: hidden; }
.calc-head { padding: 22px 24px; border-bottom: 1px solid var(--hairline); }
.calc-head h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.025em;
  margin: 6px 0 6px;
}
.calc-head p { margin: 0; color: var(--ink-3); font-size: 13px; }
.calc-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.calc-body { display: grid; grid-template-columns: 280px 1fr; gap: 0; }
@media (max-width: 720px) { .calc-body { grid-template-columns: 1fr; } }
.calc-controls {
  padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
  border-right: 1px solid var(--hairline);
  background: var(--bg-elev);
}
.calc-controls label { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.calc-controls label > span:first-child { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.calc-val { font-family: var(--mono); font-size: 12px; color: var(--accent); text-align: right; font-weight: 500; }
.calc-controls input[type=range] {
  grid-column: 1 / -1;
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 3px; background: var(--hairline-2); border-radius: 999px; margin: 6px 0 0;
}
.calc-controls input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg-elev);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.calc-controls input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border: 2px solid var(--bg-elev);
  border-radius: 50%; background: var(--accent);
}
.calc-output { padding: 24px; display: flex; flex-direction: column; gap: 18px; background: var(--bg); }
.calc-figures { display: flex; gap: 24px; flex-wrap: wrap; }
.cf { display: flex; flex-direction: column; gap: 4px; }
.cf-lbl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cf-val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.cf.primary .cf-val { color: var(--accent); font-size: 28px; }
.calc-chart { position: relative; }
.calc-chart svg { width: 100%; height: 200px; display: block; }
.calc-legend {
  display: flex; gap: 16px;
  margin-top: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
}
.leg-line { display: inline-block; width: 20px; height: 2px; margin-right: 6px; vertical-align: middle; }
.leg-line.accent { background: var(--accent); }
.leg-line.dashed { border-top: 2px dashed var(--ink-3); background: transparent; }

/* Quiz */
.quiz { margin: 40px 0; padding: 28px; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--bg-elev); }
.quiz-head { margin-bottom: 24px; }
.quiz-head h3 { font-family: var(--display); font-weight: 700; font-size: 22px; margin: 6px 0 6px; letter-spacing: -0.025em; }
.quiz-head p { margin: 0; color: var(--ink-3); font-size: 13px; }
.quiz-q { padding: 18px 0; border-top: 1px solid var(--hairline); }
.quiz-q-head { display: grid; grid-template-columns: 32px 1fr; gap: 12px; margin-bottom: 14px; }
.quiz-num { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--accent); }
.quiz-q-head p { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.4; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; margin-left: 44px; }
.quiz-opt {
  appearance: none; border: 1px solid var(--hairline-2);
  background: var(--bg);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 8px;
  display: grid; grid-template-columns: 28px 1fr; gap: 12px;
  align-items: center; text-align: left;
  font-family: inherit; font-size: 14px;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.quiz-opt:hover:not(:disabled) { background: var(--bg-deep); border-color: var(--ink-3); }
.quiz-opt:disabled { cursor: default; }
.qo-letter {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--ink-3); background: var(--bg-deep);
  width: 24px; height: 24px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.quiz-opt.correct { border-color: var(--good); background: rgba(16,185,129,0.08); }
.quiz-opt.correct .qo-letter { background: var(--good); color: white; }
.quiz-opt.wrong { border-color: var(--warn); background: rgba(239,68,68,0.06); }
.quiz-opt.wrong .qo-letter { background: var(--warn); color: white; }
.quiz-explain { margin: 12px 0 0 44px; padding: 12px 14px; font-size: 13px; border-radius: 6px; line-height: 1.5; }
.quiz-explain.good { background: rgba(16,185,129,0.08); color: var(--ink); }
.quiz-explain.bad { background: rgba(239,68,68,0.06); color: var(--ink); }
.quiz-result {
  margin-top: 20px; padding: 14px;
  text-align: center;
  background: var(--ink); color: var(--bg);
  border-radius: 8px;
  font-family: var(--mono); font-size: 13px;
}

.art-nav {
  max-width: 720px;
  margin: 0 auto 80px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.art-nav-btn {
  appearance: none; border: 1px solid var(--hairline);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.art-nav-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.art-nav-btn.next { text-align: right; align-items: flex-end; }
.ann-dir { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.04em; }
.ann-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.article-missing { padding: 120px 0; text-align: center; display: flex; flex-direction: column; gap: 24px; align-items: center; }

/* ── Mobile nav hamburger ───────────────────────────────────────────── */
.nav-burger {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  color: var(--ink);
}
.burger-icon {
  display: flex; flex-direction: column; gap: 5px; width: 22px;
}
.burger-icon i {
  display: block; height: 2px; width: 100%;
  background: currentColor; border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.burger-icon.open i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-icon.open i:nth-child(2) { opacity: 0; }
.burger-icon.open i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-menu {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: rgba(255,255,255,0.97);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 0 20px;
  display: flex; flex-direction: column;
  z-index: 49;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.nav-mobile-menu a {
  padding: 13px var(--gutter);
  font-size: 17px; font-weight: 500;
  color: var(--ink-2);
  border-bottom: 1px solid var(--hairline);
  transition: background 0.1s;
}
.nav-mobile-menu a:last-of-type { border-bottom: 0; }
.nav-mobile-menu a:hover { background: var(--bg-deep); }
.nav-mobile-menu a.active { color: var(--accent); font-weight: 600; }
.nmm-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 16px var(--gutter) 0;
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
}

@media (max-width: 768px) {
  .topnav {
    grid-template-columns: 1fr auto auto;
    position: relative;
  }
  .nav-links { display: none; }
  .nav-progress { display: none; }
  .nav-burger { display: flex; }
}

/* ── Module card progress label ─────────────────────────────────────── */
.pm-bar-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
}
.pm-progress-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.pm-time-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}

/* ── Glossario ──────────────────────────────────────────────────────── */
.glossario { padding-bottom: 96px; }
.gloss-head { padding: 64px 0 32px; }
.gloss-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 5vw, 64px);
  letter-spacing: -0.035em;
  margin: 0 0 16px;
  line-height: 1.05;
}
.gloss-search-wrap {
  position: relative;
  margin-top: 32px;
  max-width: 600px;
}
.gloss-search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
.gloss-search {
  width: 100%; padding: 16px 48px 16px 50px;
  font-size: 17px; font-family: var(--sans);
  border: 1.5px solid var(--hairline-2);
  border-radius: var(--radius-xl);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.gloss-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,102,255,0.08);
}
.gloss-search::placeholder { color: var(--ink-4); }
.gloss-search-clear {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0;
  color: var(--ink-3); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 4px;
}
.gloss-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 20px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 8px;
}
.gloss-count {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  white-space: nowrap;
}
.gloss-empty {
  padding: 80px 0; text-align: center; color: var(--ink-3);
}
.gloss-body {
  display: flex; flex-direction: column;
}
.gloss-letter-group {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0 40px;
  padding: 32px 0;
  border-bottom: 1px solid var(--hairline);
}
@media (max-width: 600px) {
  .gloss-letter-group { grid-template-columns: 1fr; }
}
.gloss-letter {
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  color: var(--accent);
  letter-spacing: -0.03em;
  padding-top: 4px;
}
.gloss-terms {
  display: flex; flex-direction: column; gap: 0;
}
.gloss-term {
  padding: 20px 0;
  border-bottom: 1px solid var(--hairline);
}
.gloss-term:last-child { border-bottom: 0; }
.gloss-term-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.gloss-term h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}
.gloss-term p {
  margin: 0; font-size: 15px; line-height: 1.65; color: var(--ink-2);
}
.gloss-cat {
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 4px;
  font-weight: 500;
  flex-shrink: 0;
}
.gloss-cat-strumenti  { background: var(--accent-soft); color: var(--accent); }
.gloss-cat-portafoglio { background: #d6f5e8; color: #065f46; }
.gloss-cat-tassazione  { background: #fef3c7; color: #78350f; }
.gloss-cat-indicatori  { background: #ede9fe; color: #4c1d95; }
.gloss-cat-costi       { background: #fee2e2; color: #7f1d1d; }
.gloss-cat-indici      { background: #f0f9ff; color: #0c4a6e; }
.gloss-cat-mercati     { background: #f4f4f5; color: #3f3f46; }

/* ── Design canvas variant chrome ───────────────────────────────────── */
.variant-frame {
  width: 100%;
  background: var(--bg);
  padding: 32px;
  font-family: var(--sans);
}
.variant-frame h1, .variant-frame h2, .variant-frame h3 { color: var(--ink); }

/* ── About ──────────────────────────────────────────────────────────── */
.about-body { max-width: 720px; margin: 0 auto; padding: 24px 0 96px; }
.about-block { padding: 40px 0; border-top: 1px solid var(--hairline); }
.about-block:first-of-type { border-top: 0; }
.ab-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 16px;
}
.about-block h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 20px;
  text-wrap: balance;
}
.about-block p {
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 18px;
  color: var(--ink-2);
}
.about-block em { font-style: italic; }
.about-disclaimer {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-top: 1px solid var(--hairline);
  padding: 28px;
  border-radius: var(--radius-lg);
  margin-top: 8px;
}
.about-disclaimer p {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  margin: 0;
}
.about-cta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 40px;
}
