/* Family structure is a readable diagram, with the people carrying the visual weight. */
:root {
  --diagram-paper: color-mix(in srgb, var(--surface) 97%, var(--paper));
  --diagram-rule: color-mix(in srgb, var(--text) 11%, transparent);
  --diagram-muted: color-mix(in srgb, var(--text) 61%, var(--surface));
}
:is(#strom, #person.profile-parity) :is(.pedigree, .profile-pedigree) {
  background-color: var(--diagram-paper);
  background-image: radial-gradient(circle, var(--diagram-rule) .7px, transparent .8px);
  background-size: 24px 24px;
  border-color: var(--border);
  border-radius: .65rem;
}
.family-tree-structure { overflow: visible; }
.family-tree-row { fill: color-mix(in srgb, var(--surface) 35%, transparent); }
.family-tree-row.is-alternate { fill: color-mix(in srgb, var(--panel) 26%, transparent); }
.family-tree-generation {
  fill: var(--diagram-muted);
  font: 600 10.5px var(--sans);
  letter-spacing: .075em;
  text-transform: uppercase;
}
.family-tree-line, .family-tree-line-halo, .family-tree-partner {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.family-tree-line-halo { stroke: var(--diagram-paper); stroke-width: 7; }
.family-tree-line { stroke: color-mix(in srgb, var(--lineage-ink) 72%, var(--muted)); stroke-width: 2.4; }
.family-tree-line.is-near-focus { stroke-width: 3; }
.family-tree-partner { stroke: var(--muted); stroke-width: 1.7; stroke-dasharray: 4 5; opacity: .8; }
.family-tree-junction { fill: var(--diagram-paper); stroke: var(--lineage-ink); stroke-width: 1.8; }
#strom .pedigree-key::before { height: 2px; border: 0; border-radius: 0; background: var(--accent); box-shadow: none; }
#strom .pedigree-key-partner::before { height: 0; border-top: 2px dashed var(--muted); background: none; }

:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  gap: 11px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--branch-ink) 25%, var(--border));
  border-inline-start: 3px solid var(--branch-ink);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--text) 6%, transparent);
  text-align: start;
  text-decoration: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node:hover {
  border-color: var(--branch-ink);
  box-shadow: 0 5px 17px color-mix(in srgb, var(--text) 13%, transparent);
  z-index: 2;
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node .compact-portrait {
  width: 42px;
  height: 42px;
  min-width: 42px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  box-shadow: none;
  font: 500 13px/1 var(--sans);
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node-copy strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-height: 40px;
  overflow: hidden;
  white-space: normal;
  color: var(--text);
  font: 650 16px/1.2 var(--sans);
  letter-spacing: -.012em;
  text-transform: none;
  overflow-wrap: break-word;
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node-copy small {
  color: var(--muted);
  white-space: normal;
  font: 450 12px/1.35 var(--sans);
  letter-spacing: 0;
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node-copy > small:first-child {
  color: var(--diagram-muted);
  font: 650 9.5px/1.3 var(--sans);
  letter-spacing: .055em;
  text-transform: uppercase;
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-focus {
  border: 1px solid var(--accent);
  border-inline-start: 4px solid var(--accent);
  background: color-mix(in srgb, var(--panel) 28%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent), 0 5px 16px color-mix(in srgb, var(--text) 10%, transparent);
}
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-partner { border-inline-start-width: 1px; border-block-end: 2px solid color-mix(in srgb, var(--branch-ink) 55%, var(--border)); }
:is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; z-index: 3; }

/* Personal identity stays in the accents; diagram controls remain predictable. */
#person.profile-parity[data-world] .profile-family-summary { border-radius: .75rem; border-width: 1px; box-shadow: none; }
#person.profile-parity[data-world] .profile-pedigree { border-radius: .65rem; }
#strom .pedigree-legend .pedigree-key::before { height: 3px; border-radius: 3px; background: var(--accent); }
#strom .pedigree-legend .pedigree-key-partner::before { height: 0; border-top: 2px dashed var(--muted); background: transparent; }
@media (max-width: 700px) {
  :is(#strom, #person.profile-parity) :is(.pedigree, .profile-pedigree) { --tree-scale: 1; }
  :is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node { border-radius: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(#strom, #person.profile-parity) .pedigree-chart .pedigree-node { transition: none; }
}
@media print {
  .family-tree-row { fill: none; }
  .family-tree-generation { fill: #555; }
  .family-tree-line, .family-tree-partner { stroke: #555; }
}
