:root {
  --ink: #2b2b2b;
  --paper: #fdfcf8;
  --accent: #7a5c3e;
  --rule: #ddd6c9;
  --muted: #8a8578;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}
main { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
main.has-sidebar {
  max-width: 62rem;
  display: grid;
  grid-template-columns: 13rem minmax(0, 44rem);
  column-gap: 2.5rem;
  justify-content: center;
}
main.has-sidebar > .pager { grid-column: 2; }
.chapter-sidebar {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
}
.chapter-sidebar nav {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.chapter-sidebar h2 {
  margin: 0.3rem 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.chapter-sidebar ol { list-style: none; margin: 0; padding: 0; }
.chapter-sidebar li { margin: 0.35rem 0; }
.chapter-sidebar a { color: var(--accent); text-decoration: none; }
.chapter-sidebar a:hover { text-decoration: underline; }
.chapter-sidebar li.current {
  font-weight: 700;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 0.5rem;
  margin-left: -0.7rem;
}
.sidebar-extra { border-top: 1px solid var(--rule); padding-top: 0.6rem; }
@media (max-width: 960px) {
  main.has-sidebar { display: block; max-width: 44rem; }
  .chapter-sidebar { display: none; }
}
img { max-width: 100%; height: auto; }

.site-header { border-bottom: 1px solid var(--rule); background: #fff; }
.top-nav {
  max-width: 44rem; margin: 0 auto; padding: 0.6rem 1rem;
  display: flex; gap: 1.2rem; align-items: baseline;
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 0.85rem;
}
.top-nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
.top-nav a:hover { text-decoration: underline; }
.top-nav-title { margin-left: auto; color: var(--muted); font-style: italic; }

h1, h2, h3, h4, h5 { line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; margin-top: 2.2rem; }
article.chapter h3 {
  font-size: 1.15rem; margin-top: 2.4rem; color: var(--accent);
  border-bottom: 1px solid var(--rule); padding-bottom: 0.2rem;
}
article.chapter h3:target {
  background: #f6edd9; outline: 0.5rem solid #f6edd9; border-radius: 2px;
}
a { color: var(--accent); }
.chapter-title { margin-bottom: 0.2rem; }
.chapter-tools {
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 0.8rem;
  margin-top: 0;
}
.signature { margin-top: 2.5rem; font-style: italic; }
.webmaster-photo {
  float: right; width: min(320px, 45%);
  margin: 0.3rem 0 1rem 1.5rem; border-radius: 3px;
}

.pager {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 0.85rem;
}
.pager a { text-decoration: none; }
.pager-next { text-align: right; }

.landing { text-align: center; }
.landing .cover {
  max-width: 20rem; width: 100%;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25); margin: 1.5rem 0;
}
.landing h1 { margin-bottom: 0.2rem; }
.byline { font-style: italic; color: var(--muted); margin: 0; }
.byline a { color: inherit; }
.site-credit {
  font-style: italic; color: var(--muted);
  font-size: 0.85rem; margin-top: 0.2rem;
}
.site-credit a { color: inherit; }
.button {
  display: inline-block; margin: 0.3rem; padding: 0.55rem 1.1rem;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 4px; font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
}
.button:hover { filter: brightness(1.1); }
.toc-list {
  text-align: left; max-width: 30rem; margin: 0 auto; padding-left: 1.4rem;
}
.toc-list li { margin: 0.45rem 0; }
.toc-count {
  color: var(--muted); font-size: 0.78rem;
  font-family: "Helvetica Neue", Arial, sans-serif; margin-left: 0.4rem;
}
.toc-extra { list-style: none; margin-top: 1rem; }
.toc-extra + .toc-extra { margin-top: 0.45rem; }
.pdf-list {
  list-style: none; padding: 0; columns: 2; max-width: 34rem; margin: 0 auto;
  text-align: left; font-size: 0.9rem;
}
.pdf-list li { margin: 0.3rem 0; }
@media (max-width: 480px) { .pdf-list { columns: 1; } }

.people h1 { margin-bottom: 0.5rem; }
.search-box input {
  width: 100%; max-width: 24rem; padding: 0.5rem 0.8rem; font-size: 1rem;
  border: 1px solid var(--rule); border-radius: 4px; background: #fff;
  font-family: inherit;
}
#people-count {
  color: var(--muted); font-size: 0.85rem; margin-left: 0.6rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.letter-group h2 {
  border-bottom: 2px solid var(--rule); padding-bottom: 0.15rem;
  color: var(--accent);
}
.people-list { list-style: none; padding: 0; columns: 2; column-gap: 2.5rem; }
.people-list li { margin: 0.25rem 0; break-inside: avoid; }
.people-list .dates { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 540px) { .people-list { columns: 1; } }

/* family tree page */
main.tree-main { max-width: none; }
.tree-head { max-width: 44rem; margin: 0 auto; }
.tree-intro { color: var(--muted); font-size: 0.9rem; }
.tree-controls {
  display: none; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin: 0.4rem 0 1.2rem; font-family: "Helvetica Neue", Arial, sans-serif;
}
.js .tree-controls { display: flex; }
.tree-controls .search-box { position: relative; margin: 0; flex: 1 1 16rem; }
#tree-results {
  display: none; position: absolute; top: 100%; left: 0; z-index: 5;
  min-width: 100%; max-height: 18rem; overflow-y: auto; background: #fff;
  border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); font-size: 0.85rem;
}
#tree-results button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 0.35rem 0.7rem; font: inherit; cursor: pointer;
}
#tree-results button:hover { background: #f6edd9; }
#tree-results .no-match { padding: 0.35rem 0.7rem; color: var(--muted); }
.tree-btn {
  border: 1px solid var(--rule); background: #fff; border-radius: 4px;
  padding: 0.35rem 0.8rem; font: inherit; font-size: 0.85rem;
  color: var(--accent); cursor: pointer;
}
.tree-btn:hover { background: #f6edd9; }

.tree-pan { overflow-x: auto; padding-bottom: 1.5rem; }
.js .tree-pan { cursor: grab; }
.js .tree-pan.dragging { cursor: grabbing; user-select: none; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree {
  display: flex; justify-content: center; min-width: max-content;
  margin: 0 auto; font-family: "Helvetica Neue", Arial, sans-serif;
}
.tree ul { display: flex; align-items: flex-start; position: relative; padding-top: 1.2rem; }
.tree ul::before {
  content: ""; position: absolute; top: 0; left: 50%; height: 1.2rem;
  border-left: 1px solid var(--rule);
}
.tree li {
  display: flex; flex-direction: column; align-items: center;
  position: relative; padding: 1.2rem 0.4rem 0;
}
.tree li::before, .tree li::after {
  content: ""; position: absolute; top: 0; width: 50%; height: 1.2rem;
}
.tree li::before { right: 50%; border-top: 1px solid var(--rule); }
.tree li::after { left: 50%; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.tree li:first-child::before { border-top: none; }
.tree li:last-child::after { border-top: none; }
.tree > li { padding-top: 0; }
.tree > li::before, .tree > li::after { display: none; }
.js .tree li.collapsed > ul { display: none; }

.tree-card {
  display: flex; flex-direction: column; gap: 0.1rem;
  background: #fff; border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.45rem 0.7rem; min-width: 9rem; max-width: 13rem;
  font-size: 0.78rem; line-height: 1.35; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tc-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.tc-photo {
  display: block; width: 3rem; height: 3rem; margin: 0 auto 0.2rem;
  border-radius: 50%; object-fit: cover; object-position: top;
  border: 1px solid var(--rule); background-color: #e7e2d6;
}
.tc-photo-none {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23aaa395'%3E%3Ccircle cx='50' cy='38' r='17'/%3E%3Cpath d='M50 58c-18 0-30 10-32 26l-1 16h66l-1-16C80 68 68 58 50 58z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center bottom;
  background-size: 78%;
}
.tree-card .tc-name { font-weight: 600; color: var(--accent); text-decoration: none; }
.tree-card .tc-name:hover { text-decoration: underline; }
.tc-dates { color: var(--muted); }
.tc-spouse { color: var(--muted); font-style: italic; }
.tc-also, .tc-refnote { font-size: 0.7rem; color: var(--muted); }
.tc-ref { border-style: dashed; background: transparent; box-shadow: none; }
.tc-toggle { display: none; }
.js .tc-toggle {
  display: inline-block; margin: 0.25rem auto 0; padding: 0.05rem 0.6rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--paper);
  font: inherit; font-size: 0.72rem; color: var(--accent); cursor: pointer;
}
.tc-toggle:hover { background: #f6edd9; }
.tree-card.hit { background: #f6edd9; outline: 0.4rem solid #f6edd9; }

.tree-unplaced { max-width: 44rem; margin: 1rem auto 0; }
.tree-unplaced .dates { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 960px) {
  .tree { display: block; min-width: 0; }
  .tree ul {
    display: block; padding: 0 0 0 1rem; margin-left: 0.6rem;
    border-left: 1px solid var(--rule);
  }
  .tree ul::before { display: none; }
  .tree li { display: block; padding: 0.6rem 0 0; }
  .tree li::before, .tree li::after { display: none; }
  .tree-card {
    display: grid; grid-template-columns: auto 1fr; column-gap: 0.6rem;
    align-items: center; text-align: left; max-width: none; min-width: 0;
  }
  .tc-photo { width: 2.6rem; height: 2.6rem; margin: 0; }
  .js .tc-toggle { grid-column: 2; justify-self: start; margin: 0.25rem 0 0; }
}
