/* Extends the incumbent static-page, card, page and print styles. */
.kinship-page { max-width: 1000px; }
.kinship-page [hidden] { display: none !important; }
.kinship-page :focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.kinship-page a { text-underline-offset: 3px; }
.kinship-page select { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
.kinship-page button:disabled { cursor: not-allowed; opacity: .55; }
.kinship-jump { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 20px; font-size: 14px; }
.kinship-tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.kinship-tool h2 { font-size: 18px; margin: 0 0 14px; }
.kinship-tool fieldset, .kinship-chart-controls { min-width: 0; margin: 0; border: 0; padding: 0; }
.kinship-tool legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.kinship-options { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.kinship-chain { font-size: 16px !important; font-weight: 600; overflow-wrap: anywhere; padding: 12px 0; margin: 0; }
.kinship-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.kinship-actions small { color: #565d69; }
.kinship-step-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kinship-step-buttons button { min-height: 44px; padding: 10px 8px; }
.kinship-note { font-size: 13px !important; color: #565d69 !important; }
.kinship-status { margin-top: 0; }
.kinship-results { list-style: none; padding: 0; margin: 0; }
.kinship-results > li + li { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 4px; }
.kinship-results h3 { font-size: 16px; text-transform: none; }
.kinship-readings { margin: 14px 0; }
.kinship-readings dt { font-size: 12px; color: #565d69; margin-top: 12px; }
.kinship-readings dd { margin: 0; }
.kinship-hanzi, .tree-hanzi { font-family: var(--ink-font); font-size: 30px; color: var(--ink); }
.kinship-trad { font-family: "HSKaiBig5", "Kaiti TC", serif; }
.kinship-romanization { display: block; font-size: 15px; color: #3c414c; }
.kinship-table-wrap { overflow: auto; border: 1px solid var(--line); background: #fff; }
.kinship-table { border-collapse: collapse; width: 100%; min-width: 690px; font-size: 14px; }
.kinship-table th, .kinship-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.kinship-table thead { background: #fafafa; }
.kinship-table caption { text-align: left; padding: 12px; color: #565d69; }
.kinship-table .kinship-hanzi { font-size: 23px; }
.kinship-table small { display: block; margin-top: 5px; line-height: 1.5; }
.kinship-table tbody th { width: 22%; font-weight: 600; }
.kinship-table td:nth-child(2), .kinship-table td:nth-child(3) { width: 21%; }
.kinship-chart-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0; }
.kinship-chart-controls label { display: grid; gap: 4px; font-size: 13px; }
.kinship-chart.page { max-width: 100%; padding: 24px; }
.kinship-chart h3 { font-size: 20px; text-align: center; margin-top: 0; }
.kinship-chart > p { text-align: center; }
.family-tree { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; margin: 22px 0; }
.tree-side h4 { text-align: center; font-size: 14px; margin: 0 0 12px; }
.grandparent-pair { --pair-gap: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: var(--pair-gap); position: relative; }
.grandparent-pair::after { content: ""; position: absolute; border-top: 1px solid #797e87; width: calc(50% + var(--pair-gap) / 2); left: calc(25% - var(--pair-gap) / 4); bottom: -15px; }
.tree-node { border: 1px solid #797e87; border-radius: 8px; background: #fff; padding: 10px 6px; text-align: center; min-width: 0; }
.tree-node > span { display: block; }
.tree-reading { font-size: 12px; }
.tree-english { font-size: 12px; margin-top: 4px; }
.tree-parent { width: 50%; margin: 30px auto 0; position: relative; }
.grandparent-pair .tree-node { position: relative; }
.grandparent-pair .tree-node::after { content: ""; position: absolute; height: 15px; border-left: 1px solid #797e87; left: 50%; bottom: -16px; }
.tree-parent .tree-node::before { content: ""; position: absolute; height: 15px; border-left: 1px solid #797e87; top: -15px; left: 50%; }
.tree-parent::after { content: ""; position: absolute; height: 24px; border-left: 1px solid #797e87; bottom: -24px; left: 50%; }
.tree-child { grid-column: 1 / -1; position: relative; margin-top: 48px; }
.tree-child > .tree-node { width: 160px; max-width: 90%; margin: 0 auto; }
.tree-child::before { content: ""; position: absolute; border-top: 1px solid #797e87; width: calc(50% + 10px); left: calc(25% - 5px); top: -24px; }
.tree-child::after { content: ""; position: absolute; height: 24px; border-left: 1px solid #797e87; left: 50%; top: -24px; }
.kinship-chart .chart-source { font-size: 11px; color: #444; margin-bottom: 0; }
.kinship-page .faq { padding: 0; margin: 30px 0; max-width: none; }
.kinship-page .faq p { color: #565d69; }
.kinship-sources p { max-width: 75ch; }
@media (max-width: 700px) {
  .kinship-tool { grid-template-columns: 1fr; }
  .kinship-chart.page { padding: 14px 8px; }
  .family-tree { gap: 0 12px; }
  .grandparent-pair { --pair-gap: 6px; }
  .tree-hanzi { font-size: 24px; }
  .tree-reading, .tree-english { font-size: 11px; }
  .tree-node { padding: 9px 3px; }
  .tree-parent { width: 65%; }
  .tree-child::before { width: calc(50% + 6px); left: calc(25% - 3px); }
}
@media print {
  .kinship-page { max-width: none; margin: 0; padding: 0; }
  .kinship-page > :not(#kinship-print-section) { display: none !important; }
  #kinship-print-section > :not(.kinship-chart) { display: none !important; }
  /* Keep border strokes clear of Chromium's rounded page clip on A4 and Letter. */
  .kinship-chart.page { padding: 0 1mm; box-shadow: none; overflow: visible; break-inside: avoid; }
  .kinship-chart h3 { font-size: 20pt; }
  .kinship-chart > p { font-size: 11pt; }
  .family-tree { gap: 0 8mm; margin: 9mm 0; }
  .grandparent-pair { --pair-gap: 4mm; }
  .tree-node { padding: 4mm 2mm; border-color: #333; }
  .tree-hanzi { font-size: 25pt; }
  .tree-reading, .tree-english { font-size: 10pt; }
  .tree-parent { width: 60%; margin-top: 10mm; }
  .grandparent-pair .tree-node::after { height: 5mm; bottom: -5mm; }
  .grandparent-pair::after { bottom: -5mm; }
  .tree-parent .tree-node::before { top: -5mm; height: 5mm; }
  .tree-parent::after { height: 7mm; bottom: -7mm; }
  .tree-child { margin-top: 14mm; }
  .tree-child::before { width: calc(50% + 4mm); left: calc(25% - 2mm); top: -7mm; }
  .tree-child::after { top: -7mm; height: 7mm; }
  .tree-child > .tree-node { width: 45mm; }
  .kinship-chart .chart-source { font-size: 9pt; }
}
