/* ============================================================================
   InProject — Foglio di stile unico del sito
   ----------------------------------------------------------------------------
   Struttura del file:
     1.  Design tokens (colori, spaziature, ombre, raggi)
     2.  Reset e base
     3.  Utility e layout
     4.  Header / navigazione
     5.  Hero e sezioni editoriali
     6.  Barra contatti
     7.  Filtri
     8.  Griglia bandi + card
     9.  Modal (popup del bando)
     10. Home page e Chi siamo
     11. Footer
     12. Animazioni
     13. Responsive

   Per cambiare l'identita' visiva del sito basta modificare i token del
   blocco 1: tutto il resto si adatta automaticamente.
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* --- Colori di marca -------------------------------------------------- */
  --navy-950: #061527;
  --navy-900: #0b2545;
  --navy-800: #123a63;
  --navy-700: #1a4f83;
  --blue-600: #1b62c4;
  --blue-500: #2a7be4;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;

  /* Colore d'accento: usato per CTA, evidenziazioni, stato "aperto" */
  --amber-600: #d9880c;
  --amber-500: #f5a524;
  --amber-100: #fdf0d5;

  /* --- Neutri ----------------------------------------------------------- */
  --ink:      #0f1b2d;   /* testo principale */
  --ink-soft: #33455c;   /* testo secondario */
  --muted:    #64748b;   /* testo terziario / label */
  --line:     #e3e9f0;   /* bordi */
  --line-soft:#eef2f7;
  --bg:       #f6f8fb;   /* sfondo pagina */
  --surface:  #ffffff;   /* sfondo card */

  /* --- Tipografia ------------------------------------------------------- */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Display",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* --- Raggi ------------------------------------------------------------ */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-full: 999px;

  /* --- Ombre ------------------------------------------------------------ */
  --sh-xs: 0 1px 2px rgba(11, 37, 69, .06);
  --sh-sm: 0 2px 8px rgba(11, 37, 69, .07);
  --sh-md: 0 8px 24px rgba(11, 37, 69, .09);
  --sh-lg: 0 18px 48px rgba(11, 37, 69, .16);
  --sh-xl: 0 32px 80px rgba(6, 21, 39, .34);

  /* --- Layout ----------------------------------------------------------- */
  --container: 1200px;
  --header-h: 74px;

  /* --- Transizioni ------------------------------------------------------ */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t-fast: .18s var(--ease);
  --t-med:  .32s var(--ease);
}


/* ==========================================================================
   2. RESET E BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Blocca lo scroll della pagina quando il modal e' aperto */
body.no-scroll { overflow: hidden; }

img { max-width: 100%; display: block; }

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--navy-800); }

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: 1.18;
  letter-spacing: -.02em;
  color: var(--navy-900);
  font-weight: 750;
}

h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1em; }

/* Focus visibile e coerente su tutti gli elementi interattivi */
:focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Testo visibile solo agli screen reader */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Link "salta al contenuto" per l'accessibilita' da tastiera */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--navy-900); color: #fff;
  padding: 10px 18px; border-radius: var(--r-sm);
  transition: top var(--t-fast);
}
.skip-link:focus { top: 12px; color: #fff; }


/* ==========================================================================
   3. UTILITY E LAYOUT
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 22px;
}

.section { padding: clamp(48px, 6vw, 86px) 0; }
.section--tight { padding: clamp(34px, 4vw, 56px) 0; }

.eyebrow {
  display: inline-block;
  font-size: .74rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin-bottom: .7rem;
}

.lead {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 68ch;
}

/* ---- Bottoni ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  padding: .82em 1.6em;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .01em;
  cursor: pointer;
  text-align: center;
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast);
}
.btn:active { transform: translateY(1px); }

/* Le icone inline dentro ai bottoni si adattano alla dimensione del testo */
.btn svg { width: 1.05em; height: 1.05em; flex: 0 0 auto; }

.btn--primary {
  background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
  color: #fff;
  box-shadow: var(--sh-sm);
}
.btn--primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.btn--accent {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: #3d2500;
  box-shadow: 0 6px 18px rgba(217, 136, 12, .3);
}
.btn--accent:hover {
  color: #3d2500;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(217, 136, 12, .38);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--navy-900);
}
.btn--ghost:hover {
  background: #fff;
  border-color: var(--blue-500);
  color: var(--blue-600);
}

.btn--lg { padding: 1em 2.1em; font-size: 1rem; }
.btn--block { width: 100%; }


/* ==========================================================================
   4. HEADER / NAVIGAZIONE
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: var(--header-h);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow var(--t-med), background-color var(--t-med);
}
/* Ombra che compare solo dopo lo scroll (classe aggiunta da layout.js) */
.site-header.is-scrolled { box-shadow: var(--sh-sm); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: var(--header-h);
}

/* ---- Logo --------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-right: auto;
  color: var(--navy-900);
  transition: opacity var(--t-fast);
}
.brand:hover { opacity: .78; color: var(--navy-900); }
/* Il logo e' un marchio circolare che contiene gia' la dicitura "IN PROJECT":
   a questa misura la scritta interna non e' leggibile e il segno funziona come
   simbolo, per questo accanto resta il nome in chiaro. */
.brand img { height: 46px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.brand-tag {
  font-size: .66rem; font-weight: 650; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}

/* ---- Menu --------------------------------------------------------------- */
.nav { display: flex; align-items: center; gap: 4px; }

.nav a {
  position: relative;
  padding: .55em .9em;
  border-radius: var(--r-sm);
  font-size: .94rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color var(--t-fast), background-color var(--t-fast);
}
.nav a:hover { color: var(--navy-900); background: var(--line-soft); }

/* Sottolineatura animata della voce attiva */
.nav a.is-active { color: var(--navy-900); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: .9em; right: .9em; bottom: .22em;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--blue-500), var(--amber-500));
}

