/* ══ Family trees page ═══════════════════════════════════
   Shares the tokens and looks of the timeline. The page is a header, a sidebar of
   families and people, and one panel that holds the chosen person and their chart. */
:root[data-look] body.tpage {
  display: grid; grid-template: auto minmax(0, 1fr) / minmax(250px, 300px) minmax(0, 1fr);
  gap: var(--gap); padding: var(--gap); position: static;
}
.tpage .backdrop { display: none; }
:root[data-look="glass"] .tpage .backdrop, :root[data-look="liquid"] .tpage .backdrop { display: block; }
.tpage > :not(.backdrop) { position: relative; z-index: 1; }
.tpage > .thead { z-index: 20; }
.thead { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px 16px; padding: 9px 16px; flex-wrap: wrap; }
.tcrumb { font: 500 15px var(--ui); color: var(--muted); padding-left: 16px; border-left: 1px solid var(--line); }
a.link { text-decoration: none; }
:root[data-look="liquid"] .thead { padding: 8px 12px 8px 20px; }

/* sidebar */
.tside { display: flex; flex-direction: column; min-height: 0; padding: 14px 12px 12px; overflow-y: auto; scrollbar-width: thin; }
.tside h2 { font: 600 12.5px var(--ui); color: var(--muted); margin: 0 6px 6px; }
.tside h2:not(:first-child) { margin-top: 16px; }
.fams { display: flex; flex-direction: column; gap: 2px; }
.fams button { text-align: left; padding: 7px 10px; border-radius: min(var(--r-s), 12px); line-height: 1.3; }
.fams button b { font-weight: 600; font-size: 15px; }
.fams button span { font-size: 13px; color: var(--muted); margin-left: 4px; }
.fams button small { display: none; font-size: 12.5px; color: var(--muted); }
.fams button[aria-current="true"] small { display: block; }
.fams button:hover, #people button:hover { background: var(--raise); }
.fams button[aria-current="true"], #people button[aria-current="true"] { background: var(--sel); }
:root[data-look] .tside .search { margin: 0 2px 8px; flex: none; min-width: 0; order: 0; }
#people { flex: none; }
#people h3 { font: 500 12px var(--ui); color: var(--muted); margin: 10px 8px 3px; }
#people button { display: block; width: 100%; text-align: left; padding: 3px 10px; border-radius: 8px; font-size: 14px; }
#people small, .who-h small { color: var(--muted); font-size: .8em; font-weight: 400; }
#people .none { color: var(--muted); font-size: 13.5px; margin: 8px; }

