/* ==================================================
   BASE VARIABLES & GLOBALS
   ================================================== */
:root {
  /* colors */
  --white: #ffffff;
  --light-gray: #f7f7f7;
  --gray: #b7b7b7;
  --black: #231f20;
  --violet: #a100ff;
  --light-violet: #f5eeff;
  --lime: #b7ff00;

  /* spacings */
  --gs: clamp(1rem, 1.2vw, 1.25rem); /* min 16px, fluido, max 20px */
  --gm: clamp(1.5rem, 2vw, 2.5rem); /* min 24px, fluido, max 40px */
  --gl: clamp(3rem, 4vw, 5rem); /* min 48px, fluido, max 80px */

  /* font sizes (base desktop) */
  --fl: clamp(21px, 2vw, 32px);
  --fm: clamp(19px, 1.65vw, 24px);
  --fs: clamp(17px, 1.12vw, 18px);

  /* fonts */
  --acumin: acumin-pro, sans-serif;
  --space: space-grotesk-variable, sans-serif;

  /* header height (desktop default) */
  --header-h: calc(var(--gm) * 3);
}

@media (max-width: 1150px) {
  :root {
    /* spacings */
    --gs: 1rem; /* 16px */
    --gm: 1.5rem; /* 24px */
    --gl: 3rem; /* 48px */

    /* mobile sizes */
    --fl: clamp(24px, 5vw, 32px);
    --fm: clamp(20px, 4.5vw, 24px);
    --fs: clamp(16px, 4vw, 18px);

    /* header height mobile */
    --header-h: calc(var(--gm) * 3);
  }
}

/* ==================================================
   GLOBAL RESET & TYPOGRAPHY
   ================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  max-width: 100vw;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  background: var(--white);
  color: var(--black);
  font-family: var(--acumin);
  font-size: var(--fs);
  max-width: 100vw;
}

html,
body {
  /* Blocca fisicamente lo scroll orizzontale senza rompere lo sticky verticale */
  max-width: 100vw;
  overflow-x: clip;
}

h1 {
  font-family: var(--space);
  color: var(--violet);
  font-size: var(--fl);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: var(--gm);
}

h2,
h3,
h4 {
  font-family: var(--space);
  color: var(--violet);
  font-size: var(--fm);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: var(--gm);
}

h5,
h6 {
  font-family: var(--space);
  color: var(--violet);
  font-size: var(--fs);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: var(--gm);
}

p {
  margin-bottom: var(--gs);
  line-height: 1.5;
}

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

/* offset for in-page anchors */
.item {
  scroll-margin-top: var(--header-h);
}

/* ==================================================
   HEADER & NAVIGATION
   ================================================== */
.header {
  align-items: flex-end;
  background: var(--light-gray);
  color: var(--black);
  display: flex;
  gap: var(--gs);
  height: calc(var(--gm) * 3);
  justify-content: space-between;
  padding: var(--gm);
  position: sticky;
  top: 0;
  z-index: 999;
  display: grid;
  grid-template-columns: 1fr 4fr;
  border-bottom: 1px solid var(--violet);
}

.header > div {
  display: flex;
  gap: var(--gs);
}

.logo {
  font-size: var(--fm);
}

.footer-logo {
  width: 53%;
}

/* unified nav container */
.site-nav {
  align-items: center;
  display: flex;
  gap: 0;
  justify-content: space-between;
}

.header .primary-menu,
.header .secondary-menu,
.header .tertiary-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.primary-menu,
.secondary-menu,
.tertiary-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-menu li,
.secondary-menu li,
.tertiary-menu li {
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: calc(var(--fs) * 1.15);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

/* primary menu typography (keep alias for retro-compat) */
.primary-menu,
.primaryMenu {
  font-family: var(--space) !important;
  text-transform: uppercase;
}

/* Hamburger */

/* =========================================
   FIX: HAMBURGER ICON E ANIMAZIONE A "X"
   ========================================= */
.menu-toggle {
  background: none;
  border: none;
  color: var(--black);
  cursor: pointer;
  display: none;
  width: 32px; /* Dimensione fissa per non rompere la geometria dell'animazione */
  height: 32px;
  position: relative;
  flex-shrink: 0; /* Impedisce al pulsante di rimpicciolirsi se c'è poco spazio */
  padding: 0;
}

/* Mostra il pulsante su mobile */
@media (max-width: 1150px) {
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Il contenitore delle barrette */
.menu-toggle .menu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 20px; /* Matematica esatta: 3 barrette (6px) + 2 spazi da 7px = 20px */
}

/* Le singole barrette */
.menu-toggle-bar {
  background: currentColor;
  border-radius: 2px;
  display: block;
  height: 2px;
  width: 100%;
  margin: 0; /* Rimuoviamo i vw che rompevano le proporzioni */
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
  transform-origin: center;
}

/* L'animazione per formare la X perfetta */
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg); /* Scende esattamente al centro */
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0; /* Scompare */
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg); /* Sale esattamente al centro */
}

/* =========================================
   FIX: HEADER SU UNA SOLA RIGA (Mobile)
   ========================================= */
