/* ════════════════════════════════════════════════════════════
   GENEALOGIA — lineage.css (partials/lineage-tree.php in hub e scheda strain, JS /js/lineage-graph.js)
   Piano docs/plans/ALBERI_GENEALOGICI.md. Colori solo da token (theme.css).
   Varietà con pagina = accento · landrace = oro · senza pagina = neutro · incrocio senza nome = tratteggio · al centro = oro pieno.
════════════════════════════════════════════════════════════ */

.lineage { color: var(--sog-text); }
/* scheda strain: fascia a tutta larghezza sotto foto e tessere (stessa larghezza delle sezioni di strain.css) */
.strain-lineage-band { box-sizing: border-box; width: min(1200px, calc(100% - 32px)); margin: 32px auto 36px; }
.strain-lineage-band .lineage h2 { font: 700 1.3rem/1.2 var(--sog-font-head); }
.lineage h2 { margin: 0 0 12px; }

/* ── tab ── */
.lg-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--sog-border); margin-bottom: 14px; }
.lg-tabs [role="tab"] {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; margin-bottom: -1px;
  border: 1px solid transparent; border-radius: 10px 10px 0 0; background: none; color: var(--sog-text-muted);
  font: 600 .92rem var(--sog-font-body); cursor: pointer;
}
.lg-tabs [role="tab"]:hover { color: var(--sog-accent-text); }
.lg-tabs [role="tab"][aria-selected="true"] { border-color: var(--sog-border); border-bottom-color: var(--sog-bg); background: var(--sog-bg); color: var(--sog-accent-text); }
.lg-tabs [role="tab"]:focus-visible { outline: 2px solid var(--sog-accent-text); outline-offset: 2px; }

/* ── albero (testo) ── */
.lg-rows { margin: 0; display: grid; gap: 10px; }
.lg-rows > div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: baseline; }
.lg-rows dt { color: var(--sog-text-muted); font-size: .88rem; }
.lg-rows dd { margin: 0; line-height: 2; min-width: 0; } /* min-width: la colonna 1fr si stringe anche su telefono */
.lg-chip {
  display: inline-block; padding: 1px 11px; margin: 0 2px; border-radius: 999px; border: 1px solid var(--sog-border);
  font-size: .86rem; line-height: 1.7; color: var(--sog-text); text-decoration: none; white-space: nowrap;
}
a.lg-chip.lg-link { background: var(--sog-accent-soft); border-color: var(--sog-border-strong); color: var(--sog-accent-text); font-weight: 600; }
a.lg-chip.lg-link:hover { background: var(--sog-accent-soft-hover); }
.lg-chip.lg-landrace { background: var(--sog-gold-soft); border-color: transparent; color: var(--sog-gold-text); }
.lg-chip.lg-anon { border-style: dashed; color: var(--sog-text-muted); }
.lg-x { color: var(--sog-text-faint); }
.lg-src, .lg-more { display: inline-block; margin-left: 6px; color: var(--sog-text-muted); font-size: .8rem; white-space: nowrap; }
.lg-others { margin-top: 12px; font-size: .9rem; }
.lg-others summary { cursor: pointer; color: var(--sog-accent-text); }
.lg-others ul { margin: 8px 0 0; padding-left: 18px; line-height: 2; }
.lg-note { margin: 12px 0 0; color: var(--sog-text-muted); font-size: .82rem; }
.lg-explore { margin: 10px 0 0; }
.lg-explore a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--sog-border-strong);
  background: var(--sog-accent-soft); color: var(--sog-accent-text); font-weight: 600; font-size: .9rem; text-decoration: none; }
.lg-explore a:hover { background: var(--sog-accent-soft-hover); }

