/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg:          #0d0f14;
  --surface:     #161920;
  --surface2:    #1e2230;
  --border:      #252a38;
  --border2:     #2e3447;
  --text:        #e8eaf0;
  --muted:       #7c8399;
  --muted2:      #4a5068;
  --accent:      #4ade80;
  --accent-dim:  rgba(74, 222, 128, 0.10);
  --accent-bdr:  rgba(74, 222, 128, 0.25);
  --red:         #f87171;
  --red-dim:     rgba(248, 113, 113, 0.10);
  --red-bdr:     rgba(248, 113, 113, 0.25);
  --amber:       #fbbf24;
  --amber-dim:   rgba(251, 191, 36, 0.10);
  --amber-bdr:   rgba(251, 191, 36, 0.25);
  --blue:        #60a5fa;
  --blue-dim:    rgba(96, 165, 250, 0.10);
  --blue-bdr:    rgba(96, 165, 250, 0.25);
  --r:           12px;
  --rs:          8px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: 900px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   NAV
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-links { display: flex; gap: 24px; }

.nav-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 80px 24px 56px;
  text-align: center;
  background: radial-gradient(ellipse 80% 300px at 50% -60px, rgba(74, 222, 128, 0.07), transparent);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-bdr);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 18px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(15px, 2vw, 17px);
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 36px;
}

.hero-cta {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 100px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.hero-cta:hover { opacity: 0.85; }

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  padding: 24px 20px;
  text-align: center;
  border-right: 1px solid var(--border);
}

.stat:last-child { border-right: none; }

.stat-v {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  display: block;
}

.stat-l {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
  display: block;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type { border-bottom: none; }

.sec-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.sec-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.sec-desc {
  font-size: 15px;
  color: var(--muted);
  max-width: 600px;
  line-height: 1.7;
}

/* ============================================================
   RULES
   ============================================================ */
.rules { display: flex; flex-direction: column; gap: 14px; margin-top: 32px; }

.rule {
  display: flex;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px 24px;
  transition: border-color 0.2s;
}

.rule:hover { border-color: var(--border2); }

.rule-num {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-bdr);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.rule-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.rule-body p { font-size: 14px; color: var(--muted); line-height: 1.6; }

.rule-danger {
  border: 1px solid var(--red-bdr);
  background: var(--red-dim);
  border-radius: var(--rs);
  padding: 12px 16px;
  font-size: 13px;
  color: #fca5a5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}

/* ============================================================
   MATH GRID
   ============================================================ */
.math-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 32px; }

.math-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
}

.math-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.math-formula {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  padding: 14px 16px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 13px;
  color: var(--accent);
  line-height: 1.8;
  margin-bottom: 12px;
  white-space: pre;
  overflow-x: auto;
}

.math-note { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  border-radius: var(--rs);
  padding: 14px 18px;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.55;
}