@media (max-width: 1150px) {
  .header {
    display: flex !important;
    flex-wrap: nowrap !important; /* Forza gli elementi a non andare MAI a capo */
    justify-content: space-between;
    align-items: center; /* Centra verticalmente logo e icona */
    gap: 15px; /* Spazio di sicurezza tra logo e icona */
  }

  .header .logo {
    flex: 1 1 auto;
    /* Se lo schermo è microscopico, permette al logo di stringersi 
       anziché buttare fuori l'hamburger */
  }
}

/* Focus accessibility */
.menu-toggle:focus-visible,
.site-nav a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.content a,
.paragraph a {
  text-decoration: underline;
  color: var(--violet);
}

.content a:hover,
.paragraph a:hover {
  text-decoration: none;
}

/* ==================================================
   FOOTER
   ================================================== */
.footer {
  align-items: flex-start;
  background: var(--black);
  color: var(--white);
  display: grid;
  gap: var(--gl);
  grid-template-columns: 2fr 1fr 1fr 1fr 4fr;
  padding: var(--gm);
}

.footer div {
  display: flex;
  flex-direction: column;
}

.footer a:hover {
  text-decoration: underline;
}

.social {
  display: flex;
}

.colophon {
  gap: var(--gm);
}

.social-icons {
  display: flex;
  flex-flow: row !important;
  gap: var(--gs);
}

.social-icons a {
  color: var(--white);
  font-size: var(--fm);
  transition: color 0.2s ease;
}

.social-icons a:hover {
  color: var(--lime);
}

/* ==================================================
   LAYOUT (GRID)
   ================================================== */
.grid {
  align-items: flex-start;
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
}

.page .grid,
.two-col .grid {
  grid-template-columns: 1fr 4fr;
}

.page.no-submenu .grid {
  grid-template-columns: 1fr;
}

.page.two-col .grid .list {
  column-gap: 0;
  flex-wrap: wrap !important;
  flex-flow: row;
}

.page.no-submenu .grid .list {
  grid-column: 1 / -1;
}

.page .grid .list {
  column-gap: var(--gm);
  display: flex;
  flex-flow: column;
  grid-template-columns: repeat(8, 1fr);
}

.two-col .list .item {
  width: 50%;
  padding: calc(var(--gm) * 1.5) !important;
}

.page .content {
  grid-column: 1 / 9;
}

.page .list .item {
  grid-column: 1 / 6;
}

.list .content,
.list .item,
.form-column {
  padding: calc(var(--gm) * 1.5);
}

.list .item {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: var(--gs);
}

.list .item.centered {
  display: flex;
  flex-direction: column;
  padding: calc(var(--gm) * 1.5) calc(var(--gl) * 4);
}

.list .item:last-child {
  margin: 0 !important;
  padding-bottom: calc(var(--gm) * 3);
}

.front h1 {
  padding: var(--gm);
  margin: 0;
}

/* Front page sections */
.front-main {
  display: flex;
  flex-wrap: wrap;
}

.front-section {
  align-items: center;
  color: var(--white);
  display: flex;
  justify-content: center;
  min-height: 34vh;
  padding: var(--gm);
  position: relative;
  text-align: center;
  width: 100%;
}

.front-section--image {
  background-position: center;
  background-size: cover;
}

.front-section--image::after {
  content: "";
  inset: 0;
  position: absolute;
}

.front-section__inner {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: var(--gm);
  justify-content: center;
  position: relative;
  z-index: 1;
}

.front-section__title {
  line-height: 1.4;
  margin: 0;
  font-size: var(--fl);
  text-transform: uppercase;
  color: var(--black);
}

.front-section__button {
  border: 1px solid black;
  font-family: var(--space);
  border-radius: 999px;
  color: var(--black);
  display: inline-flex;
  padding: 0.6rem 2.2rem;
}

.front-section__button:hover,
.front-section__button:focus-visible {
  background: var(--black);
  color: var(--white);
}

.front-section--half {
  width: 50%;
}

.front-section--full {
  width: 100%;
}

@media (max-width: 1150px) {
  .front-section--half {
    width: 100%;
  }

  .two-col .list .item {
    width: 100%;
    padding: var(--gm) !important;
  }
}

/* Index / sticky columns */
.index,
.single .grid > .index {
  background-color: var(--light-violet);
  min-height: 100vh;
}

.inner-index {
  position: sticky;
  top: calc(var(--gm) * 3);
  padding: var(--gm);
}

/* sticky columns */
.index,
.aside {
  position: sticky;
  top: calc(var(--gm) * 3);
}

.placeholder {
  background: var(--light-violet);
  height: calc(100vh - (var(--gm) * 3));
}

/* Single template index column fills viewport with sticky contents */
.single .grid > .single-diagram {
  position: sticky;
  top: calc(var(--gm) * 3);
  align-self: stretch;
  background-color: transparent;
  border-radius: 0;
  padding: 0;
}

.single .single-diagram .diagram-shell {
  position: sticky;
  top: calc(var(--gm) * 3);
  align-items: center;
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 320px;
  overflow: hidden;
}

.single .single-diagram .diagram-inline {
  width: 130%;
  max-width: none;
  margin: -10% -5%;
}

.single .single-diagram svg,
.single .single-diagram img {
  color: var(--black);
  height: auto;
  max-width: 100%;
  width: 100%;
  display: block;
}

