@font-face {
  font-family: "Rodokmen Sans";
  src: url("assets/fonts/RobotoCondensed.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --documented: #165544;
  --probable: #805200;
  --paper: #f6f5f2;
  --paper-bright: #fff;
  --ink: #171714;
  --muted: #686760;
  --line: #e3e2dd;
  --white: #fff;
  --accent: #735846;
  --g1: #9e392f;
  --g2: #ca6a3f;
  --g3: #d79b44;
  --g4: #7b9a65;
  --g5: #4b8d85;
  --g6: #4c7292;
  --g7: #6c5f8e;
  --g8: #8c6079;
  --sidebar-width: 232px;
  --shadow: 0 20px 60px rgb(33 29 21 / 14%);
  color-scheme: light;
  font-family: "Rodokmen Sans", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
}

/* Certainty always has text and a border pattern in addition to color. */
.certainty-badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; max-width: 100%; padding: 3px 8px; border: 1px solid currentColor; border-radius: 4px; font-size: .78rem; font-weight: 600; line-height: 1.4; color: var(--documented); background: #edf6f1; }
.certainty-badge.is-probable { color: var(--probable); background: #fff5dd; border-style: dashed; }
.certainty-badge.is-root { color: #514941; background: #f4f1eb; }
.certainty-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.person-card-copy .certainty-badge { margin-bottom: 8px; }
.person-card.is-uncertain { border-style: dashed; }
.person-node.is-documented > rect:first-of-type { stroke: var(--documented); }
.person-node.is-uncertain > rect:first-of-type { stroke: var(--probable); stroke-width: 1.5; stroke-dasharray: 5 3; }
.person-node .node-certainty { fill: var(--documented); font-size: 11px; font-weight: 600; }
.person-node.is-uncertain .node-certainty { fill: var(--probable); }
.tree-edge.parent.is-uncertain { stroke: var(--probable); stroke-dasharray: 6 4; }
.tree-edge.parent.is-documented { stroke: var(--documented); }
.tree-person-panel > div > .certainty-badge { margin-bottom: 8px; }
.tree-person-panel .tree-panel-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tree-panel-kicker .certainty-badge { font-size: .67rem; letter-spacing: 0; text-transform: none; padding: 1px 5px; }
.person-header .certainty-note { background: transparent; border-left: 0; padding: 0; color: var(--muted); }
.map-selection { display: grid; gap: 8px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.map-selection h2 { font-size: 1.15rem; margin: 0 0 4px; }
.map-selection label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 3px; }
.map-selection select { width: 100%; min-width: 0; max-width: 100%; min-height: 44px; padding: 8px; border: 1px solid #8b877f; border-radius: 4px; background: white; color: var(--ink); }
.map-selection p { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.map-selection .button { min-height: 44px; }
.timeline-panel .certainty-legend { margin: 16px 0; }
.map-empty { padding: 12px; border-left: 3px solid var(--probable); background: #fff5dd; font-size: .9rem; }
.map-event-list { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.map-event-list summary { cursor: pointer; min-height: 44px; font-weight: 600; padding-block: 8px; }
#map-visible-events article { padding: 12px 0; border-top: 1px solid var(--line); }
#map-visible-events time { display: block; font-size: .8rem; color: var(--muted); }
#map-visible-events article > button { display: block; border: 0; background: transparent; padding: 6px 0; min-height: 44px; text-align: left; font-weight: 600; cursor: pointer; }
#map-visible-events p { margin: 0 0 8px; font-size: .85rem; }
.map-event-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.map-event-actions button { min-height: 44px; padding: 8px; border: 1px solid #8b877f; border-radius: 4px; background: white; cursor: pointer; }
.event-marker.is-probable { outline: 2px dashed var(--probable); outline-offset: 3px; }
.event-marker.is-mixed { outline: 3px double var(--probable); outline-offset: 3px; }
.map-popup .certainty-badge { margin: 5px 0; }
.archive-toolbar { flex-wrap: wrap; gap: 12px; }
.sort-field select { min-height: 44px; }
.timeline-panel, .tree-person-panel, dialog { scroll-padding-block: 60px; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper-bright);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select { font: inherit; }

button { color: inherit; }

img { display: block; max-width: 100%; }

a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 9999;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.sidebar { display: none; }

.mobile-header {
  position: sticky;
  z-index: 1000;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}

.mobile-brand,
.menu-toggle,
.mobile-nav button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  font-size: .78rem;
}

.mobile-brand span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 1.1rem;
}

.menu-toggle {
  min-height: 44px;
  padding: 6px 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .7rem;
}

.mobile-nav {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-bright);
  box-shadow: 0 8px 20px rgb(0 0 0 / 8%);
}

.mobile-nav.is-open { display: grid; }
.mobile-nav button[aria-current="page"] { background: var(--paper); text-decoration: underline; text-underline-offset: 5px; }

.mobile-nav button {
  padding: 10px 4px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.logout-button {
  min-height: 44px;
  margin-top: auto;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font-size: .8rem;
}
.logout-button:hover { color: var(--ink); }
.logout-button span { margin-left: 8px; }
.logout-button[hidden] { display: none; }
.mobile-nav .logout-button { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 8px; text-align: center; }

.main-content { min-height: 100vh; }

.view[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 13px;
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .68rem;
  font-weight: 700;
}
.workspace-head h1,
.person-header h2 {
  margin: 0;
  letter-spacing: -.045em;
  line-height: .98;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.button,
.tool-button {
  border: 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .7rem;
  font-weight: 700;
}

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid currentColor;
}

.button-dark { background: var(--ink); color: white; border-color: var(--ink); }

.button:hover { transform: translateY(-1px); }

.workspace-view { min-height: 100vh; background: var(--paper-bright); }

.workspace-head {
  display: grid;
  gap: 18px;
  padding: 30px 20px 24px;
  border-bottom: 1px solid var(--line);
}

.workspace-head h1 { font-size: clamp(2.5rem, 4.8vw, 4.2rem); }
.workspace-head > p { max-width: 420px; margin: 0; align-self: end; color: var(--muted); font-size: .95rem; line-height: 1.65; }

.tree-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.search-field { position: relative; display: block; min-width: min(100%, 250px); }
.search-wrap { position: relative; min-width: 0; }
.tree-search-wrap { flex: 1 1 260px; max-width: 380px; }
.search-results { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; width: 100%; max-height: min(460px, 55dvh); overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); background: white; box-shadow: var(--shadow); }
.search-results ul { list-style: none; padding: 0; margin: 0; }
.search-summary { margin: 0; padding: 12px 16px; font-size: .8rem; line-height: 1.5; border-bottom: 1px solid var(--line); }
.search-result-link { display: grid; gap: 5px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.search-result-name { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.search-result-link:hover, .search-result-link:focus-visible { background: var(--paper); }
.search-result-link:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; }
.search-result-action { font-weight: 600; }
.search-results small { color: var(--muted); font-size: .75rem; }
.search-excerpt { overflow-wrap: anywhere; }
.search-excerpt mark { background: #f4dfa5; color: #27241c; }
.search-results .search-excerpt { line-height: 1.5; }
.search-no-results { padding: 8px 16px; color: var(--muted); }

.search-field::before {
  content: "⌕";
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-53%);
  color: var(--muted);
  font-size: 1.15rem;
}

.search-field input { 
  width: 100%;
  height: 44px;
  padding: 0 14px 0 37px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: var(--paper-bright);
}

.search-field input:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgb(23 23 20 / 10%); }

.tool-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
}

.tool-button:hover { border-color: var(--ink); }

.generation-legend { display: flex; flex-wrap: wrap; gap: 5px 11px; }

.generation-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.generation-key i { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--generation-color); }

.tree-shell {
  position: relative;
  height: calc(100svh - 310px);
  min-height: 440px;
  overflow: hidden;
  touch-action: none;
  background-color: #f6f5f2;
  background-image: radial-gradient(#d8d6ce 0.65px, transparent 0.65px);
  background-size: 22px 22px;
  cursor: grab;
}

.tree-shell.is-dragging { cursor: grabbing; }
.tree-zoom { position: absolute; z-index: 21; top: 16px; left: 16px; display: flex; align-items: center; border: 1px solid var(--line); background: white; box-shadow: 0 2px 8px rgb(0 0 0 / 4%); cursor: default; }
.tree-zoom button { width: 44px; height: 44px; border: 0; background: white; font-size: 1.4rem; cursor: pointer; }
.tree-zoom button:hover { background: var(--paper); }
.tree-zoom output { min-width: 48px; text-align: center; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.family-tree { width: 100%; height: 100%; display: block; }
.tree-viewport { transform-origin: 0 0; }
.tree-edge { fill: none; stroke: #b9b6ad; stroke-width: 1.25; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tree-edge.partner { stroke-dasharray: 5 4; }
.tree-edge.sibling { stroke-dasharray: 2 5; }
.tree-edge.is-highlighted { stroke: var(--ink); stroke-width: 2.5; }
.tree-edge.is-dimmed { opacity: .14; }

.person-node { cursor: pointer; outline: none; }
.person-node rect { fill: white; stroke: #d2cfc6; stroke-width: 1; transition: filter .2s, stroke .2s; }
.person-node .node-accent { fill: var(--generation-color); stroke: none; }
.person-node text { pointer-events: none; fill: var(--ink); }
.person-node .node-name { font-family: Georgia, serif; font-size: 14px; }
.person-node .node-meta { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; fill: #777269; }
.person-node:hover rect,
.person-node:focus rect,
.person-node.is-match rect,
.person-node.is-selected rect { stroke: var(--ink); filter: drop-shadow(0 7px 7px rgb(26 23 18 / 14%)); }
.person-node.is-connected rect { stroke: var(--generation-color); stroke-width: 2; filter: drop-shadow(0 5px 6px rgb(26 23 18 / 10%)); }
.person-node.is-dimmed > rect:first-of-type { fill: var(--paper); }
.person-node.is-dimmed text { fill: var(--muted); }
.person-node.is-dimmed .node-accent { opacity: .35; }

.tree-person-panel {
  position: absolute;
  z-index: 20;
  right: 10px;
  bottom: 10px;
  left: 10px;
  max-height: min(54%, 470px);
  overflow-y: auto;
  padding: 24px 20px 20px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--generation-color, var(--ink));
  background: rgb(255 255 255 / 97%);
  box-shadow: 0 10px 35px rgb(29 25 18 / 10%);
  backdrop-filter: blur(12px);
  cursor: default;
  touch-action: pan-y;
}

.tree-person-panel[hidden] { display: none; }
#tree-person-panel-content { display: flex; flex-direction: column; }
.tree-panel-actions { order: 1; }
.tree-panel-details { order: 2; }
.tree-panel-close { position: absolute; top: 8px; right: 10px; width: 44px; height: 44px; border: 1px solid var(--line); background: white; cursor: pointer; font-size: 1.4rem; }
.tree-panel-kicker { margin: 0 42px 8px 0; color: var(--generation-color); text-transform: uppercase; letter-spacing: .12em; font-size: .65rem; font-weight: 700; }
.tree-person-panel h2 { margin: 0 42px 10px 0; font-family: Georgia, serif; font-size: 1.65rem; line-height: 1.05; font-weight: 400; }
.tree-panel-summary { margin: 0 0 14px; color: var(--muted); font-size: .76rem; }
.tree-panel-relations { display: grid; gap: 9px; margin: 14px 0; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .72rem; }
.tree-panel-relations > div { display: grid; grid-template-columns: 68px 1fr; gap: 7px; align-items: start; }
.tree-panel-relations strong { padding-top: 4px; text-transform: uppercase; letter-spacing: .06em; font-size: .6rem; }
.tree-panel-relations span { display: flex; flex-wrap: wrap; gap: 4px 7px; color: var(--muted); }
.tree-relation-button { padding: 3px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.tree-relation-button:hover { border-color: var(--ink); }
.tree-panel-facts { margin: 12px 0; padding: 0; list-style: none; }
.tree-panel-facts li { margin: 6px 0; color: #3f3c36; font-size: .72rem; }
.tree-panel-facts time { display: inline-block; min-width: 58px; color: var(--generation-color); font-weight: 700; }
.tree-panel-details { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.tree-panel-details h3 { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .1em; font-size: .62rem; }
.tree-panel-details .markdown-body { font-size: .88rem; }
.tree-panel-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.tree-panel-actions button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); background: white; cursor: pointer; text-transform: uppercase; letter-spacing: .07em; font-size: .62rem; font-weight: 700; }
.tree-panel-actions .primary { border-color: var(--ink); background: var(--ink); color: white; }

.tree-help {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 7px 10px;
  background: rgb(255 255 255 / 85%);
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .02em;
}

.map-layout { display: grid; min-height: 690px; }

.map-canvas { min-height: 58svh; background: #cdd9dc; isolation: isolate; }
.leaflet-container { font-family: inherit; background: #cdd9dc; }

.leaflet-control-attribution { font-size: 9px !important; }

.event-marker {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--marker-color, var(--ink));
  box-shadow: 0 1px 8px rgb(0 0 0 / 40%);
  transition: opacity .2s, transform .2s;
}

.event-marker.is-selected { transform: scale(1.35); box-shadow: 0 0 0 4px rgb(255 255 255 / 75%), 0 2px 10px rgb(0 0 0 / 45%); }
.event-marker.is-dimmed { opacity: .28; }

.event-marker.address::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid white;
  border-radius: 50%;
}

.leaflet-popup-content-wrapper { border-radius: 0; box-shadow: var(--shadow); }
.leaflet-popup-content { min-width: 210px; margin: 16px; }
.map-popup time { color: var(--accent); font-weight: 700; font-size: .7rem; letter-spacing: .08em; }
.map-popup strong { display: block; margin: 4px 0; font-family: Georgia, serif; font-size: 1rem; }
.map-popup-actions { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 10px; }
.map-popup button { padding: 5px 0; border: 0; border-bottom: 1px solid; background: none; cursor: pointer; font-size: .64rem; text-transform: uppercase; }

.life-route { stroke-linecap: round; stroke-linejoin: round; }
.kinship-route { stroke-linecap: round; animation: kinship-flow 1.7s linear infinite; }
@keyframes kinship-flow { to { stroke-dashoffset: -26; } }
.route-arrow-wrap { pointer-events: none !important; background: transparent; border: 0; }
.route-arrow { display: block; width: 22px; color: var(--route-color, var(--ink)); font-size: 20px; line-height: 18px; text-align: center; text-shadow: 0 0 3px white, 0 0 3px white; transform-origin: 50% 50%; }
.route-arrow.family { color: #332f2b; font-size: 17px; }

.timeline-panel { padding: 24px 20px; background: var(--paper); }
.timeline-top { display: flex; justify-content: space-between; align-items: flex-start; }
#timeline-range-output { font-family: Georgia, serif; font-size: 1.55rem; line-height: 1; }

.timeline-range-controls { display: grid; gap: 12px; margin: 23px 0; }
.timeline-range-controls label { display: grid; gap: 5px; color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
.timeline-range-controls label span { display: flex; justify-content: space-between; }
.timeline-range-controls output { color: var(--ink); font-weight: 700; }
.timeline-slider { width: 100%; margin: 0; accent-color: var(--ink); }

.map-route-legend { display: grid; gap: 7px; margin: 22px 0 0; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.map-route-legend span { display: flex; align-items: center; gap: 9px; }
.map-route-legend i { position: relative; display: inline-block; width: 44px; height: 8px; }
.map-route-legend i::before { content: ""; position: absolute; top: 3px; right: 0; left: 0; border-top: 2px solid var(--accent); }
.map-route-legend i::after { content: "›"; position: absolute; top: -6px; right: -1px; color: var(--accent); font-size: 17px; }
.map-route-legend .family-sample::before { border-top: 2px dashed var(--ink); }
.map-route-legend .family-sample::after { color: var(--ink); }

.map-filters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px 12px;
  margin: 26px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: .75rem;
}

.map-filters label { display: flex; align-items: center; gap: 6px; }
.map-filters input { accent-color: var(--ink); }
.map-filters .map-filter-wide { grid-column: 1 / -1; padding-top: 7px; border-top: 1px solid var(--line); }

.timeline-event { min-height: 150px; }
.timeline-event time { color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .1em; }
.timeline-event h3 { margin: 5px 0; font-family: Georgia, serif; font-size: 1.4rem; font-weight: 400; }
.timeline-event p { margin: 7px 0; color: var(--muted); font-size: .78rem; }
.timeline-event button { padding: 6px 0; border: 0; border-bottom: 1px solid; background: transparent; cursor: pointer; text-align: left; text-transform: uppercase; letter-spacing: .06em; font-size: .62rem; }
.map-person-relations { display: grid; gap: 8px; margin: 16px 0; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.map-person-relations > div { display: grid; grid-template-columns: 52px 1fr; gap: 7px; align-items: start; }
.map-person-relations strong { padding-top: 5px; font-size: .59rem; text-transform: uppercase; letter-spacing: .07em; }
.map-person-relations span { display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--muted); font-size: .68rem; }
.map-person-relations button { padding: 3px 0; text-transform: none; letter-spacing: 0; font-size: .68rem; }
.map-person-actions { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 12px; }
.map-person-empty { padding: 10px 0; color: var(--muted); font-size: .73rem; }
.map-attribution-note { margin: 28px 0 0; color: var(--muted); font-size: .62rem; }

.people-heading { align-items: end; }
.people-search { width: 100%; }
.archive-intro { margin: 22px 20px; max-width: 580px; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.archive-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; }
.sort-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.sort-field select { min-height: 44px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 0; background: white; color: var(--ink); }

.people-filter {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.filter-chip {
  flex: 0 0 auto;
  min-width: 40px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.filter-chip.is-active { background: var(--ink); color: white; border-color: var(--ink); }
.result-count { margin: 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .09em; }

.people-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px 22px; padding: 0 20px 40px; }

.person-card {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  background: white;
  text-align: left;
  overflow: visible;
}

.person-card-cover { position: relative; width: 100%; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border: 0; background: #e9e7e0; cursor: pointer; }
.person-card-cover img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.65); transition: transform .45s ease, filter .45s ease; }
.person-card-cover:hover img, .person-card-cover:focus-visible img { transform: scale(1.04); filter: saturate(1); }
.person-card-cover > span:not(.cover-placeholder) { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; padding: 28px 14px 12px; background: linear-gradient(transparent, rgb(0 0 0 / 65%)); color: white; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; }
.person-card-cover.is-empty { display: grid; place-items: center; background: var(--paper); }
.cover-placeholder { color: #686760; font-family: Georgia, serif; font-size: 1.4rem; font-style: italic; }
.person-card-copy { padding-top: 18px; }
.person-card small { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; }
.person-card h2 { margin: 10px 0; font-family: Georgia, serif; font-size: 1.6rem; line-height: 1.15; font-weight: 400; overflow-wrap: anywhere; }
.person-card p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: .92rem; line-height: 1.6; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.person-card p.search-excerpt { display: block; }
.person-card-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.person-card-actions button { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 5px; padding: 0 5px; border: 0; background: white; color: var(--muted); cursor: pointer; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.person-card-actions button:first-child { color: var(--ink); font-weight: 700; }
.people-empty { grid-column: 1 / -1; padding: 50px 24px 70px; background: var(--paper); text-align: center; }
.people-empty h2 { font-family: Georgia, serif; font-size: 2rem; font-weight: 400; }
.people-empty p { color: var(--muted); }
.person-card-actions button:hover,
.person-card-actions button:focus-visible { border-color: var(--generation-color); box-shadow: 0 0 0 1px var(--generation-color); outline: none; }

dialog { padding: 0; border: 0; }
dialog::backdrop { background: rgb(14 13 11 / 64%); backdrop-filter: blur(2px); }

.person-dialog {
  width: min(calc(100vw - 16px), 1040px);
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  background: var(--paper-bright);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog-close {
  position: sticky;
  z-index: 20;
  top: 12px;
  float: right;
  display: grid;
  width: 42px;
  height: 42px;
  margin: 12px 12px -54px 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-size: 1.5rem;
}

.person-header { min-width: 0; padding: 62px 24px 32px; border-bottom: 1px solid var(--line); border-top: 4px solid var(--generation-color); background: var(--paper); color: var(--ink); }
.person-header .eyebrow { color: var(--muted); }
.person-header h2 { max-width: 800px; overflow-wrap: anywhere; font-size: clamp(2.1rem, 5vw, 3.7rem); }
.person-header p { max-width: 700px; margin: 18px 0 0; overflow-wrap: anywhere; }
.person-family-links { display: grid; max-width: 760px; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.person-family-links > div { display: grid; min-width: 0; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: start; }
.person-family-label { padding-top: 3px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-size: .7rem; font-weight: 700; }
.person-family-values { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px 12px; }
.person-family-values a { color: var(--ink); overflow-wrap: anywhere; text-decoration-thickness: 1px; text-underline-offset: 3px; font-size: .9rem; }
.person-family-values a:hover { text-decoration-thickness: 2px; }
.person-family-empty { color: var(--muted); font-size: .9rem; }
.person-header-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.person-header-actions button { min-height: 44px; padding: 0 13px; border: 1px solid var(--line); background: white; color: var(--ink); cursor: pointer; text-transform: uppercase; letter-spacing: .07em; font-size: .72rem; font-weight: 700; }
.person-header-actions button:hover { background: white; color: var(--ink); }

.person-content { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.person-content > * { min-width: 0; max-width: 100%; }
.person-facts { padding: 25px 22px 40px; }
.person-facts h3,
.person-events h3,
.person-sources h3 { margin: 0 0 18px; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; }

.markdown-body { min-width: 0; max-width: 100%; color: #36342f; font-size: 1rem; line-height: 1.75; overflow-wrap: anywhere; }
.markdown-body ul { margin: 0; padding-left: 18px; }
.markdown-body li > p { margin: .7em 0; }
.markdown-body li { margin: 7px 0; }
.markdown-body li::marker { color: var(--generation-color); }
.markdown-body code { max-width: 100%; padding: 2px 4px; background: #ebe6dc; font-size: .75rem; overflow-wrap: anywhere; word-break: break-word; }
.markdown-body a { overflow-wrap: anywhere; word-break: break-word; text-decoration-thickness: 1px; text-underline-offset: 2px; }

.person-events { padding: 25px 22px 40px; border-top: 1px solid var(--line); }
.event-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.event-item { display: grid; min-width: 0; grid-template-columns: minmax(0, 78px) minmax(0, 1fr); gap: 13px; padding: 15px; background: white; }
.event-item > * { min-width: 0; }
.event-date { color: var(--generation-color); font-weight: 700; font-size: .75rem; }
.event-item p { margin: 0; overflow-wrap: anywhere; font-size: .78rem; }
.event-place { display: block; margin-top: 4px; color: var(--muted); }
.event-source { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.event-source a,
.event-source button { padding: 0; border: 0; border-bottom: 1px solid; background: transparent; color: var(--muted); cursor: pointer; font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; }

.person-sources { padding: 25px 22px 44px; border-top: 1px solid var(--line); }
.source-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.source-image { position: relative; min-width: 0; aspect-ratio: 4 / 3; padding: 0; border: 0; background: #ded8cd; cursor: zoom-in; overflow: hidden; }
.source-image img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7); transition: transform .3s; }
.source-image:hover img { transform: scale(1.03); }
.source-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 18px 8px 7px;
  background: linear-gradient(transparent, rgb(16 15 13 / 88%));
  color: white;
  font-size: .61rem;
  line-height: 1.25;
  text-align: left;
}
.source-empty { padding: 20px; border: 1px dashed var(--line); color: var(--muted); font-size: .78rem; }

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  overflow: auto;
  background: #151512;
  color: white;
}
.lightbox figure {
  display: flex;
  height: 100%;
  margin: 0;
  padding: calc(58px + env(safe-area-inset-top)) 10px calc(12px + env(safe-area-inset-bottom));
  flex-direction: column;
}
.scan-toolbar {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 48px 8px 0;
}
.navigation-notice { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; max-width: calc(100vw - 32px); margin: 0; padding: 12px 18px; background: #292824; color: white; box-shadow: 0 4px 24px #0003; }
.share-dialog { width: min(520px, calc(100vw - 24px)); border: 1px solid var(--line); padding: 48px 24px 24px; color: var(--ink); }
.share-dialog h2 { margin-top: 0; }
.share-dialog label { display: block; margin-bottom: 8px; }
.share-dialog input { width: 100%; min-width: 0; padding: 12px; font: inherit; }
.dialog-notice { margin: 24px 60px 0 24px; }
.scan-toolbar [data-navigation-notice] { color: white; }
.scan-toolbar button {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgb(255 255 255 / 35%);
  background: #292824;
  color: white;
  cursor: pointer;
  font-size: .75rem;
}
.scan-toolbar button:disabled { opacity: .38; cursor: default; }
.scan-toolbar button:nth-of-type(1),
.scan-toolbar button:nth-of-type(2) { font-size: 1.2rem; }
.scan-toolbar output { min-width: 54px; color: white; text-align: center; font-size: .7rem; font-variant-numeric: tabular-nums; }
.scan-navigation { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 18px; padding-bottom: 10px; }
.scan-navigation button { min-width: 48px; min-height: 44px; border: 1px solid rgb(255 255 255 / 35%); background: #292824; color: white; font-size: 1.4rem; cursor: pointer; }
.scan-navigation button:disabled { opacity: .38; cursor: default; }
#scan-position { min-width: 105px; text-align: center; font-size: .8rem; font-variant-numeric: tabular-nums; }
.scan-stage {
  position: relative;
  display: grid;
  min-height: 180px;
  flex: 1 1 auto;
  place-items: center;
  overflow: hidden;
  background: #0d0d0b;
  cursor: grab;
  touch-action: none;
  user-select: none;
  overscroll-behavior: contain;
}
.scan-stage.is-panning { cursor: grabbing; }
.lightbox img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  transform-origin: center;
  will-change: transform;
  user-select: none;
}
.lightbox figcaption { padding: 12px 5px 5px; color: rgb(255 255 255 / 75%); font-size: .72rem; }
.lightbox figcaption a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.lightbox-close {
  position: fixed;
  top: calc(6px + env(safe-area-inset-top));
  right: 6px;
  margin: 0;
}
.noscript { position: fixed; z-index: 9999; right: 10px; bottom: 10px; left: 10px; padding: 15px; background: #8d2e26; color: white; }

:focus-visible { outline: 3px solid #1675d1; outline-offset: 3px; }

.mobile-only { display: none; }
.tree-options { display: flex; flex-wrap: wrap; gap: 8px; }
.tree-readable { position: absolute; z-index: 21; top: 16px; right: 12px; background: white; }
.tree-panel-extra { display: flex; flex-direction: column; }
.tree-panel-map, .tree-panel-toggle { display: none; }
.map-scope-actions { margin-bottom: 14px; }

@media (min-width: 580px) {

  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .source-gallery { grid-template-columns: repeat(3, 1fr); }
  .lightbox { width: min(96vw, 1450px); height: 96dvh; max-height: 96dvh; margin: auto; }
  .lightbox figure { padding: 54px 12px 12px; }
  .lightbox-close { position: absolute; top: 12px; right: 12px; }
}

@media (min-width: 900px) {
  .mobile-header { display: none; }
  .sidebar {
    position: fixed;
    z-index: 1000;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    padding: 52px 32px 28px;
    background: white;
  }
  .brand { display: flex; align-items: flex-start; flex-direction: column; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
  .brand-mark { display: grid; width: 70px; height: 78px; place-items: center; border: 1px solid var(--ink); background: white; color: var(--ink); font-family: Georgia, serif; font-size: 3.6rem; line-height: 1; }
  .brand-name { margin-top: 16px; text-transform: uppercase; letter-spacing: .16em; font-size: .95rem; }
  .brand-subtitle { margin-top: 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; }
  .nav-list { display: grid; gap: 8px; margin-top: 80px; }
  .nav-link { display: flex; gap: 12px; align-items: center; min-height: 44px; padding: 8px 0; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: .95rem; }
  .nav-number { font-size: .62rem; color: #686760; }
  .nav-link:hover, .nav-link.is-active { color: var(--ink); }
  .nav-link.is-active { text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 1px; }
  .main-content { margin-left: var(--sidebar-width); padding: 24px 28px 24px 0; }

  .workspace-view { min-height: calc(100dvh - 48px); }
  .workspace-head { grid-template-columns: 1.1fr .9fr; gap: 28px; padding: 28px 28px 30px; }
  [data-view="tree"] { display: flex; flex-direction: column; height: calc(100dvh - 48px); min-height: 700px; }
  [data-view="tree"] .workspace-head { flex: 0 0 auto; }
  .tree-toolbar { padding: 14px 24px; flex: 0 0 auto; }
  .generation-legend { margin-left: auto; }
  .tree-shell { height: auto; min-height: 0; flex: 1; border: 1px solid var(--line); border-top: 0; }
  .tree-person-panel { top: 10px; right: 10px; bottom: 10px; left: auto; width: 350px; max-height: none; padding: 30px 25px 24px; }
  .map-layout { grid-template-columns: minmax(0, 1fr) 330px; height: calc(100dvh - 225px); min-height: 600px; border: 1px solid var(--line); border-top: 0; }
  .map-canvas { min-height: 100%; }
  .timeline-panel { overflow-y: auto; padding: 30px 28px; }
  .people-heading { grid-template-columns: 1fr minmax(250px, .6fr); }
  .archive-intro { margin: 26px 28px; }
  .people-filter { padding-right: 28px; padding-left: 28px; }
  .archive-toolbar { padding: 20px 28px; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 28px 48px; }
  .person-content { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); }
  .person-facts { padding: 40px 40px 60px; }
  .person-events { padding: 40px 40px 60px; border-top: 0; border-left: 1px solid var(--line); }
  .person-sources { grid-column: 1 / -1; padding: 40px; }
  .person-header { padding: 72px 40px 46px; }
  .source-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}

@media (min-width: 1300px) {
  .people-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* A selection is shared by the tree, map and profile navigation. */
.evidence-links { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 8px 0 12px; }
.evidence-links button { border: 1px solid var(--line); border-radius: 3px; background: #faf8f5; padding: 7px 10px; min-height: 36px; color: var(--ink); font: inherit; font-size: .82rem; cursor: pointer; }
.evidence-links button:hover { border-color: var(--accent); background: #eee7df; }
.map-load-status { position: absolute; z-index: 700; top: 14px; left: 64px; right: 14px; width: fit-content; max-width: calc(100% - 78px); padding: 10px 14px; background: #fff; color: #454039; border: 1px solid var(--line); box-shadow: 0 2px 8px #0001; font-size: .85rem; pointer-events: none; }
.selection-toolbar, .map-scope-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); background: var(--paper); }
.selection-toolbar p, .map-scope-bar p { margin: 0; }
.selection-toolbar p, #map-scope-summary { color: var(--muted); font-size: .85rem; }
.map-scope-bar .eyebrow { color: var(--ink); line-height: 1.5; margin-bottom: 5px; }
.map-scope-actions { display: flex; flex-wrap: wrap; gap: 8px; }
button:disabled { opacity: .45; cursor: default; }
button[hidden] { display: none !important; }
.tree-panel-primary { display: grid; gap: 8px; margin: 14px 0; }
.tree-panel-primary .button { width: 100%; justify-content: center; min-height: 46px; font-size: .8rem; }
.tree-panel-primary span { font-size: .78rem; color: var(--muted); }
.tree-panel-actions { order: 0; margin-top: 4px; }
.tree-panel-actions button { min-height: 44px; }
.tree-panel-actions button[aria-pressed="true"] { border-color: var(--accent); background: #eee7df; color: #4d3626; }
.tree-panel-details { order: 1; }
.person-node.is-uncertain > rect:first-of-type { stroke-dasharray: 4 3; }
.certainty-note { padding: 10px 14px; background: #fff6df; border-left: 3px solid #b48b39; font-size: .9rem; }
.map-person-list { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.map-person-list summary { cursor: pointer; min-height: 44px; font-weight: 600; }
#map-scope-people { display: grid; gap: 4px; }
#map-scope-people button { display: grid; gap: 3px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
#map-scope-people small { color: var(--muted); }
.event-marker:has(span) { display: grid; place-items: center; width: 28px; height: 28px; margin: -5px; color: white; font: 700 11px/1 sans-serif; box-shadow: 0 0 0 3px white, 0 2px 8px #0004; }
.place-event-list { max-height: 290px; overflow-y: auto; overscroll-behavior: contain; margin-top: 12px; }
.place-event-list article { padding: 10px 0; border-top: 1px solid var(--line); }
.place-event-list article > button { display: block; padding: 5px 0; background: none; border: 0; font-weight: 700; font-size: 1rem; cursor: pointer; text-align: left; }
.place-event-list time { display: block; font-size: .8rem; }
.map-popup-actions button { min-height: 36px; }
.source-image img { object-fit: contain; background: #ece8e0; }
.source-image:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #795b36; outline-offset: 3px; }
@media (max-width: 599px) {
  .selection-toolbar, .map-scope-bar { padding: 12px; }
  .selection-toolbar .tool-button { width: 100%; }
  .tree-person-panel { padding: 18px 16px; max-height: 52%; }
  .tree-panel-primary { position: sticky; top: -18px; z-index: 1; padding: 10px 0; background: white; }
  .tree-panel-primary span { display: none; }
  .tree-panel-summary { display: none; }
  .tree-panel-relations { margin: 8px 0; }
  .map-scope-actions { width: 100%; }
  .map-scope-actions button { flex: 1; }
  .generation-legend { display: none; }
}
@media (min-width: 900px) {
  .map-layout { height: calc(100dvh - 290px); }
  .tree-panel-primary .button { font-size: .78rem; }
}

/* On small screens the tree and map occupy the available viewport. */
@media (max-width: 899px) {
  .mobile-only { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-header { height: calc(56px + env(safe-area-inset-top)); min-height: 56px; padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); gap: 4px; }
  .mobile-brand { min-width: 44px; min-height: 44px; justify-content: center; }
  .mobile-brand .mobile-brand-name { display: none; }
  .mobile-nav, .mobile-nav.is-open { position: static; display: flex; align-items: center; justify-content: center; flex: 1; padding: 0; gap: 2px; border: 0; background: transparent; box-shadow: none; }
  .mobile-nav button { min-width: 52px; min-height: 44px; padding: 0 10px; font-size: .85rem; letter-spacing: .03em; }
  .mobile-nav button[aria-current="page"] { background: #ece8df; text-decoration: none; box-shadow: inset 0 -2px var(--accent); }
  .menu-toggle { order: 2; min-width: 44px; padding: 0 6px; font-size: .7rem; }
  .mobile-nav .logout-button { display: none; }
  #mobile-account { display: none; }
  .mobile-nav.is-open #mobile-account { display: contents; }
  .mobile-nav.is-open .logout-button { position: absolute; display: block; top: 100%; right: 8px; width: 210px; margin: 0; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
  .main-content { min-height: 0; }
  .workspace-head { padding: 8px 12px; gap: 8px; }
  .workspace-head h1 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -.03em; }
  .workspace-head > p, .workspace-head .eyebrow { display: none; }
  [data-view="tree"], [data-view="map"] { display: flex; flex-direction: column; height: calc(100svh - 56px - env(safe-area-inset-top)); height: calc(100dvh - 56px - env(safe-area-inset-top)); min-height: 280px; }
  [data-view="tree"] > :not(.tree-shell), [data-view="map"] > :not(.map-layout) { flex-shrink: 0; }
  .tree-toolbar { padding: 6px 10px; gap: 8px; flex-wrap: nowrap; }
  .tree-search-wrap { min-width: 0; max-width: none; flex: 1; }
  .tree-search-wrap .search-field { min-width: 0; }
  .search-field input { font-size: 16px; }
  .tree-view-options { position: relative; }
  #tree-options-toggle { padding: 0 10px; font-size: .75rem; text-transform: none; letter-spacing: 0; }
  .tree-options { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: 250px; max-width: calc(100vw - 20px); max-height: calc(100dvh - 165px); overflow-y: auto; padding: 10px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
  .tree-view-options.is-open .tree-options { display: grid; }
  .tree-pan { display: flex; gap: 4px; }
  .tree-pan button { flex: 1; padding: 0; font-size: 1.3rem; }
  .generation-legend, .selection-toolbar { display: none; }
  .tree-shell { flex: 1; height: auto; min-height: 0; padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain; }
  .tree-zoom { top: 10px; left: max(10px, env(safe-area-inset-left)); }
  .tree-zoom output { min-width: 40px; }
  .tree-readable { top: 10px; right: 10px; padding: 0 10px; font-size: .7rem; letter-spacing: 0; text-transform: none; }
  .tree-help { right: auto; left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); padding: 6px 8px; font-size: .72rem; pointer-events: none; }
  .tree-shell:has(.tree-person-panel:not([hidden])) .tree-help { display: none; }
  .tree-person-panel { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); padding: 10px 12px; max-height: calc(100% - 66px); border-radius: 8px; }
  .tree-panel-close { top: 6px; right: 6px; }
  .tree-panel-kicker { margin: 0 40px 5px 0; font-size: .67rem; letter-spacing: .06em; }
  .tree-person-panel h2 { margin: 0 40px 8px 0; font-size: 1.25rem; line-height: 1.15; }
  .tree-panel-primary { position: static; display: grid; grid-template-columns: 1.1fr 1.2fr .85fr; gap: 6px; margin: 0; padding: 0; }
  .tree-panel-primary .button { min-width: 0; min-height: 44px; padding: 0 5px; font-size: .8rem; text-transform: none; letter-spacing: 0; }
  .tree-panel-map, .tree-panel-toggle { display: inline-flex; align-items: center; justify-content: center; background: white; }
  .tree-panel-primary > span { display: none; }
  .tree-panel-extra { display: none; }
  .tree-person-panel.is-expanded .tree-panel-extra { display: flex; }
  .tree-panel-relations { margin: 12px 0; font-size: .85rem; }
  .tree-panel-relations > div { grid-template-columns: 54px 1fr; }
  .tree-relation-button { min-height: 44px; padding: 8px 0; }
  .tree-panel-actions { margin-top: 12px; }
  .tree-panel-facts, .tree-panel-summary, .tree-panel-details { display: none; }
  .map-scope-bar { flex-wrap: nowrap; gap: 8px; padding: 6px 10px; }
  .map-scope-bar > div:first-child { min-width: 0; flex: 1; }
  .map-scope-bar .eyebrow { margin-bottom: 2px; font-size: .65rem; letter-spacing: .04em; }
  #map-scope-summary { font-size: .75rem; line-height: 1.25; }
  #map-controls-toggle { flex-shrink: 0; padding: 0 10px; font-size: .75rem; letter-spacing: 0; text-transform: none; }
  .map-layout { position: relative; display: block; flex: 1; min-height: 0; height: auto; }
  .map-canvas { width: 100%; height: 100%; min-height: 0; }
  .timeline-panel { display: none; position: absolute; z-index: 800; bottom: max(8px, env(safe-area-inset-bottom)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); max-height: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
  .timeline-panel.is-open { display: block; }
  #map-controls-close { position: sticky; top: 0; z-index: 1; display: flex; width: calc(100% + 32px); margin: 0 -16px 14px; min-height: 48px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); }
  .map-scope-actions { margin-bottom: 12px; }
  .map-scope-actions:not(:has(button:not([hidden]))) { display: none; }
  .map-filters label { min-height: 44px; align-items: center; }
  .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }
  .people-heading { padding: 12px; }
  .archive-intro { display: none; }
}

@media (min-width: 600px) and (max-width: 899px) and (max-height: 550px) {
  .tree-person-panel { left: auto; width: 280px; top: 64px; bottom: 8px; }
  .timeline-panel { left: auto; width: 330px; }
}

/* Profile browsing and dated evidence share one consistent presentation. */
.profile-navigation { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 54px 14px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.profile-navigation button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); background: white; color: var(--ink); cursor: pointer; }
.profile-navigation button:disabled { opacity: .45; cursor: default; }
.profile-navigation span { white-space: nowrap; font-size: .8rem; }
.birth-order { color: var(--ink); font-size: .9rem; line-height: 1.5; }
.birth-explanation { margin: 12px 0; font-size: .9rem; }
.birth-explanation summary { cursor: pointer; min-height: 32px; }
.person-card { cursor: pointer; }
.person-card:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.people-view-options { min-width: 0; }
.stories-grid { display: grid; gap: 24px; padding: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.story-card { padding: 24px; border: 1px solid var(--line); background: white; min-width: 0; }
.story-card h2 { font-family: var(--font-display, Georgia, serif); font-size: 1.5rem; line-height: 1.2; margin-top: 0; }
.story-card p { line-height: 1.7; }
.story-links { display: flex; flex-direction: column; gap: 8px; }
.story-links a { min-height: 32px; padding-block: 6px; color: var(--accent-dark, #87392f); text-underline-offset: 3px; }
.family-insights { padding: 24px 24px 0; line-height: 1.65; }
.family-insights h2 { font: 1.8rem Georgia, serif; }
.family-insights h3 { font: 1.5rem Georgia, serif; margin-top: 0; }
.family-insights h4 { font-size: 1rem; margin-bottom: 8px; }
.family-insights a { color: var(--accent-dark, #87392f); text-underline-offset: 3px; overflow-wrap: anywhere; }
.insight-controls { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; margin-block: 20px; }
.insight-controls label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.insight-controls select { min-height: 44px; padding: 8px; max-width: 100%; background: white; color: var(--ink); border: 1px solid var(--line); }
.insight-controls .insight-checkbox { flex-wrap: nowrap; min-height: 44px; cursor: pointer; }
.insight-checkbox input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--accent); }
#insight-results { display: grid; gap: 24px; }
.insight-panel { padding: 24px; background: white; border: 1px solid var(--line); min-width: 0; }
.insight-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.insight-table caption { text-align: left; margin-bottom: 12px; }
.insight-table th, .insight-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.insight-table thead th { background: var(--paper); }
.insight-table th:first-child { width: 40%; }
.insight-panel details { border-top: 1px solid var(--line); padding-block: 4px; }
.insight-panel summary { padding-block: 10px; min-height: 44px; cursor: pointer; }
.insight-panel li { margin-block: 10px; }
.insight-panel ul { padding-left: 22px; }
.insight-panel .age-distribution { list-style: none; padding: 0; max-width: 680px; }
.age-distribution li { display: grid; grid-template-columns: 75px 1fr 70px; gap: 12px; align-items: center; }
.age-distribution strong { font-size: .9rem; }
.age-bar { height: 14px; background: linear-gradient(to right, #536b65 var(--share), #f2f0e9 var(--share)); }
.marriage-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.marriage-highlights section { padding: 16px; background: var(--paper); }
@media (max-width: 599px) {
  .family-insights { padding: 12px 12px 0; }
  #insight-results { gap: 12px; }
  .insight-panel { padding: 14px; }
  .insight-table { font-size: .77rem; }
  .insight-table th, .insight-table td { padding: 8px 4px; overflow-wrap: anywhere; }
  .insight-table th:first-child { width: 36%; }
  .age-distribution li { gap: 8px; }
}
.markdown-body a, .event-item a, .birth-explanation a { overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .mobile-header { display: flex; flex-wrap: nowrap; }
  .mobile-brand.menu-toggle { order: 0; flex: 0 0 44px; font-family: Georgia, serif; font-size: 1.3rem; padding: 0; }
  .mobile-nav, .mobile-nav.is-open { justify-content: flex-start; gap: 0; min-width: 0; }
  .mobile-nav > button { flex: 1; min-width: 45px; padding: 0 6px; font-size: .8rem; }
  #mobile-view-slot { flex: 0 0 auto; }
  #mobile-view-slot > [hidden] { display: none !important; }
  #mobile-view-slot button { min-height: 44px; }
  #tree-options-toggle, #map-controls-toggle, #people-options-toggle { padding: 0 7px; font-size: .75rem; letter-spacing: 0; text-transform: none; }
  #mobile-account { display: none; }
  .mobile-nav.is-open #mobile-account { display: block; position: absolute; left: 8px; right: 8px; top: 100%; max-height: calc(100dvh - 72px); overflow-y: auto; padding: 14px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
  .mobile-nav.is-open #mobile-account .logout-button { position: static; display: block; width: 100%; box-shadow: none; }
  #mobile-tools { display: grid; gap: 12px; margin-top: 8px; }
  #mobile-tools > [hidden] { display: none !important; }
  #mobile-tools .tree-search-wrap, #mobile-tools .people-search { width: 100%; max-width: none; }
  #mobile-tools .search-results { position: relative; top: auto; margin-top: 6px; max-height: 50dvh; }
  #mobile-tools .archive-intro { padding: 0; margin: 0; font-size: .8rem; }
  .workspace-head, .tree-toolbar, .map-scope-bar { display: none; }
  .tree-options { position: fixed; top: calc(56px + env(safe-area-inset-top)); right: 8px; max-height: calc(100dvh - 72px); }
  #people-options { display: none; position: fixed; top: calc(56px + env(safe-area-inset-top)); left: 8px; right: 8px; max-height: calc(100dvh - 72px); overflow-y: auto; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 12px; }
  .people-view-options.is-open #people-options { display: block; }
  #people-options .people-filter { display: flex; flex-wrap: wrap; padding: 0; overflow: visible; }
  #people-options .archive-toolbar { display: flex; flex-wrap: wrap; padding: 12px 0 0; gap: 12px; }
  #people-options .sort-field { flex: 1; min-width: 115px; }
  #people-options select { width: 100%; }
  [data-view="people"] > #people-search-help { display: none; }
  .people-grid { padding-top: 16px; }
  .profile-navigation { padding: 8px 64px 8px 8px; gap: 4px; }
  .profile-navigation button { font-size: .75rem; padding: 6px; }
  .profile-navigation span { font-size: .7rem; }
  .stories-grid { padding: 12px; gap: 12px; }
  .story-card { padding: 18px; }
}
#family-tree[data-selection-scope="person"] .is-dimmed { visibility: hidden; pointer-events: none; }
.source-glossary { margin-top: 20px; font-size: .9rem; }
.source-glossary summary { min-height: 44px; cursor: pointer; }
.source-glossary dt { font-weight: 600; margin-top: 8px; overflow-wrap: anywhere; }
.source-glossary dd { margin-left: 0; line-height: 1.5; }
@media (max-width: 899px) {
  #mobile-tools .map-scope-bar { display: block; padding: 0; }
  #mobile-tools #people-search-help, #birth-sort-help:not([hidden]) { display: block; }
}

.map-data-credit { padding: 1rem 1.5rem; color: #555; font-size: .85rem; line-height: 1.5; }

/* Loading feedback never covers the family controls or map attribution. */
.map-load-status{position:absolute;top:12px;right:12px;z-index:800;max-width:min(330px,calc(100% - 74px));padding:10px 12px;border:1px solid #d2d0c5;background:#fffdf4ee;color:#343b30;font:13px/1.5 Arial,sans-serif;box-shadow:0 2px 8px #0001}
.map-load-status button{display:block;margin-top:7px;padding:5px 9px;border:1px solid #aaa;background:#fff;color:#243d31;font:inherit;cursor:pointer}
.map-load-status[hidden],.map-load-status button[hidden]{display:none}
.map-load-status button:focus-visible{outline:3px solid #678457;outline-offset:2px}
.leaflet-control-attribution a{color:#245742}
