:root {
  --ledger:#f8f3e7;
  --linen:#fdfbf3;
  --fern:#233b31;
  --pine:#25473a;
  --dust:#536257;
  --rule:#cfc6b3;
  --brass:#94633e;
  --honey:#e7c58f;
}
[hidden] { display:none !important; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.lineage-body, .person-body { background:var(--ledger); }
.lineage-main { width:min(1470px,calc(100% - 8vw)); margin:auto; padding:0 0 3rem; }
.lineage-intro {
  display:flex; justify-content:space-between; align-items:end; gap:2rem; padding:clamp(22px,2.5vw,36px) 0 21px;
}
.lineage-era { color:#785033; margin:0 0 .1rem; font-size:.92rem; }
.lineage-intro h1, .person-page h1 { font-weight:500; font-size:clamp(3rem,6.1vw,5.75rem); line-height:.98; color:var(--fern); margin:0 0 .8rem; letter-spacing:-.065em; }
.lineage-lead { max-width:54rem; margin:.15rem 0 0; font-size:clamp(1rem,1.25vw,1.14rem); color:#3f5145; }
.lineage-index { display:flex; gap:clamp(1.25rem,4vw,3rem); flex-shrink:0; color:var(--dust); font-size:.89rem; padding-bottom:.2rem; }
.lineage-index span { display:grid; gap:.25rem; }
.lineage-index strong { font:400 2.85rem/.95 Georgia,serif; color:var(--fern); }
.explorer { position:relative; border:1px solid var(--rule); border-radius:12px; background:var(--linen); box-shadow:0 14px 34px #2d3a2814; }
.tree-toolbar { display:flex; gap:.9rem; align-items:end; padding:13px 16px; border-bottom:1px solid var(--rule); background:#fbf8ee; border-radius:12px 12px 0 0; }
.tree-toolbar label { display:block; margin:0 0 .25rem; color:#49534b; font-size:.9rem; font-weight:660; }
.tree-search { position:relative; flex:1 1 15rem; max-width:29rem; min-width:0; }
.tree-branch { flex:1 1 10rem; max-width:18rem; min-width:0; }
.tree-search input, .tree-branch select { display:block; width:100%; min-width:0; font:inherit; color:var(--fern); border:1px solid #afa999; background:#fffdf5; border-radius:6px; min-height:42px; padding:.42rem .7rem; }
.tree-branch select { appearance:none; padding-right:2rem; background-image:linear-gradient(45deg,transparent 50%,#4d675a 50%),linear-gradient(135deg,#4d675a 50%,transparent 50%); background-position:calc(100% - 17px) center,calc(100% - 11px) center; background-size:6px 6px,6px 6px; background-repeat:no-repeat; }
.tree-modes { display:flex; margin-left:auto; flex-shrink:0; padding:3px; gap:2px; border:1px solid #c8bdab; border-radius:6px; background:#f0ecdf; }
.tree-modes button,.zoom-tools button,.crumb-button { cursor:pointer; font:inherit; color:var(--fern); }
.tree-modes button { border:0; background:transparent; border-radius:4px; min-height:34px; padding:.25rem .75rem; font-weight:650; }
.tree-modes button[aria-pressed=true] { color:white; background:#275144; }
#tree-results { position:absolute; z-index:10; top:100%; left:0; right:0; max-height:330px; overflow:auto; margin:.35rem 0 0; padding:0; border:1px solid #aca996; border-radius:6px; list-style:none; background:#fffdf5; box-shadow:0 10px 24px #20382e26; }
.tree-option { display:grid; padding:.52rem .7rem; gap:.05rem; cursor:pointer; line-height:1.3; color:var(--fern); }
.tree-option + li { border-top:1px solid #e4ddd0; }.tree-option:hover,.tree-option[aria-selected=true] { background:#e2ecdf; }
.tree-option span,.tree-empty { font-size:.88rem; color:#4e5e53; }.tree-empty { padding:1rem; }
.tree-work { display:grid; grid-template-columns:minmax(0,1fr) minmax(270px,29%); }
.tree-primary { min-width:0; }
.tree-context { display:flex; justify-content:space-between; align-items:center; gap:.5rem; min-height:51px; padding:.4rem .9rem; border-bottom:1px solid #dcd5c5; background:#f7f3e8; }
.tree-context p { margin:0; font-size:.9rem; line-height:1.35; color:var(--fern); font-weight:630; }
.zoom-tools { display:flex; gap:4px; flex-shrink:0; }
.zoom-tools button { min-height:34px; padding:.12rem .55rem; background:#fffdf4; border:1px solid #c0b8a7; border-radius:5px; }
.zoom-tools button:disabled { opacity:.57; cursor:default; }
.crumb-button { padding:0; text-decoration:underline; text-underline-offset:.19em; border:0; background:none; }
.crumb-divider { opacity:.62; }
.map-view, .list-view { height:clamp(520px,62vh,695px); overflow:auto; overscroll-behavior:contain; position:relative; }
.map-view { background-color:#eef0e5; background-image:radial-gradient(#9ba79582 1px,transparent 1.1px); background-size:15px 15px; cursor:grab; }
.map-view.is-dragging { cursor:grabbing; user-select:none; }.map-view:focus-visible { outline:3px solid #94633e; outline-offset:-4px; }
#map-size { position:relative; overflow:hidden; }
#map-layer { position:absolute; left:0; top:0; transform-origin:left top; }
#map-links,#map-nodes { position:absolute; inset:0; pointer-events:none; }
.map-generation { pointer-events:none; position:absolute; top:11px; color:#3c594d; min-width:231px; height:27px; letter-spacing:.05em; font-size:.88rem; font-weight:650; line-height:25px; border-bottom:1px solid #9dac9c; padding-left:1px; }
.map-node { pointer-events:auto; position:absolute; display:flex; align-items:center; width:231px; height:63px; background:#fffdf5; border:1px solid #b2b9ab; border-left:4px solid var(--branch-ink); border-radius:6px; box-shadow:0 2px 5px #213d2520; }
.map-node:hover { box-shadow:0 2px 9px #10281935; }
.map-node.is-chosen { background:#234439; color:white; border-color:#234439; border-left-color:var(--honey); }
.node-name { cursor:pointer; display:flex; gap:.47rem; align-items:center; text-align:left; border:0; background:none; color:inherit; font:inherit; padding:.32rem .35rem .32rem .56rem; height:100%; flex:1; min-width:0; }
.node-title { display:flex; flex-direction:column; min-width:0; line-height:1.1; }
.node-title strong { font:600 .96rem/1.08 Georgia,serif; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.node-title small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; line-height:1.15; margin-top:.19rem; color:#516158; font-size:.77rem; }
.is-chosen .node-title small { color:#e6ebdc; }
.node-portrait { display:block; width:33px; height:41px; object-fit:cover; background:#e6d8bd; border-radius:3px; }
.node-toggle { cursor:pointer; flex:none; margin:0 .27rem 0 0; width:30px; min-height:34px; border:1px solid #b8c4b6; border-radius:4px; background:#e6eee1; color:#1c4736; font:650 1.1rem/1 system-ui; }
.map-foot { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; min-height:41px; gap:.2rem .6rem; padding:.38rem .9rem; background:#f8f6eb; color:#4b5a4e; font-size:.82rem; border-top:1px solid #cfd5c8; border-radius:0 0 0 12px; }
.person-panel { min-width:0; max-height:calc(clamp(520px,62vh,695px) + 93px); overflow:auto; padding:clamp(.85rem,1.55vw,1.55rem); background:#fefbf1; border-left:1px solid var(--rule); border-radius:0 0 12px 0; outline-offset:-4px; }
.panel-top { display:flex; gap:.65rem; align-items:flex-start; }
.panel-portrait { width:63px; height:78px; object-fit:cover; border:1px solid var(--rule); padding:3px; background:#f4e9d4; }
.panel-generation,.panel-dates { color:#526753; margin:0 0 .45rem; font-size:.88rem; }
.panel-dates { margin:.55rem 0 0; }
.panel-name { color:var(--fern); margin:0; font-weight:500; font-size:clamp(1.45rem,2.5vw,2.55rem); line-height:1; letter-spacing:-.033em; }
.panel-bio { color:#38483f; font-size:1rem; line-height:1.52; margin:1rem 0 .7rem; }
.panel-photo-links { display:flex; flex-direction:column; gap:.25rem; }
.panel-source { font-size:.87rem; word-break:break-word; }
.panel-documents { border-top:1px solid var(--rule); padding-top:.8rem; margin-top:1rem; }
.panel-documents h3 { color:var(--fern); }
.document-previews { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap:1rem; }
.panel-documents .document-previews { grid-template-columns:repeat(auto-fit,minmax(min(100%,8.8rem),1fr)); gap:.65rem; }
.document-previews figure { min-width:0; margin:0; padding:.55rem; background:var(--linen); border:1px solid var(--rule); }
.document-preview { display:grid; gap:.45rem; line-height:1.3; }
.document-preview img { display:block; width:100%; aspect-ratio:4 / 3; object-fit:contain; background:#e9e3d7; }
.document-preview strong { font-size:.9rem; text-decoration:underline; text-underline-offset:.2em; }
.document-previews figcaption { font-size:.8rem; overflow-wrap:anywhere; }
.record-quote { margin:.65rem 0 .45rem; padding-left:.55rem; border-left:2px solid #967243; font:1rem/1.35 Georgia,serif; color:#38483f; }
.record-note { margin:.5rem 0; font-size:.88rem; }
.profile-link-note { flex-basis:100%; }
.media-viewer { width:min(96vw,75rem); max-width:none; max-height:94dvh; padding:0; color:#273b30; background:#faf6eb; border:1px solid var(--rule); }
.media-viewer::backdrop { background:#17271fbd; }
.media-toolbar,.media-footer { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:.45rem 1rem; padding:.55rem .75rem; }
.media-toolbar strong { overflow-wrap:anywhere; }
.media-toolbar form { margin:0; display:flex; flex-wrap:wrap; gap:.35rem; }
.media-toolbar button { min-height:2.45rem; min-width:2.45rem; font:inherit; color:inherit; background:#fffdf7; border:1px solid var(--rule); }
.media-toolbar button:disabled { opacity:.58; }
.media-scroll { max-height:69dvh; overflow:auto; overscroll-behavior:contain; background:#232e26; }
.media-surface { position:relative; }
.media-surface img { display:block; width:100%; height:auto; }
.record-page h1 { font-size:clamp(2.2rem,5vw,3.9rem); line-height:1.05; }
.record-tools { display:flex; flex-wrap:wrap; align-items:center; gap:.55rem 1.25rem; margin:1rem 0; }
.record-tools label { display:inline-flex; align-items:center; gap:.4rem; cursor:pointer; }
.record-tools input { width:1.15rem; height:1.15rem; accent-color:var(--pine); }
.record-scan { margin:0; }
.record-surface { position:relative; }
.record-surface img { display:block; width:100%; height:auto; }
.record-focus { position:absolute; border:2px solid #bf372b; box-shadow:0 0 0 1px #fff; background:#c9482510; pointer-events:none; }
.record-page:has(#record-highlight:not(:checked)) .record-focus { visibility:hidden; }
.record-detail { margin-top:1.75rem; scroll-margin-top:1rem; }
.record-detail img { display:block; max-width:100%; height:auto; }
.panel-family { border-top:1px solid var(--rule); margin:.85rem 0 0; padding:.7rem 0 0; display:flex; flex-wrap:wrap; gap:.28rem .4rem; }
.panel-family h3 { font-size:1.02rem; width:100%; color:var(--fern); margin:0 0 .1rem; }
.kin-button { cursor:pointer; min-height:31px; padding:.14rem .42rem; border:1px solid #c5cbbb; border-radius:4px; background:#f3f5e9; color:#264a38; text-align:left; font:inherit; font-size:.85rem; }
.kin-button:hover { background:#e5eddf; }
.panel-actions { margin-top:.9rem; display:flex; flex-wrap:wrap; align-items:center; gap:.42rem; }
.person-primary { display:inline-block; text-decoration:none; font-weight:660; color:#fff8e9; background:#235142; border-radius:5px; padding:.54rem .73rem; font-size:.91rem; }
.person-primary:hover { color:white; background:#153c30; }
.list-view { background:#f0f1e8; min-width:0; padding:.65rem .8rem; }
.outline-root,.outline-children { list-style:none; padding:0; margin:0; }
.outline-children { border-left:1px solid #a4b4a5; margin-left:.58rem; padding-left:.62rem; }
.outline-row { display:flex; align-items:center; gap:.5rem; border-radius:5px; padding:.17rem .3rem; margin:.16rem 0; border-bottom:1px solid #d4dacf; min-height:41px; }
.outline-row.is-chosen { background:#dae8db; }
.outline-person-button { cursor:pointer; background:none; border:0; text-align:left; padding:.29rem .4rem; color:#23463a; font:650 1rem/1.2 system-ui; flex:1; }
.outline-dates { font-size:.87rem; color:#476052; }
.outline-row .node-toggle { min-height:36px; }
.lineage-resources { display:flex; flex-wrap:wrap; gap:.5rem 1.2rem; padding:1.2rem 0; }
.lineage-resources a { font-weight:620; text-underline-offset:.25em; }
.fallback summary { cursor:pointer; }
.lineage-discover { display:grid; grid-template-columns:minmax(200px,.65fr) minmax(0,1.6fr); gap:1.75rem; padding:1.65rem 0 0; border-top:1px solid var(--rule); }
.lineage-discover h2 { margin:.25rem 0; color:var(--fern); font-weight:500; font-size:2.28rem; }
.lineage-discover p { margin:.35rem 0; color:#4e594f; }
.discover-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; }
.discover-grid article { border-top:2px solid #708a73; background:#fdf9ee; padding:.68rem .8rem; }
.discover-grid h3 { font-size:1.17rem; margin:0; overflow-wrap:anywhere; }
.discover-grid h3 a { text-decoration:none; }
.discover-grid h3 a:hover { text-decoration:underline; }
.discover-grid p,.discover-grid span { font-size:.87rem; margin:.25rem 0 0; }
.discover-grid span { color:#586a5a; }
.lineage-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:.8rem; padding:1rem 0 1.6rem; width:min(1470px,calc(100% - 8vw)); margin:auto; }
.lineage-footer div { display:flex; flex-wrap:wrap; gap:.65rem 1.1rem; }
.person-page { width:min(1040px,calc(100% - 9vw)); margin:auto; padding:1.45rem 0 3rem; }
.person-breadcrumb { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; margin:0 0 1.3rem; font-size:.93rem; }
.person-hero { padding:clamp(1rem,4.5vw,3rem) 0; border-top:1px solid var(--rule); border-bottom:1px solid var(--rule); margin:1rem 0 1.25rem; }
.person-hero.with-picture { display:grid; grid-template-columns:minmax(0,1fr) minmax(140px,30%); gap:1.4rem; align-items:center; }
.person-hero h1 { font-size:clamp(2.4rem,6.1vw,5.4rem); margin:.42rem 0; overflow-wrap:anywhere; }
.person-role { color:#385344; font-size:1.15rem; margin:.6rem 0 .15rem; }
.muted { color:#566557; }
.person-plate { margin:0; justify-self:end; padding:.5rem; background:#fdf9ed; border:1px solid var(--rule); }
.person-plate img { display:block; width:100%; max-height:270px; object-fit:contain; }
.person-plate figcaption { text-align:center; padding:.3rem; }
.person-content { display:grid; gap:clamp(1rem,3vw,2.2rem); grid-template-columns:1.62fr 1fr; }
.person-content section { margin:0 0 1.2rem; }
.person-content h2,.directory-grid h2 { color:var(--fern); font-size:1.6rem; margin:.35rem 0 .62rem; }
.person-bio { color:#36473a; font-size:1.08rem; }
.profile-family { align-self:start; background:#fef9ef; padding:.65rem 1rem .2rem; border-left:3px solid #778a6a; }
.profile-list { display:grid; gap:.22rem; padding:0; margin:.35rem 0 1rem; list-style:none; }
.profile-list li { padding:.38rem 0; display:flex; flex-wrap:wrap; gap:.15rem .5rem; justify-content:space-between; border-bottom:1px solid #d9d3c3; overflow-wrap:anywhere; }
.profile-list span { font-size:.88rem; color:#55675a; }
.directory-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem 1.6rem; }.directory-grid section { scroll-margin-top:1rem; }
.directory-letters { display:flex; flex-wrap:wrap; gap:.5rem; padding:.75rem 0; border-bottom:1px solid var(--rule); }
.directory-letters a { width:38px; min-height:38px; text-align:center; padding:.25rem; background:#faf7e9; border:1px solid var(--rule); }
@media(max-width:1050px) { .lineage-main{width:calc(100% - 5vw)} .tree-work { grid-template-columns:minmax(0,1fr) minmax(245px,31%); } .lineage-discover{grid-template-columns:1fr;gap:.75rem} }
@media(max-width:770px) {
  .lineage-main{width:calc(100% - 24px)} .lineage-intro{padding:25px 4px 17px;align-items:start;flex-direction:column;gap:.75rem} .lineage-index{gap:1.4rem}.lineage-index span{display:block}.lineage-index strong{font-size:1.59rem;margin-right:3px}
  .tree-work { grid-template-columns:1fr; } .map-view,.list-view{height:390px}
  .tree-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.65rem;padding:10px} .tree-search{grid-column:1/-1;max-width:none}.tree-branch{max-width:none}
  .person-panel{border-left:0;border-top:1px solid var(--rule);border-radius:0 0 12px 12px;max-height:none;padding:1rem;scroll-margin-top:.4rem}
  .map-foot{border-radius:0}.panel-name{font-size:1.9rem}.lineage-resources{font-size:.93rem}
  .discover-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem} .person-content{grid-template-columns:1fr}
  .person-hero.with-picture{grid-template-columns:minmax(0,1fr) minmax(90px,29%);gap:.55rem}
  .person-hero h1{font-size:clamp(2.05rem,7.5vw,4rem)} .person-role{font-size:1rem} .person-plate figcaption{font-size:.72rem}
  .tree-option{min-height:44px}.node-toggle{min-height:37px}
}
@media(max-width:420px) { .outline-dates{display:none} .tree-modes button{padding:.25rem .53rem}.tree-context{padding-inline:.55rem}.tree-context p{font-size:.81rem}.zoom-tools button{padding-inline:.37rem}.map-foot{font-size:.79rem}.directory-grid{grid-template-columns:1fr} }
@media(prefers-reduced-motion:reduce) { html{scroll-behavior:auto} }

.archive-tree-return { max-width:820px; margin:1rem auto 0; display:flex; align-items:center; flex-wrap:wrap; gap:.45rem; }
