:root {
  --paper: #f7f8f5;
  --card: #fff;
  --ink: #243e35;
  --text: #343e37;
  --muted: #667065;
  --line: #dce1d8;
  --sage: #eaf0e5;
  --accent: #8a5039;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--ink); text-underline-offset: 4px; }
button:hover, a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible { outline: 3px solid #a66c47; outline-offset: 3px; }
[hidden] { display: none !important; }

.masthead, main { width: min(1280px, calc(100% - 80px)); margin: 0 auto; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 18px; }
h1 { margin: 0; font-size: 25px; font-weight: 600; letter-spacing: -.6px; }
.wordmark { text-decoration: none; }
.source-top { font-size: 12px; white-space: nowrap; }
.archive-stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 9px 0 0; font-size: 12px; color: var(--muted); }
.archive-stats strong { font-weight: 400; }
main { padding-bottom: 48px; }

.view-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 0;
  background: var(--paper);
}
.view-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-width: 0;
  min-height: 72px;
  padding: 16px;
  border: 1px solid #cbd3c5;
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}
.view-nav svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.view-nav button:hover { background: var(--sage); border-color: #9aaa91; }
.view-nav button.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.workspace { display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: start; gap: 28px; padding-top: 16px; }
.directory { min-width: 0; }
.search-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 9px; }
.search-wrap { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: var(--card); border: 1px solid #b8c4b3; border-radius: 4px; }
.search-wrap > span { font-size: 25px; }
.search-wrap input { min-width: 0; width: 100%; border: 0; outline: none; background: transparent; color: var(--text); font-size: 13px; }
.search-wrap:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.search-wrap input:focus-visible { outline: none; }
input[type=search]::-webkit-search-cancel-button { display: none; }
.search-wrap button { padding: 0 2px; border: 0; background: none; font-size: 23px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.filters label { color: var(--muted); font-size: 11px; }
select { display: block; width: 100%; margin-top: 6px; padding: 9px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--text); font-size: 12px; }
.review-filter { display: flex; align-items: center; gap: 7px; margin-top: 15px; font-size: 12px; line-height: 1.5; }
.review-filter input { accent-color: var(--ink); margin: 0; }
.review-filter span { color: var(--muted); }
.results-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.text-button { padding: 5px 0; background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.results { max-height: 660px; overflow: auto; scrollbar-width: thin; scrollbar-color: #c5cdbf transparent; }
.result { position: relative; display: block; width: 100%; padding: 13px 12px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); }
.result.selected { background: var(--sage); box-shadow: inset 3px 0 var(--ink); }
.result:hover { background: #eef2e9; color: var(--ink); }
.result-name { display: block; margin-bottom: 5px; font-family: var(--serif); font-size: 16px; line-height: 1.35; }
.result-meta { display: block; color: var(--muted); font-size: 11px; line-height: 1.6; }
.review-dot { display: inline-block; width: 5px; height: 5px; margin: 0 0 3px 6px; background: var(--accent); border-radius: 50%; }
.load-more { width: 100%; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: transparent; font-size: 12px; }
.empty { padding: 24px 8px; color: var(--muted); font-size: 13px; line-height: 1.8; }

.profile { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--card); scroll-margin-top: 112px; }
.profile:focus { outline: none; }
.profile-top { padding: 22px 28px; border-bottom: 1px solid var(--line); }
.profile-label { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.profile-label .eyebrow { margin: 0; color: var(--muted); font-size: 11px; }
.copy-link { flex-shrink: 0; padding: 7px 9px; border: 1px solid #c7d0c1; border-radius: 4px; background: transparent; font-size: 11px; }
.profile h2 { margin: 17px 0 9px; color: var(--ink); font-family: var(--serif); font-size: clamp(26px, 2.6vw, 34px); font-weight: 400; letter-spacing: -.6px; line-height: 1.2; overflow-wrap: anywhere; }
.lifespan { margin: 0; color: var(--muted); font-size: 12px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.tag { padding: 4px 7px; border: 1px solid #d5dfcd; border-radius: 3px; background: var(--sage); font-size: 10px; }
.tag.review { border-color: #e3ceb7; background: #f4e6d7; color: #804428; }
.profile-body { padding: 22px 28px 26px; }
.lineage-label { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-bottom: 20px; border-bottom: 1px solid var(--line); font-size: 11px; line-height: 1.8; }
.lineage a { color: var(--muted); }
.lineage span { color: #929f88; }
.record-section { padding-top: 22px; }
.profile-body > .record-section:first-child { padding-top: 0; }
.section-heading { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; }
.section-heading h3, .source-section h3 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 600; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.events { display: grid; gap: 13px; margin: 0; }
.event { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 14px; }
.event dt { padding-top: 2px; color: var(--muted); font-size: 12px; }
.event dd { margin: 0; font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }
.relatives { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.relative-card { display: block; padding: 11px 13px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); text-decoration: none; }
.relative-card:hover { border-color: #91a184; background: var(--sage); }
.relative-name { display: block; font-family: var(--serif); font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.relative-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.missing { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.review-notes { margin-top: 20px; padding: 14px 16px; border-left: 3px solid #b67c51; background: #faf0e3; color: #79523b; font-size: 12px; line-height: 1.8; }
.review-notes h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.review-notes p { margin: 8px 0 0; }
.source-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.source-head { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; }
.source-head > a { flex-shrink: 0; font-size: 11px; }
.source-section details { margin-top: 15px; }
.source-section summary, .siblings summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.source-section pre { padding: 15px; border-radius: 4px; background: var(--paper); color: var(--muted); font-family: var(--sans); font-size: 12px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.interpretation { color: var(--muted); font-size: 12px; line-height: 1.7; }
.siblings { margin-top: 20px; }
.siblings .relatives { margin-top: 12px; }
.small-button { display: inline-block; padding: 10px 12px; border: 1px solid #c2ccbb; border-radius: 4px; background: transparent; font-size: 12px; text-decoration: none; }

.outline-panel h2, .about-panel h2 { margin: 0 0 12px; color: var(--ink); font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.7; }
.outline-actions { display: flex; align-items: center; gap: 15px; margin: 16px 0; }
.outline-actions .small-button { padding: 8px 10px; font-size: 11px; }
.family-tree { max-height: 850px; padding: 8px 4px 15px 0; overflow: auto; scrollbar-width: thin; font-size: 12px; }
.tree-node { margin-left: 14px; padding-left: 9px; border-left: 1px solid #cbd4c3; }
.tree-node:first-child { margin-left: 0; }
.tree-node summary { padding: 10px 0; cursor: pointer; line-height: 1.6; }
.tree-node summary a { font-family: var(--serif); font-size: 14px; text-decoration: none; }
.tree-node summary span { display: inline-block; margin-left: 6px; color: var(--muted); font-size: 10px; }
.tree-partner { margin: 0 0 8px 12px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.tree-partner a { color: var(--muted); }
.tree-node.is-selected > summary { border-radius: 3px; background: #e1e9d9; }
.workspace.outline-view { grid-template-columns: minmax(320px, 1fr) minmax(0, 1.55fr); gap: 28px; }
.about-panel { max-width: 1000px; padding: 24px 0; }
.about-panel h2 { margin-bottom: 24px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.about-grid h3 { margin: 26px 0 10px; color: var(--ink); font-size: 15px; font-weight: 600; }
.about-grid h3:first-child { margin-top: 0; }
.about-grid p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.85; }
.about-grid a { overflow-wrap: anywhere; }
.compilation-history { margin: 16px 0; font-size: 13px; line-height: 1.85; }
.compilation-history summary { color: var(--ink); cursor: pointer; }
.compilation-history summary + p { margin-top: 12px; }
.compilation-history ul { margin: 12px 0; padding-left: 20px; color: var(--muted); }
.compilation-history li + li { margin-top: 10px; }
.download-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: 12px; z-index: 10; background: var(--card); width: 1px; height: 1px; clip-path: inset(100%); overflow: hidden; }
.skip-link:focus { width: auto; height: auto; clip-path: none; padding: 12px; }
.noscript { padding: 30px; }
.copy-fallback { display: block; width: 100%; margin-top: 12px; padding: 8px; border: 1px solid var(--line); font-size: 11px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
  .profile-top, .profile-body { padding-left: 22px; padding-right: 22px; }
  .relatives { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .masthead, main { width: calc(100% - 32px); }
  .masthead { padding: 22px 0 12px; gap: 12px; }
  h1 { font-size: 23px; }
  .source-top { font-size: 11px; }
  .archive-stats { gap: 10px; font-size: 11px; }
  .view-nav { gap: 8px; padding: 10px 0; }
  .view-nav button { flex-direction: column; gap: 9px; min-height: 86px; padding: 12px 6px; font-size: 12px; }
  .view-nav svg { width: 21px; height: 21px; }
  .workspace, .workspace.outline-view { display: flex; flex-direction: column; gap: 24px; padding-top: 12px; }
  .directory, .outline-panel, .profile { width: 100%; }
  .results { max-height: 300px; }
  .result { padding: 12px; }
  .result-name { font-size: 15px; }
  .profile { scroll-margin-top: 134px; }
  .profile-top, .profile-body { padding: 20px 18px; }
  .profile h2 { font-size: 29px; }
  .profile-label { gap: 8px; }
  .profile-label .eyebrow { font-size: 10px; }
  .copy-link { font-size: 10px; }
  .family-tree { max-height: 470px; }
  .tree-node { margin-left: 10px; padding-left: 7px; }
  .tree-node summary a { font-size: 13px; }
  .about-panel { padding: 20px 0; }
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .event { grid-template-columns: 59px minmax(0, 1fr); gap: 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  .view-nav button, .relative-card, .result { transition: background .15s, border-color .15s; }
}

@media print {
  .masthead, .view-nav, .directory, .outline-panel, .copy-link { display: none !important; }
  main { width: 100%; padding: 0; }
  .workspace { display: block; padding: 0; }
  .profile { overflow: visible; border: 0; }
  .profile-top { background: white; }
  .profile-body { padding-top: 0; }
  .source-section details { display: block; }
  .relatives { grid-template-columns: 1fr 1fr; }
  a { color: black; }
}
