/* =========================================================
   CER Tenna — Foglio di stile (bozza)
   Palette: verde sostenibilità + accento solare
   ========================================================= */

:root {
  --green-900: #0f3d2e;
  --green-800: #14523c;
  --green-700: #166e4a;
  --green-600: #1f8557;
  --green-500: #2a9d6a;
  --green-100: #e3f3ea;
  --green-050: #f1f9f4;

  --sun: #f4b740;
  --sun-dark: #d99a1c;

  --ink: #14241c;
  --muted: #5a6b62;
  --line: #e0e8e3;
  --bg: #f7faf8;
  --card: #ffffff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 61, 46, .04), 0 8px 28px rgba(16, 61, 46, .08);
  --shadow-sm: 0 1px 2px rgba(16, 61, 46, .06), 0 4px 14px rgba(16, 61, 46, .05);
  --maxw: 1120px;
  --font-head: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.15;
  color: var(--green-900);
  font-weight: 700;
  letter-spacing: -.01em;
}

h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .6em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }

p { margin: 0 0 1em; }

a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.text-center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-600);
  margin-bottom: .8em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .98rem;
  padding: .8em 1.5em;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--green-700); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--green-800); }
.btn--ghost { background: #fff; color: var(--green-800); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--green-500); }
.btn--sun { background: var(--sun); color: #3a2c05; }
.btn--sun:hover { background: var(--sun-dark); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 250, 248, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6em;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--green-900);
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  display: block;
}
.brand .logo img, .footer-brand .logo img { width: 100%; height: 100%; display: block; }
.brand small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: .02em; }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block;
  padding: .5em .85em;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 500;
  font-size: .95rem;
}
.nav-links a:hover { background: var(--green-100); text-decoration: none; }
.nav-links a.active { color: var(--green-700); font-weight: 600; }
.nav-cta { margin-left: 8px; }

.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 44px; height: 44px;
  padding: 10px;
}
.nav-toggle span { display: block; height: 2px; background: var(--green-900); margin: 5px 0; border-radius: 2px; transition: .25s; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 72px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 20px;
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .8em .6em; }
  .nav-cta { margin: 8px 0 0; }
  .nav-cta .btn { width: 100%; justify-content: center; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(244,183,64,.18), transparent 60%),
    linear-gradient(160deg, var(--green-050) 0%, #eaf5ee 100%);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--green-100) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .5;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
          mask-image: linear-gradient(180deg, #000, transparent);
}
.hero .container { position: relative; z-index: 1; padding-top: 80px; padding-bottom: 84px; }
.hero h1 { max-width: 16ch; }
.hero .lead { margin-bottom: 1.8em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .5em;
  background: #fff; border: 1px solid var(--line);
  padding: .4em .9em; border-radius: 999px;
  font-size: .85rem; font-weight: 600; color: var(--green-800);
  margin-bottom: 1.4em; box-shadow: var(--shadow-sm);
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: .2em; }
.card .icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--green-100); color: var(--green-700);
  border-radius: 12px;
  font-size: 1.4rem;
  margin-bottom: 14px;
}