.alert.ok   { background: var(--accent-dim); border: 1px solid var(--accent-bdr); color: #86efac; }
.alert.warn { background: var(--amber-dim);  border: 1px solid var(--amber-bdr);  color: #fde68a; }
.alert.danger{ background: var(--red-dim);   border: 1px solid var(--red-bdr);    color: #fca5a5; }
.alert.info { background: var(--blue-dim);   border: 1px solid var(--blue-bdr);   color: #93c5fd; }

.alert-icon { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

/* ============================================================
   TIMELINE / RISK BOX
   ============================================================ */
.risk-box {
  background: var(--surface);
  border: 1px solid var(--amber-bdr);
  border-radius: var(--r);
  padding: 24px;
  margin-top: 28px;
}

.risk-box-title { font-size: 13px; font-weight: 600; color: var(--amber); margin-bottom: 20px; }

.tl { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 14px; }

.tl-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  flex-shrink: 0;
}

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.tl-dot--g { background: var(--accent); }
.tl-dot--r { background: var(--red); }
.tl-dot--a { background: var(--amber); }

.tl-line { width: 1px; flex: 1; background: var(--border2); margin: 5px 0; min-height: 24px; }

.tl-content { padding-bottom: 22px; flex: 1; }
.tl-content:last-child { padding-bottom: 0; }

.tl-head { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.tl-body { font-size: 13px; color: var(--muted); line-height: 1.55; }

.hl-red   { color: var(--red);   font-weight: 700; }
.hl-green { color: var(--accent); font-weight: 700; }
.hl-amber { color: var(--amber); font-weight: 700; }

/* ============================================================
   TABLE
   ============================================================ */
.tbl-title { font-size: 17px; font-weight: 600; margin: 36px 0 8px; }
.tbl-desc  { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.tbl-note  { font-size: 12px; color: var(--muted2); margin-bottom: 0; }

.tbl-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.tag--g { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-bdr); }
.tag--a { background: var(--amber-dim);  color: var(--amber);  border: 1px solid var(--amber-bdr); }
.tag--r { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-bdr); }

.td-green { color: var(--accent); font-weight: 600; }
.td-red   { color: var(--red);    font-weight: 600; }

.tbl-footnote { font-size: 12px; color: var(--muted2); margin-top: 10px; }

/* ============================================================
   CALCOLATORE
   ============================================================ */
.calc-outer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-top: 32px;
}

.calc-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-head-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.calc-head h3  { font-size: 15px; font-weight: 600; }

.calc-body { padding: 24px; }

.inp-label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; }

.inp-group { display: flex; margin-bottom: 6px; }

.inp-pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--rs) 0 0 var(--rs);
  padding: 10px 14px;
  font-size: 16px;
  color: var(--muted2);
}

.inp {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--rs) var(--rs) 0;
  padding: 10px 14px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.inp:focus { border-color: var(--accent); }

.inp-hint { font-size: 12px; color: var(--muted2); margin-bottom: 20px; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }

.met {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 14px;
}

.met-l {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 5px;
}

.met-v { font-size: 20px; font-weight: 700; }
.met-v.g { color: var(--accent); }
.met-v.r { color: var(--red); }
.met-v.a { color: var(--amber); }
.met-v.b { color: var(--blue); }

/* Scenario cards */
.sc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }

.sc {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 16px;
}

.sc.sc--warn { border-color: var(--red-bdr); background: rgba(248, 113, 113, 0.05); }

.sc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 12px;
}

.sc-title.g { color: var(--accent); }
.sc-title.r { color: var(--red); }

.sc-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.sc-row:last-child { border-bottom: none; }
.sc-k { color: var(--muted); }
.sc-v { font-weight: 600; }

/* Simulation */
.sim-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 18px;
  margin-bottom: 14px;
}

.sim-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 14px;
}

.sim-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.sim-row:last-child { border-bottom: none; }
.sim-k { color: var(--muted); }

.sim-netto {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 8px;
  font-size: 18px;
  font-weight: 800;
}

.bar-wrap  { margin: 10px 0 6px; }
.bar-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.bar-bg    { height: 6px; background: var(--red-dim); border-radius: 3px; overflow: hidden; }
.bar-fill  { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.35s ease; }

/* Reintegro box */
.reint-box {
  background: var(--amber-dim);
  border: 1px solid var(--amber-bdr);
  border-radius: var(--rs);
  padding: 14px 16px;
  font-size: 13px;
  color: #fde68a;
  line-height: 1.6;
}

.reint-box strong { color: var(--amber); }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
}

footer p { font-size: 13px; color: var(--muted2); line-height: 1.6; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .nav-links { display: none; }

  .stats-bar { grid-template-columns: 1fr; }
  .stat { border-right: none; border-bottom: 1px solid var(--border); }
  .stat:last-child { border-bottom: none; }

  .math-grid { grid-template-columns: 1fr; }

  .metrics { grid-template-columns: 1fr 1fr; }

  .sc-grid { grid-template-columns: 1fr; }

  .hero { padding: 56px 24px 40px; }

  .math-formula { font-size: 12px; }
}