.header-cta { display: inline-flex; white-space: nowrap; }

/* ---- Hamburger (mobile) -------------------------------------------------- */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.nav-toggle span {
  display: block; position: relative;
  width: 19px; height: 2px; border-radius: 2px;
  background: var(--navy-900);
  transition: transform var(--t-fast), background-color var(--t-fast);
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: ""; position: absolute; left: 0;
  width: 19px; height: 2px; border-radius: 2px;
  background: var(--navy-900);
  transition: transform var(--t-fast), top var(--t-fast);
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }


/* ==========================================================================
   5. HERO E SEZIONI EDITORIALI
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(42,123,228,.5), transparent 62%),
    radial-gradient(760px 420px at 92% 8%,  rgba(245,165,36,.24), transparent 60%),
    linear-gradient(150deg, var(--navy-900) 0%, var(--navy-950) 100%);
}

/* Griglia decorativa leggerissima sullo sfondo dell'hero */
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}

.hero > .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; }
.hero .eyebrow { color: var(--amber-500); }
.hero .lead { color: rgba(255,255,255,.82); }

.hero--page  { padding: clamp(52px, 6vw, 84px) 0 clamp(58px, 6vw, 76px); }
.hero--home  { padding: clamp(70px, 8vw, 128px) 0 clamp(64px, 7vw, 108px); }

.hero-actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 26px;
}

/* Riquadro evidenziato dentro l'hero (es. "Zero costi iniziali") */
.hero-note {
  margin-top: 30px;
  padding: 16px 22px;
  max-width: 62ch;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.16);
  border-left: 3px solid var(--amber-500);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  font-size: 1rem;
}
.hero-note p { margin: 0; }

/* ---- Intestazione di sezione -------------------------------------------- */
.section-head { max-width: 74ch; margin-bottom: 34px; }
.section-head--center { margin-inline: auto; text-align: center; }


/* ==========================================================================
   6. BARRA CONTATTI
   Contiene telefono e orario di sportello: informazioni presenti
   nell'intestazione delle pagine "Bandi" del sito originale.
   ========================================================================== */

.infobar { background: var(--surface); border-bottom: 1px solid var(--line); }

.infobar-grid {
  display: grid;
  /* min() evita che le colonne sforino su schermi molto stretti */
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 6px 40px;
  padding: 20px 0;
}

.infobar-item { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0; }

.infobar-icon {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--blue-50);
  color: var(--blue-600);
}
.infobar-icon svg { width: 20px; height: 20px; }

.infobar-label {
  font-size: .7rem; font-weight: 750; letter-spacing: .11em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 2px;
}
.infobar-value { font-size: .96rem; color: var(--ink); line-height: 1.5; }
.infobar-value strong { font-weight: 750; }
.infobar-value a { font-weight: 750; overflow-wrap: anywhere; }
.infobar-sep { margin: 0 .5em; color: var(--muted); }
.infobar-note { display: block; color: var(--muted); font-size: .87rem; }


