:root {
  --gap: 1.5rem;
  --radius: 12px;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-secondary: #4b5563;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

/* HEADER */
.site-header {
  background: #fff;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.header-container {
  max-width: 1800px;
  margin: 0 auto;
}

.header-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.site-logo {
  width: 256px;
  height: auto;
}

.site-title {
  text-align: center;
  margin: 0;
  font-size: 1.75rem;
}

.site-subtitle {
  margin: 1rem auto 0;
  max-width: 900px;
  text-align: center;
  color: var(--text-secondary);
}

/* NAV */
.main-nav {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1000;
}

.nav-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-main);
  padding: 0.5rem;
}

.main-nav a.active {
  border-bottom: 2px solid #2563eb;
  font-weight: 600;
}

.nav-toggle { display: none; }

/* GRID */
main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 1rem;
}

#main-index {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.grid {
  display: grid;
  gap: var(--gap);
  align-items: stretch;
}

@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* CARD */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;

  /* 🔒 BLOCCA SBORDAMENTI */
  overflow: hidden;
  min-width: 0;
}


/* FLOURISH */
.viz-wrapper {
  position: relative;
  flex-grow: 1;

  /* 🔒 CONTENIMENTO */
  width: 100%;
  overflow: hidden;
  min-width: 0;
}

/*.flourish-embed {
  width: 100%;
  min-height: 220px;
}
*/
.flourish-embed {
  width: 100% !important;
  max-width: 100%;
  height: auto;

  /* evita overflow orizzontale */
  overflow: hidden;
}

.flourish-embed iframe,
.flourish-embed svg {
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
}


@media (min-width: 1200px) {
  .flourish-embed { min-height: 300px; }
}

/* EXPAND */
.viz-expand {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
}

/* MODALE */

.viz-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 2000;

  display: flex;
  align-items: center;
  justify-content: center;

  /* abilita scroll se necessario */
  overflow: auto;
}


/* Stato nascosto (default) */
.viz-modal[hidden] {
  display: none;
}

/* Stato visibile */
.viz-modal:not([hidden]) {
  display: flex;
}

.viz-modal-content {
  background: #fff;
  width: min(95vw, 1600px);
  max-height: 95vh;

  border-radius: 12px;
  padding: 1rem;
  position: relative;

  display: flex;
  flex-direction: column;

  /* scroll interno */
  overflow: auto;
}

.viz-modal-body {
  width: 100%;
  min-height: 300px;

  /* IMPORTANTISSIMO */
  overflow: visible;
}


.viz-modal-body .flourish-embed {
  width: 100%;
  max-width: 100%;
  height: auto !important;
}

.viz-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.25rem;
}

/* MOBILE */
@media (max-width: 767px) {
  .header-top {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .site-logo {
    margin: 0 auto;
    width: 200px;
  }

  .nav-container {
    justify-content: space-between;
  }

  .nav-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
  }

  .main-nav ul {
    display: none;
    flex-direction: column;
  }

  .main-nav ul.open {
    display: flex;
  }
}

/* FOOTER */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
}

/* ===============================
   LINK COME CALL TO ACTION
================================ */
.cta-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cta-list li + li {
  margin-top: 0.75rem;
}

.cta-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background-color: #2563eb; /* blu istituzionale */
  color: #ffffff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.cta-button .icon {
  font-size: 1.1rem;
  line-height: 1;
}

.cta-button:hover,
.cta-button:focus {
  background-color: #1d4ed8;
  outline: none;
  transform: translateY(-1px);
}

.cta-button:active {
  transform: translateY(0);
}

/* MOBILE */
@media (max-width: 767px) {
  .cta-button {
    justify-content: center;
  }
}

.flourish-credit::before {
    display: none;
}
.flourish-credit::after {
    display: none;
}

.hidden{
  display:none!important;
}
