:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d7;
  --ink: #2b2620;
  --ink-2: #5d554a;
  --ink-3: #8a8174;
  --line: #d8cfbd;
  --rule: #b9ad96;
  --red: #b4322a;
  --green: #2f7a4a;
  --accent: #8a5a2b;
  --accent-bg: #f1e3cf;
  --direct: #fff3d6;
  --direct-border: #d9a74a;
  --card: #fbf8f1;
  --shadow: 0 1px 2px rgba(43, 38, 32, .08), 0 4px 14px rgba(43, 38, 32, .06);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1a16; --paper-2: #26221d; --ink: #ece4d6; --ink-2: #c3b9a8; --ink-3: #8f8676;
    --line: #3b352d; --rule: #5a5245; --red: #e06a5f; --green: #6cc08a; --accent: #d9a86a; --accent-bg: #3a2f22;
    --direct: #3a3120; --direct-border: #b8893a; --card: #26221d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --paper: #1d1a16; --paper-2: #26221d; --ink: #ece4d6; --ink-2: #c3b9a8; --ink-3: #8f8676;
  --line: #3b352d; --rule: #5a5245; --red: #e06a5f; --green: #6cc08a; --accent: #d9a86a; --accent-bg: #3a2f22;
  --direct: #3a3120; --direct-border: #b8893a; --card: #26221d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.45;
}
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

header.site {
  border-bottom: 1px solid var(--line); background: var(--paper-2);
}
header.site .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; padding-top: 18px; padding-bottom: 14px; }
header.site h1 { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; margin: 0; letter-spacing: .01em; }
header.site h1 small { font-weight: 400; color: var(--ink-3); font-size: .95rem; margin-left: 8px; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav.main a { text-decoration: none; color: var(--ink-2); padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
nav.main a:hover { background: var(--accent-bg); color: var(--ink); }
nav.main a[aria-current="page"] { background: var(--ink); color: var(--paper); }

.lead { font-family: var(--serif); font-size: 1.1rem; color: var(--ink-2); margin: 22px 0 6px; max-width: 70ch; }
.muted { color: var(--ink-3); font-size: .9rem; }

/* direct line strip */
.direct-line { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 14px; scrollbar-width: thin; }
.direct-line .chip {
  flex: 0 0 auto; background: var(--direct); border: 1px solid var(--direct-border); border-radius: 8px;
  padding: 6px 10px; text-decoration: none; color: var(--ink); min-width: 118px; position: relative;
}
.direct-line .chip + .chip::before { content: "→"; position: absolute; left: -10px; top: 50%; transform: translate(-50%,-50%); color: var(--ink-3); font-size: .8rem; }
.direct-line .chip .g { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); display: block; }
.direct-line .chip .n { font-weight: 600; font-size: .9rem; display: block; line-height: 1.2; }
.direct-line .chip .d { font-size: .78rem; color: var(--ink-2); display: block; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 14px; }
.toolbar input[type=search] {
  flex: 1 1 220px; font: inherit; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--card); color: var(--ink); min-width: 0;
}
.btn {
  font: inherit; font-size: .9rem; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--card); color: var(--ink); cursor: pointer;
}
.btn:hover { background: var(--accent-bg); }
.stats { font-size: .85rem; color: var(--ink-3); margin-left: auto; }

/* tree */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 1px solid var(--line); }
.tree li { margin: 6px 0; position: relative; }
.tree ul > li::before { content: ""; position: absolute; left: -22px; top: 22px; width: 16px; border-top: 1px solid var(--line); }
.person {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 8px 8px; box-shadow: var(--shadow);
}
.person.direct { background: var(--direct); border-color: var(--direct-border); }
.person .tog {
  grid-row: 1 / -1; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font: inherit; cursor: pointer; display: grid; place-items: center; padding: 0; margin-top: 2px;
}
.person .tog[disabled] { opacity: .35; cursor: default; }
.person .head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.person .code { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); background: var(--paper-2); padding: 1px 6px; border-radius: 4px; }
.person .name { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.person .name.ms { color: var(--red); }
.rel { display: inline-block; font-family: var(--sans); font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink); background: var(--direct-border); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.direct-line .chip .r { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--accent); }
.register .rel { font-size: .68rem; }
.person .place { font-size: .8rem; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.person .dates { font-size: .9rem; color: var(--ink-2); }
.person .spouse { font-size: .9rem; color: var(--ink-2); }
.person .spouse .x { color: var(--ink-3); font-family: var(--mono); font-size: .8rem; margin-right: 4px; }
.person .spouse a { color: var(--green); font-weight: 600; text-decoration: none; }
.person .spouse a:hover { text-decoration: underline; }
.person .kids { font-size: .78rem; color: var(--ink-3); margin-left: 6px; }
.person .note { grid-column: 2; font-size: .82rem; color: var(--ink-3); margin-top: 4px; display: none; }
.person.open-note .note { display: block; }
.person .notebtn { font-size: .75rem; color: var(--accent); background: none; border: none; cursor: pointer; padding: 0; margin-left: 6px; font-family: inherit; }
.conf-L .name::after { content: " ?"; color: var(--ink-3); font-weight: 400; }
li.collapsed > ul { display: none; }
.hit > .person { outline: 2px solid var(--accent); }
/* search routes: the path from the stamvader to each match, one colour per match */
.route > .person { box-shadow: var(--route), var(--shadow); }
.route.single > .person { background: color-mix(in srgb, var(--rc) 13%, var(--card)); border-color: var(--rc); }
.routehit > .person { outline: 3px solid var(--rc); border-color: var(--rc); background: color-mix(in srgb, var(--rc) 20%, var(--card)); }
.rkey { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 12px; }
.rkey:empty { display: none; }
.rkey .lg { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px 2px 8px; text-decoration: none; }
.rkey .lg:hover { border-color: var(--rule); }
.rkey .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.rkey .code { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); }


/* photos */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 10px 0 30px; }
.gallery figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery img { width: 100%; height: auto; display: block; }
.gallery figcaption { padding: 8px 10px; font-size: .85rem; color: var(--ink-2); }

h2 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; margin: 30px 0 8px; }
footer.site { border-top: 1px solid var(--line); margin-top: 40px; padding: 18px 0 40px; font-size: .85rem; color: var(--ink-3); }
footer.site p { margin: 4px 0; }

/* register */
.register { font-family: var(--serif); font-size: 1rem; line-height: 1.5; }
.register .entry { display: flex; gap: 10px; margin: 2px 0; padding-left: calc(var(--depth) * 22px); }
.register .code { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); flex: 0 0 auto; min-width: 4.5em; padding-top: 3px; }
.register .ms { color: var(--red); }
.register .sw { color: var(--green); }
.register .entry.direct { background: var(--direct); border-radius: 4px; }
.register .b-head { font-weight: 700; font-size: 1.15rem; margin-top: 18px; }

/* charts */
.chart-wrap { overflow: auto; max-height: 78vh; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); margin: 10px 0; }
.chart-wrap svg { display: block; }
.legend { font-size: .85rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0; }
.legend .sw { color: var(--green); } .legend .ms { color: var(--red); }

@media print {
  header.site, .toolbar, .direct-line, footer.site, nav.main, .noprint { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .register .entry.direct { background: #f3e9cf; }
  .chart-wrap { overflow: visible; border: none; }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 600px) {
  header.site h1 { font-size: 1.35rem; }
  .person { grid-template-columns: auto 1fr; }
  .tree ul { padding-left: 14px; }
  .tree ul > li::before { left: -14px; width: 10px; }
}