/* ==========================================================================
   7. FILTRI
   ========================================================================== */

.filters {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: rgba(246,248,251,.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 220px; flex: 1 1 240px; }

.filter-label {
  font-size: .72rem; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}

/* Select nativa stilizzata: massima compatibilita' e ottima UX su mobile */
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: .72em 2.6em .72em 1em;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--navy-900);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%230b2545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1em center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.filter-select:hover { border-color: #c9d6e5; }
.filter-select:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-100); outline: none; }
/* Evidenzia il filtro quando e' attivo (diverso da "tutti") */
.filter-select.is-set { border-color: var(--blue-500); background-color: var(--blue-50); }

.filter-meta {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto; padding-bottom: 2px;
}

.filter-count { font-size: .9rem; color: var(--muted); white-space: nowrap; }
.filter-count strong { color: var(--navy-900); font-weight: 750; }

.filter-reset {
  display: none;                 /* mostrato via JS solo se c'e' un filtro attivo */
  align-items: center; gap: .45em;
  padding: .55em 1em;
  font: inherit; font-size: .88rem; font-weight: 650;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}
.filter-reset.is-visible { display: inline-flex; }
.filter-reset svg { width: 12px; height: 12px; flex: 0 0 auto; }
.filter-reset:hover { color: #b42318; border-color: #f3c6c2; background: #fff5f4; }


/* ==========================================================================
   8. GRIGLIA BANDI + CARD
   ========================================================================== */

.bandi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(238px, 100%), 1fr));
  gap: 26px;
  padding: 38px 0 clamp(56px, 7vw, 96px);
  list-style: none;
  margin: 0;
}

/* ---- Card --------------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.card:hover,
.card:focus-visible {
  transform: translateY(-6px);
  border-color: #cfdcec;
  box-shadow: var(--sh-lg);
}

/* Immagine: taglio verticale con ancoraggio in alto, cosi' resta leggibile
   l'intestazione della locandina del bando. */
.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: linear-gradient(160deg, #eef3f9, #e2eaf4);
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform .55s var(--ease);
}
.card:hover .card-media img { transform: scale(1.045); }

/* Velo + etichetta "Apri" che compaiono al passaggio del mouse */
.card-media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6,21,39,.62) 0%, rgba(6,21,39,.05) 45%, transparent 70%);
  opacity: 0;
  transition: opacity var(--t-med);
}
.card:hover .card-media::after,
.card:focus-visible .card-media::after { opacity: 1; }

.card-open {
  position: absolute;
  left: 12px; bottom: 12px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: .45em;
  padding: .42em .85em;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.95);
  color: var(--navy-900);
  font-size: .78rem; font-weight: 750;
  box-shadow: var(--sh-sm);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.card:hover .card-open,
.card:focus-visible .card-open { opacity: 1; transform: translateY(0); }
.card-open svg { width: 13px; height: 13px; }

/* Corpo della card: badge (ed eventuale titolo, se attivato nel JSON) */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px 16px;
}

