/* =====================================================================
 * DISTRO5 UI — Testata di pagina ("hero")
 * ---------------------------------------------------------------------
 * Markup generato da _distro5_page_hero() in catalog_lite.theme.
 * Pagine abilitate: _distro5_hero_pages() nello stesso file.
 * ===================================================================== */

.d5-hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 var(--d5-space-4);
  padding: var(--d5-space-4) var(--d5-space-5) var(--d5-space-4);
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-lg);
  box-shadow: var(--d5-shadow);
}

/* Grafica decorativa a destra (come nel mockup): disco in vinile azzurro
   e onde di linee sottili (d5-wave.svg), su sfondo bianco, senza riquadri */
.d5-hero::before,
.d5-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
/* onde: sfumano ai due lati, nessun fondo */
.d5-hero::after {
  z-index: 0;
  top: 0;
  right: 0;
  width: 820px;
  height: 100%;
  max-height: 230px;
  /* onde distese su tutta la parte destra della testata: sfumano a
     sinistra e a destra */
  background: url(d5-wave.svg) right 0 center / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 25%, #000 72%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 25%, #000 72%, transparent 100%);
}
/* disco: foro bianco, etichetta chiara, vinile azzurro con solchi; sfuma in basso */
.d5-hero::before {
  z-index: 1;
  top: 12px;
  right: 290px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 0 4px, rgba(255,255,255,0) 5px),
    radial-gradient(circle, #eaf3fb 0 22px, #dcebf7 30px, rgba(220,235,247,0) 31px),
    repeating-radial-gradient(circle, rgba(255,255,255,.10) 0 1px, rgba(255,255,255,0) 1px 3px),
    linear-gradient(160deg, #a9cdec 0%, #7fb3df 55%, #9cc6e9 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 45%, rgba(0,0,0,.15) 100%);
          mask-image: linear-gradient(180deg, #000 45%, rgba(0,0,0,.15) 100%);
  opacity: .9;
}
@media (max-width: 991px) {
  .d5-hero::before { right: 24px; opacity: .35; }
  .d5-hero::after  { width: 100%; opacity: .6; }
}
.d5-hero > * {
  position: relative;
  z-index: 1;
}

/* Albero del sito */
.d5-hero__crumbs .breadcrumb,
.d5-hero__crumbs nav {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.d5-hero__crumbs ol,
.d5-hero__crumbs ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--d5-space-2);
  padding: 0;
  list-style: none;
  font-size: var(--d5-fs-sm);
  color: var(--d5-text-muted);
}
/* breadcrumb.css centra l'elenco con larghezze fisse (510–1110px): qui no */
.d5-hero .d5-hero__crumbs .breadcrumb .breadcrumb__items {
  width: auto;
  margin-left: 0;
  padding-left: 0;
}
.d5-hero .d5-hero__crumbs .breadcrumb {
  margin-left: 0;
}
.d5-hero__crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  background: none;
}
.d5-hero__crumbs .breadcrumb__item-separator {
  color: var(--d5-text-subtle);
  font-size: 11px;
}
/* il primo elemento non ha bisogno del separatore */
.d5-hero__crumbs li:first-child .breadcrumb__item-separator {
  display: none;
}
/* "HOME" (/home) ripete "Home": la nascondo */
.d5-hero__crumbs li:has(> a[href$="/home"]) {
  display: none;
}
.d5-hero__crumbs a {
  color: #1a8dd7;
  font-weight: 600;
  text-decoration: none;
}
/* Casetta al posto della parola "Home" */
.d5-hero__crumbs li:first-child a span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}
.d5-hero__crumbs li:first-child a::before {
  content: "\f015";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 15px;
  color: #017abd;
}

