:root {
  --bg: #f7f4ee; --ink: #26221c; --muted: #6f675b; --accent: #4e3d24; --card: #fff; --line: #e2dacb;
  --record: #2e7d32; --supported: #1565c0; --candidate: #b26a00; --compiled: #8e44ad; --family: #c62828;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1916; --ink: #ece6da; --muted: #a59c8c; --accent: #d9c49c; --card: #26231f; --line: #3d382f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font: 600 1.8rem/1.2 Georgia, serif; color: var(--accent); margin: 0 0 .4em; }
h2 { font: 600 1.2rem/1.3 Georgia, serif; color: var(--accent); margin: 1.6em 0 .6em; }
.muted { color: var(--muted); }
code { font-size: .9em; }

.site-header { background: var(--accent); }
.site-header nav { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex;
  flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }
.brand { color: #fff; font: 600 1.1rem Georgia, serif; text-decoration: none; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.nav-links a { color: #f1e8d6; text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { .site-header { background: #2e261a; } }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 60px; }
footer { border-top: 1px solid var(--line); padding: 16px; text-align: center; font-size: .85rem; color: var(--muted); }
.lede { font-size: 1.08rem; max-width: 760px; }
.crumb { font-size: .9rem; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.card h2 { margin-top: 0; }
.note { background: var(--card); border-left: 4px solid var(--accent); padding: 4px 16px 10px; border-radius: 6px; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; white-space: nowrap; }
.lines td:last-child, .lines th:last-child { white-space: nowrap; }
.facts { max-width: 760px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.facts th { width: 150px; color: var(--muted); }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  border: 1px solid currentColor; white-space: nowrap; vertical-align: middle; }
.ev-record { color: var(--record); } .ev-supported { color: var(--supported); }
.ev-candidate { color: var(--candidate); } .ev-compiled { color: var(--compiled); }
.ev-family { color: var(--family); }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; }

/* pedigree chart: youngest on the left, father above mother */
.chart-wrap { overflow-x: auto; padding: 12px 0 18px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); margin: 14px 0; }
.ped { display: flex; align-items: center; }
.parents { display: flex; flex-direction: column; padding-left: 22px; position: relative; }
.parents::before { content: ""; position: absolute; left: 0; top: 25%; bottom: 25%;
  border-left: 2px solid var(--line); }
.parents > .ped { position: relative; padding: 3px 0; }
.parents > .ped::before { content: ""; position: absolute; left: -22px; width: 20px; top: 50%;
  border-top: 2px solid var(--line); }
.box { display: block; min-width: 170px; max-width: 210px; margin-left: 8px; padding: 5px 9px;
  background: var(--bg); border: 1px solid var(--line); border-left: 5px solid currentColor;
  border-radius: 6px; text-decoration: none; font-size: .85rem; line-height: 1.3; }
.box .nm { display: block; color: var(--ink); font-weight: 600; }
.box .yr { display: block; color: var(--muted); font-size: .78rem; }
.box:hover { background: var(--card); box-shadow: 0 1px 6px rgba(0,0,0,.15); }
.box.unknown { color: var(--muted); border-left-color: var(--line); font-style: italic; min-width: 120px; }

.open-questions li { margin-bottom: .4em; }
.notes p { max-width: 760px; }

.record-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.record { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.record img { display: block; width: 100%; height: 170px; object-fit: cover; object-position: top; background: #ddd; }
.record .pdf { display: flex; align-items: center; justify-content: center; height: 170px; font-weight: 700;
  color: var(--muted); background: var(--bg); }
.record figcaption { padding: 8px 10px; font-size: .78rem; line-height: 1.35; overflow-wrap: anywhere; }
.toc { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; margin-bottom: 8px; }
.articles li { margin-bottom: .35em; }
.prose { max-width: 860px; overflow-x: auto; }
.prose table { font-size: .9rem; }