.card-title {
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--navy-900);
  margin: 0;
  /* massimo 3 righe, poi puntini */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: .34em;
  padding: .3em .7em;
  border-radius: var(--r-full);
  font-size: .74rem; font-weight: 700; line-height: 1.35;
  white-space: nowrap;
}
/* Chi puo' partecipare */
.badge--who  { background: var(--blue-50);   color: var(--blue-600); border: 1px solid #d6e6fb; }
/* Tipologia di bando */
.badge--type { background: var(--amber-100); color: #8a5a05;         border: 1px solid #f6e0b4; }
/* Contatore "+N" quando i valori sono piu' di due */
.badge--more { background: #f1f5f9; color: var(--muted); border: 1px solid var(--line); }

/* ---- Stati speciali della griglia ---------------------------------------- */
.grid-state {
  padding: 62px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.grid-state h3 { color: var(--navy-900); margin-bottom: .3em; }
.grid-state p { margin-bottom: 1.2em; }

/* Scheletri di caricamento */
.skeleton {
  aspect-ratio: 4 / 5;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, #eef2f7 30%, #f7fafc 50%, #eef2f7 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}


/* ==========================================================================
   9. MODAL (popup del bando)
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vw, 34px);
  background: rgba(6, 21, 39, .72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-med), visibility var(--t-med);
}
.modal.is-open { opacity: 1; visibility: visible; }

.modal-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(940px, 100%);
  max-height: 100%;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  overflow: hidden;
  transform: translateY(22px) scale(.975);
  opacity: 0;
  transition: transform var(--t-med), opacity var(--t-med);
}
.modal.is-open .modal-dialog { transform: none; opacity: 1; }

/* ---- Intestazione del modal ---------------------------------------------- */
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal-head .badges { flex: 1 1 auto; }
.modal-title { font-size: 1.05rem; margin: 0 0 8px; }

.modal-close {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast);
}
.modal-close:hover {
  background: var(--navy-900); color: #fff;
  border-color: var(--navy-900); transform: rotate(90deg);
}
.modal-close svg { width: 16px; height: 16px; }

/* ---- Area immagine (scrollabile) ----------------------------------------- */
.modal-media {
  flex: 1 1 auto;
  overflow: auto;
  background: #eef2f7;
  padding: 16px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-media img {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  height: auto;
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  background: #fff;
}

/* ---- Piede del modal con la CTA ------------------------------------------ */
.modal-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.modal-foot .btn { flex: 1 1 auto; }
.modal-hint { font-size: .82rem; color: var(--muted); }

/* ---- Frecce di navigazione tra i bandi ------------------------------------ */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: none;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.94);
  color: var(--navy-900);
  box-shadow: var(--sh-md);
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.modal-nav:hover { background: var(--navy-900); color: #fff; }
.modal-nav--prev { left: 10px; }
.modal-nav--next { right: 10px; }
.modal-nav svg { width: 17px; height: 17px; }
.modal-nav[hidden] { display: none; }


/* ==========================================================================
   10. HOME PAGE E CHI SIAMO
   ========================================================================== */

/* ---- Griglia di schede generiche ------------------------------------------ */
.cards-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr));
  gap: 24px;
}

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 30px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.panel:hover { transform: translateY(-4px); box-shadow: var(--sh-md); border-color: #cfdcec; }

/* Filo colorato in cima alla scheda */
.panel::before {
  content: "";
  position: absolute; left: 28px; right: 28px; top: 0;
  height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--blue-500), var(--amber-500));
  opacity: 0; transition: opacity var(--t-med);
}
.panel:hover::before { opacity: 1; }

.panel h3 { font-size: 1.3rem; margin-bottom: .6rem; }
.panel h4 {
  font-size: .76rem; font-weight: 750; letter-spacing: .11em;
  text-transform: uppercase; color: var(--muted);
  margin: 1.4rem 0 .6rem;
}

/* Elenco puntato con segno di spunta */
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.check-list li { position: relative; padding-left: 30px; color: var(--ink-soft); }
.check-list li::before {
  content: "";
  position: absolute; left: 0; top: .42em;
  width: 18px; height: 18px;
  border-radius: var(--r-full);
  background: var(--blue-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M1.5 6.4l3 3L10.5 2.6' stroke='%231b62c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.check-list li strong { color: var(--navy-900); font-weight: 750; }

/* ---- Timeline "Come lavoriamo" -------------------------------------------- */
.steps { display: grid; gap: 20px; counter-reset: step; }

.step {
  position: relative;
  padding: 28px 28px 26px 78px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.step:hover { transform: translateX(4px); box-shadow: var(--sh-md); border-color: #cfdcec; }

/* Numero progressivo generato automaticamente dal CSS */
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 26px; top: 26px;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--navy-800), var(--navy-950));
  color: #fff;
  font-size: .85rem; font-weight: 750; letter-spacing: -.02em;
}

.step h3 {
  font-size: 1.02rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .85rem;
}

/* ---- Fascia CTA ----------------------------------------------------------- */
.cta-band {
  position: relative;
  overflow: hidden;
  padding: clamp(38px, 5vw, 62px) clamp(24px, 4vw, 56px);
  border-radius: var(--r-xl);
  color: #fff;
  background:
    radial-gradient(620px 320px at 88% 10%, rgba(245,165,36,.26), transparent 62%),
    linear-gradient(140deg, var(--navy-800), var(--navy-950));
  box-shadow: var(--sh-md);
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.85); max-width: 60ch; }
.cta-band .btn { margin-top: 10px; }


/* ==========================================================================
   11. FOOTER
   ========================================================================== */

.site-footer {
  background: var(--navy-950);
  color: rgba(255,255,255,.72);
  padding: clamp(46px, 5vw, 66px) 0 26px;
  font-size: .94rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 34px;
  padding-bottom: 32px;
}

.site-footer h4 {
  color: #fff;
  font-size: .76rem; font-weight: 750; letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.site-footer a { color: rgba(255,255,255,.82); }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .brand-name { color: #fff; }
.site-footer .brand-tag  { color: rgba(255,255,255,.55); }

/* Il logo ha sfondo trasparente, quindi si posa bene anche sul blu scuro */
.footer-logo { height: 62px; width: auto; margin-bottom: 14px; }

.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }

.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .84rem;
  color: rgba(255,255,255,.5);
}

/* Torna su */
.to-top {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 50;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--navy-900);
  box-shadow: var(--sh-md);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity var(--t-med), transform var(--t-med), visibility var(--t-med),
              background-color var(--t-fast), color var(--t-fast);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--navy-900); color: #fff; }
