@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* =========================================================
   CIVIC — Design system "grid"
   Palette e font dal sito civiclab.it (Elementor kit)
   ========================================================= */
:root {
  --blue: #467FF7;        /* primario civiclab.it */
  --blue-deep: #0033FF;   /* logo */
  --navy: #1C244B;
  --slate: #324A6D;
  --mist: #C8D5DC;
  --bg: #FFFFFF;
  --bg-soft: #F4F7FB;
  --line: #D9E1EA;
  --text: #1C244B;
  --muted: #5E6E86;
  /* colori badge numerati (dal kit del sito) */
  --c1: #467FF7; --c2: #0033FF; --c3: #1C244B; --c4: #FFBC7D; --c5: #F8BCAA; --c6: #61CE70;
  --font: 'Poppins', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --pad: clamp(12px, 1.6vw, 20px);
  --max: 1480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.025em; line-height: 1.08; }
h1 { font-size: clamp(2.4rem, 5.4vw, 4.6rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); }
h3 { font-size: 1.3rem; }
p { color: var(--muted); font-weight: 300; }
.blue { color: var(--blue); }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--pad); }
.mono, .label, .badge, .tag, .btn, .tabs button, .cell-links a { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Header (barra a celle) ---------- */
.topbar { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: stretch; height: 64px; max-width: var(--max); margin-inline: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 var(--pad); font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; border-right: 1px solid var(--line); }
.brand img { width: 30px; height: 30px; }
.brand small { font-family: var(--mono); font-size: .62rem; font-weight: 500; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; line-height: 1.2; }
.nav { display: flex; align-items: stretch; list-style: none; flex: 1; }
.nav > li { position: relative; display: flex; }
.nav > li > a { display: flex; align-items: center; padding: 0 1.1rem; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-right: 1px solid var(--line); transition: .2s; }
.nav > li > a:hover { color: var(--navy); background: var(--bg-soft); }
.nav > li > a.active { color: #fff; background: var(--navy); }
.nav .num { color: var(--blue); margin-right: .45rem; }
.nav > li > a.active .num { color: var(--mist); }
.dropdown { position: absolute; top: 100%; left: -1px; min-width: 270px; list-style: none; background: #fff; border: 1px solid var(--line); opacity: 0; visibility: hidden; transform: translateY(4px); transition: .18s; }
.nav > li:hover .dropdown { opacity: 1; visibility: visible; transform: none; }
.dropdown a { display: flex; justify-content: space-between; padding: .85rem 1rem; font-size: .88rem; border-bottom: 1px solid var(--line); }
.dropdown li:last-child a { border-bottom: 0; }
.dropdown a::after { content: '↗'; color: var(--blue); font-family: var(--mono); }
.dropdown a:hover { background: var(--bg-soft); color: var(--blue); }
.topbar-cta { margin-left: auto; display: flex; align-items: center; padding: 0 1.4rem; background: var(--blue); color: #fff; font-family: var(--mono); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; transition: .2s; }
.topbar-cta:hover { background: var(--blue-deep); }
.burger { display: none; margin-left: auto; width: 64px; border: 0; border-left: 1px solid var(--line); background: none; cursor: pointer; }
.burger span { display: block; width: 22px; height: 2px; background: var(--navy); margin: 5px auto; transition: .3s; }

/* Mobile CTA nascosta di default su desktop */
.nav .mobile-cta { display: none; }

/* ---------- Notice strip ---------- */
.notice { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: var(--pad); border: 1px solid var(--blue); background: linear-gradient(90deg, rgba(70,127,247,.08), rgba(70,127,247,.02)); padding: .8rem 1rem; }
.notice .badge { background: var(--blue); color: #fff; }
.notice strong { font-weight: 500; font-size: .95rem; }
.notice .spacer { flex: 1; }
.notice a.mono { font-size: .72rem; color: var(--slate); }
.notice a.mono:hover { color: var(--blue); }

/* ---------- Toolbar & labels ---------- */
.toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: var(--pad) 0; }
.tabs { display: inline-flex; border: 1px solid var(--line); }
.tabs button, .tabs a { background: #fff; border: 0; border-right: 1px solid var(--line); padding: .6rem .9rem; font-size: .7rem; color: var(--muted); cursor: pointer; transition: .2s; display: inline-flex; gap: .4rem; }
.tabs > :last-child { border-right: 0; }
.tabs button:hover, .tabs a:hover { color: var(--navy); background: var(--bg-soft); }
.tabs .active { background: var(--navy); color: #fff; }
.tabs .count { color: var(--blue); }
.tabs .active .count { color: var(--mist); }
.toolbar .spacer { flex: 1; }
.label { display: block; font-size: .72rem; color: var(--muted); margin: calc(var(--pad) * 2) 0 .9rem; }
.label b { color: var(--blue); font-weight: 600; }
.badge { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 .4rem; font-size: .68rem; font-weight: 600; color: #fff; background: var(--c, var(--blue)); }
.badge.dark-text { color: var(--navy); }
.tag { display: inline-block; font-size: .64rem; font-weight: 500; padding: .3rem .55rem; border: 1px solid var(--blue); color: var(--blue); }
.tag.green { border-color: #2fa043; color: #2fa043; }
.tag.grey { border-color: var(--mist); color: var(--muted); }

/* ---------- Grid a celle ---------- */
.cells { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cells > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cols-2 { --cols: 2; } .cols-3 { --cols: 3; } .cols-4 { --cols: 4; } .cols-6 { --cols: 6; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .row-2 { grid-row: span 2; }

.cell { background: #fff; display: flex; flex-direction: column; position: relative; transition: background .25s; }
.cell:hover { background: var(--bg-soft); }
.cell-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.cell-links { display: flex; gap: 1rem; }
.cell-links a { font-size: .66rem; color: var(--muted); transition: .2s; }
.cell-links a:hover { color: var(--blue); }
.cell-body { padding: 1.2rem 1rem 1rem; display: flex; flex-direction: column; gap: .9rem; flex: 1; }
.cell-title { display: flex; gap: .9rem; align-items: center; }
.cell-title h3 span { color: var(--blue); }
.cell-title p { font-size: .88rem; line-height: 1.4; margin-top: .15rem; }
.cell-title .sub { font-size: .76rem; color: #8b98ab; }
.ico { width: 52px; height: 52px; flex: none; display: grid; place-items: center; background: var(--c, var(--blue)); color: #fff; overflow: hidden; }
.ico svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico img { width: 100%; height: 100%; object-fit: cover; }
.ico.dark-text { color: var(--navy); }
.meta { font-size: .82rem; color: var(--muted); }
.cell-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .3rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 40px; padding: 0 1.1rem; font-size: .72rem; font-weight: 600; border: 1px solid var(--navy); background: var(--navy); color: #fff; cursor: pointer; transition: .2s; white-space: nowrap; }
.btn:hover { background: transparent; color: var(--navy); }
.btn--blue { background: var(--blue); border-color: var(--blue); }
.btn--blue:hover { background: transparent; color: var(--blue); }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--navy); }
.btn--white { background: #fff; color: var(--blue); border-color: #fff; }
.btn--white:hover { background: transparent; color: #fff; }
.btn--block { flex: 1; }
.btn--sq { width: 40px; padding: 0; }

/* Hero cells */
.hero-cell { padding: clamp(1.5rem, 4vw, 3.2rem); justify-content: space-between; gap: 2rem; min-height: 460px; }
.hero-cell p.lead { font-size: 1.15rem; max-width: 560px; margin-top: 1.2rem; }
.hero-cell .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.media-cell { padding: 0; overflow: hidden; min-height: 240px; }
.media-cell img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s; }
.media-cell:hover img { transform: scale(1.04); }
.media-cell .cap { position: absolute; left: .8rem; bottom: .8rem; }
.stat-cell { padding: 1.2rem 1rem; justify-content: space-between; gap: 1.5rem; }
.stat-cell strong { font-size: clamp(2rem, 3.4vw, 2.8rem); font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.stat-cell .mono { font-size: .68rem; color: var(--muted); }
.blue-cell { background: var(--blue); color: #fff; }
.blue-cell:hover { background: var(--blue-deep); }
.blue-cell p, .blue-cell .mono { color: rgba(255,255,255,.85); }
.navy-cell { background: var(--navy); color: #fff; }
.navy-cell:hover { background: #141a38; }
.navy-cell p { color: var(--mist); }
.text-cell { padding: clamp(1.5rem, 3vw, 2.4rem); gap: 1rem; }
.text-cell .manifesto { font-size: clamp(1.3rem, 2.3vw, 1.9rem); font-weight: 500; line-height: 1.35; color: var(--navy); letter-spacing: -.015em; }
.text-cell .manifesto em { font-style: normal; color: var(--blue); }

/* Big CTA tiles (home) */
.cta-cell { padding: clamp(1.4rem, 2.6vw, 2.2rem); justify-content: space-between; gap: 2rem; min-height: 230px; overflow: hidden; }
.cta-cell .cta-top { display: flex; justify-content: space-between; align-items: flex-start; }
.cta-cell .cta-arrow { font-family: var(--mono); font-size: 2.4rem; line-height: 1; transition: transform .35s; }
.cta-cell:hover .cta-arrow { transform: translate(6px, -6px); }
.cta-cell h2 { font-size: clamp(1.9rem, 3.2vw, 2.9rem); }
.cta-cell p { margin-top: .4rem; }
.cta-cell .ico { width: 60px; height: 60px; background: rgba(255,255,255,.16); }
.cta-cell .ico svg { width: 30px; height: 30px; }
.cta-cell::after { content: ''; position: absolute; right: -60px; bottom: -60px; width: 200px; height: 200px; border: 28px solid rgba(255,255,255,.08); border-radius: 50%; transition: transform .6s; }
.cta-cell:hover::after { transform: scale(1.25); }
.hero-logo { width: 74px; height: 74px; }
.mini-cell { flex-direction: row; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; font-weight: 500; }
.mini-cell .mono { font-size: .7rem; color: var(--muted); }
.mini-cell span:last-child { color: var(--blue); font-family: var(--mono); }

/* Page head */
.page-head { padding: clamp(1.5rem, 4vw, 3rem); gap: 1rem; }
.page-head p { font-size: 1.1rem; max-width: 640px; }
.crumbs { font-size: .7rem; color: var(--muted); }
.crumbs a:hover { color: var(--blue); }

/* Lists in cells */
.checklist { list-style: none; display: grid; gap: .45rem; font-size: .9rem; }
.checklist li { display: flex; gap: .6rem; }
.checklist li::before { content: '→'; font-family: var(--mono); color: var(--blue); }
.prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.prices div { padding: .7rem .8rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prices strong { font-size: 1.25rem; font-weight: 600; display: block; }
.prices span { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Archive table */
.table { border: 1px solid var(--line); }
.table-row { display: grid; grid-template-columns: 90px 1.2fr 2fr 160px; align-items: center; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); transition: background .2s; }
.table-row:last-child { border-bottom: 0; }
.table-row:hover { background: var(--bg-soft); }
.table-row.head { font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--bg-soft); }
.table-row h3 { font-size: 1rem; }
.table-row .year { font-family: var(--mono); color: var(--blue); font-weight: 600; }

/* Forms */
.form { display: grid; gap: .9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.field label { display: block; font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .35rem; }
.field input, .field select, .field textarea { width: 100%; padding: .8rem .9rem; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-size: .95rem; border-radius: 0; transition: .2s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(70,127,247,.15); }
.form-success { display: none; padding: .9rem 1rem; border: 1px solid #2fa043; color: #2fa043; font-size: .9rem; }
.form-success.show { display: block; }
.map { flex: 1; min-height: 280px; }
.map iframe { width: 100%; height: 100%; min-height: 280px; border: 0; filter: grayscale(.4); }

/* Footer */
.footer { margin-top: calc(var(--pad) * 3); border-top: 1px solid var(--line); }
.footer .cells { border-top: 0; }
.footer .cell-body h4 { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.footer ul { list-style: none; display: grid; gap: .35rem; font-size: .92rem; }
.footer ul a:hover { color: var(--blue); }
.newsletter { display: flex; gap: .5rem; }
.newsletter input { flex: 1; min-width: 0; padding: 0 .8rem; height: 40px; border: 1px solid var(--line); font: inherit; font-size: .9rem; }
.newsletter input:focus { outline: none; border-color: var(--blue); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1rem var(--pad); font-size: .68rem; color: var(--muted); max-width: var(--max); margin-inline: auto; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .nav > li > a { padding: 0 .7rem; font-size: .66rem; }
  .nav .num { display: none; }
  .cols-4, .cols-6 { --cols: 3; }
  .span-4 { grid-column: span 3; }
}

@media (max-width: 960px) {
  .burger { display: block; position: relative; z-index: 1001; }
  .topbar-cta { display: none; }
  
  .nav { 
    position: fixed; 
    inset: 64px 0 0; 
    flex-direction: column; 
    background: #fff; 
    transform: translateX(100%); 
    transition: transform .35s ease; 
    overflow-y: auto; 
    z-index: 1000;
  }
  
  .nav.open { 
    transform: translateX(0); 
  }
  
  .nav > li { flex-direction: column; border-bottom: 1px solid var(--line); }
  .nav > li > a { padding: 1.1rem var(--pad); font-size: .85rem; border-right: 0; }
  .nav .num { display: inline; }
  
  .dropdown { position: static; opacity: 1; visibility: visible; transform: none; border: 0; border-top: 1px solid var(--line); }
  .dropdown a { padding-left: calc(var(--pad) + 1.5rem); }
  
  .nav .mobile-cta { display: flex; }
  
  .burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .burger.open span:nth-child(2) { opacity: 0; }
  .burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  
  .cols-3, .cols-4, .cols-6 { --cols: 2; }
  .span-3, .span-4 { grid-column: span 2; }
  .row-2 { grid-row: auto; }
  .table-row { grid-template-columns: 70px 1fr; }
  .table-row > :nth-child(3) { grid-column: 2; }
  .table-row > :nth-child(4) { grid-column: 2; }
  .table-row.head { display: none; }
}

@media (max-width: 620px) {
  .cells, .cols-2, .cols-3, .cols-4, .cols-6 { --cols: 1; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
  .stat-grid { --cols: 2 !important; }
  .form-row { grid-template-columns: 1fr; }
  .hero-cell { min-height: 0; }
  .notice .spacer { display: none; }
}

@media (prefers-reduced-motion: reduce) { 
  * { transition: none !important; } 
  .reveal { opacity: 1; transform: none; } 
}