/* The archive's green and paper palette, with a clearer working surface. */
.tree-view .page-heading { margin-bottom: 16px; }
.tree-view h1 { font-size: 2.2rem; }
#tree-mobile-stats { display: none; }
.tree-controls { gap: 10px; margin-bottom: 10px; }
.tree-controls select { min-height: 42px; }
#descendant-depth-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
#tree-child-links { order: 3; flex-basis: 100%; max-width: none; }
.tree-controls #tree-settings-toggle[aria-expanded=true] { background: var(--soft); border-color: #91a99a; }
.tree-options { padding: 12px 14px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; margin-bottom: 10px; }
.tree-options .tree-siblings-option { flex-direction: row; align-items: center; min-height: 44px; font-size: .875rem; color: var(--ink); }
.tree-siblings-option input { width: 18px; height: 18px; accent-color: var(--green); }
.tree-branch-legend { margin: 6px 0 12px; }
.tree-branch-legend span { color: #485c50; }
.tree-branch-legend i { height: 4px; }
.tree-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; border: 1px solid #cdd8ce; border-left: 4px solid var(--branch, var(--green)); border-radius: 12px 12px 0 0; background: var(--paper); padding: 12px 16px; }
.tree-selected-person { display: flex; flex-direction: column; min-width: 170px; flex: 1; }
.tree-selection-label { font-size: .75rem; color: #5c6e61; letter-spacing: .06em; text-transform: uppercase; }
#tree-selected-name { font-size: 1rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
#tree-selected-detail { font-size: .875rem; color: #536359; margin-top: 2px; }
.tree-parent-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 48%; }
.tree-parent-links:empty { display: none; }
.tree-parent-links > span { font-size: .875rem; color: #536359; margin-right: 3px; }
.tree-parent-links button { min-height: 40px; padding: 7px 10px; border: 1px solid #c6d4c8; border-radius: 7px; background: #f0f4ee; color: var(--branch, var(--green)); font-size: .875rem; text-align: left; }
.tree-selection-actions { display: flex; gap: 7px; }
#tree-open-profile { background: var(--green); color: white; border-color: var(--green); }
.tree-trail { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 7px 12px; background: #edf2eb; border-inline: 1px solid #cdd8ce; scrollbar-width: thin; }
.tree-trail button { flex-shrink: 0; min-height: 36px; font-size: .875rem; padding: 5px 8px; border-radius: 5px; background: transparent; color: #2b5141; }
.tree-trail button[aria-current] { background: white; font-weight: 600; }
.trail-label { flex-shrink: 0; font-size: .75rem; color: #536359; margin-right: 5px; }
.trail-arrow { color: #496653; }
.tree-sibling-strip { display: flex; align-items: center; gap: 7px; padding: 8px 12px; background: #f2f5ee; border-inline: 1px solid #cdd8ce; overflow-x: auto; scrollbar-width: thin; }
.tree-sibling-strip > span { font-size: .875rem; color: #526456; margin-right: 6px; flex-shrink: 0; }
.tree-sibling-strip button { background: white; border: 1px solid #cbd6c8; border-radius: 7px; padding: 6px 12px; text-align: left; flex: 1 0 auto; min-height: 48px; }
.tree-sibling-strip .tree-sibling-label { max-width: 190px; white-space: normal; overflow-wrap: anywhere; }
.tree-sibling-strip .tree-sibling-empty { flex-shrink: 1; }
.tree-sibling-strip strong { display: block; font-size: .875rem; font-weight: 600; }
.tree-sibling-strip small { display: block; color: #536456; font-size: .75rem; }
.tree-shell { min-height: 480px; height: clamp(480px, calc(100dvh - 440px), 760px); border-radius: 0 0 14px 14px; border-color: #cdd8ce; background: #f6f8f3; }
.tree-stage { background-image: radial-gradient(#697e652c .8px, transparent .8px); }
.tree-node { border-color: #b7c9b8; box-shadow: 0 3px 12px #1d3c3014; }
.tree-node .node-main { cursor: pointer; }
.tree-node .node-name { font-size: 1.0625rem; }
.tree-node .node-dates { color: #526456; }
.tree-node.focus-person .node-dates { color: #e0e9df; }
.tree-node.selected-person { outline: 3px solid #b38b3f; outline-offset: 4px; box-shadow: 0 5px 18px #284d382e; }
.tree-node .node-role { max-width: 106px; padding-inline: 5px; font-size: .875rem; }
.node-profile { width: 37px; min-width: 37px; height: 37px; display: grid; place-items: center; border-radius: 7px; background: #e5eee3; color: #315642; }
.node-profile .icon { width: 18px; height: 18px; }
.focus-person .node-profile { color: white; background: #ffffff1c; }
.tree-world .family-line, .tree-world .partner-line { stroke-width: var(--tree-line-width, 1.7px); opacity: .85; }
.tree-world.has-trace .tree-node:not(.on-trail) { background: #eef1eb; border-color: #c5d1c4; box-shadow: none; }
.tree-world.has-trace .tree-node:not(.on-trail) .node-name { color: #526155; }
.tree-world.has-trace #connections path:not(.on-trail) { opacity: .35; }
.tree-world.has-trace #connections .on-trail { stroke-width: var(--tree-trace-width, 3.2px); opacity: 1; }
.tree-world[data-direction=vertical] .tree-generation { left: var(--generation-x, 14px) !important; }
.tree-world.has-trace .tree-node.on-trail { border-color: var(--branch); }
.tree-world[data-detail=compact] .avatar, .tree-world[data-detail=compact] .node-footer { display: none; }
.tree-world[data-detail=compact] .node-main { height: 100%; padding: 18px; align-items: center; }
.tree-world[data-detail=compact] .node-name { font-size: 1.7rem; line-height: 1.22; }
.tree-world[data-detail=compact] .node-dates { font-size: 1.25rem; }
.tree-world[data-detail=overview] .node-footer, .tree-world[data-detail=overview] .node-copy, .tree-world[data-detail=overview] .avatar, .tree-world[data-detail=overview] .tree-generation { display: none; }
.tree-world[data-detail=overview] .tree-node { background: var(--branch); border: 0; box-shadow: none; border-radius: 22px; }
.tree-world[data-detail=overview].has-trace .tree-node:not(.on-trail) { background: var(--branch); opacity: .5; }
.tree-world[data-detail=overview] .node-main { height: 100%; min-height: 0; padding: 0; }
.tree-world[data-detail=overview] .tree-node.selected-person { outline-width: 16px; outline-offset: 10px; }
.tree-overview-hint { position: absolute; left: 16px; top: 14px; margin: 0; padding: 10px 12px; border: 1px solid #c7d5c7; border-radius: 9px; background: #fcfbf8f5; font-size: .875rem; line-height: 1.45; max-width: min(330px, calc(100% - 230px)); pointer-events: none; }
.tree-overview-hint strong { display: block; color: #254c3b; margin-bottom: 2px; }
.tree-map { position: absolute; left: 14px; bottom: 60px; width: 196px; background: #fcfbf8f5; border: 1px solid #b8cbbb; border-radius: 9px; box-shadow: 0 4px 12px #213d3012; }
.tree-map summary { cursor: pointer; min-height: 36px; padding: 7px 10px; font-size: .875rem; color: #325542; }
.tree-map summary:focus-visible { outline: 3px solid #ad813b; outline-offset: 3px; }
.tree-map:not([open]) { width: auto; }
.tree-minimap { padding: 0; margin: 0 7px; width: calc(100% - 14px); height: 100px; display: block; border-radius: 4px; background: #e8eee5; touch-action: none; cursor: crosshair; }
.tree-minimap svg { display: block; width: 100%; height: 100%; }
.map-connections path { fill: none; vector-effect: non-scaling-stroke; stroke-width: .65px; opacity: .5; }
.map-connections path.map-on-trail { stroke-width: 1.5px; opacity: 1; }
.map-node { opacity: .65; }
.map-node.map-on-trail, .map-node.map-selected { opacity: 1; }
.map-node.map-selected { stroke: #926723; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.map-viewport { fill: #8ca6cb30; stroke: #203f75; stroke-width: 1.7px; vector-effect: non-scaling-stroke; pointer-events: none; }
#tree-map-count { display: block; padding: 4px 9px 6px; font-size: .75rem; color: #526456; }
.tree-legend { max-width: calc(100% - 370px); }
.tree-legend span { color: #465b4c; }
.zoom-controls { border-color: #bfcebf; }
.zoom-controls button { min-width: 40px; min-height: 40px; }
.zoom-controls #fit-tree { display: flex; width: auto; gap: 6px; padding: 0 10px; }
.zoom-controls #fit-tree[aria-pressed=true] { background: var(--soft); color: var(--green); }
.tree-expanded .tree-shell { min-height: 280px; }
.tree-expanded .tree-selection { padding-block: 8px; }
@media (max-width: 1100px) {
  .tree-parent-links { max-width: none; order: 3; flex-basis: 100%; }
  .tree-parent-links:empty { flex-basis: auto; }
}
@media (max-width: 760px) {
  .tree-view .eyebrow, .tree-view #focus-caption, .tree-view .separator, #tree-stats { display: none; }
  #tree-mobile-stats { display: inline; }
  .tree-view .page-heading { margin-bottom: 14px; }
  .tree-view h1 { font-size: 2rem; }
  .tree-controls { flex-direction: row; align-items: center; gap: 8px; }
  .tree-controls .segmented { flex-basis: 100%; }
  .tree-controls .segmented button { flex: 1; min-height: 40px; }
  .tree-controls #depth-label { flex: 1; min-width: 0; gap: 6px; }
  .tree-controls #depth-label select { flex: 1; min-width: 0; }
  .tree-controls #descendant-depth-label { flex: 1 1 100%; min-width: 0; }
  .tree-controls #descendant-depth-label select { flex: 1; min-width: 0; }
  .tree-controls .tree-expand-button { margin-left: 0; }
  .tree-controls #tree-expand-label, .tree-controls .settings-label { display: none; }
  .tree-controls #tree-expand, .tree-controls #tree-settings-toggle { width: 44px; min-width: 44px; min-height: 44px; padding: 9px; }
  .tree-options { padding: 10px; margin-top: 0; }
  .tree-branch-legend { display: none; }
  .tree-selection { padding: 10px; gap: 9px; }
  .tree-selected-person { min-width: 145px; }
  .tree-selection-label { display: none; }
  .tree-selection-actions { gap: 5px; }
  .tree-selection-actions .button { min-height: 44px; padding-inline: 10px; }
  #tree-center-selected > span:last-child { display: none; }
  #tree-center-selected { min-width: 44px; }
  .tree-parent-links { gap: 5px; }
  .tree-parent-links button { min-height: 44px; }
  .tree-trail { padding-inline: 5px; }
  .tree-shell { height: 64dvh; min-height: 460px; }
  .tree-map { top: 10px; right: 10px; bottom: auto; left: auto; width: 152px; }
  .tree-map summary { min-height: 44px; padding: 11px 9px; }
  .tree-minimap { height: 85px; }
  .tree-overview-hint { top: 64px; left: 10px; max-width: calc(100% - 20px); padding: 8px 10px; }
  .tree-map[open] ~ .tree-legend { max-width: 140px; }
  .tree-legend { left: 8px; top: 9px; max-width: calc(100% - 155px); background: #fcfbf8d9; padding: 5px; gap: 4px; }
  .tree-legend span { font-size: .75rem; }
  .zoom-controls { bottom: 10px; right: 50%; }
  .zoom-controls .fit-label { display: none; }
  .zoom-controls button { min-height: 44px; min-width: 44px; }
  .tree-world .node-footer { gap: 4px; padding-inline: 10px; }
  .node-profile, .node-collapse, .node-focus { min-width: 40px; width: 40px; height: 40px; }
  .tree-expanded .tree-controls .segmented { flex-basis: auto; }
  .tree-expanded .tree-controls #depth-label { flex-basis: auto; flex: 1; }
  .tree-expanded .tree-controls #tree-settings-toggle { margin-left: auto; }
  .tree-expanded .tree-branch-legend { display: none; }
  .tree-expanded .tree-selection-label { display: none; }
  .tree-expanded .tree-parent-links > span { display: none; }
  .tree-expanded .tree-selection { padding: 8px; }
  .tree-expanded .tree-help { display: none; }
  .tree-expanded .tree-shell { min-height: 300px; }
}
