/* L'intestazione può trovarsi nello stesso contenitore dell'elenco oppure subito prima. */
html #page .section-title:has(+ #categoriesPlaceHolder, + link + #categoriesPlaceHolder, + .container > #categoriesPlaceHolder) {
  --categorie-anteprima: 1;
  color: #003c70;
  font-family: var(--portal-font-family, sans-serif) !important;
  font-size: clamp(24px, 2.45vw, 32px);
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.32;
  margin-block-end: 16px;
  overflow-wrap: break-word;
  text-wrap: balance;
}

/* Nel blocco territoriale il titolo segue il bordo delle categorie.
   Il titolo esterno alla griglia mantiene la composizione centrata. */
html #page .section-title:has(+ #categoriesPlaceHolder, + link + #categoriesPlaceHolder) {
  text-align: start;
  --categorie-margine-tratto: 0;
}
html #page .section-title:has(+ .container > #categoriesPlaceHolder) {
  text-align: center;
  --categorie-margine-tratto: auto;
}
html #page .section-title:has(+ #categoriesPlaceHolder, + link + #categoriesPlaceHolder, + .container > #categoriesPlaceHolder)::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin: 9px auto 0;
  margin-inline-start: var(--categorie-margine-tratto);
  border-radius: 2px;
  background: #fa7636;
}

html #page #categoriesPlaceHolder .category-band.category-accordion {
  border: 1px solid #d5e0e8;
  border-radius: 12px;
  background-color: #fff;
  box-shadow: none;
}
html #page #categoriesPlaceHolder .category-band .category-toggle {
  border-radius: 11px;
  color: #003c70;
}
html #page #categoriesPlaceHolder .category-band .category-toggle :is(h2, .category-label) {
  color: inherit;
  font-weight: 600;
}
html #page #categoriesPlaceHolder .category-band:has(.category-toggle[aria-expanded="true"], details[open]) {
  border-color: #87a7bf;
}
html #page #categoriesPlaceHolder .category-band :is(.category-toggle[aria-expanded="true"], details[open] > summary) {
  background: #eaf3f8;
  box-shadow: inset 4px 0 #fa7636;
  color: #003c70;
}
html #page #categoriesPlaceHolder .category-toggle:focus-visible,
html #page #categoriesPlaceHolder a.btn-tag:focus-visible {
  outline: 2px solid #003c70;
  outline-offset: -2px;
}
html #page #categoriesPlaceHolder .category-links > a.btn-tag {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  line-height: 1.45;
}
html #page #categoriesPlaceHolder .category-links .category-link-name {
  min-width: 0;
  overflow-wrap: break-word;
}
/* Nel livello usato dal portale, il composto resta intero finché entra nella voce. */
@layer portal-word-flow {
  html #page #categoriesPlaceHolder .category-link-name .portal-whole-word {
    display: inline-block !important;
    inline-size: max-content !important;
    max-inline-size: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
}
html #page #categoriesPlaceHolder details.category-native > .category-links {
  margin-inline: clamp(10px, 2.4vw, 20px);
}
@media (pointer: coarse) {
  html #page #categoriesPlaceHolder .category-links > a.btn-tag {
    min-height: 44px;
    align-content: center;
  }
}
@media (forced-colors: active) {
  html #page #categoriesPlaceHolder .category-band:has(.category-toggle[aria-expanded="true"], details[open]) {
    border-color: Highlight;
  }
}

/* Nella griglia regionale una parola più larga della colonna resta leggibile accanto alla propria icona. */
@layer portal-word-flow {
  html #page #categoriesPlaceHolder.region-category-grid .category-link-name {
    overflow-wrap: anywhere !important;
  }
}