.to-top svg { width: 16px; height: 16px; }


/* ==========================================================================
   12. ANIMAZIONI
   ========================================================================== */

/* Comparsa progressiva degli elementi allo scroll (attivata da layout.js).
   Lo stato "nascosto" si applica solo se JavaScript e' attivo (classe .js
   aggiunta all'<html> in testa alla pagina): senza JavaScript il contenuto
   resta comunque visibile. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Comparsa a cascata delle card della griglia */
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.card-in { animation: card-in .5s var(--ease) both; }

/* Rispetta la preferenza di sistema "riduci animazioni" */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}


/* ==========================================================================
   13. RESPONSIVE
   ========================================================================== */

/* --- Tablet --------------------------------------------------------------- */
@media (max-width: 980px) {
  .bandi-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
}

/* --- Mobile: menu a tendina ------------------------------------------------ */
@media (max-width: 860px) {
  :root { --header-h: 66px; }

  .nav-toggle { display: inline-flex; }

  .nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 18px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-md);
    transform-origin: top;
    /* nascosto di default su mobile */
    display: none;
  }
  .nav.is-open { display: flex; animation: card-in .22s var(--ease) both; }
  .nav a { padding: .8em 1em; font-size: 1rem; }
  .nav a.is-active::after { left: 1em; right: auto; width: 22px; }

  /* Il numero di telefono resta raggiungibile: il bottone diventa solo icona */
  .header-cta { padding: .7em; margin-left: auto; }
  .header-cta .cta-label { display: none; }
  .header-cta svg { width: 1.25em; height: 1.25em; }

  .brand { margin-right: 0; }
  .brand-tag { display: none; }

  .filters { position: static; }
  .filters-inner { gap: 12px; }
  .filter-field { flex: 1 1 100%; min-width: 0; }
  .filter-meta { margin-left: 0; width: 100%; justify-content: space-between; }

  .modal { padding: 0; }
  .modal-dialog { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .modal-nav { display: none; }
  .modal-foot { flex-direction: column; align-items: stretch; }
  .modal-hint { display: none; }

  .step { padding: 74px 22px 24px; }
  .step::before { top: 22px; left: 22px; }
}

/* --- Mobile piccolo -------------------------------------------------------- */
@media (max-width: 520px) {
  body { font-size: 16px; }
  .bandi-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card-body { padding: 11px 11px 13px; }
  .badge { font-size: .68rem; padding: .26em .6em; }
  .card-open { display: none; }
  .to-top { right: 12px; bottom: 12px; }
}


/* ==========================================================================
   14. BANNER COOKIE
   Compare solo finche' la persona non ha scelto. Creato da layout.js.
   ========================================================================== */

.cookie-banner {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 60;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px 20px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}

.cookie-testo {
  flex: 1 1 320px;
  margin: 0;
  font-size: .92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.cookie-testo a { font-weight: 700; white-space: nowrap; }

.cookie-azioni { display: flex; gap: 10px; margin-left: auto; }
.cookie-azioni .btn { padding: .6em 1.2em; font-size: .9rem; }

@media (max-width: 520px) {
  .cookie-banner { padding: 14px; gap: 12px; }
  .cookie-azioni { width: 100%; margin-left: 0; }
  .cookie-azioni .btn { flex: 1; }
}


/* ==========================================================================
   15. STAMPA
   ========================================================================== */

@media print {
  .site-header, .filters, .site-footer, .to-top, .modal, .cookie-banner { display: none !important; }
  .card { break-inside: avoid; box-shadow: none; }
}