.single .single-diagram .diagram-link {
  color: var(--black);
  cursor: pointer;
  outline: none;
  text-decoration: none;
  transition: color 0.2s ease;
}

.single .single-diagram .diagram-link:focus-visible text {
  text-decoration: underline;
}

.single-content {
  padding: calc(var(--gm) * 1.5);
}

.single .single-content .diagram-highlight {
  animation: diagram-highlight-pulse 1.6s ease;
  box-shadow: 0 0 0 0 rgba(183, 255, 0, 0.45);
  border-radius: 1rem;
}

@keyframes diagram-highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(183, 255, 0, 0.65);
  }
  60% {
    box-shadow: 0 0 0 18px rgba(183, 255, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(183, 255, 0, 0);
  }
}

.single .single-diagram .diagram-label {
  fill: currentColor;
  font-family: var(--space);
  letter-spacing: 0.01em;
  user-select: none;
}

.single .single-diagram text.diagram-topic {
  fill: var(--violet);
  font-size: var(--gs);
  text-transform: uppercase;
}

.single .single-diagram text.diagram-node {
  fill: var(--black);
  font-size: calc(var(--fs) * 0.9);
}

.single .single-diagram .diagram-node-dot {
  fill: var(--black);
}

.single .single-diagram .diagram-point {
  transition: color 0.2s ease;
}

.single .single-diagram .diagram-halo {
  opacity: 0;
  transform: scale(0.85);
  transform-origin: center;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.single .single-diagram .diagram-point.is-hover .diagram-halo,
.single .single-diagram .diagram-point:focus-within .diagram-halo {
  opacity: 1;
  transform: scale(1);
}

/* content blocks */
.content,
.item,
.subitem {
  /* padding-bottom: var(--gl); */
}

/* Collapsible subitems */

.subitem__header {
  align-items: flex-start;
  display: flex;
  gap: var(--gs);
  justify-content: space-between;
}

.subitem__header .subtitle {
  flex: 1;
  font-size: var(--fm) !important;
}

.subitem__header .subtitle:hover > .subitem-toggle {
  flex: 1;
  font-size: var(--fm) !important;
  text-decoration: underline;
}

.subitem--collapsible {
  margin-bottom: 0 !important;
}

.subitem--collapsible .subtitle {
  margin-bottom: 0;
  font-size: var(--fm) !important;
}

.subitem-toggle {
  align-items: center;
  appearance: none;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: var(--gs);
  padding: 0;
  text-align: left;
  width: 100%;
}

.subitem-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.subitem-toggle__title {
  flex: 1;
}

.subitem-toggle__icon {
  flex: 0 0 auto;
  height: 0.9rem;
  position: relative;
  width: 0.9rem;
}

.subitem-toggle__icon::before,
.subitem-toggle__icon::after {
  background: currentColor;
  content: "";
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.subitem-toggle__icon::before {
  height: 100%;
  width: 2px;
}

.subitem-toggle__icon::after {
  height: 2px;
  width: 100%;
}

.subitem--open .subitem-toggle__icon::before {
  display: none;
}

.paragraph--collapsible {
  margin-top: var(--gs);
}

/* Ensure list bullets live within the paragraph width */
.content ul,
.content ol,
.paragraph ul,
.paragraph ol {
  list-style: none;
  margin: var(--gs) 0;
  padding-left: 0;
}

.content li,
.paragraph li {
  margin-bottom: 0.81em;
  margin-left: 1em;
}

.content ul li::before,
.paragraph ul li::before,
.content ol li::before,
.paragraph ol li::before {
  display: inline-block;
  margin-right: 0em;
  min-width: 1em;
}

.content ul li::before,
.paragraph ul li::before {
  content: "•";
  margin-left: -1em;
}

.content ol,
.paragraph ol {
  counter-reset: paragraph-ol-counter;
}

.content ol li::before,
.paragraph ol li::before {
  counter-increment: paragraph-ol-counter;
  content: counter(paragraph-ol-counter) ".";
}

.subitem {
  padding-top: var(--gl);
}

.title {
  color: var(--violet);
  font-family: var(--space);
  font-size: var(--fm);
  margin-bottom: var(--gs);
}

/* Title block */
.title-block {
  background-color: var(--light-gray);
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--gl);
  padding: var(--gm);
}

/* Generic rounded button wrapper */
.title-block button {
  appearance: none;
  background: none;
  border: 1px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  cursor: pointer;
  font-family: var(--space);
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  padding: 0.9rem 2.2rem;
  transition:
    transform 0.05s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.title-block button:hover {
  background: var(--black);
  color: #fff;
}

.title-block button:active {
  transform: translateY(1px);
}

.content h3 {
  font-size: var(--fm);
  line-height: 1.2;
}

/* ==================================================
   TOC / INDEX
   ================================================== */
.toc {
  font-size: calc(var(--fs) * 0.9);
  font-family: var(--space);
}

.toc ul {
  list-style: none;
  padding: 0;
}

.toc li {
  margin: calc(var(--gs) / 2) 0;
}

.toc-children {
  margin: var(--gs);
}

/* base state */
.toc a {
  align-items: center;
  color: var(--black);
  display: inline-flex;
  gap: 0.75rem;
  line-height: 1.3;
  text-decoration: none;
}

/* bullet */
.toc a::before {
  background: var(--gray);
  border-radius: 50%;
  content: "";
  display: inline-block;
  flex: 0 0 1vw;
  height: 1vw;
  width: 1vw;
}

.toc-children .toc-link::before {
  display: none;
}

.toc .active a {
  color: var(--violet);
}

.toc .active a:hover {
  color: var(--violet);
}

.toc .active a::before {
  background-color: var(--violet);
}

/* hover */
.toc a:hover {
  color: var(--black);
}

.toc a:hover::before {
  background: var(--violet);
}

/* active */
.toc a.is-active {
  color: var(--violet);
}

.toc a.is-active::before {
  background: var(--violet);
}

/* Toggle (reuses hamburger styles for bars) */
.toggle {
  align-items: center;
  background: none;
  border: 0;
  color: var(--violet);
  cursor: pointer;
  display: none;
  gap: 0.5rem;
  padding: 0;
  font: inherit;
}

.toggle .chevron {
  display: inline-flex;
  transition: transform 0.2s ease;
}

#index-toggle[aria-expanded="true"] .chevron,
#filters-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* chevron-to-X animation for index toggle */
#index-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
#index-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}
#index-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.nav-title .page-title {
  color: var(--violet);
  font-size: var(--fs);
  text-transform: uppercase;
  margin: 0;
}

/* ==================================================
   LIST (rich lists inside .list only)
   ================================================== */

/* custom bullets inside .list */
.list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  padding-left: 1vw;
  position: relative;
}