/* Riga principale: icona, titolo, contatore */
.d5-hero__main {
  display: flex;
  align-items: center;
  gap: var(--d5-space-4);
}
.d5-hero__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--d5-primary-gradient);
  box-shadow: 0 6px 16px rgba(1, 116, 174, .28);
  color: #fff;
  font-size: 26px;
}
.d5-hero__heading {
  min-width: 0;
}
body .d5-hero__title {
  margin: 0;
  padding: 0;
  color: var(--d5-text);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
  text-transform: none;
}
.d5-hero__summary {
  margin-top: 4px;
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-lg);
}
.d5-hero__stat {
  display: inline-flex;
  align-items: center;
  gap: var(--d5-space-3);
  margin-left: auto;
  min-width: 150px;
  padding: 14px 20px;
  /* pseudo-pulsante: azzurro traslucido sopra le onde, bordo e ombra morbidi */
  background: linear-gradient(180deg, rgba(222,240,253,.94), rgba(205,232,251,.94));
  border: 1px solid #c4e1f6;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(1,116,174,.12), inset 0 1px 0 rgba(255,255,255,.7);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  color: #1a8dd7;
  cursor: default;
}
.d5-hero__stat > svg { color: #1a8dd7; }
.d5-hero__stat > i,
.d5-hero__stat > svg {
  font-size: 26px;
}
.d5-hero__stat strong {
  display: block;
  color: var(--d5-text);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.d5-hero__stat small {
  display: block;
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-xs);
}

/* Schede di navigazione della sezione */
.d5-hero__tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--d5-space-2);
  margin-top: var(--d5-space-4);
}
body .d5-hero__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 var(--d5-space-3);
  background: #eaf4fc;
  border: 1px solid #e0eef9;
  border-radius: var(--d5-radius-sm);
  color: var(--d5-text);
  font-size: var(--d5-fs);
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background var(--d5-transition), border-color var(--d5-transition), color var(--d5-transition);
}
/* Font Awesome trasforma <i> in <svg>: coloro entrambi */
body .d5-hero__tab i,
body .d5-hero__tab svg {
  color: #1a8dd7;
  font-size: 18px;
}
body .d5-hero__tab:hover,
body .d5-hero__tab:focus {
  background: #cfeafb;
  border-color: rgba(1, 144, 217, .25);
  color: var(--d5-primary-dark);
}
body .d5-hero__tab.is-active,
body .d5-hero__tab.is-active:hover {
  background: var(--d5-primary-gradient);
  border-color: var(--d5-primary-dark);
  color: var(--d5-on-primary);
  box-shadow: 0 4px 12px rgba(1, 116, 174, .25);
}
body .d5-hero__tab.is-active i,
body .d5-hero__tab.is-active svg {
  color: var(--d5-on-primary);
}

/* Schermi stretti */
@media (max-width: 991px) {
  .d5-hero::before { display: none; }
  .d5-hero__main { flex-wrap: wrap; }
  .d5-hero__stat { margin-left: 0; }
  body .d5-hero__title { font-size: 26px; }
}

/* ---------------------------------------------------------------------
 * TRANSITORIO: sulle pagine con la testata nuova nascondo gli elementi
 * vecchi che la testata sostituisce. Da togliere quando saranno rimossi
 * dalla configurazione (header delle View Release).
 * --------------------------------------------------------------------- */
.d5-has-hero .view-current-user-info .page_title {
  display: none;
}
.d5-has-tabs .view-header > a.btn.btn-info,
.d5-has-tabs .view-header > a.btn.btn-light.text-info {
  display: none;
}
.d5-has-tabs .view-header:not(:has(> :not(a.btn-info, a.text-info))) {
  display: none;
}


/* =====================================================================
 * Utente connesso in alto a destra (accanto alla lingua)
 * ===================================================================== */
.header-top-highlighted-second.d5-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--d5-space-4);
  height: 100%;
  white-space: nowrap;
}
.d5-header-sep {
  width: 1px;
  height: 38px;
  background: rgba(255, 255, 255, .22);
}

/* body details.d5-user: annulla lo stile "card" dato ai <details> dei form */
body details.d5-user {
  position: relative;
  z-index: 1000;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #fff;
  font-weight: 400;
}
body details.d5-user > summary.d5-user__summary,
body details.d5-user[open] > summary.d5-user__summary {
  margin: 0;
  border: 0;
  color: #fff;
  font-weight: 400;
}
.d5-user__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
  border-radius: var(--d5-radius);
  list-style: none;
  cursor: pointer;
  color: #fff;
  transition: background var(--d5-transition);
}
.d5-user__summary::-webkit-details-marker { display: none; }
.d5-user__summary::marker { content: ""; }
.d5-user__summary:hover,
.d5-user[open] .d5-user__summary {
  background: rgba(255, 255, 255, .08);
}
.d5-user__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2aa6e6 0%, #0174ae 100%);
  border: 2px solid rgba(255, 255, 255, .28);
  color: #fff;
  font-size: 19px;
}
.d5-user__avatar svg,
.d5-user__avatar i { color: #fff; }
.d5-user__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  text-align: left;
}
.d5-user__name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.d5-user__role {
  color: #8fd0f5;
  font-size: 13px;
}
.d5-user__chev,
.d5-user__summary > svg:last-child {
  color: #fff;
  font-size: 12px;
  transition: transform var(--d5-transition);
}
.d5-user[open] .d5-user__chev,
.d5-user[open] .d5-user__summary > svg:last-child {
  transform: rotate(180deg);
}

/* Menu a tendina */
.d5-user__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius);
  box-shadow: var(--d5-shadow-lg);
  text-align: left;
}
.d5-user__menu li { margin: 0; padding: 0; }
body .d5-user__menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--d5-radius-sm);
  color: var(--d5-text);
  font-size: var(--d5-fs);
  font-weight: 500;
  text-decoration: none;
}
body .d5-user__menu a svg,
body .d5-user__menu a i {
  width: 16px;
  color: #1a8dd7;
}
body .d5-user__menu a:hover {
  background: var(--d5-primary-soft);
  color: var(--d5-primary-dark);
}

@media (max-width: 767px) {
  .d5-user__text { display: none; }
  .d5-header-sep { display: none; }
}

