:root {
  color-scheme: light dark;
  --bg: #faf8f5; --surface: #ffffff; --surface-2: #f0ece6;
  --text: #211e1a; --muted: #6b655c; --border: #ddd6cc;
  --accent: oklch(0.45 0.09 250); --radius: 10px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .06);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 20px; --space-5: 32px;
  --avatar-sm: 64px; --avatar-lg: 112px;
  /* names the tree and timeline CSS already use */
  --edge: #8a8f98; --node: var(--surface); --node-line: #5b6470; --sel: var(--accent);
  --line: #a0a9b6; /* resting connectors: quiet, but still a solid line at fit zoom */
  --box-line: #bcc4cf; /* resting box outlines */
  /* a selected person's relatives, by relationship */
  --role-parent: oklch(0.58 0.10 55); --role-partner: oklch(0.58 0.09 355);
  --role-child: oklch(0.57 0.09 160); --role-sibling: oklch(0.55 0.09 290);
  /* lineage ramp, deliberately muted: oldest ancestor terracotta, the selected generation dusty violet, youngest descendant sea green */
  --lin-old: oklch(0.55 0.10 35); --lin-mid: oklch(0.50 0.06 285); --lin-new: oklch(0.58 0.08 190);
  /* timeline events */
  --ev-birth: oklch(0.57 0.09 160); --ev-partner: oklch(0.58 0.09 355);
  --ev-end: oklch(0.55 0.11 30); --ev-death: oklch(0.50 0.02 260);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --surface: #1f1e1b; --surface-2: #2b2925;
    --text: #ece8e1; --muted: #a39c90; --border: #3d3a34;
    --accent: oklch(0.78 0.09 250); --shadow: none;
    --edge: #6b7380; --node-line: #8b95a3;
    --line: #667082;
    --box-line: #4a5361;
    --role-parent: oklch(0.76 0.09 55); --role-partner: oklch(0.76 0.08 355);
    --role-child: oklch(0.76 0.08 160); --role-sibling: oklch(0.74 0.08 290);
    --lin-old: oklch(0.74 0.09 35); --lin-mid: oklch(0.74 0.06 285); --lin-new: oklch(0.78 0.08 190);
    --ev-birth: oklch(0.76 0.08 160); --ev-partner: oklch(0.76 0.08 355);
    --ev-end: oklch(0.74 0.10 30); --ev-death: oklch(0.72 0.02 260);
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--font-sans); height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bar { display: flex; gap: 1rem; align-items: center; padding: .5rem 1rem; border-bottom: 1px solid var(--node-line); position: relative; }
.bar h1 { font-size: 1.1rem; margin: 0; }
#search { padding: .35rem .5rem; min-width: 14rem; }
#results { position: absolute; top: 100%; left: 12rem; z-index: 5; list-style: none; margin: 0; padding: 0; background: var(--node); border: 1px solid var(--node-line); max-height: 16rem; overflow: auto; }
#results button { display: block; width: 100%; text-align: left; padding: .4rem .6rem; border: 0; background: none; font: inherit; cursor: pointer; }
main { flex: 1; display: flex; min-height: 0; }
.site-page main { display: block; flex: none; }
#views { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
#tree { flex: 1; width: 100%; touch-action: none; cursor: grab; background: transparent; }
#tree[hidden], #timeline-svg[hidden] { display: none; }
#tabs { display: flex; gap: .25rem; }
#tabs a { padding: .3rem .8rem; border-radius: 6px; text-decoration: none; color: inherit; border: 1px solid transparent; }
#tabs a[aria-current="page"] { border-color: var(--node-line); background: var(--node); font-weight: 600; }
#timeline { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#timeline[hidden] { display: none; }
#timeline-head { display: flex; align-items: baseline; gap: 1rem; padding: .4rem 1rem; }
#timeline-head h2 { margin: 0; font-size: 1.05rem; }
#timeline-head .hint { opacity: .65; font-size: .85rem; }
#timeline-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#timeline-body[hidden] { display: none; }
#timeline-axis { flex: none; display: block; width: 100%; height: 34px; }
#timeline-rows { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; touch-action: pan-y; cursor: grab; }
#timeline-rows:active { cursor: grabbing; }
#timeline-svg { display: block; width: 100%; }
.tl-controls { display: inline-flex; align-items: center; gap: .3rem; margin-left: auto; }
.tl-controls button { min-width: 2rem; padding: .2rem .5rem; border: 1px solid var(--node-line); border-radius: 6px; background: var(--node); color: inherit; font: inherit; cursor: pointer; }
.tl-controls button:hover { border-color: var(--sel); color: var(--sel); }
.tl-controls .hint { margin-left: .6rem; white-space: nowrap; }
#timeline-scroll { position: relative; height: 14px; margin: 0 1rem .4rem; background: var(--node); border: 1px solid var(--node-line); border-radius: 7px; cursor: pointer; }
#timeline-scroll[hidden] { display: none; }
#timeline-scroll .thumb { position: absolute; top: 1px; bottom: 1px; border-radius: 6px; background: var(--sel); opacity: .55; min-width: 12px; }
#undated { padding: .4rem 1rem; border-top: 1px solid var(--node-line); max-height: 9rem; overflow: auto; }
.axis-bg { fill: var(--node); }
.tick { stroke: var(--edge); stroke-width: 1; opacity: .35; }
.tick-label { fill: currentColor; font-size: 11px; opacity: .75; }
.node rect { fill: var(--node); stroke: var(--box-line); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.node:hover rect { stroke: var(--sel); stroke-width: 1.75px; } /* hover accents only the node under the pointer */
.node.selected rect { stroke: var(--sel); stroke-width: 2px; }
.node { cursor: pointer; }
.node text { fill: currentColor; font-size: 13px; pointer-events: none; }
.node .years { font-size: 11px; opacity: .7; }
.node.selected .name { font-weight: 600; }
/* Connectors keep a constant on-screen width: scaled strokes turn to sub-pixel hairlines when a big tree is fitted */
.edge { stroke: var(--line); stroke-width: 1.1px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.edge.child { stroke-width: 1.25px; }
.edge.spouse { stroke-width: 1px; }
.edge.hi { stroke: var(--sel); stroke-width: 1.5px; }
.edge.dim { opacity: .25; }
.union { fill: var(--line); }
.union.hi { fill: var(--sel); }
.union.dim { opacity: .12; }
.node.dim { opacity: .35; }
.node.focus rect { stroke: var(--sel); stroke-width: 2px; }
.node .more { font-size: 10px; fill: var(--muted); }
#focus-bar { display: flex; align-items: baseline; gap: 1rem; padding: .4rem 1rem; border-bottom: 1px solid var(--node-line); background: var(--node); }
#focus-bar[hidden] { display: none; }
#focus-bar .back { margin-left: auto; }
.node.related rect { stroke: var(--sel); stroke-width: 1.5px; }
.error { padding: 1rem; color: #b91c1c; }
.plain-list { padding: 1rem 2rem; }
.edge.ended { stroke-dasharray: 6px 4px; }
.edge.adopted { stroke-dasharray: 2px 4px; }
.union.ended { fill: var(--node); stroke: var(--line); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.union.ended.hi { stroke: var(--sel); }
#panel { width: 24rem; max-width: 42vw; overflow: auto; padding: var(--space-4); border-left: 1px solid var(--border); background: var(--surface); }
.panel-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.panel-title { flex: 1; min-width: 0; }
.panel-head h2 { margin: 0; font-size: 1.25rem; line-height: 1.25; overflow-wrap: anywhere; }
.panel-head .years { margin: 2px 0 0; color: var(--muted); }
.panel-head .summary { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.panel-head .close { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 var(--space-1); }
.panel-head .close:hover { color: var(--accent); }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 600; letter-spacing: .02em; user-select: none; }
.avatar-sm { width: var(--avatar-sm); height: var(--avatar-sm); font-size: 1.35rem; }
.avatar-lg { width: var(--avatar-lg); height: var(--avatar-lg); font-size: 2.2rem; }
.pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.pill { padding: 3px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .85rem; }
.surname-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0; }
.surname-pills .pill { white-space: nowrap; }
.pill:hover { border-color: var(--accent); color: var(--accent); }
#panel .bio { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.bio > :first-child { margin-top: 0; }
.read-more { font-size: .85rem; }
.rel-group h3 { margin: var(--space-4) 0 var(--space-2); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.chip { display: block; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.chip:hover { border-color: var(--accent); }
.chip-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.chip-years, .chip-note, .partnership { display: block; font-size: .85rem; color: var(--muted); }
.person-page { height: auto; min-height: 100vh; }
.person-page main.person { display: block; flex: none; }
.site-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface); }
.site-bar .site-title { font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto; }
.person { width: 100%; max-width: 60rem; margin: 0 auto; padding: var(--space-4); }
.hero { display: flex; gap: var(--space-4); align-items: center; max-width: 46rem; margin-bottom: var(--space-4); }
.hero h1 { margin: 0; font-size: 1.75rem; line-height: 1.2; overflow-wrap: anywhere; }
.hero .years { margin: 2px 0 var(--space-2); color: var(--muted); }
.events { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: fit-content(14rem) 1fr; column-gap: var(--space-3); }
.events li { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; padding: var(--space-1) 0; border-top: 1px solid var(--border); }
.events li:first-child { border-top: 0; }
.events .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.events li.rel .what { color: var(--muted); }
.events .age { color: var(--muted); }
.union.ended { fill: var(--node); }
/* relationship roles (a person is selected); these override the plain highlight colour */
.edge.role-parent { stroke: var(--role-parent); stroke-width: 1.5px; }
.edge.role-partner { stroke: var(--role-partner); stroke-width: 1.5px; }
.edge.role-child { stroke: var(--role-child); stroke-width: 1.5px; }
.edge.role-sibling { stroke: var(--role-sibling); stroke-width: 1.5px; }
.union.role-parent { fill: var(--role-parent); } .union.role-partner { fill: var(--role-partner); }
.union.role-child { fill: var(--role-child); } .union.role-sibling { fill: var(--role-sibling); }
.union.ended.role-parent, .union.ended.role-partner, .union.ended.role-child, .union.ended.role-sibling { fill: var(--node); }
.union.ended.role-parent { stroke: var(--role-parent); } .union.ended.role-partner { stroke: var(--role-partner); }
.node.role-parent rect { stroke: var(--role-parent); stroke-width: 1.5px; }
.node.role-partner rect { stroke: var(--role-partner); stroke-width: 1.5px; }
.node.role-child rect { stroke: var(--role-child); stroke-width: 1.5px; }
.node.role-sibling rect { stroke: var(--role-sibling); stroke-width: 1.5px; }
#legend { position: absolute; left: var(--space-3); bottom: var(--space-3); z-index: 3; display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-2) var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: .85rem; pointer-events: none; }
#legend[hidden] { display: none; }
.legend-swatch { display: inline-block; width: 22px; height: 5px; margin-right: var(--space-2); border-radius: 3px; vertical-align: middle; }
.legend-swatch.role-parent { background: var(--role-parent); } .legend-swatch.role-partner { background: var(--role-partner); }
.legend-swatch.role-child { background: var(--role-child); } .legend-swatch.role-sibling { background: var(--role-sibling); }
/* lineage colours: --p is how far along its side of the ramp (0-100); blended in OKLab, a straight perceptual blend */
.lin-old { --c: color-mix(in oklab, var(--lin-old) calc(var(--p) * 1%), var(--lin-mid)); }
.lin-new { --c: color-mix(in oklab, var(--lin-new) calc(var(--p) * 1%), var(--lin-mid)); }
.lin-mid { --c: var(--lin-mid); }
.edge.lin { stroke: var(--c); stroke-width: 1.5px; }
.union.lin { fill: var(--c); }
.union.ended.lin { fill: var(--node); stroke: var(--c); }
.node.lin rect { stroke: var(--c); stroke-width: 1.5px; }
.node.lin-partner rect { stroke-dasharray: 5px 3px; }
.legend-modes { display: flex; gap: var(--space-1); margin-bottom: var(--space-2); pointer-events: auto; }
.legend-modes button { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: .8rem; cursor: pointer; }
.legend-modes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.legend-ramp { min-width: 220px; height: 8px; border-radius: 4px; background: linear-gradient(in oklab to right, var(--lin-old), var(--lin-mid), var(--lin-new)); }
.legend-ends { display: flex; justify-content: space-between; gap: var(--space-3); white-space: nowrap; margin-top: var(--space-1); font-size: .75rem; color: var(--muted); }
.group-label { fill: var(--muted); font-weight: 600; letter-spacing: .04em; }

/* Phone: the side panel becomes a bottom sheet and the header wraps. */
@media (max-width: 40rem) {
  .bar { flex-wrap: wrap; gap: .5rem; }
  #search { flex: 1 1 100%; min-width: 0; }
  #results { left: 0; right: 0; }
  #panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 60vh; z-index: 6; border-left: 0; border-top: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; overflow-wrap: anywhere; }
  main:has(#panel:not([hidden])) #legend { display: none; }
  #timeline-head { flex-wrap: wrap; }
}

/* Tree zoom controls */
#tree-controls { position: absolute; right: var(--space-3); bottom: var(--space-3); z-index: 3; display: flex; flex-direction: column; gap: var(--space-1); }
#tree-controls[hidden], #tree-controls button[hidden] { display: none; }
#tree-controls button { min-width: 36px; min-height: 36px; padding: 0 var(--space-2); border: 1px solid var(--node-line); border-radius: 6px; background: var(--node); color: inherit; font: inherit; cursor: pointer; }
#tree-controls button:hover { border-color: var(--sel); color: var(--sel); }
@media (max-width: 40rem) { main:has(#panel:not([hidden])) #tree-controls { bottom: calc(60vh + var(--space-3)); } }

/* Level of detail: names give way to family labels as the tree shrinks */
#tree.lod-mid .node .years, #tree.lod-far .node text { display: none; }
.group-label.island { display: none; fill: var(--text); }
#tree.lod-far .group-label.island { display: inline; }
#tree.lod-far .node rect { fill: var(--surface-2); }

/* Shared site header */
.site-bar nav { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.site-bar nav a { color: var(--text); text-decoration: none; }
.site-bar nav a:hover { color: var(--accent); }
.site-search input { min-width: 12rem; padding: .35rem .5rem; }
@media (max-width: 40rem) { .site-search { flex: 1 1 100%; } .site-search input { width: 100%; min-width: 0; box-sizing: border-box; } }
.bar-link { color: inherit; }
.person .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }

/* Home page */
.home { max-width: 46rem; margin: 0 auto; padding: var(--space-5) var(--space-4); }
.home h1 { margin: 0 0 var(--space-3); }
.home .intro { margin-bottom: var(--space-4); }
.home-search { display: flex; gap: var(--space-2); margin: var(--space-4) 0; }
.home-search input { flex: 1; min-width: 0; padding: .6rem .8rem; font-size: 1.05rem; }
.home h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: var(--space-4) 0 var(--space-2); }
.home .numbers { color: var(--muted); }
.home .recent ul, .home #on-this-day ul { list-style: none; margin: 0; padding: 0; }
.home .recent li, .home #on-this-day li { padding: var(--space-1) 0; }
.home .when, .home .years { color: var(--muted); font-size: .9rem; }
body.site-page { height: auto; min-height: 100vh; }

/* Kinship line */
.kin { margin: 2px 0 0; color: var(--accent); font-size: .9rem; }

/* Timeline: one lifespan bar per person */
#timeline-empty { padding: var(--space-4); color: var(--muted); }
#timeline-empty[hidden], .tl-controls[hidden] { display: none; }
.span-row { cursor: pointer; }
.span-row .bar { fill: var(--muted); opacity: .45; }
.span-row .bar.open-unknown { fill: url(#tl-fade); }
.span-row.selected .bar { fill: var(--accent); opacity: 1; }
.span-row.selected .bar.open-unknown { fill: url(#tl-fade-accent); }
.span-row.related .bar { opacity: .8; }
.span-row.dim { opacity: .3; }
.cap.birth { fill: var(--ev-birth); }
.cap.death { fill: var(--ev-death); }
.mark.partner { fill: var(--ev-partner); }
.mark.end { fill: var(--ev-end); }
.span-row .label { font-size: 12px; fill: currentColor; }
.span-row .label .years { fill: var(--muted); }
.span-row.selected .label { font-weight: 600; }

/* Look: serif names and headings, a reading column */
h1, h2, .site-title, .chip-name, .panel-head h2, .bio { font-family: var(--font-serif); }
.person h2 { font-size: 1.25rem; text-transform: none; letter-spacing: 0; color: var(--text); margin: var(--space-5) 0 var(--space-3); }
.person h3 { margin: var(--space-3) 0 var(--space-2); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.person .bio { max-width: 46rem; font-size: 1.05rem; line-height: 1.7; overflow-wrap: anywhere; }
.person .summary { margin: var(--space-2) 0; font-size: 1.05rem; }
.life { max-width: 46rem; }
.chips.row { flex-direction: row; flex-wrap: wrap; }
.chips.row > li { flex: 0 1 14rem; }
.chips.compact { flex-direction: row; flex-wrap: wrap; gap: var(--space-2); }
.chips.compact .chip { padding: 2px var(--space-3); border-radius: 999px; }
.chips.compact .chip > span { display: inline; }
.chips.compact .chip-years { margin-left: var(--space-2); }
.person details { margin: var(--space-4) 0; }
.person summary { cursor: pointer; font-family: var(--font-serif); font-size: 1.25rem; }
.lineage, .lineage ul { list-style: none; margin: 0; padding: 0; }
.lineage ul { margin-left: var(--space-3); padding-left: var(--space-3); border-left: 1px solid var(--border); }
.lineage li { padding: 2px 0; }
.person .lineage details { margin: 0; }
.person .lineage summary { font-family: inherit; font-size: inherit; }
.lineage summary { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; list-style: none; }
.lineage summary::-webkit-details-marker { display: none; }
.lineage summary::before { content: "\25B8"; flex: none; width: 1rem; line-height: 1.6; color: var(--muted); }
.lineage details[open] > summary::before { content: "\25BE"; }
.lineage li > .chip { margin-left: calc(1rem + var(--space-2)); }
.lineage .chip { max-width: 22rem; min-width: 0; }
.lineage summary .chip { flex: 1 1 auto; }
.bar, .site-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
#search, .site-search input, .home-search input { border: 1px solid var(--border); border-radius: 999px; padding: .4rem .9rem; background: var(--surface); color: inherit; font: inherit; }
@media print {
  .site-bar, .pills, footer.page-foot, .gallery, .gallery-lightbox { display: none; }
  .person { max-width: none; }
  * { box-shadow: none !important; }
}

/* Portraits */
img.avatar { object-fit: cover; }

/* Facts, notes and sources */
.note, .cite { display: block; font-size: .85rem; color: var(--muted); }
/* map page */
.map-layout { display: flex; gap: 1rem; align-items: stretch; flex-wrap: wrap; }
#map { flex: 1 1 28rem; min-width: 0; }
#map-list { flex: 0 1 18rem; font-size: .95rem; }
#map-list h2 { margin-top: 0; font-size: 1.1rem; }
.map-view { position: relative; height: 62vh; min-height: 22rem; overflow: hidden; background: #d9e2e8; border: 1px solid var(--line, #ccc); border-radius: 6px; cursor: grab; touch-action: none; }
.map-view.dragging { cursor: grabbing; }
.map-view:focus-visible { outline: 2px solid var(--accent, #7a3e65); }
.map-tiles, .map-markers { position: absolute; inset: 0; }
.map-tile { position: absolute; width: 256px; height: 256px; user-select: none; max-width: none; }
.map-marker { position: absolute; transform: translate(-50%, -50%); min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem; border-radius: 999px; border: 2px solid #fff; background: var(--accent, #7a3e65); color: #fff; font-size: .8rem; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.map-controls { position: absolute; top: .5rem; left: .5rem; display: flex; flex-direction: column; gap: .25rem; }
.map-controls button { min-width: 2rem; height: 2rem; border: 1px solid #888; background: #fff; color: #222; border-radius: 4px; cursor: pointer; }
.map-attribution { position: absolute; right: 0; bottom: 0; padding: .1rem .4rem; font-size: .7rem; background: rgba(255,255,255,.8); color: #333; }
.on-map { font-size: .8rem; font-weight: normal; margin-left: .4rem; }
.cite-ref { font-size: .75rem; margin-left: .15rem; }
.cite-ref a { text-decoration: none; }
.sources ol { padding-left: 1.4rem; color: var(--muted); font-size: .9rem; }
.sources .back { text-decoration: none; margin-left: .3rem; }
.source-list { list-style: none; padding: 0; }
.source-list > li { margin: .8rem 0; }
.source-list ul { margin: .2rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.attrs { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--space-3); margin: var(--space-2) 0; }
.attrs dt { color: var(--muted); }
.attrs dd { margin: 0; }
.panel-facts ul, .panel-events ul { margin: 0; padding-left: var(--space-4); }
.mark.fact { fill: var(--muted); }

/* Optional edit and correction links */
.page-foot { margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: .85rem; display: flex; gap: var(--space-4); }

/* Shared header and page columns line up on one 60rem column */
.site-bar { padding-inline: max(var(--space-4), calc((100% - 60rem) / 2 + var(--space-4))); }
.site-bar .site-title { margin-right: 0; }
.site-bar nav { margin-right: auto; }
.home, .index { max-width: 60rem; margin: 0 auto; width: 100%; }
.index { padding: var(--space-5) var(--space-4); }
.index h2 { font-size: 1.25rem; margin: var(--space-4) 0 var(--space-2); }
.index ul { padding-left: var(--space-4); margin: 0; }
.index .count { color: var(--muted); font-size: .9rem; font-weight: 400; }
.index .years { color: var(--muted); font-size: .9rem; }
.relate-pick { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.relate-pick select { max-width: 100%; padding: .35rem .5rem; }
#relate-answer { font-size: 1.15rem; margin-top: var(--space-4); }

/* The viewer's own row of tabs sits under the shared site bar */
.viewbar { padding-inline: max(var(--space-4), calc((100% - 60rem) / 2 + var(--space-4))); background: var(--surface-2); }

/* Site nav: the current page, and the viewer's two ways to look at the tree */
.site-bar nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
#modes { display: flex; gap: .25rem; }
#modes a { padding: .3rem .8rem; border-radius: 6px; text-decoration: none; color: inherit; border: 1px solid transparent; }
#modes a[aria-current="page"] { border-color: var(--node-line); background: var(--node); font-weight: 600; }

/* Places grouped by country */
.index .groups { color: var(--muted); }
.index .country { margin-top: var(--space-5); }
.index .country > h2 { border-bottom: 1px solid var(--border); padding-bottom: var(--space-1); }
.index h3 { font-size: 1.05rem; margin: var(--space-3) 0 var(--space-1); }

/* Photos from an external gallery: a featured mosaic and a lightbox */
.gallery { max-width: 46rem; }
.gallery-thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.gallery-thumbs li { position: relative; aspect-ratio: 1; min-width: 0; min-height: 0; }
.gallery-thumbs li.featured { grid-column: span 2; grid-row: span 2; }
.gallery-thumbs[data-count="1"] { grid-template-columns: minmax(0, 28rem); }
.gallery-thumbs[data-count="1"] li { aspect-ratio: 3 / 2; }
.gallery-thumbs[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-thumbs a { position: relative; display: block; width: 100%; height: 100%; line-height: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.gallery-thumbs img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.gallery-thumbs a:hover img { transform: scale(1.03); }
.gallery-thumbs a:hover, .gallery-thumbs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gallery-more { margin: var(--space-3) 0 0; }
@media (max-width: 40rem) {
  .gallery-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-thumbs li.featured { grid-row: auto; aspect-ratio: 3 / 2; }
}
.gallery-lightbox { width: fit-content; min-width: min(92vw, 24rem); max-width: min(92vw, 64rem); max-height: 94vh; touch-action: pan-y pinch-zoom; padding: 0; border: 0; background: transparent; color: #fff; overflow: visible; }
.gallery-lightbox::backdrop { background: rgba(12, 11, 10, .88); }
.gallery-lightbox[open] { animation: gallery-in .18s ease-out; }
@keyframes gallery-in { from { opacity: 0; transform: scale(.98); } }
.gallery-lightbox figure { margin: 0; }
.gallery-lightbox .gallery-big { display: block; max-width: min(92vw, 64rem); max-height: 78vh; margin: 0 auto; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); }
.gallery-bar { display: flex; justify-content: space-between; gap: var(--space-3); margin: var(--space-2) 0 0; font-size: .9rem; }
.gallery-count { margin: 0; color: #d8d3ca; }
.gallery-lightbox a { color: #fff; }
.gallery-close, .gallery-prev, .gallery-next { position: absolute; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font: 1.6rem/1 var(--font-sans); cursor: pointer; }
.gallery-close { top: var(--space-2); right: var(--space-2); }
.gallery-prev, .gallery-next { top: 40%; }
.gallery-prev { left: var(--space-2); }
.gallery-next { right: var(--space-2); }
.gallery-close:hover, .gallery-prev:hover, .gallery-next:hover { background: rgba(0, 0, 0, .8); }
.gallery-close:focus-visible, .gallery-prev:focus-visible, .gallery-next:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .gallery-lightbox[open] { animation: none; }
  .gallery-thumbs img { transition: none; }
}
.site-bar nav a.site-gallery::after { content: " \2197"; font-size: .85em; }
