/* =========================================================
   metodiKo – foglio di stile
   Idea grafica: la mappa di una metropolitana.
   Ogni settore è una linea con un colore del logo, tutte
   convergono nella stazione centrale metodiKo.
   Tutti i colori sono qui sotto, in :root.
   ========================================================= */
:root {
  /* superfici e testo: azzurro e blu, niente nero */
  --bg: #e4f2fc;           /* sfondo azzurro chiaro */
  --surface: #ffffff;
  --ink: #163f8c;          /* blu: testo e "binario" principale */
  --muted: #4a6488;
  --rule: #bcd9ef;
  --on-ink: #ffffff;       /* testo sopra il blu */

  /* colori delle linee (settori) */
  --l-r: #ee4b4b;          /* Retail */
  --l-f: #f47c34;          /* Food */
  --l-i: #4a68f5;          /* Ingrosso */
  --l-m: #00a95a;          /* Mobilità */
  --l-p: #dc4fa8;          /* Produzione */
  --l-o: #0097b2;          /* Online */
  --l-x: #9aa3ae;          /* linea in costruzione */

  /* tabellone */
  --board-bg: #133576;
  --board-fg: #ffd34d;
  --board-dim: #9fb9e3;
  --board-rule: #2c5197;

  --font: "Overpass", "Helvetica Neue", Arial, sans-serif;
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --max: 1180px;
}


*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.05; text-wrap: balance; }
p { margin: 0; }

.wrap {
  width: 100%; max-width: var(--max); margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.kicker {
  font-family: var(--mono); font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}

/* ---------- Pulsanti: come i cartelli di direzione ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: 15px 24px 13px; border-radius: 6px;
  background: var(--ink); color: var(--on-ink);
  font: inherit; font-weight: 800; font-size: 1rem; text-decoration: none;
  border: 2px solid var(--ink); cursor: pointer;
  transition: transform .15s;
}
.btn::after { content: "→"; font-weight: 400; transition: transform .15s; }
.btn:hover::after { transform: translateX(4px); }
.btn--line { background: transparent; color: var(--ink); font-family: var(--mono); font-weight: 600; }
.btn--line::after { content: none; }
.btn--small { padding: 9px 16px 7px; font-size: .9rem; }
.btn--full { width: 100%; justify-content: center; }
:focus-visible { outline: 3px solid var(--l-i); outline-offset: 2px; }

/* "Pastiglia" con la lettera della linea */
.chip {
  display: inline-grid; place-items: center; flex: none;
  width: 1.6em; height: 1.6em; border-radius: 5px;
  font-family: var(--font); font-weight: 900; font-size: .85em; line-height: 1;
  color: #fff; padding-top: .12em;
}
.chip--r { background: var(--l-r); } .chip--f { background: var(--l-f); }
.chip--i { background: var(--l-i); } .chip--m { background: var(--l-m); }
.chip--p { background: var(--l-p); } .chip--o { background: var(--l-o); }
.chip--x { background: var(--l-x); }

/* ---------- Header ---------- */
.header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--bg);
  border-bottom: 4px solid var(--ink);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.logo img { height: 40px; width: auto; }

.nav { display: flex; align-items: center; gap: 26px; }
.nav a { text-decoration: none; font-weight: 700; font-size: .95rem; }
.nav a:not(.btn):hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.nav__area { color: var(--muted); font-weight: 600 !important; }

.burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.burger span { display: block; width: 26px; height: 3px; background: var(--ink); margin: 5px 0; transition: transform .25s, opacity .25s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { padding-block: 64px 72px; }
.hero__text { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px 56px; align-items: end; }
.hero__text .kicker { grid-column: 1 / -1; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4.2rem); font-weight: 900; letter-spacing: -.035em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 30em; }
.hero__cta { grid-column: 2; display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Mappa ---------- */
.map { margin-top: 48px; background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.map__scroll { overflow-x: auto; padding: 24px 16px 8px; }
.netmap { display: block; width: 100%; min-width: 760px; height: auto; }

.line { fill: none; stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; transition: opacity .25s; cursor: pointer; }
.line--r { stroke: var(--l-r); } .line--f { stroke: var(--l-f); } .line--i { stroke: var(--l-i); }
.line--m { stroke: var(--l-m); } .line--p { stroke: var(--l-p); } .line--o { stroke: var(--l-o); }
.line--x { stroke: var(--l-x); stroke-dasharray: 2 16; }

.trains circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5; }

.stops circle { fill: var(--surface); stroke: var(--ink); stroke-width: 3.5; }
.stops text, .badges + .hub text { font-family: var(--font); }
.stops text { fill: var(--ink); font-size: 14px; font-weight: 700; text-anchor: middle; }
.stops text.l { text-anchor: start; }
.stops text.r { text-anchor: end; }
.stops [data-line="X"] text { fill: var(--muted); font-weight: 600; }
.stops g, .badges g { transition: opacity .25s; }

.badge rect { stroke: none; }
.badge text { fill: #fff; font-family: var(--font); font-size: 18px; font-weight: 900; text-anchor: middle; }
.badge--r rect { fill: var(--l-r); } .badge--f rect { fill: var(--l-f); } .badge--i rect { fill: var(--l-i); }
.badge--m rect { fill: var(--l-m); } .badge--p rect { fill: var(--l-p); } .badge--o rect { fill: var(--l-o); }
.badge--x rect { fill: var(--l-x); }
.badge { cursor: pointer; }

.hub rect { fill: var(--surface); stroke: var(--ink); stroke-width: 7; }
.hub text { fill: var(--ink); font-family: var(--font); font-size: 22px; font-weight: 900; text-anchor: middle; letter-spacing: -.02em; }
.hub .hub__sub { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; fill: var(--muted); }

/* evidenzia una linea, spegne le altre */
.netmap.is-focus [data-line] { opacity: .14; }
.netmap.is-focus [data-line].is-on { opacity: 1; }
.netmap.is-focus .trains { opacity: .25; }

/* Legenda */
.legend { display: grid; grid-template-columns: 1.3fr 1fr; border-top: 2px solid var(--ink); }
.legend__keys { display: flex; flex-wrap: wrap; gap: 8px; padding: 20px; align-content: start; border-right: 2px solid var(--ink); }
.key {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 5px 7px; border: 2px solid var(--rule); border-radius: 6px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: border-color .15s;
}
.key:hover { border-color: var(--ink); }
.key[aria-pressed="true"] { border-color: var(--ink); background: var(--bg); }
.legend__info { padding: 20px 24px; min-width: 0; }
.info h2 { font-size: 1.35rem; font-weight: 900; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.info p { color: var(--muted); }
.info a { font-weight: 700; color: var(--ink); }

/* ---------- Sezioni con il "binario" verticale ---------- */
.section { padding-block: 88px; }
.section--alt { background: var(--surface); border-block: 2px solid var(--rule); }

.route { position: relative; padding-left: calc(max(20px, env(safe-area-inset-left, 0px)) + 44px); }
.route::before {
  content: ""; position: absolute; top: 6px; bottom: -182px;
  left: calc(max(20px, env(safe-area-inset-left, 0px)) + 9px);
  width: 6px; background: var(--ink); border-radius: 3px;
}
.route--end::before { bottom: auto; height: 40px; }
.route__stop { position: relative; margin-bottom: 40px; max-width: 760px; }
.route__stop::before {
  content: ""; position: absolute; left: -44px; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 6px solid var(--ink);
}
.route--end .route__stop::before { width: 30px; height: 30px; left: -47px; top: -3px; background: var(--ink); }
.route__stop h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 900; letter-spacing: -.03em; margin-top: 10px; }

/* Cartelli */
.signs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 36px 48px; margin-bottom: 56px; }
.sign { display: grid; grid-template-columns: 52px 1fr; gap: 18px; align-items: start; }
.sign__pict { width: 52px; height: 52px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.sign__pict svg { width: 28px; height: 28px; fill: none; stroke: var(--on-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sign h3 { font-size: 1.2rem; font-weight: 800; margin: 4px 0 6px; }
.sign p { color: var(--muted); }

/* Tabellone */
.board { margin: 0; background: var(--board-bg); color: var(--board-fg); border-radius: 10px; overflow: hidden; font-family: var(--mono); }
.board__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--board-rule); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 600; }
.board__clock { color: var(--board-dim); }
.board__clock b { color: var(--board-fg); }
.board__scroll { overflow-x: auto; }
.board table { width: 100%; min-width: 600px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board th { text-align: left; font-size: .72rem; font-weight: 400; color: var(--board-dim); text-transform: uppercase; letter-spacing: .1em; padding: 12px 20px 8px; }
.board td { padding: 10px 20px; border-top: 1px solid var(--board-rule); font-size: 1rem; }
.board .num { text-align: right; }
.board tfoot td { border-top: 2px solid var(--board-fg); font-weight: 600; }
.board td.flip { animation: flip .5s ease; }
@keyframes flip { 0% { transform: rotateX(90deg); opacity: .2; } 100% { transform: none; opacity: 1; } }
.board__note { padding: 10px 20px 14px; font-size: .75rem; color: var(--board-dim); text-transform: uppercase; letter-spacing: .1em; }

/* Percorso: una sequenza vera, tre fermate */
.journey { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; position: relative; }
.journey::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 6px; background: var(--l-i); border-radius: 3px; }
.journey li { position: relative; padding-top: 44px; }
.journey__dot { position: absolute; top: 0; left: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 6px solid var(--ink); }
.journey h3 { font-size: 1.4rem; font-weight: 900; margin-bottom: 8px; }
.journey p { color: var(--muted); }

/* Clienti */
.riders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.rider { margin: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; padding-top: 22px; border-top: 4px solid var(--ink); }
.rider blockquote { margin: 0; font-size: 1.2rem; font-weight: 600; line-height: 1.4; }
.rider blockquote::before { content: "“"; }
.rider blockquote::after { content: "”"; }
.rider figcaption { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); }
.rider figcaption .chip { font-size: 1.1rem; }
.rider strong { display: block; color: var(--ink); font-size: 1rem; }

/* Contatti */
.section--end { padding-bottom: 96px; }
.contact { display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: start; }
.contact__text { min-width: 0; }
.contact__sub { color: var(--muted); font-size: 1.1rem; max-width: 30em; }
.contact__list { margin: 32px 0; display: grid; gap: 0; }
.contact__list div { padding: 14px 0; border-bottom: 2px solid var(--rule); }
.contact__list dt { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.contact__list dd { margin: 4px 0 0; }
.contact__list a { font-size: 1.5rem; font-weight: 900; text-decoration: none; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.contact__list a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.contact__agents { color: var(--muted); font-size: .95rem; }
.contact__agents a { color: var(--ink); font-weight: 700; }

.form { background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 28px; display: grid; gap: 18px; min-width: 0; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 700; min-width: 0; }
.form input, .form select, .form textarea {
  font: inherit; font-weight: 400; padding: 12px 2px 8px; width: 100%;
  border: 0; border-bottom: 3px solid var(--rule); border-radius: 0;
  background: transparent; color: var(--ink); transition: border-color .15s;
}
.form select { padding-left: 0; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-bottom-color: var(--l-i); }
.form .is-invalid { border-bottom-color: var(--l-r); }
.form__check { flex-direction: row !important; align-items: flex-start; gap: 10px !important; font-weight: 400 !important; color: var(--muted); }
.form__check input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--ink); }
.form__msg { font-size: .92rem; min-height: 1.2em; }
.form__msg.ok { color: var(--l-m); font-weight: 700; }
.form__msg.err { color: var(--l-r); font-weight: 700; }

/* Footer */
.footer { border-top: 4px solid var(--ink); padding-block: 26px; font-size: .9rem; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer a { color: var(--ink); font-weight: 700; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .trains { display: none; }
  .board td.flip { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero__text { grid-template-columns: 1fr; }
  .hero__cta { grid-column: 1; }
  .legend { grid-template-columns: 1fr; }
  .legend__keys { border-right: 0; border-bottom: 2px solid var(--ink); }
  .riders { grid-template-columns: 1fr; gap: 28px; }
  .contact { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .burger { display: block; }
  .nav {
    position: fixed; left: 0; right: 0; top: calc(76px + env(safe-area-inset-top, 0px));
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 4px solid var(--ink);
    padding: 8px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px));
    transform: translateY(-130%); transition: transform .3s ease; z-index: -1;
  }
  .nav.is-open { transform: none; }
  .nav a { padding: 14px 0; border-bottom: 2px solid var(--rule); }
  .nav .btn { margin-top: 16px; justify-content: center; border-bottom: 2px solid var(--ink); }
  .signs { grid-template-columns: 1fr; }
  .journey { grid-template-columns: 1fr; gap: 28px; }
  .journey::before { left: 10px; right: auto; top: 0; bottom: 0; width: 6px; height: auto; }
  .journey li { padding: 0 0 0 48px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding-block: 40px 48px; }
  .section { padding-block: 64px; }
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .route { padding-left: calc(max(16px, env(safe-area-inset-left, 0px)) + 36px); }
  .route::before { left: calc(max(16px, env(safe-area-inset-left, 0px)) + 7px); width: 5px; bottom: -134px; }
  .route__stop::before { left: -36px; width: 20px; height: 20px; border-width: 5px; }
  .route--end .route__stop::before { left: -38px; width: 24px; height: 24px; }
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
  .form { padding: 20px; }
  .form__row { grid-template-columns: 1fr; }
  .contact__list a { font-size: 1.3rem; }
}

/* =========================================================
   Pagine delle linee (retail.html, food.html, ...)
   Il colore della linea arriva da --line sul <body>.
   ========================================================= */
.route--line::before { background: var(--line, var(--ink)); }
.route--line .route__stop::before { border-color: var(--line, var(--ink)); }
.route--line.route--end .route__stop::before { background: var(--line, var(--ink)); }

.line-hero { padding-block: 56px 40px; }
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 28px; }
.crumbs a { color: var(--ink); font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.line-hero__title { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.line-hero__badge { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 16px; background: var(--line); color: #fff; font-weight: 900; font-size: 3.4rem; line-height: 1; padding-top: .1em; }
.line-hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.4rem); font-weight: 900; letter-spacing: -.035em; margin-top: 10px; }
.line-hero .lead { margin-top: 20px; }
.line-hero .hero__cta { margin-top: 28px; }
.line-hero__band { margin-top: 40px; height: 12px; border-radius: 6px; background: var(--line); position: relative; }
.line-hero__band::after { content: "metodiKo"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: var(--surface); border: 5px solid var(--ink); border-radius: 999px; padding: 6px 18px 3px; font-weight: 900; font-size: 1rem; }

/* le funzioni come fermate lungo il binario colorato */
.stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 30px; max-width: 760px; }
.stations li { position: relative; }
.stations li::before {
  content: ""; position: absolute; left: -41px; top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--line, var(--ink));
}
.stations h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.stations p { color: var(--muted); max-width: 40em; }