/* .list li::before {
  background: currentColor;
  border-radius: 50%;
  content: "";
  height: 0.5vw;
  left: 0;
  position: absolute;
  top: 0.6em;
  width: 0.5vw;
} */

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

/* color variants */
.list {
  color: var(--black);
}

.list.violet {
  color: var(--violet);
}

/* ==================================================
   FILTERS SIDEBAR
   ================================================== */
.index.filters {
  display: flex;
  flex-direction: column;
  gap: var(--gs);
  padding: var(--gm);
  position: sticky;
  top: calc(var(--gm) * 3);
  z-index: 99;
  background: var(--white);
}

.index.filters .nav-title {
  align-items: center;
  display: flex;
  gap: var(--gs);
  justify-content: space-between;
}

.index.filters .page-title,
.btn-sort-toggle {
  color: var(--violet);
  font-size: var(--fs);
  line-height: 1;
  text-transform: uppercase;
}

.index.filters .toggle {
  color: var(--violet);
  display: none;
  width: 1rem;
}

.filters-panel {
  display: block;
}

.filters-form {
  display: grid;
  gap: var(--gm);
}

.filters-group {
  border: 0;
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.filters-list {
  display: grid;
  gap: calc(var(--gs) / 2) 0;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--space);
  font-size: calc(var(--fs) * 0.9);
}

.filters-list li label {
  align-items: center;
  color: var(--black);
  cursor: pointer;
  display: inline-flex;
  line-height: 1.3;
}

.filters-list input[type="checkbox"] {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.filters-list li label span {
  align-items: center;
  display: inline-flex;
}

.filters-list li label span::before {
  background: var(--gray);
  border-radius: 50%;
  content: "";
  display: inline-block;
  flex: 0 0 18px;
  height: 18px;
  margin-right: 0.6rem;
  transform: translateY(0.03em);
  width: 18px;
}

.filters-list li label:hover {
  color: var(--black);
}

.filters-list li label:hover span::before {
  background: var(--violet);
}

.filters-list input[type="checkbox"]:checked + span {
  color: var(--violet);
}

.filters-list input[type="checkbox"]:checked + span::before {
  background: var(--violet);
}

.filters-actions {
  align-items: center;
  display: flex;
  gap: 0.75rem;
}

.btn-reset {
  text-decoration: underline;
}

.btn-reset:hover {
  text-decoration: none;
}

.results-count {
  color: var(--gray);
  font-size: 0.95em;
  margin-top: 0.25rem;
}

/* Legend (unified) */
.filters-group > legend {
  color: var(--violet);
  font-family: var(--space), sans-serif;
  margin-bottom: 0.35rem;
}

/* ==================================================
   PROJECTS LIST & MAP
   ================================================== */
.projects .list .project-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);

  padding-bottom: var(--gl);
  padding: calc(var(--gm) * 1.5);
}

.projects .list .project-title {
  font-family: var(--space);
  font-size: var(--fm);
  margin-bottom: 0.25rem;
}

.projects .list .project-meta {
  margin-bottom: 0.5rem;
}

.projects .list .project-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  color: var(--gray);
}

.project-excerpt a {
  text-decoration: underline;
}

.project-excerpt a:hover {
  text-decoration: none;
}

/* Map */
.projects-map {
  background: var(--light-violet);
  height: calc(100vh - (var(--gm) * 3));
  overflow: hidden;
  position: relative;
}

/* Map popup */
.maplibregl-popup-content {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  font-family: var(--space, system-ui, sans-serif) !important;
  padding: var(--gs) !important;
}

.maplibregl-popup-content .pm-addr {
  color: var(--black);
  opacity: 0.8;
}

.maplibregl-popup-content .pm-link a {
  color: var(--violet);
  text-decoration: underline;
}

