:root {
  --bg: #f7fbfb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #eef7f6;
  --text: #17313a;
  --muted: #5f767d;
  --line: #d7e7e5;
  --teal: #177a74;
  --teal-strong: #11655f;
  --teal-soft: #dff3f0;
  --s8: #F8B1B0;
  --s8-strong: #A64F58;
  --s8-soft: #FDEAEA;
  --shadow: 0 16px 36px rgba(23, 49, 58, 0.08);
  --radius: 24px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.68;
  background:
    radial-gradient(circle at top right, rgba(58, 169, 162, 0.12), transparent 22%),
    linear-gradient(180deg, #fbfefd 0%, #f7fbfb 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  background: rgba(23, 122, 116, 0.08);
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.92em;
}

button {
  font: inherit;
}

.shell {
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 251, 251, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(23, 49, 58, 0.06);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.navlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.navlinks a:hover {
  color: var(--teal);
}

.hero {
  padding: 64px 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 16px;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--teal), transparent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.7rem, 5.3vw, 4.8rem);
  line-height: 0.95;
  max-width: 11ch;
}

.subtitle {
  margin: 18px 0 0;
  max-width: 42ch;
  font-size: clamp(1.06rem, 1.9vw, 1.22rem);
  color: #27464d;
}

.hero-copy,
.section-intro {
  color: var(--muted);
}

.hero-copy {
  margin-top: 18px;
  max-width: 66ch;
}

.actions,
.facts,
.links,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions,
.facts {
  margin-top: 24px;
}

.btn,
.fact {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(23, 49, 58, 0.05);
}

.btn:hover {
  color: var(--teal);
  border-color: #b7d7d2;
}

.btn.primary {
  background: linear-gradient(135deg, var(--teal) 0%, #249f97 100%);
  border-color: transparent;
  color: #ffffff;
}

.fact {
  padding: 10px 14px;
  color: #254249;
  font-size: 0.92rem;
}

.card,
.figure-card,
.dataset-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  padding: 22px;
}

.card p:last-child {
  margin-bottom: 0;
}

main section {
  padding: 28px 0;
  scroll-margin-top: 88px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.section-head p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
}

.takeaways {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.takeaway {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f5fbfa 100%);
}

.takeaway strong {
  display: block;
  margin-bottom: 6px;
  color: var(--teal-strong);
  font-size: 1.2rem;
}

.chart-stack {
  display: grid;
  gap: 26px;
  min-width: 0;
}

.figure-card {
  margin: 0;
  padding: 18px 18px 20px;
  min-width: 0;
  width: 100%;
}

.figure-card h3 {
  font-size: 1.18rem;
  line-height: 1.3;
  margin-bottom: 10px;
  letter-spacing: -0.015em;
}

.plot-frame {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border-radius: 18px;
  border: 1px solid #ddebe8;
  background: #ffffff;
  min-height: 430px;
}

.plot-target {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 430px;
}

.js-plotly-plot,
.plot-container,
.svg-container {
  max-width: 100% !important;
}

.plot-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.plot-frame.ready .plot-status {
  opacity: 0;
}

.chart-lede {
  margin: 18px 0 10px;
  padding: 16px 18px 16px 20px;
  border-left: 4px solid var(--teal);
  border-radius: 8px 14px 14px 8px;
  background: linear-gradient(180deg, rgba(223, 243, 240, 0.6) 0%, rgba(255, 255, 255, 0.94) 100%);
  color: #102a32;
  font-size: 1.04rem;
  font-weight: 500;
  line-height: 1.6;
}

.chart-lede strong {
  color: var(--teal-strong);
}

.chart-howto {
  margin: 4px 2px 0;
  padding: 12px 16px;
  border-left: 3px solid #c6d7d4;
  color: var(--muted);
  background: #f8fcfb;
  border-radius: 8px 14px 14px 8px;
  font-size: 0.95rem;
}

.links {
  margin-top: 14px;
}

.links a,
.dataset-list a,
.source-links a {
  color: var(--teal);
  font-weight: 700;
}

.source-links {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.source-links a {
  margin-right: 12px;
  white-space: nowrap;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fcfb;
  border: 1px solid var(--line);
  color: #3f5960;
  font-size: 0.84rem;
}

.tags {
  margin-top: 12px;
}

.map-card {
  overflow: hidden;
  padding: 0;
}

.map-copy {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 18px;
  padding: 20px 20px 16px;
  align-items: start;
}

.map-copy p {
  margin: 0;
  color: var(--muted);
}

.map-copy .chart-lede {
  margin: 0;
}

.map-frame {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.map-frame iframe {
  display: block;
  width: 100%;
  height: min(920px, 88vh);
  min-height: 760px;
  border: 0;
}

.dataset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dataset-card {
  padding: 18px;
}

.dataset-card h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.dataset-card p {
  margin: 0;
  color: var(--muted);
}

.dataset-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.dataset-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.dataset-list span:last-child {
  white-space: nowrap;
}

.js-plotly-plot .plotly .modebar {
  right: 8px;
  top: 8px;
}

.footer {
  padding: 28px 0 42px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .hero,
  .takeaways,
  .map-copy,
  .dataset-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --radius: 17px;
    --shadow: 0 10px 24px rgba(23, 49, 58, 0.07);
  }

  .shell {
    width: min(var(--max), calc(100% - 18px));
  }

  .nav {
    align-items: center;
    gap: 10px;
    padding: 10px 0;
  }

  .brand {
    flex: 0 0 auto;
    font-size: 0.98rem;
  }

  .navlinks {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    white-space: nowrap;
    width: auto;
    min-width: 0;
    padding: 2px 0 4px;
    scrollbar-width: none;
  }

  .navlinks::-webkit-scrollbar {
    display: none;
  }

  .hero {
    padding: 28px 0 18px;
    gap: 14px;
  }

  h1 {
    font-size: clamp(2.35rem, 12vw, 3.25rem);
    max-width: none;
  }

  .subtitle {
    font-size: 1.03rem;
  }

  .hero-copy {
    margin-top: 14px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .btn {
    justify-content: center;
    min-height: 44px;
  }

  .card,
  .figure-card,
  .dataset-card,
  .takeaway {
    border-radius: var(--radius);
  }

  .card,
  .dataset-card {
    padding: 15px;
  }

  main section {
    padding: 22px 0;
    scroll-margin-top: 70px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .takeaways,
  .chart-stack,
  .map-copy,
  .dataset-grid {
    gap: 12px;
  }

  .takeaway {
    padding: 14px;
  }

  .figure-card {
    padding: 11px 10px 14px;
  }

  .figure-card h3 {
    font-size: 1.04rem;
    margin: 0 2px 8px;
  }

  .plot-target,
  .plot-frame {
    min-height: 390px;
  }

  .plot-frame {
    border-radius: 13px;
  }

  .chart-lede {
    margin-top: 12px;
    padding: 12px 13px;
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .chart-howto {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .links,
  .source-links {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .links::-webkit-scrollbar,
  .source-links::-webkit-scrollbar {
    display: none;
  }

  .links a,
  .source-links a {
    flex: 0 0 auto;
    margin-right: 0;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    white-space: nowrap;
    font-size: 0.88rem;
  }

  .source-links {
    align-items: center;
    font-size: 0;
  }

  .source-links::before {
    content: "Fonti:";
    flex: 0 0 auto;
    align-self: center;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
  }

  .map-copy {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .map-frame iframe {
    height: 1380px;
    min-height: 1380px;
  }

  .dataset-list a {
    flex-direction: column;
    gap: 2px;
  }

  .footer {
    padding-bottom: 28px;
  }
}