/* ---------- Stats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.stat {
  flex: 1 1 160px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 18px 20px;
}
.stat .num { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; color: var(--green-700); }
.stat .lbl { font-size: .85rem; color: var(--muted); }

/* ---------- Impact numbers ---------- */
.impact { text-align: center; }
.impact .icon { margin: 0 auto 14px; width: 54px; height: 54px; font-size: 1.6rem; }
.big-num { font-family: var(--font-head); font-weight: 700; font-size: 2.3rem; line-height: 1.05; color: var(--green-700); }
.big-num .unit { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.impact h3 { margin: .25em 0 .35em; }
.impact p { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---------- Map ---------- */
#area-map { height: 380px; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: var(--green-050); z-index: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .85rem; color: var(--muted); margin-top: 12px; }
.map-legend .key { display: inline-flex; align-items: center; gap: 7px; }
.map-legend .swatch { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.swatch--area { background: rgba(31,133,87,.25); border: 2px solid var(--green-600); }
.swatch--in { background: var(--green-600); border-radius: 50%; }
.swatch--out { background: var(--sun-dark); border-radius: 50%; }

/* ---------- Flow infographic ---------- */
.flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: nowrap; }
.flow-step {
  flex: 1 1 0; min-width: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 18px 12px; text-align: center; box-shadow: var(--shadow-sm);
}
.flow-step .flow-ico {
  width: 52px; height: 52px; margin: 0 auto 10px;
  display: grid; place-items: center; font-size: 1.6rem;
  background: var(--green-100); border-radius: 14px;
}
.flow-step strong { display: block; font-family: var(--font-head); color: var(--green-900); font-size: .98rem; }
.flow-step span { display: block; font-size: .8rem; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.flow-step--accent { background: linear-gradient(160deg, #fff, var(--green-050)); border-color: var(--green-500); }
.flow-step--accent .flow-ico { background: var(--green-700); color: var(--sun); }
.flow-arrow { display: flex; align-items: center; color: var(--green-500); font-size: 1.4rem; font-weight: 700; }
@media (max-width: 760px) {
  .flow { flex-direction: column; }
  .flow-arrow { justify-content: center; transform: rotate(90deg); }
}

/* ---------- Share chart (produzione vs consumo) ---------- */
.share-chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: .88rem; color: var(--muted); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend .swatch { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }

/* ---------- Tips ---------- */
.tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tips li { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; }
.tips .t-ico { font-size: 1.4rem; flex: 0 0 auto; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 18px; }
.step { display: flex; gap: 18px; align-items: flex-start; }
.step .n {
  counter-increment: step;
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--green-700); color: #fff;
  border-radius: 50%; font-family: var(--font-head); font-weight: 700;
}
.step .n::before { content: counter(step); }

/* ---------- Simulation tables ---------- */
.sim {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sim-head { padding: 24px 28px; background: var(--green-800); color: #fff; }
.sim-head h3 { color: #fff; margin: 0; }
.sim-head .tag { font-size: .8rem; opacity: .85; }
.sim-body { padding: 8px 28px 24px; }
.sim-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.sim-row:last-child { border-bottom: none; }
.sim-row .k { color: var(--muted); }
.sim-row .v { font-weight: 600; font-family: var(--font-head); text-align: right; }
.sim-total { background: var(--green-050); margin: 8px -28px -24px; padding: 18px 28px; }
.sim-total .v { color: var(--green-700); font-size: 1.25rem; }

/* Blocco quota standard + promo nelle card simulazione */
.sim-foot { margin: 8px -28px -24px; }
.sim-foot .row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 28px; }
.sim-foot .row .k { font-family: var(--font-head); }
.sim-foot .row .k small { display: block; font-weight: 400; font-size: .8rem; opacity: .8; }
.sim-foot .row .v { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.sim-foot .row.std { background: var(--green-050); }
.sim-foot .row.std .v { color: var(--green-700); }
.sim-foot .row.promo { background: linear-gradient(135deg, var(--sun), var(--sun-dark)); color: #3a2c05; }
.sim-foot .row.promo .k small { opacity: .9; }

/* Banner promo */
.promo-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  background: linear-gradient(135deg, #fff7e6, #ffedc2);
  border: 1.5px solid var(--sun);
  border-radius: var(--radius);
  padding: 16px 22px; margin-top: 22px;
}
.promo-banner .tag-promo {
  background: var(--sun-dark); color: #3a2c05;
  font-family: var(--font-head); font-weight: 700; font-size: .78rem;
  padding: .3em .8em; border-radius: 999px; letter-spacing: .03em;
}
.promo-banner p { margin: 0; color: #5b4a1f; font-size: .95rem; }

table.assumptions { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.assumptions th, table.assumptions td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.assumptions th { background: var(--green-050); font-family: var(--font-head); color: var(--green-800); }

/* ---------- Notice / disclaimer ---------- */
.notice {
  border-left: 4px solid var(--sun);
  background: #fffaf0;
  padding: 16px 20px;
  border-radius: 8px;
  font-size: .93rem;
  color: #5b4a1f;
}
.notice strong { color: #3a2c05; }
.notice--info { border-left-color: var(--green-500); background: var(--green-050); color: var(--green-800); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .92rem; color: var(--green-900); }
.field .hint { font-size: .82rem; color: var(--muted); }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 1rem;
  padding: .75em .9em; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}
.field textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.check input { margin-top: 3px; }

.result-box { margin-top: 8px; padding: 16px 20px; border-radius: 10px; font-weight: 500; display: none; }
.result-box.show { display: block; }
.result-box.ok { background: var(--green-050); border: 1px solid var(--green-500); color: var(--green-800); }
.result-box.warn { background: #fffaf0; border: 1px solid var(--sun); color: #5b4a1f; }
.result-box.neutral { background: #f4f6f5; border: 1px solid var(--line); color: var(--ink); }
.result-box.loading { background: var(--green-050); border: 1px solid var(--green-100); color: var(--green-800); display: flex; align-items: center; gap: 10px; }

.spinner {
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 2.5px solid var(--green-100);
  border-top-color: var(--green-600);
  border-radius: 50%;
  display: inline-block;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented control (modalità di verifica) */
.segmented { display: inline-flex; background: var(--green-050); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 20px; }
.segmented label {
  position: relative; cursor: pointer;
  padding: .5em 1.1em; border-radius: 999px;
  font-family: var(--font-head); font-weight: 600; font-size: .92rem; color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { }
.segmented label:has(input:checked) { background: var(--green-700); color: #fff; }

/* ---------- CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  color: #fff; border-radius: var(--radius);
  padding: 48px; text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.85); max-width: 50ch; margin: 0 auto 1.5em; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--green-900); color: #cfe3d8;
  padding: 56px 0 28px; margin-top: 24px;
}
.site-footer a { color: #cfe3d8; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 1em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-bottom {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: .82rem; color: #9bbcaa; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: .6em; font-family: var(--font-head); font-weight: 700; color: #fff; margin-bottom: .6em; }
.footer-brand .logo { width: 34px; height: 34px; flex: 0 0 auto; display: block; }

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.badge-soft { display:inline-block; background: var(--green-100); color: var(--green-800); font-size:.78rem; font-weight:600; padding:.25em .7em; border-radius:999px; }