/* ==================================================
   FORMS (Project submit)
   ================================================== */
.project-submit-form {
  display: flex;
  flex-direction: column;
  font-family: var(--acumin) !important;
  font-size: inherit;
  gap: var(--gs);
}

/* Labels/titoletti */
.project-submit-form label,
.project-submit-form legend {
  color: var(--violet);
  font-family: var(--space), sans-serif !important;
  letter-spacing: 0.01em;
  margin: 0 0 0.35rem 0;
}

/* Sottotitoli/descrizioni piccole */
.project-submit-form small,
.project-submit-form .help {
  color: #6b6b6b;
  display: block;
  font-size: 0.85em;
  margin-top: 0.25rem;
}

/* Campi base */
.project-submit-form input[type="text"],
.project-submit-form input[type="email"],
.project-submit-form input[type="url"],
.project-submit-form textarea {
  background: #f1f1f1;
  border: none;
  color: var(--black);
  font-family: var(--space);
  font-size: var(--fs);
  outline: none;
  padding: 0.85rem 1rem;
  width: 100%;
}

.project-submit-form textarea {
  min-height: 180px;
  resize: vertical;
}

/* Focus */
.project-submit-form input:focus,
.project-submit-form textarea:focus {
  background: #e7e7e7;
  outline: 2px solid var(--violet);
}