/* main panel */
:root[data-look] .tpage main.tmain { position: relative; inset: auto; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.tbar { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbar .seg { flex-wrap: wrap; }
#gens-wrap { margin-left: auto; }
#who { padding: 14px 20px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 24px; align-items: start; }
.who-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; grid-column: 1 / -1; }
.who-f { font: 500 12.5px var(--ui); color: var(--accent); width: 100%; }
#who h1 { font: 600 27px/1.15 var(--ui); font-stretch: 88%; margin: 0; }
#who .sk { font-size: 17px; color: var(--muted); }
.who-d { font: 400 15.5px/1.5 var(--read); margin: 4px 0 0; max-width: 68ch; grid-column: 1; }
#who dl { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 13.5px; grid-column: 1; }
#who dl div { display: flex; gap: 6px; max-width: 100%; }
#who dt { color: var(--muted); white-space: nowrap; }
#who dd { margin: 0; }
#who dd i { color: var(--muted); }
#who .tn { font: 500 13.5px var(--ui); color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
#who .tn:hover { text-decoration-color: var(--accent); }
.who-ev { grid-column: 2; grid-row: 2 / span 2; align-self: center; font: 500 13.5px var(--ui); text-decoration: none; padding: 7px 13px; border-radius: var(--r-s); background: var(--raise); white-space: nowrap; }
.who-ev:hover { background: var(--sel); }
#canvas { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; outline: 0; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
#canvas .empty { color: var(--muted); font: 400 15px/1.5 var(--read); max-width: 60ch; margin: 6px 4px 18px; }

/* node-and-line charts */
.chart { display: block; max-width: none; }
#canvas[data-view="fan"] .chart, #canvas[data-view="hourglass"] .chart, #canvas[data-view="desc"] .chart { margin: 0 auto; }
.nd { cursor: pointer; outline: 0; }
.nd rect { fill: var(--raise); stroke: var(--line); stroke-width: 1; }
.nd:hover rect, .nd:focus-visible rect { stroke: var(--text); }
.nd.focus rect { stroke: var(--accent); stroke-width: 2; fill: var(--sel); }
.nd.stub { cursor: default; }
.nd.stub rect { fill: none; stroke-dasharray: 3 3; }
.nd circle { fill: var(--accent); }
.nd .nn { font: 600 13px var(--ui); fill: var(--text); }
.nd .ns { font: 400 11.5px var(--deva); fill: var(--muted); }
.nd.stub .ns { font-family: var(--ui); }
.nd .nm { font: 500 10.5px var(--ui); fill: var(--accent); }
.lk { fill: none; stroke: color-mix(in srgb, var(--muted) 55%, transparent); stroke-width: 1.3; }
.lk.gap { stroke-dasharray: 4 4; }
.gl { font: italic 400 10.5px var(--ui); fill: var(--muted); }

/* fan chart */
.fs { cursor: pointer; outline: 0; }
.fs path, .fs circle { fill: var(--raise); stroke: var(--panel-solid); stroke-width: 1.5; }
.fs.mat path { fill: color-mix(in srgb, var(--accent) 13%, var(--raise)); }
.fs:hover path, .fs:focus-visible path { fill: var(--sel); }
.fs.stub { cursor: default; }
.fs.stub path { fill: none; stroke: var(--line); stroke-dasharray: 3 3; }
path.fs.void { fill: none; stroke: var(--line); stroke-dasharray: 2 5; stroke-width: 1; cursor: default; }
.fs.centre { cursor: default; }
.fs.centre circle { fill: var(--sel); stroke: var(--accent); stroke-width: 2; }
.ft { font: 600 12px var(--ui); fill: var(--text); pointer-events: none; }
.ft.small { font-weight: 500; font-size: 11px; }
.ft.big { font-size: 14px; }
.ft.sub { font: 400 12px var(--deva); fill: var(--muted); }
.fs.stub .ft { fill: var(--muted); font-weight: 400; }

/* outline (rails come from the shared tree rules in style.css) */
.outline { max-width: 760px; }
.outline .tp.cur .tn { color: var(--accent); }
.outline button.tn { text-decoration: none; }
.outline button.tn:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.outline .tb > .tl:first-child:not(:last-child) > .gap::before { display: block; top: 0; bottom: 0; height: auto; }

/* report */
.report { max-width: 760px; font: 400 15px/1.6 var(--read); }
.report h3 { font: 600 22px/1.2 var(--ui); font-stretch: 88%; margin: 0 0 10px; }
.report h5 { font: 600 13px var(--ui); color: var(--muted); margin: 22px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.report h4 { font: 600 16px/1.3 var(--ui); margin: 0; }
.report h4 span, .report h4 small { font-weight: 400; font-size: 13.5px; color: var(--muted); margin-left: 4px; }
.report p { margin: 2px 0 0; }
.report i { color: var(--muted); }
.rp-line { margin-bottom: 6px !important; }
.rp-e { display: grid; grid-template-columns: 64px 1fr; gap: 0 10px; margin: 0 0 12px; }
.rp-n { font: 500 12px var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-e > .rp-n { padding-top: 4px; overflow-wrap: anywhere; }
.rp-k { font-size: 14px; }
.report .tn { font: inherit; font-weight: 500; color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.rp-src { font: 400 12.5px/1.5 var(--ui) !important; color: var(--muted); margin-top: 22px !important; }

@media (max-width: 860px) {
  :root[data-look] body.tpage { display: flex; flex-direction: column; height: auto; min-height: 100%; overflow: visible; }
  html:has(body.tpage) { height: auto; }
  .tside { overflow: visible; }
  .fams { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .fams button { flex: none; background: var(--raise); }
  .fams button small, .fams button[aria-current="true"] small { display: none; }
  #people { max-height: 150px; flex: none; }
  #who { grid-template-columns: 1fr; padding: 12px 14px; }
  .who-ev { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 8px; white-space: normal; }
  #who h1 { font-size: 23px; }
  :root[data-look] .tpage main.tmain { overflow: visible; }
  #canvas { min-height: 60vh; max-height: 78vh; padding: 12px; }
  #gens-wrap { margin-left: 0; }
}