/* ── grafico ── */
.lg-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.lg-tools button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--sog-border); background: var(--sog-panel);
  color: var(--sog-text); font-size: 1.05rem; cursor: pointer;
}
.lg-tools button:hover { border-color: var(--sog-border-strong); color: var(--sog-accent-text); }
.lg-tools small { color: var(--sog-text-muted); font-size: .8rem; }
/* riquadro alto, si trascina col mouse (JS); flex + margin auto = grafico centrato se più piccolo, mai tagliato se più grande */
.lg-graph {
  display: flex; min-height: 420px; max-height: 80vh; overflow: auto; border: 1px solid var(--sog-border-soft); border-radius: 12px;
  background: var(--sog-bg-2); font-family: var(--sog-font-body); cursor: grab; user-select: none; -webkit-user-select: none;
}
.lg-graph.is-dragging { cursor: grabbing; }
.lg-graph > svg { margin: auto; flex: none; }
.lg-svg { display: block; font-size: 13px; }
/* schermo intero (pulsante ⤢): strumenti in alto, grafico su tutto il resto */
.lg-panel:fullscreen, .lf-box:fullscreen { display: flex; flex-direction: column; padding: 16px; background: var(--sog-bg); overflow: hidden; }
.lg-panel:fullscreen .lg-graph, .lf-box:fullscreen .lg-graph { flex: 1; height: auto; max-height: none; }
.lg-panel:fullscreen .lg-explore, .lf-box:fullscreen .lg-note { display: none; }
.lg-edge { fill: none; stroke: var(--sog-border-strong); stroke-width: 1.5; }
.lg-n rect { fill: var(--sog-surface); stroke: var(--sog-border-strong); stroke-width: 1; }
.lg-n text { fill: var(--sog-text); }
.lg-n-link rect { fill: var(--sog-accent); stroke: none; }
.lg-n-link text { fill: var(--sog-on-accent); font-weight: 600; }
.lg-n-landrace rect { fill: var(--sog-gold-soft); stroke: var(--sog-gold); }
.lg-n-landrace text { fill: var(--sog-gold-text); }
.lg-n-anon rect { fill: none; stroke-dasharray: 4 3; }
.lg-n-anon text { fill: var(--sog-text-muted); }
.lg-n-me rect { fill: var(--sog-gold); stroke: var(--sog-text); stroke-width: 2; }
.lg-n-me text { fill: var(--sog-on-gold); font-weight: 700; }
.lg-n-more rect { fill: none; stroke: var(--sog-accent); stroke-dasharray: 3 3; }
.lg-n-more text { fill: var(--sog-accent-text); }
.lineage a:hover .lg-n-link rect, .lineage a:focus-visible .lg-n-link rect { fill: var(--sog-accent-strong); }
.lineage a:focus-visible { outline: none; }
.lineage a:focus-visible rect { stroke: var(--sog-text); stroke-width: 2; }

/* ── pagina famiglie (/lineage, js/lineage-family.js) ── */
.lineage-page { box-sizing: border-box; width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 56px; color: var(--sog-text); }
.lineage-page h1 { margin: 10px 0 6px; font: 800 clamp(1.4rem, 3vw, 2rem)/1.2 var(--sog-font-head); }
.lf-intro { margin: 0 0 18px; color: var(--sog-text-muted); max-width: 820px; }
.lf-founders h2 { margin: 0 0 8px; font: 700 1rem var(--sog-font-head); color: var(--sog-text-muted); }
.lf-founders ul { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lf-founder {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--sog-border);
  background: var(--sog-panel); color: var(--sog-text); text-decoration: none; font-size: .88rem; font-weight: 600;
}
.lf-founder small { color: var(--sog-text-muted); font-weight: 500; }
.lf-founder.is-landrace { border-color: color-mix(in srgb, var(--sog-gold) 45%, transparent); }
.lf-founder:hover { border-color: var(--sog-border-strong); color: var(--sog-accent-text); }
.lf-founder[aria-current] { background: var(--sog-accent); border-color: var(--sog-accent); color: var(--sog-on-accent); }
.lf-founder[aria-current] small { color: var(--sog-on-accent); }
.lf-box { padding: 14px; border: 1px solid var(--sog-border-soft); border-radius: 14px; background: var(--sog-panel); }
.lf-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 30px; margin-bottom: 8px; }
.lf-sel small { color: var(--sog-text-muted); }
.lf-sel a:not(.lg-chip) { color: var(--sog-accent-text); }
.lf-open { margin-left: auto; font-weight: 600; }
.lf-graph { height: clamp(520px, 82vh, 1200px); max-height: none; }
.lf-graph > svg { margin: 0 auto; } /* albero verticale: parte dall'alto, centrato solo in orizzontale */
.lg-n.is-click { cursor: pointer; }
.lg-n.is-click:hover rect, .lg-n.is-click:focus-visible rect { stroke: var(--sog-gold); stroke-width: 2.5; }
.lg-n:focus-visible { outline: none; }
.lg-n-small text { font-size: 11px; }
.lg-n-trail { opacity: .88; }
.lg-n-stub rect { fill: var(--sog-accent-soft); stroke: var(--sog-accent); stroke-dasharray: 3 3; }
.lg-n-stub text { fill: var(--sog-accent-text); font-size: 11px; }

@media (max-width: 600px) {
  .lf-open { margin-left: 0; }
  .lg-rows > div { grid-template-columns: 1fr; gap: 2px; }
  .lg-tabs [role="tab"] { padding: 8px 12px; }
}