/* coincidenze con le altre linee */
.links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.link-item { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.link-item .chip { font-size: 1.25rem; }
.link-item h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.link-item p { color: var(--muted); }
.link-item a { color: var(--ink); font-weight: 700; }

/* cambia linea */
.switch { padding-block: 40px; border-top: 2px solid var(--rule); }
.switch__inner { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.switch__label { font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.switch__keys { display: flex; flex-wrap: wrap; gap: 8px; }
.switch .key { text-decoration: none; }
.switch .key[aria-current="page"] { border-color: var(--ink); background: var(--surface); }

/* link "vai alla linea" nella legenda della home */
.info__more { display: inline-block; margin-top: 10px; font-weight: 800; color: var(--ink); text-decoration: none; border-bottom: 3px solid var(--rule); }
.info__more:hover { border-color: var(--ink); }

@media (max-width: 960px) {
  .links { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .line-hero__badge { width: 64px; height: 64px; font-size: 2.3rem; border-radius: 12px; }
  .line-hero__title { gap: 16px; }
  .stations li::before { left: -34px; width: 16px; height: 16px; }
}

/* ---------- Cosa gestisce (home) ---------- */
.modules { grid-column: 1 / -1; list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.modules li { padding: 7px 14px 5px; border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); font-weight: 700; font-size: .92rem; }

/* ---------- Immagini nelle pagine dei settori ---------- */
.line-hero__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.line-hero__img, .station__img { margin: 0; background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; max-width: 100%; }
.line-hero__img img, .station__img img { width: 100%; height: 100%; display: block; }
.line-hero__img--foto img, .station__img--foto img { object-fit: cover; }
.line-hero__img--illu img, .station__img--illu img { object-fit: contain; padding: 14px; }

.stations { max-width: 980px; }
.stations li.has-img { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 28px; align-items: start; }
.stations li > div { min-width: 0; }

@media (max-width: 960px) {
  .line-hero__grid { grid-template-columns: 1fr; }
  .line-hero__img { max-width: 520px; }
}
@media (max-width: 600px) {
  .stations li.has-img { grid-template-columns: 1fr; gap: 14px; }
  .station__img { max-width: 320px; }
}

/* campo trappola anti-spam del modulo contatti */
.form__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* =========================================================
   Menu "Settori" con sottovoci
   ========================================================= */
.nav__group { position: relative; }
.nav__toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .95rem; color: var(--ink);
}
.nav__caret { width: 8px; height: 8px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.nav__group.is-open .nav__caret { transform: translateY(2px) rotate(-135deg); }

.nav__sub {
  position: absolute; top: calc(100% + 14px); left: -18px; z-index: 60;
  width: 300px; padding: 8px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 14px 30px rgba(22, 63, 140, .14);
  display: none;
}
.nav__sub::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; } /* ponte per il passaggio del mouse */
.nav__group.is-open .nav__sub { display: grid; }
@media (hover: hover) and (min-width: 821px) {
  .nav__group:hover .nav__sub { display: grid; }
  .nav__group:hover .nav__caret { transform: translateY(2px) rotate(-135deg); }
}
.nav .nav__sub a {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 8px; text-decoration: none; font-size: 1rem;
}
.nav .nav__sub a:hover, .nav .nav__sub a:focus-visible, .nav .nav__sub a[aria-current="page"] { background: var(--bg); text-decoration: none; }
.nav__sub .chip { font-size: 1.05rem; }
.nav__sub span { display: flex; flex-direction: column; line-height: 1.25; }
.nav__sub small { font-weight: 400; font-size: .82rem; color: var(--muted); }

@media (max-width: 820px) {
  .nav__toggle { width: 100%; justify-content: space-between; padding: 14px 0; border-bottom: 2px solid var(--rule); font-size: 1rem; }
  .nav__sub { position: static; width: auto; padding: 6px 0 10px; background: transparent; border: 0; border-bottom: 2px solid var(--rule); border-radius: 0; box-shadow: none; }
  .nav__sub::before { content: none; }
  .nav .nav__sub a { border-bottom: 0; padding: 10px 8px; }
}