/* ---------------------------------------------------------------------
 * Pulsantoni di sezione: generati dal menu principale
 * (_distro5_menu_grid() in catalog_lite.theme). Le voci e i permessi
 * seguono il menu; qui solo l'aspetto.
 * --------------------------------------------------------------------- */
.d5-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--d5-space-3);
  margin: 0 0 var(--d5-space-5);
}
.d5-menu-grid__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 132px;
  padding: 20px 16px;
  background: var(--d5-surface);
  border: 1px solid var(--d5-border);
  border-radius: var(--d5-radius-lg);
  box-shadow: var(--d5-shadow);
  color: var(--d5-text);
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.d5-menu-grid__item:hover,
.d5-menu-grid__item:focus-visible {
  border-color: #b9d5ea;
  box-shadow: 0 10px 24px rgba(1, 116, 174, .14);
  color: var(--d5-text);
  text-decoration: none;
  transform: translateY(-2px);
}
.d5-menu-grid__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e3f3fd;
  color: #1a8dd7;
  font-size: 24px;
}
.d5-menu-grid__icon i,
.d5-menu-grid__icon svg {
  color: #1a8dd7;
}
.d5-menu-grid__item:hover .d5-menu-grid__icon {
  background: var(--d5-primary-gradient, linear-gradient(180deg,#0a9be3,#0085cd));
}
.d5-menu-grid__item:hover .d5-menu-grid__icon i,
.d5-menu-grid__item:hover .d5-menu-grid__icon svg {
  color: #fff;
}
.d5-menu-grid__label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.d5-menu-grid__desc {
  color: var(--d5-text-muted);
  font-size: var(--d5-fs-xs);
  line-height: 1.35;
}

/* TRANSITORIO: dove c'è la griglia automatica nascondo i vecchi pulsantoni
   scritti a mano nel corpo della pagina. Toglili dal nodo quando vuoi. */
.d5-has-menu-grid .field--name-body [class*="col-"]:has(> a.btn.btn-lg) {
  display: none;
}

/* Emoji usate come icona (stessa del menu in alto) */
.d5-menu-grid__icon .d5-emoji { font-size: 26px; line-height: 1; }
.d5-hero__tab .d5-emoji { font-size: 15px; line-height: 1; margin-right: 2px; }

/* Etichette lunghe delle schede: vanno a capo invece di uscire dal pulsante */
body .d5-hero__tab {
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}
body .d5-hero__tab > span { min-width: 0; }
body .d5-hero__tab i,
body .d5-hero__tab svg,
body .d5-hero__tab .d5-emoji { flex: 0 0 auto; }
@media (max-width: 575px) {
  .d5-hero__tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .d5-hero__tab { font-size: 12px; gap: 6px; }
}

/* ---------------------------------------------------------------------
 * Sfondi disegnati per sezione (classe d5-bg--<lettera> sul body,
 * scelta in _distro5_section_background() in catalog_lite.theme).
 * Sostituiscono il grigio sfumato e le immagini caricate dalle pagine.
 * --------------------------------------------------------------------- */
html body.d5-bg {
  background: #eef4f9 linear-gradient(180deg, #f6fafd 0%, #e3eef8 100%) fixed !important;
}
body.d5-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
body.d5-bg--E::before { background-image: url(d5-bg-E.svg); }
body.d5-bg--F::before { background-image: url(d5-bg-F.svg); }
body.d5-bg--G::before { background-image: url(d5-bg-G.svg); }
body.d5-bg--I::before { background-image: url(d5-bg-I.svg); }
body.d5-bg--J::before { background-image: url(d5-bg-J.svg); }
body.d5-bg--K::before { background-image: url(d5-bg-K.svg); }
body.d5-bg--L::before { background-image: url(d5-bg-L.svg); }
body.d5-bg--M::before { background-image: url(d5-bg-M.svg); }
body.d5-bg--N::before { background-image: url(d5-bg-N.svg); }
/* Su schermi piccoli il disegno resta, ma più tenue */
@media (max-width: 767px) {
  body.d5-bg::before { opacity: .6; }
}

/* Testi delle schede: vanno a capo solo tra una parola e l'altra,
   senza spezzare le parole con il trattino */
body .d5-hero__tab {
  overflow-wrap: normal;
  word-break: normal;
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* Sezioni con molte schede (più di 7): "pillole" larghe quanto il loro
   testo, su una riga, che si dispongono su più righe riempiendo lo spazio */
.d5-hero__tabs.d5-hero__tabs--many {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.d5-hero__tabs--many .d5-hero__tab {
  flex: 1 1 auto;
  min-height: 40px;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: .01em;
  white-space: nowrap;
}
.d5-hero__tabs--many .d5-hero__tab i,
.d5-hero__tabs--many .d5-hero__tab svg {
  font-size: 15px;
}
/* sui telefoni le pillole possono andare a capo tra le parole */
@media (max-width: 575px) {
  .d5-hero__tabs--many .d5-hero__tab { white-space: normal; flex-basis: 40%; }
}
/* l'ultima riga non si allarga a tutta la larghezza */
.d5-hero__tabs--many::after {
  content: "";
  flex: 100 1 0;
}
