/* =====================================================================
   Pagina "Modulistica" - disegno in stile Apple: ricerca in evidenza, "Parti dalla tua
   necessita'" (sei argomenti), schede compatte con pannello di dettaglio per ogni modulo,
   avvertenza finale. File aggiuntivo: per tornare indietro basta non caricarlo (la pagina
   riprende il disegno di prima). Pensato prima per il telefono (campi a 16px, aree di tocco
   da 44px, margini di sicurezza).
   Senza JavaScript ogni scheda resta completa (quando usarlo, allegati, scarica, fonte).
   ===================================================================== */

.mh,
.mh-sheet {
  --mh-ink: #1d1d1f;
  --mh-sub: #515154;
  --mh-mute: #6e6e73;
  --mh-line: rgba(29, 29, 31, 0.1);
  --mh-bg: #fbf8f5;
  --mh-fill: rgba(120, 120, 128, 0.12);
  --mh-accent: var(--asser-primary, #7d445e);
  --mh-accent-2: var(--asser-secondary, #4b2338);
  --mh-sticky: 57px;
  --mh-font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mh-display: "Sora", "Manrope", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mh-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color: var(--mh-ink);
  font-family: var(--mh-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mh {
  display: block;
  width: 100%;
  overflow-x: clip;
}

.mh *,
.mh *::before,
.mh *::after,
.mh-sheet *,
.mh-sheet *::before,
.mh-sheet *::after {
  box-sizing: border-box;
}

.mh a,
.mh-sheet a {
  text-underline-offset: 0.18em;
}

.mh button,
.mh-sheet button {
  font-family: inherit;
}

.mh-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mh [hidden],
.mh-sheet[hidden] {
  display: none !important;
}

.mh-wrap {
  width: 100%;
  max-width: 1180px;
  margin-right: auto;
  margin-left: auto;
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
}

/* ---------- tinte delle icone (una per argomento) ---------- */
[data-mh-tone="green"] { --mh-t1: #3f9486; --mh-t2: #1e5b51; }
[data-mh-tone="indigo"] { --mh-t1: #6f8acb; --mh-t2: #38508f; }
[data-mh-tone="amber"] { --mh-t1: #e69a3a; --mh-t2: #b0600d; }
[data-mh-tone="rose"] { --mh-t1: #e0646f; --mh-t2: #a52c40; }
[data-mh-tone="plum"] { --mh-t1: #92506f; --mh-t2: #4b2338; }
[data-mh-tone="teal"] { --mh-t1: #3aa6c1; --mh-t2: #1b6a86; }
[data-mh-tone="slate"] { --mh-t1: #8b909c; --mh-t2: #565a65; }

.mh-ico {
  display: grid;
  flex: none;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--mh-t1, #92506f), var(--mh-t2, #4b2338));
  box-shadow: 0 6px 14px rgba(29, 29, 31, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff;
}

.mh-svg {
  display: block;
  flex: none;
}

.mh-go {
  display: inline-grid;
  flex: none;
  place-items: center;
  color: var(--mh-mute);
  transition: transform 0.2s ease, color 0.2s ease;
}

/* ---------- testata e ricerca ---------- */
.mh-hero {
  padding: clamp(2.6rem, 8vw, 5.2rem) 0 clamp(1.5rem, 3.6vw, 2.5rem);
  background:
    radial-gradient(900px 360px at 50% -8%, rgba(125, 68, 94, 0.12), rgba(125, 68, 94, 0) 70%),
    linear-gradient(#ffffff, var(--mh-bg));
  text-align: center;
}

.mh-kicker {
  margin: 0 0 0.9rem;
  color: var(--mh-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mh .mh-title {
  max-width: 16em;
  margin: 0 auto;
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: clamp(2.15rem, 5.4vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.mh .mh-lead {
  max-width: 40rem;
  margin: 1.1rem auto 0;
  color: var(--mh-sub);
  font-size: clamp(1.02rem, 1.9vw, 1.2rem);
  font-weight: 500;
  line-height: 1.55;
  text-wrap: pretty;
}

.mh-tools {
  max-width: 54rem;
  margin: 1.9rem auto 0;
}

.mh-search {
  max-width: 43rem;
  margin-right: auto;
  margin-left: auto;
}

.mh-search__field {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 58px;
  padding: 0 0.7rem 0 1.15rem;
  border: 1px solid var(--mh-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.04), 0 12px 32px rgba(29, 29, 31, 0.07);
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mh-search__field:focus-within {
  border-color: rgba(125, 68, 94, 0.55);
  box-shadow: 0 0 0 4px rgba(125, 68, 94, 0.14), 0 12px 32px rgba(29, 29, 31, 0.07);
}

.mh-search__icon {
  display: grid;
  flex: none;
  place-items: center;
  color: var(--mh-mute);
}

.mh .mh-search input[type="search"] {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--mh-ink);
  font-family: var(--mh-font);
  font-size: 1.05rem;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
}

.mh .mh-search input[type="search"]::placeholder {
  color: var(--mh-mute);
  opacity: 1;
}

.mh .mh-search input[type="search"]::-webkit-search-cancel-button,
.mh .mh-search input[type="search"]::-webkit-search-decoration {
  display: none;
  -webkit-appearance: none;
}

.mh .mh-search__clear {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--mh-fill);
  color: var(--mh-sub);
  cursor: pointer;
}

.mh .mh-search__clear:hover {
  background: rgba(120, 120, 128, 0.22);
}

.mh-trending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.05rem 0 0;
}

.mh-trending > span {
  margin-right: 0.15rem;
  color: var(--mh-mute);
  font-size: 0.86rem;
  font-weight: 700;
}

.mh .mh-trending button {
  min-height: 36px;
  margin: 0;
  padding: 0.4rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: var(--mh-fill);
  color: var(--mh-ink);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.mh .mh-trending button:hover {
  background: rgba(120, 120, 128, 0.2);
}

.mh .mh-trending button:active {
  transform: scale(0.97);
}

.mh-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem 1.4rem;
  margin: 1.7rem 0 0;
  color: var(--mh-mute);
  font-size: 0.92rem;
  font-weight: 500;
}

.mh-stats b {
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mh .mh-stats a {
  color: var(--mh-accent);
  font-weight: 800;
  text-decoration: none;
}

.mh .mh-stats a:hover {
  text-decoration: underline;
}

/* ---------- barra di sezioni (resta sotto la barra del sito) ---------- */
.mh-bar {
  position: sticky;
  top: var(--mh-sticky);
  z-index: 40;
  border-top: 1px solid var(--mh-line);
  border-bottom: 1px solid var(--mh-line);
  background: rgba(251, 248, 245, 0.97);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}

.mh-bar__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
}

.mh-bar__title {
  flex: none;
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mh-bar ul {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mh .mh-bar a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.8rem;
  border-radius: 999px;
  color: var(--mh-sub);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mh .mh-bar a:hover {
  color: var(--mh-ink);
}

.mh .mh-bar a.is-current {
  background: rgba(125, 68, 94, 0.1);
  color: var(--mh-accent-2);
}

/* ---------- scelta rapida ---------- */
.mh-needs {
  padding: clamp(2.4rem, 6vw, 4rem) 0 clamp(1.2rem, 3vw, 2rem);
  background: var(--mh-bg);
  scroll-margin-top: calc(var(--mh-sticky) + 52px);
}

.mh-eyebrow {
  margin: 0 0 0.55rem;
  color: var(--mh-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mh .mh-h2 {
  margin: 0;
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: clamp(1.7rem, 3.6vw, 2.45rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.mh-needs__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 1.7rem 0 0;
  padding: 0;
  list-style: none;
}

.mh .mh-need {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "ico text go"
    "ico n go";
  align-items: center;
  gap: 0.15rem 0.95rem;
  min-height: 100%;
  padding: 1rem 1rem 1rem 1.05rem;
  border: 1px solid var(--mh-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.04);
  color: var(--mh-ink);
  text-decoration: none;
  transition: transform 0.25s var(--mh-ease), box-shadow 0.25s var(--mh-ease), border-color 0.25s ease, background-color 0.25s ease;
}

.mh .mh-need .mh-ico {
  grid-area: ico;
  align-self: start;
}

.mh-need__text {
  grid-area: text;
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.mh-need__text b {
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: 1.04rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.mh-need__text span {
  color: var(--mh-sub);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

.mh-need__n {
  grid-area: n;
  align-self: end;
  margin-top: 0.35rem;
  color: var(--mh-mute);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 700;
}

.mh-need__n b {
  color: var(--mh-ink);
  font-variant-numeric: tabular-nums;
}

.mh .mh-need .mh-go {
  grid-area: go;
}

.mh .mh-need:hover {
  border-color: rgba(125, 68, 94, 0.3);
  box-shadow: 0 14px 34px rgba(29, 29, 31, 0.1);
  transform: translateY(-3px);
}

.mh .mh-need:hover .mh-go {
  color: var(--mh-accent);
  transform: translateX(3px);
}

.mh .mh-need[aria-pressed="true"] {
  border-color: var(--mh-accent);
  background: linear-gradient(#fff, #fbf3f6);
  box-shadow: 0 0 0 3px rgba(125, 68, 94, 0.14), 0 10px 26px rgba(75, 35, 56, 0.1);
}

.mh .mh-need[aria-pressed="true"] .mh-go {
  color: var(--mh-accent);
}

.mh .mh-needs__more {
  margin: 1.4rem 0 0;
  color: var(--mh-mute);
  font-size: 0.95rem;
  font-weight: 500;
}

.mh .mh-needs__more a {
  color: var(--mh-accent);
  font-weight: 800;
}

/* ---------- elenco dei moduli ---------- */
.mh-library {
  padding: 0 0 clamp(1.5rem, 4vw, 2.5rem);
  background: var(--mh-bg);
  scroll-margin-top: calc(var(--mh-sticky) + 70px);
}

.mh-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin: 1.4rem 0 0;
  padding: 0.7rem 0.8rem 0.7rem 1.1rem;
  border: 1px solid var(--mh-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.04);
}

.mh-status p {
  margin: 0;
  color: var(--mh-ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.mh .mh-empty {
  margin: 1.4rem 0 0;
  padding: 1.4rem 1.3rem;
  border: 1px dashed rgba(125, 68, 94, 0.35);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--mh-sub);
  font-size: 0.98rem;
  line-height: 1.55;
  text-align: center;
}

.mh-section {
  padding-top: clamp(2.2rem, 5vw, 3.4rem);
  scroll-margin-top: calc(var(--mh-sticky) + 52px);
}

.mh-section[hidden] {
  display: none;
}

.mh-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.mh .mh-section__desc {
  max-width: 44rem;
  margin: 0.7rem 0 0;
  color: var(--mh-sub);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
}

.mh-count {
  flex: none;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--mh-fill);
  color: var(--mh-sub);
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mh-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.1rem 0 0;
}

.mh .mh-index a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--mh-line);
  border-radius: 999px;
  background: #fff;
  color: var(--mh-sub);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

.mh .mh-index a:hover {
  color: var(--mh-accent-2);
}

.mh .mh-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.mh-cell {
  display: flex;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mh-cell[hidden] {
  display: none;
}

/* ---------- la scheda di un modulo ---------- */
.mh .mh-card {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  padding: 1.15rem 1.15rem 1.1rem;
  border: 1px solid var(--mh-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.04);
  scroll-margin-top: calc(var(--mh-sticky) + 72px);
  transition: transform 0.28s var(--mh-ease), box-shadow 0.28s var(--mh-ease), border-color 0.28s ease;
}

.mh-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

/* il codice (AdER RS, ASSER ...) sta nella riga del titoletto: su schermo largo lo si porta in alto a destra */
.mh .mh-card .mh-code {
  position: absolute;
  top: 1.2rem;
  right: 1.15rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.mh .mh-ico {
  width: 44px;
  height: 44px;
  border-radius: 13px;
}

.mh-code {
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mh-card--ader .mh-code {
  background: rgba(10, 132, 255, 0.1);
  color: #0a62c9;
}

.mh-card--asser .mh-code {
  background: rgba(125, 68, 94, 0.11);
  color: var(--mh-accent-2);
}

.mh-card__main {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.mh-card__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.5rem;
  margin: 0;
  color: var(--mh-mute);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mh .mh-card__title {
  margin: 0;
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: 1.14rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.mh .mh-card__title a {
  color: inherit;
  text-decoration: none;
}

.mh .mh-card__desc {
  margin: 0;
  color: var(--mh-sub);
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.5;
}

.mh-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mh-badge {
  margin: 0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--mh-fill);
  color: var(--mh-sub);
  font-size: 0.78rem;
  font-weight: 700;
}

.mh-badge--kind {
  background: rgba(125, 68, 94, 0.1);
  color: var(--mh-accent-2);
}

.mh-card--ader .mh-badge--kind {
  background: rgba(10, 132, 255, 0.1);
  color: #0a62c9;
}

.mh-card__extra {
  display: grid;
  gap: 0.9rem;
}

.mh-card__cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.4rem;
}

.mh .mh-card__cols h4 {
  margin: 0 0 0.45rem;
  color: var(--mh-ink);
  font-family: var(--mh-font);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.mh .mh-card__cols ul {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mh .mh-card__cols li {
  position: relative;
  margin: 0;
  padding-left: 1.05rem;
  color: var(--mh-sub);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
}

.mh .mh-card__cols li::before {
  position: absolute;
  top: 0.6em;
  left: 0;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--mh-t1, var(--mh-accent));
  content: "";
}

.mh-card__meta {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  color: var(--mh-mute);
  font-size: 0.78rem;
  font-weight: 500;
}

.mh .mh-file {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.mh-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 0.3rem;
}

.mh-more {
  display: none;
}

/* ---------- bottoni ---------- */
.mh .mh-btn,
.mh-sheet .mh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  margin: 0;
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--mh-font);
  font-size: 0.93rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.mh .mh-btn--primary,
.mh-sheet .mh-btn--primary {
  background: linear-gradient(135deg, #8a4a69, #4b2338);
  box-shadow: 0 8px 20px rgba(75, 35, 56, 0.28);
  color: #fff;
}

.mh .mh-btn--primary:hover,
.mh-sheet .mh-btn--primary:hover {
  box-shadow: 0 12px 26px rgba(75, 35, 56, 0.34);
  transform: translateY(-1px);
}

.mh .mh-btn--soft,
.mh-sheet .mh-btn--soft {
  border-color: var(--mh-line);
  background: #fff;
  color: var(--mh-accent-2);
}

.mh .mh-btn--soft:hover,
.mh-sheet .mh-btn--soft:hover {
  border-color: rgba(125, 68, 94, 0.35);
  background: #fbf3f6;
}

.mh .mh-btn--small {
  min-height: 44px;
  padding: 0 1rem;
  font-size: 0.88rem;
}

.mh .mh-btn:active,
.mh-sheet .mh-btn:active {
  transform: scale(0.98);
}

.mh .mh-btn .mh-svg,
.mh-sheet .mh-btn .mh-svg {
  flex: none;
}

/* ---------- "Prima di inviare" ---------- */
.mh-note {
  padding: clamp(1rem, 3vw, 2rem) 0 clamp(3rem, 7vw, 5rem);
  background: var(--mh-bg);
  scroll-margin-top: calc(var(--mh-sticky) + 52px);
}

.mh-note__box {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.3rem 1.4rem;
  border: 1px solid var(--mh-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.04);
}

.mh-note__ico {
  display: grid;
  flex: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: rgba(125, 68, 94, 0.1);
  color: var(--mh-accent);
}

.mh-note__box strong {
  display: block;
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: 1.05rem;
  font-weight: 650;
}

.mh .mh-note__box p {
  margin: 0.35rem 0 0;
  color: var(--mh-sub);
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.6;
}

/* =====================================================================
   Con JavaScript: schede compatte (i dettagli stanno nel pannello)
   ===================================================================== */
.mh.mh-js .mh-index {
  display: none;
}

.mh.mh-js .mh-card {
  cursor: pointer;
}

.mh.mh-js .mh-card__extra,
.mh.mh-js .mh-source {
  display: none;
}

.mh.mh-js .mh-card__desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.mh.mh-js .mh-card__title a::after {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  content: "";
}

.mh.mh-js .mh-card__foot {
  justify-content: space-between;
}

.mh.mh-js .mh-card__foot .mh-download {
  position: relative;
  z-index: 2;
  min-height: 44px;
  padding: 0 1rem;
  font-size: 0.86rem;
}

.mh.mh-js .mh-more {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--mh-accent);
  font-size: 0.88rem;
  font-weight: 800;
}

.mh.mh-js .mh-card:hover {
  border-color: rgba(125, 68, 94, 0.3);
  box-shadow: 0 16px 36px rgba(29, 29, 31, 0.1);
  transform: translateY(-3px);
}

.mh.mh-js .mh-card:hover .mh-more .mh-svg {
  transform: translateX(3px);
}

.mh.mh-js .mh-more .mh-svg {
  transition: transform 0.2s ease;
}

.mh .mh-need:focus-visible {
  outline: 3px solid rgba(125, 68, 94, 0.55);
  outline-offset: 3px;
}

/* con la tastiera il contorno e' sulla scheda intera (il titolo e' il collegamento che la copre); i programmi senza ":has" tengono il contorno del titolo */
@supports selector(:has(a)) {
  .mh .mh-card:has(.mh-card__title a:focus-visible) {
    outline: 3px solid rgba(125, 68, 94, 0.55);
    outline-offset: 3px;
  }

  .mh .mh-card__title a:focus-visible {
    outline: 0;
  }
}

.mh a:focus-visible,
.mh button:focus-visible,
.mh-sheet a:focus-visible,
.mh-sheet button:focus-visible {
  outline: 3px solid rgba(125, 68, 94, 0.55);
  outline-offset: 2px;
}

/* ---------- senza JavaScript: scheda completa, su due colonne piu' larghe ---------- */
.mh:not(.mh-js) .mh-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mh:not(.mh-js) .mh-card__foot {
  justify-content: flex-start;
}

.mh:not(.mh-js) .mh-card__cols {
  grid-template-columns: minmax(0, 1fr);
}

/* =====================================================================
   Comparsa dolce (solo se il movimento e' consentito)
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .mh.mh-ready .mh-pre {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s var(--mh-ease), transform 0.6s var(--mh-ease);
  }

  .mh.mh-ready .mh-pre.is-in {
    opacity: 1;
    transform: none;
  }
}

/* =====================================================================
   Pannello di dettaglio (sta fuori dalla pagina: vive nel body)
   ===================================================================== */
.mh-sheet {
  position: fixed;
  z-index: 100000;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top, 0px)) max(1.25rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
  line-height: 1.5;
  visibility: hidden;
  pointer-events: none;
}

.mh-sheet.is-open {
  visibility: visible;
  pointer-events: auto;
}

.mh-sheet__backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(29, 29, 31, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mh-sheet.is-open .mh-sheet__backdrop {
  opacity: 1;
}

.mh-sheet__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 780px);
  max-height: min(100%, 860px);
  overflow: hidden;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(29, 29, 31, 0.35), 0 0 0 1px rgba(29, 29, 31, 0.06);
  opacity: 0;
  outline: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.3s ease, transform 0.34s var(--mh-ease);
}

.mh-sheet.is-open .mh-sheet__panel {
  opacity: 1;
  transform: none;
}

.mh-sheet__bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.75rem 1rem;
  border-bottom: 1px solid var(--mh-line);
  background: rgba(255, 255, 255, 0.92);
}

.mh-sheet__crumb {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--mh-mute);
  font-size: 0.84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-sheet .mh-round {
  display: grid;
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--mh-fill);
  color: var(--mh-ink);
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.mh-sheet .mh-round:hover:not(:disabled) {
  background: rgba(120, 120, 128, 0.22);
}

.mh-sheet .mh-round:disabled {
  opacity: 0.35;
  cursor: default;
}

.mh-sheet__scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 1.5rem 1.6rem 1.7rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mh-sheet__head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.mh-sheet .mh-ico {
  display: grid;
  flex: none;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--mh-t1, #92506f), var(--mh-t2, #4b2338));
  box-shadow: 0 8px 18px rgba(29, 29, 31, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff;
}

.mh-sheet__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  color: var(--mh-mute);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mh-sheet .mh-code {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
}

.mh-sheet[data-kind="ader"] .mh-code {
  background: rgba(10, 132, 255, 0.1);
  color: #0a62c9;
}

.mh-sheet[data-kind="asser"] .mh-code {
  background: rgba(125, 68, 94, 0.11);
  color: var(--mh-accent-2);
}

.mh-sheet h2 {
  margin: 0;
  color: var(--mh-ink);
  font-family: var(--mh-display);
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.mh-sheet__desc {
  margin: 1.1rem 0 0;
  color: var(--mh-sub);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.6;
}

.mh-sheet .mh-badges {
  margin-top: 1.1rem;
}

.mh-sheet__cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.mh-sheet__cols section {
  padding: 1.1rem 1.15rem;
  border-radius: 20px;
  background: #f6f3f1;
}

.mh-sheet h3 {
  margin: 0 0 0.6rem;
  color: var(--mh-ink);
  font-family: var(--mh-font);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.mh-sheet__cols ul {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mh-sheet__cols li {
  position: relative;
  margin: 0;
  padding-left: 1.5rem;
  color: var(--mh-sub);
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.5;
}

.mh-sheet__cols li::before {
  position: absolute;
  top: 0.18em;
  left: 0;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--mh-t1, #92506f), var(--mh-t2, #4b2338));
  content: "";
}

.mh-sheet__cols li::after {
  position: absolute;
  top: 0.45em;
  left: 0.33rem;
  width: 0.36rem;
  height: 0.2rem;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg);
}

.mh-sheet__related {
  margin-top: 1.4rem;
}

.mh-sheet__related ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mh-sheet__related li {
  margin: 0;
}

.mh-sheet .mh-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--mh-line);
  border-radius: 999px;
  background: #fff;
  color: var(--mh-ink);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.mh-sheet .mh-chip:hover {
  border-color: rgba(125, 68, 94, 0.35);
  background: #fbf3f6;
}

.mh-sheet .mh-chip b {
  color: var(--mh-accent-2);
  font-weight: 800;
}

.mh-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.7rem;
}

.mh-sheet__meta {
  display: grid;
  gap: 0.15rem;
  margin: 1rem 0 0;
  color: var(--mh-mute);
  font-size: 0.8rem;
  font-weight: 500;
}

.mh-sheet__meta span:first-child {
  overflow-wrap: anywhere;
}

.mh-sheet__pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1.7rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--mh-line);
}

.mh-sheet__pager button {
  display: grid;
  gap: 0.15rem;
  min-height: 56px;
  margin: 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--mh-line);
  border-radius: 16px;
  background: #fff;
  color: var(--mh-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.mh-sheet__pager button:hover {
  border-color: rgba(125, 68, 94, 0.35);
  background: #fbf3f6;
}

.mh-sheet__pager button[data-mh-next] {
  text-align: right;
}

.mh-sheet__pager small {
  color: var(--mh-mute);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mh-sheet__pager strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--mh-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* il pannello aperto blocca la pagina sotto; il blocco sta SOLO su "html": con "overflow: hidden" anche su "body" le barre del sito (sticky) smettono di restare in alto */
html.mh-lock {
  overflow: hidden;
  overscroll-behavior: none;
}

/* =====================================================================
   Schermi piu' stretti
   ===================================================================== */
@media (max-width: 1099px) {
  .mh-needs__grid,
  .mh .mh-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* schermi a sfioramento (telefono, tablet, anche iPad in orizzontale): tutto cio' che si tocca e' alto almeno 44 px */
@media (pointer: coarse), (max-width: 920px) {
  .mh .mh-trending button,
  .mh .mh-bar a,
  .mh .mh-index a,
  .mh .mh-btn--small {
    min-height: 44px;
  }

  .mh .mh-stats a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .mh .mh-needs__more a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (max-width: 920px) {
  .mh-wrap {
    padding-right: max(var(--m-gutter, 16px), env(safe-area-inset-right, 0px));
    padding-left: max(var(--m-gutter, 16px), env(safe-area-inset-left, 0px));
  }

  .mh-search__field {
    min-height: 56px;
  }

  .mh .mh-search input[type="search"] {
    font-size: 16px;
  }

  .mh .mh-trending button,
  .mh .mh-bar a,
  .mh .mh-index a {
    min-height: 44px;
  }

  .mh .mh-btn--small {
    min-height: 44px;
  }

  .mh.mh-js .mh-card__foot .mh-download {
    min-height: 44px;
  }

  /* crocetta della ricerca e tondi del pannello: area da toccare di 44 px */
  .mh .mh-search__clear {
    width: 44px;
    height: 44px;
  }

  .mh-sheet .mh-round {
    width: 44px;
    height: 44px;
  }

  .mh-sheet .mh-chip {
    min-height: 44px;
  }

  .mh-sheet__pager button {
    min-height: 56px;
  }
}

@media (max-width: 760px) {
  .mh-bar__title {
    display: none;
  }

  .mh-bar__in {
    padding-right: 0;
    padding-left: 0;
  }

  .mh-bar ul {
    width: 100%;
    padding: 0 var(--m-gutter, 16px);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mh-bar ul::-webkit-scrollbar {
    display: none;
  }

  .mh-bar li {
    flex: none;
    scroll-snap-align: start;
  }

  .mh-sheet__cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .mh-card__cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .mh-needs__grid,
  .mh .mh-grid,
  .mh:not(.mh-js) .mh-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* testata piu' raccolta */
  .mh-hero {
    padding-top: 2.1rem;
    padding-bottom: 1.3rem;
  }

  .mh .mh-title {
    font-size: 1.95rem;
  }

  .mh .mh-lead {
    margin-top: 0.85rem;
    font-size: 1rem;
  }

  .mh-tools {
    margin-top: 1.4rem;
  }

  /* i suggerimenti scorrono su una riga sola */
  .mh-trending {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-right: calc(-1 * var(--m-gutter, 16px));
    margin-left: calc(-1 * var(--m-gutter, 16px));
    padding: 0.15rem var(--m-gutter, 16px) 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mh-trending::-webkit-scrollbar {
    display: none;
  }

  .mh-trending > span,
  .mh .mh-trending button {
    flex: none;
  }

  .mh-stats {
    margin-top: 1.1rem;
    font-size: 0.86rem;
  }

  /* gli argomenti: righe raccolte, con il numero dei moduli a destra */
  .mh-needs__grid {
    gap: 10px;
    margin-top: 1.3rem;
  }

  .mh .mh-need {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "ico text n go";
    gap: 0 0.8rem;
    padding: 0.85rem 0.85rem 0.85rem 0.9rem;
    border-radius: 20px;
  }

  .mh .mh-need .mh-ico {
    align-self: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .mh-need__text span {
    font-size: 0.86rem;
  }

  .mh-need__n {
    align-self: center;
    margin: 0;
    font-size: 0.95rem;
  }

  .mh-need__n span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .mh-section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }

  .mh-stats {
    gap: 0.35rem 1.1rem;
  }

  .mh .mh-card {
    padding: 1.05rem 1.05rem 1rem;
    border-radius: 22px;
  }

  .mh .mh-card .mh-code {
    position: static;
    flex: none;
  }

  /* con lo script, sul telefono ogni modulo e' una riga (icona, titolo, scarica): tutto l'elenco si legge in poche schermate */
  .mh.mh-js .mh-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "ico main act";
    gap: 0 0.85rem;
    align-items: center;
    padding: 0.9rem 0.8rem 0.9rem 0.9rem;
    border-radius: 20px;
  }

  .mh.mh-js .mh-card__top {
    display: block;
    grid-area: ico;
    align-self: start;
  }

  .mh.mh-js .mh-card__main {
    grid-area: main;
    gap: 0.3rem;
  }

  .mh.mh-js .mh-card__foot {
    grid-area: act;
    margin: 0;
    padding: 0;
  }

  .mh.mh-js .mh-card__foot .mh-download {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  .mh.mh-js .mh-card__foot .mh-download span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .mh.mh-js .mh-more {
    display: none;
  }

  .mh.mh-js .mh-card__desc {
    font-size: 0.88rem;
    -webkit-line-clamp: 1;
  }

  .mh.mh-js .mh-card__title {
    font-size: 1.05rem;
  }

  .mh-note__box {
    padding: 1.1rem 1.1rem;
    border-radius: 22px;
  }

  /* il pannello diventa un foglio che sale dal basso */
  .mh-sheet {
    align-items: flex-end;
    padding: 0;
  }

  .mh-sheet__panel {
    width: 100%;
    max-height: calc(100% - max(2.2rem, env(safe-area-inset-top, 0px)));
    border-radius: 28px 28px 0 0;
    transform: translateY(40px);
  }

  .mh-sheet__scroll {
    padding: 1.3rem 1.15rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
  }

  .mh-sheet__actions .mh-btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 380px) {
  .mh .mh-title {
    font-size: 2rem;
  }

  .mh .mh-need {
    padding: 0.8rem 0.75rem 0.8rem 0.8rem;
  }

  .mh-sheet__head {
    gap: 0.8rem;
  }

  .mh-sheet .mh-ico {
    width: 48px;
    height: 48px;
  }
}

/* ---------- niente movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .mh,
  .mh *,
  .mh *::before,
  .mh *::after,
  .mh-sheet,
  .mh-sheet *,
  .mh-sheet *::before,
  .mh-sheet *::after {
    scroll-behavior: auto;
    transition: none !important;
    animation: none !important;
  }

  .mh.mh-js .mh-card:hover,
  .mh .mh-need:hover {
    transform: none;
  }
}

/* ---------- stampa: le schede complete, senza barre ---------- */
@media print {
  .mh-bar,
  .mh-search,
  .mh-trending,
  .mh-needs,
  .mh-status,
  .mh-sheet {
    display: none;
  }

  .mh.mh-js .mh-card__extra {
    display: block;
  }

  .mh .mh-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
