/* theme/rete.css: «Chi l'ha fatta», la rete dei protagonisti. Colori dal tema, in chiaro e in scuro; i tipi si riconoscono anche dalla forma.
   Sul telefono scorre di lato solo il riquadro della rete; la scheda e l'elenco stanno sotto, a tutta larghezza. */
.rete { --rt-filo: .26; margin: 0 0 34px; }
.rete[hidden] { display: none; }
.rete p { margin: 0; }

/* I comandi: i tipi e l'anno */
.rt-comandi { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; margin: 0 0 8px; padding: 10px 0; border-block: 1px solid var(--ink); }
.rt-interruttori { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-interruttore, .rt-salta { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 4px 11px 4px 8px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); font-family: var(--cond); font-size: 16px; font-weight: 700; line-height: 1.15; text-align: left; cursor: pointer; touch-action: manipulation; }
.rt-interruttore small, .rt-salta small { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.rt-interruttore[aria-pressed="false"] { border-style: dashed; color: var(--muted); }
.rt-interruttore[aria-pressed="false"] span { text-decoration: line-through; text-decoration-thickness: 1px; }
.rt-interruttore[aria-pressed="false"] .rt-glifo { opacity: .4; }
.rt-glifo { flex: none; overflow: visible; }
.rt-anni { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; flex: 1 1 100%; }
.rete p.rt-fino { min-width: 150px; font-family: var(--cond); font-size: 17px; font-weight: 700; white-space: nowrap; }
.rt-fino b { font-family: var(--mono); font-weight: 600; color: var(--red); }
.rt-fino span:last-child { font-weight: 500; color: var(--muted); }
.rete input.rt-cursore { --field: transparent; flex: 1 1 160px; min-width: 140px; height: 44px; margin: 0; padding: 0; border: 0; accent-color: var(--red); cursor: pointer; touch-action: pan-y; }
.rt-cresci { min-height: 44px; margin: 0; padding: 4px 14px; border: 0; border-radius: 0; background: var(--spot); color: var(--on-spot); font-family: var(--cond); font-size: 16px; font-weight: 700; letter-spacing: .02em; cursor: pointer; }
.rt-cresci::before { content: "▸ "; content: "▸ " / ""; }
.rt-cresci.rt-va::before { content: "▪ "; content: "▪ " / ""; }
.rt-cresci[hidden] { display: none; }
.rete p.rt-scorri { margin: 0 0 4px; font-family: var(--cond); font-size: 15px; font-weight: 500; color: var(--muted); }
.rete p.rt-scorri::after { content: " ⟷"; }
.rt-scorri[hidden] { display: none; }

/* Il riquadro: scorre di lato solo lui, e solo quando la rete non ci sta */
.rt-telaio { position: relative; min-width: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.rt-telaio.rt-largo { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.rt-tela { display: block; font-family: var(--cond); font-size: 14px; font-weight: 500; -webkit-user-select: none; user-select: none; }

.rt-griglia { stroke: var(--line); stroke-width: 1; }
.rt-confine { stroke: var(--ink); stroke-width: 1; stroke-opacity: .45; }
.rt-anno { fill: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 400; }
.rt-anno.rt-dopo { opacity: .4; }
.rt-tipo { fill: var(--ink); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.rt-fascia.rt-spenta { opacity: .4; }
.rt-ora { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 4 4; }
.rt-ora.rt-via { display: none; }

/* I segni dei tipi */
.rt-tondo { stroke-width: 1.6; }
.rt-t-persona .rt-tondo { fill: var(--red); stroke: var(--red); }
.rt-t-impresa .rt-tondo { fill: var(--paper); stroke: var(--ink); stroke-width: 3.2; }
.rt-t-luogo .rt-tondo { fill: var(--spot); stroke: var(--ink); }
.rt-t-luogo .rt-cuore { fill: var(--ink); }
.rt-t-istituzione .rt-tondo { fill: var(--paper); stroke: var(--visited); stroke-width: 1.8; }
.rt-t-istituzione .rt-cuore { fill: var(--visited); }
.rt-t-media .rt-tondo { fill: var(--paper); stroke: var(--muted); stroke-width: 2; stroke-dasharray: 3 2.3; }

/* I legami: curve leggere, accese quando si sceglie un nome */
.rt-legame { fill: none; stroke: var(--ink); stroke-opacity: var(--rt-filo); stroke-width: 1.3; }
.rt-con-scelta .rt-legame { stroke-opacity: .07; }
.rt-legame.rt-acceso { stroke: var(--red); stroke-opacity: .95; stroke-width: 2.4; }
.rt-legame.rt-dopo { stroke-opacity: 0; }
.rt-legame.rt-spento { display: none; }

/* I nomi: ogni nome col suo cerchio è un bottone */
.rt-nodo { cursor: pointer; outline: none; }
.rt-presa { fill: transparent; }
.rt-nome { fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
@media (hover: hover) { .rt-nodo:hover .rt-presa { fill: color-mix(in srgb, var(--spot) 28%, transparent); } }
.rt-con-scelta .rt-nodo:not(.rt-acceso, .rt-vicino) { opacity: .3; }
.rt-con-scelta .rt-nodo:focus-visible { opacity: 1; }   /* il nome col fuoco si vede intero, anello compreso */
.rt-nodo.rt-vicino .rt-presa { stroke: var(--red); stroke-width: 1.2; }
.rt-nodo.rt-acceso .rt-presa { fill: var(--spot); stroke: var(--ink); stroke-width: 1; }
.rt-nodo.rt-acceso .rt-nome { fill: var(--on-spot); stroke: none; }
.rt-nodo:focus-visible .rt-presa { stroke: var(--red); stroke-width: 2.5; }
.rt-tela .rt-nodo.rt-dopo { opacity: .12; pointer-events: none; }
.rt-nodo.rt-spento { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .rt-nodo { transition: opacity .35s; }
  .rt-legame { transition: stroke-opacity .35s; }
}

/* La scheda */
.rt-scheda { min-height: 64px; margin: 12px 0 0; padding: 12px 0 6px; border-top: 3px double var(--ink); }
.rete p.rt-invito { padding: 6px 0; font-family: var(--cond); font-size: 17px; font-weight: 500; line-height: 1.35; color: var(--muted); }
.rete p.rt-meta { display: flex; align-items: center; gap: 6px; font-family: var(--cond); font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.rete .rt-nome-scelto { margin: 2px 0 6px; padding: 0; border: 0; font-size: clamp(27px, 3vw, 36px); line-height: 1.08; scroll-margin-top: 70px; }
.rt-nome-scelto:focus { outline: none; }
.rt-nome-scelto:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.rete p.rt-testo { max-width: 720px; font-size: 19px; line-height: 1.45; }
.rete p.rt-vai { margin: 2px 0 4px; }
.rt-vai a { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--cond); font-size: 18px; font-weight: 700; color: var(--red); }
.rt-vicini h3 { margin: 4px 0 6px; font-family: var(--cond); font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rt-vicini ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rt-salta { border-color: var(--line); font-weight: 500; }
.rete p.rt-nessuno { font-family: var(--cond); font-size: 16px; font-weight: 500; color: var(--muted); }
@media (hover: hover) {
  .rt-interruttore:hover, .rt-salta:hover { border-color: var(--ink); background: var(--paper-2); }
  .rt-cresci:hover { text-decoration: underline; }
}
.rt-interruttore:focus-visible, .rt-salta:focus-visible, .rt-cresci:focus-visible, .rt-cursore:focus-visible, .rt-vai a:focus-visible, .rt-elenco summary:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* La rete in forma di elenco */
.rt-elenco { margin: 22px 0 0; padding: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rete .rt-elenco summary { min-height: 44px; padding: 10px 0; font-family: var(--cond); font-size: 18px; font-weight: 700; line-height: 1.35; color: var(--ink); cursor: pointer; }
.rt-elenco ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 0 32px; margin: 0 0 14px; padding: 0; list-style: none; }
.rt-elenco li { padding: 9px 0 11px; border-top: 1px solid var(--line); }
.rete p.rt-e-testa { line-height: 1.3; }
.rt-e-anno { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--red); }
.rt-e-nome { font-size: 19px; font-weight: 700; }
.rt-e-tipo { font-family: var(--cond); font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.rete p.rt-e-testo { margin-top: 3px; font-size: 17px; line-height: 1.4; }
.rete p.rt-e-legami { margin-top: 4px; font-family: var(--cond); font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--muted); }

@media (max-width: 560px) {
  .rt-comandi { gap: 8px; }
  .rt-interruttore { padding-inline: 6px 9px; font-size: 15px; }
  .rt-anni { flex-basis: 100%; }
  .rete p.rt-fino { min-width: 0; flex-basis: 100%; }
  .rete p.rt-testo { font-size: 18px; }
}

@media screen and (prefers-color-scheme: dark) {
  .rete { --rt-filo: .32; }
  .rt-confine { stroke-opacity: .35; }
}

@media print {
  .rt-comandi, .rt-scorri, .rt-scheda { display: none; }
  .rt-telaio { overflow: visible; }
  .rt-tela { max-width: 100%; height: auto; }
  .rt-elenco > summary { display: none; }
}