/* Fieldset */
.project-submit-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/* ===== Categorie (checkbox) con pallino ===== */
.project-submit-form .cats {
  display: grid;
  gap: 12px 40px;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.project-submit-form .cat {
  align-items: center;
  color: #a8a8a8;
  display: flex;
  font-family: var(--acumin);
  gap: 0.6rem;
}

/* nascondo la checkbox nativa */
.project-submit-form .cat input[type="checkbox"] {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

/* pallino */
.project-submit-form .cat .dot {
  background: #c9c9c9;
  border-radius: 0;
  flex: 0 0 18px;
  height: 18px;
  transform: translateY(1px);
  width: 18px;
}

/* checked -> viola pieno + testo viola */
.project-submit-form .cat input[type="checkbox"]:checked + .dot {
  background: var(--violet);
}

.project-submit-form .cat input[type="checkbox"]:checked ~ .label {
  color: var(--violet);
}

/* hover riga intera -> nero */
.project-submit-form .cat:hover .label {
  color: var(--black);
}

.project-submit-form .cat:hover .dot {
  background: var(--black);
}

/* ===== GDPR checkbox testuale ===== */
.project-submit-form .gdpr {
  align-items: flex-start;
  color: #3a3a3a;
  display: flex;
  gap: 0.65rem;
  line-height: 1.35;
}

.project-submit-form .gdpr a {
  color: var(--black);
  text-decoration: underline;
}

/* ===== Pulsante ===== */
.project-submit-form button[type="submit"] {
  appearance: none;
  background: #fff;
  border: 2px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  padding: 0.9rem 2.2rem;
  transition:
    transform 0.05s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.project-submit-form button[type="submit"]:hover {
  background: var(--black);
  color: #fff;
}

.project-submit-form button[type="submit"]:active {
  transform: translateY(1px);
}

/* reCAPTCHA spacing */
.project-submit-form .g-recaptcha {
  margin: 0.25rem 0 0.5rem;
}

/* Titoletti di sezione tipo “Your details” */
.project-submit-form .section-caption {
  color: #b9b9b9;
  font-family: var(--space), sans-serif;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  margin-top: 0.25rem;
}

/* Notifica dopo submit */
.notice.notice-success {
  background: var(--light-violet);
  border-left: 4px solid var(--violet);
  color: var(--black);
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
}

/* ==================================================
   CONTACT FORM 7
   ================================================== */
.wpcf7 {
  font-family: var(--acumin), sans-serif;
  font-size: inherit;
  width: 100%;
}

.wpcf7-form {
  display: flex;
  flex-direction: column;
  gap: var(--gs);
}

.wpcf7-form p {
  margin: 0;
}

.wpcf7-form label {
  color: var(--violet);
  display: block;
  font-family: var(--space), sans-serif;
  font-size: 0.95em;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.wpcf7-form .required {
  color: var(--black);
  font-weight: 400;
  margin-left: 0.15rem;
}

.wpcf7-form .wpcf7-form-control-wrap {
  display: block;
  margin-top: 10px;
}

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="url"],
.wpcf7-form input[type="tel"],
.wpcf7-form input[type="number"],
.wpcf7-form input[type="date"],
.wpcf7-form select,
.wpcf7-form textarea {
  background: #f1f1f1;
  border: none;
  color: var(--black);
  font: inherit;
  outline: none;
  padding: 0.85rem 1rem;
  width: 100%;
}

.wpcf7-form textarea {
  min-height: 180px;
  resize: vertical;
  font-size: var(--fs);
}

.wpcf7-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--black) 50%),
    linear-gradient(135deg, var(--black) 50%, transparent 50%);
  background-position:
    calc(100% - 1.25rem) calc(50% - 3px),
    calc(100% - 0.95rem) calc(50% - 3px);
  background-size:
    8px 8px,
    8px 8px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.wpcf7-form input:focus,
.wpcf7-form select:focus,
.wpcf7-form textarea:focus {
  background: #e7e7e7;
  outline: 2px solid var(--violet);
}

.wpcf7-form .wpcf7-form-control.wpcf7-not-valid {
  outline: 2px solid #ff5e7a;
  background: #ffeef1;
}

.wpcf7-not-valid-tip {
  color: #ff5e7a;
  font-size: 0.9em;
  margin-top: 0.25rem;
}

.wpcf7-form .wpcf7-list-item {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.wpcf7-form .wpcf7-list-item input[type="checkbox"],
.wpcf7-form .wpcf7-list-item input[type="radio"] {
  accent-color: var(--violet);
  height: 18px;
  width: 18px;
}

.wpcf7-form .wpcf7-acceptance label {
  color: var(--black);
  font-family: var(--acumin), sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.wpcf7-form .wpcf7-submit {
  appearance: none;
  background: none;
  border: 1px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  cursor: pointer;
  font-family: var(--space), sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  margin-top: 0.5rem;
  padding: 0.9rem 2.2rem;
  transition:
    transform 0.05s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.wpcf7-form .wpcf7-submit:hover {
  background: var(--black);
  color: #fff;
}

.wpcf7-form .wpcf7-submit:active {
  transform: translateY(1px);
}

.wpcf7-form .wpcf7-spinner {
  border-color: rgba(161, 0, 255, 0.3);
  border-top-color: var(--violet);
  margin-left: 0.75rem;
}

.wpcf7-form .wpcf7-response-output {
  background: var(--light-violet);
  border: none;
  border-left: 4px solid var(--violet);
  color: var(--black);
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
}

.wpcf7-form .wpcf7-response-output.wpcf7-mail-sent-ng {
  background: #ffeef1;
  border-left-color: #ff5e7a;
}

.wpcf7-form .wpcf7-response-output.wpcf7-mail-sent-ok {
  border-left-color: var(--lime);
}

/* =============== Categorie stile TOC =============== */
.cats.toc-like {
  display: grid;
  gap: 10px 28px;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.cats .cat {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  line-height: 1.3;
  user-select: none;
}

/* nascondi la checkbox nativa */
.cats .cat input[type="checkbox"] {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

/* pallino come nella TOC */
.cats .cat .dot {
  background: var(--gray);
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 1vw;
  height: 1vw;
  transform: translateY(1px);
  transition: background 0.15s ease;
  width: 1vw;
}

/* testo come nella TOC */
.cats .cat .text {
  color: var(--black);
  transition: color 0.15s ease;
}

/* Hover → nero, come TOC */
.cats .cat:hover .dot {
  background: var(--violet);
}

.cats .cat:hover .text {
  color: var(--black);
}

/* Selezionato → viola, come TOC .is-active */
.cats .cat input[type="checkbox"]:checked + .dot {
  background: var(--violet);
}

.cats .cat input[type="checkbox"]:checked ~ .text {
  color: var(--violet);
}

/* ==================================================
   ACCEPTANCE / LINKS
   ================================================== */
.acceptance {
  color: var(--black) !important;
  font-family: var(--acumin) !important;
  font-size: calc(var(--fs) / 1.2) !important;
}

.acceptance a {
  text-decoration: underline;
}

.acceptance a:hover {
  text-decoration: none;
}

/* ==================================================
   SNACKBAR / TOAST
   ================================================== */
.snackbar {
  align-items: center;
  background: #111;
  bottom: var(--gm);
  color: #fff;
  display: flex;
  gap: 0.75rem;
  left: 50%;
  line-height: 1.3;
  min-width: 260px;
  opacity: 0;
  padding: var(--gs);
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
}

.snackbar--show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.snackbar__icon {
  font-size: 1.1em;
  line-height: 1;
}

.snackbar__msg {
  flex: 1 1 auto;
}

.snackbar__btn {
  background: transparent;
  font-family: var(--acumin), sans-serif;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

/* Varianti colore (base) */
.snackbar--success {
  background: var(--violet);
}

.snackbar--error {
  background: var(--lime);
  color: var(--black);
}

.snackbar--info {
  background: var(--violet);
}

/* Tema ICT (palette alternativa separata) */
.ict-snack {
  background: #231f20;
  bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  color: #fff;
  display: flex;
  font-family: space-grotesk-variable, sans-serif;
  font-size: 16px;
  gap: 12px;
  left: 50%;
  line-height: 1.2;
  min-width: min(92vw, 540px);
  opacity: 0;
  padding: 14px 18px;
  pointer-events: auto;
  position: fixed;
  translate: 0 12px;
  transition:
    opacity 0.2s ease,
    translate 0.2s ease;
  z-index: 9999;
  transform: translateX(-50%);
}

.ict-snack--show {
  opacity: 1;
  translate: 0 0;
}

.ict-snack__icon {
  font-size: 18px;
  line-height: 0;
}

.ict-snack__close {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  margin-left: auto;
  padding: 4px 6px;
}

/* ==================================================
   TOC CHILDREN / ACCORDION
   ================================================== */
.toc-link {
  cursor: pointer;
}

.toc-link .chevron {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.toc-link[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* sotto-punti nell'indice TOC */
.toc-children {
  list-style: none;
  margin-left: var(--gm);
  padding: 0;
}

.toc-children a {
  text-decoration: none;
  color: var(--black) !important;
  display: block;
  font-size: calc(var(--fs) * 0.8);
}

.toc-children a.is-active {
  color: var(--violet) !important;
}

.toc-children a:hover {
  color: var(--black);
}

.toc-children a:hover.is-active {
  color: var(--violet);
}

/* rimuove marker */
.toc-children li::before {
  content: none !important;
}

/* ==================================================
   PRINCIPLES DIAGRAM
   ================================================== */
.principles-diagram {
  width: 100%;
  height: calc(100vh - (var(--gm) * 3));
  overflow: hidden;
  background: #fff;
  touch-action: none;
  position: sticky;
  top: calc(var(--gm) * 3);
}

.principles-diagram svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* linee tratteggiate tra i topic */
.principles-diagram .ring {
  fill: none;
  stroke: var(--violet);
  stroke-width: 3;
  stroke-dasharray: 8 15;
  opacity: 1;
  stroke-linecap: round;
}

/* etichette dei topic */
.principles-diagram .topic {
  font-size: clamp(14px, 2.3vw, 28px);
  fill: var(--violet);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: clamp(8px, 2vw, 20px);
  cursor: default;
  user-select: none;
}

/* nodi (punti neri) */
.principles-diagram .node {
  fill: var(--black);
  cursor: pointer;
  transition:
    r 0.2s ease,
    fill 0.2s ease;
}

/* label dei nodi: visibili solo in hover/active */
.principles-diagram .node-label {
  font-size: clamp(12px, 2vw, 22px);
  fill: var(--black);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  user-select: none;
}

.principles-diagram .node-wrap.active .node-label {
  opacity: 1;
}

/* alone "blob" verde */
.principles-diagram .halo {
  fill: url(#haloGradient);
  filter: url(#glow);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.principles-diagram .halo.show {
  opacity: 1;
}

/* opzionale: immagine di fallback sotto al diagramma */
.aside .illustration {
  margin-top: 1rem;
  width: 100%;
  height: auto;
  display: block;
}

.single-pagination {
  margin-top: var(--gl);
  color: var(--violet);
  display: flex;
  flex-flow: column;
}

.single-pagination a:hover {
  text-decoration: underline;
}

/* ==================================================
   DOWNLOADS
   ================================================== */
.accent {
  padding: calc(var(--gm) * 1.5);
  background-color: var(--light-violet);
}

.accent-2 {
  padding: calc(var(--gm) * 1.5);
  background-color: var(--light-gray);
}

.downloads-title {
  color: var(--violet);
  text-transform: uppercase;
}

/* Gruppo downloads nel pannello dell'accordion */
.toc-downloads-group {
  margin-top: 0.75rem;
}

.toc-downloads-group .downloads-title {
  display: block;
  color: var(--violet);
  text-transform: uppercase;
  font-family: var(--space), sans-serif;
}

/* Lista e item dei download */
.downloads-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-download-item {
  padding-left: 0;
  margin: 0.35rem 0;
}

/* Link dei download con icona */
.toc .downloads-list .download-link {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--black);
  line-height: 1.3;
}

.toc .downloads-list .download-link:hover {
  color: var(--violet);
}

/* Rimuove il pallino creato da .toc a::before */
.toc .downloads-list .download-link::before {
  content: none !important;
  display: none !important;
}

/* Icona download */
.toc .downloads-list .fa-download {
  font-size: 0.9rem;
  line-height: 1;
}

/* Download link nella single */
.toc-downloads-simple {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.toc-downloads-simple__divider {
  display: block;
  width: 100%;
  border-top: 2px dashed rgba(161, 0, 255, 0.4);
  margin-top: 0.5rem;
}

.toc-downloads-simple__link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--violet) !important;
  font-family: inherit;
  font-size: inherit;
  text-decoration: none;
}

.toc-downloads-simple__link::before {
  content: none !important;
  display: none !important;
}

.toc-downloads-simple__link:hover,
.toc-downloads-simple__link:focus-visible {
  color: var(--black) !important;
}

.toc-downloads-simple__icon svg {
  width: 14px;
  height: auto;
}

.toc-downloads-simple__label {
  text-decoration: none;
}

/* ==================================================
   RESPONSIVE
   ================================================== */
@media (max-width: 1150px) {
  /* show hamburger */
  .menu-toggle {
    display: inline-block;
  }

  .page.image .grid {
    display: grid;
    grid-template-columns: 1fr !important;
  }

  .footer-logo {
    width: 35%;
  }

  .header {
    align-items: center;
    display: flex;
  }

  .index {
    min-height: unset;
  }

  .list .item {
    grid-template-columns: 1fr;
    padding: var(--gm) !important;
  }

  /* mobile dropdown nav */
  .site-nav {
    background: var(--light-gray);
    display: none;
    flex-direction: column;
    font-size: var(--fm);
    gap: var(--gm);
    height: 100vh;
    left: 0;
    padding: var(--gm);
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1000;
  }

  .header.nav-open .site-nav {
    display: block;
  }

  .primary-menu,
  .secondary-menu,
  .tertiary-menu {
    flex-direction: column;
    gap: var(--gm);
  }

  .header .secondary-menu {
    padding-top: var(--gm);
  }

  /* footer stack */
  .footer {
    grid-template-columns: 1fr;
    padding: var(--gl) var(--gm);
  }

  .colophon {
    flex-direction: column-reverse !important;
    gap: var(--gl);
  }

  .social {
    gap: var(--gm);
  }

  .social-icons {
    gap: var(--gm);
  }

  /* grids collapse */
  .grid,
  .page .grid,
  .two-col .grid,
  .page .grid .list,
  .two-col .grid .list {
    gap: var(--gm);
    grid-template-columns: 1fr;
  }

  .two-col > .list .item {
    display: flex;
  }

  .two-col .content {
    grid-column: 1;
  }

  .index,
  .aside,
  .single-diagram {
    position: static;
  }

  .index {
    background-color: var(--light-violet);
    gap: var(--gm);
    position: sticky;
    z-index: 9;
  }

  /* index as full-width panel */
  .toggle {
    display: flex;
    flex-flow: column;
  }

  .nav-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .toc {
    display: none;
    position: relative;
  }

  .index.nav-open .toc {
    display: block;
  }

  .projects .list {
    order: 2;
  }

  .projects .grid {
    gap: 0;
  }

  .projects-map {
    height: 60vh;
  }

  .toc li {
    margin: var(--gs) 0;
  }

  /* larger bullets on mobile */
  .toc a::before {
    flex: 0 0 3vw;
    height: 3vw;
    width: 3vw;
  }

  .toc-children a {
    color: var(--black) !important;
  }

  .list li {
    padding-left: 3vw !important;
  }

  .list .content {
    padding: var(--gm) !important;
  }

  .list li::before {
    height: 1.5vw !important;
    width: 1.5vw !important;
  }

  /* Filters panel behavior */
  .index.filters {
    gap: var(--gm);
  }

  .index.filters .toggle {
    align-items: center;
    display: inline-flex;
    justify-content: center;
  }

  .filters-panel {
    display: none;
  }

  .filters-panel.open {
    display: block;
  }

  .filters-list {
    gap: 0.6rem;
  }

  /* Form categories on mobile */
  .project-submit-form .cats {
    gap: 10px 16px;
    grid-template-columns: 1fr;
  }

  .cats .cat .dot {
    flex: 0 0 3vw !important;
    height: 3vw !important;
    width: 3vw !important;
  }

  .cats {
    margin: var(--gs) 0 !important;
  }

  .cat {
    margin: 0 !important;
  }

  /* Snackbar full-width on mobile */
  .snackbar {
    bottom: 0 !important;
    padding: var(--gm) !important;
    width: 100%;
  }

  .title-block {
    grid-template-columns: 1fr;
    gap: var(--gs);
  }

  .title-block button {
    width: 100%;
  }

  .single .grid > .index {
    min-height: auto;
  }

  .single .single-diagram .diagram-shell {
    overflow: hidden;
  }

  .inner-index,
  .single-content {
    padding: var(--gm);
  }

  .projects .list .project-item {
    padding: var(--gm);
  }




  .header, 
  .index {
    transition: transform 0.3s ease, top 0.3s ease;
  }

  /* Quando il body riceve la classe "scroll-down" dal Javascript: */
  body.scroll-down .header {
    transform: translateY(-100%); /* L'header trasla in alto fuori dallo schermo */
  }

  body.scroll-down .index {
    top: 0; /* Il menu dei filtri scala in cima per tappare il buco dell'header! */
  }


  
}

.wpcf7 form .wpcf7-response-output {
  margin: 0;
  padding: 0;
  border: 0;
}

.page.image .grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 2rem;
}

.page.image .side-image {
  position: sticky;
  top: 2rem;
  align-self: start;
}

.page.image .side-image__img {
  width: 100%;
  height: auto;
  display: block;
}

.current-menu-item {
  color: var(--violet);
}

.footer .current-menu-item {
  color: white;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-close-button {
  display: none;
}

/* 1. Rendiamo TUTTI i contenitori del diagramma visibili oltre i loro bordi (nessun taglio né sopra, né sotto, né ai lati) */
.single .grid > .single-diagram,
.single .single-diagram .diagram-shell,
.single .single-diagram .diagram-inline,
.single .single-diagram svg {
  overflow: visible !important;
}

.footer {
  position: relative;
  z-index: 10;
}

/* ==================================================
   MOBILE DIAGRAM ZOOM FIX
   ================================================== */
@media (max-width: 1150px) {
  .single .single-diagram {
    overflow: hidden !important;
    width: 100vw; 
    position: relative !important;
    left: 50%;
    transform: translateX(-50%); /* Centra perfettamente il contenitore */
  }

  .single .single-diagram .diagram-shell {
    height: auto;
    min-height: 60vh;
    overflow: visible !important; 
  }

  .single .grid > .single-diagram {
    top: 0;
  }

  .single .single-diagram .diagram-inline {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important; 
    transform: scale(1.2);
    transform-origin: center center;
  }
}



.glossary-item,
.two-col .title {
	border: .1em solid #ff1fc3;
    padding: .1em .2em;
	color: var(--black) !important;
	width: fit-content;
	text-decoration:none !important;
}

.glossary-item:hover {
	color: #ff1fc3!important;
}