:root {
  --page: #EDF0EC;      /* archive-box grey green */
  --page-2: #E1E6E0;
  --ink: #1C2725;
  --ink-2: #53615D;
  --rule: #C6CEC8;
  --desk: #24332F;      /* reading-desk felt */
  --desk-2: #314540;
  --desk-ink: #DCE5DF;
  --desk-dim: #9FB1A9;
  --paper: #F7F5EE;
  --spruce: #1F6B57;
  --ochre: #96600F;
  --brick: #A2452F;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--spruce); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--spruce); outline-offset: 2px; }
.desk :focus-visible { outline-color: #fff; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 20; }

.shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.left { padding: 0 56px; max-width: 780px; width: 100%; justify-self: end; display: flex; flex-direction: column; }
main { flex: none; padding-bottom: 14px; outline: none; }

/* top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.site { font-family: var(--serif); font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 18px; font-size: 15px; white-space: nowrap; }
.site { white-space: nowrap; }
.top nav a { color: var(--ink-2); text-decoration: none; padding: 4px 0; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); font-weight: 600; box-shadow: 0 2px 0 var(--ink); }
.foot { padding: 4px 0 28px; color: var(--ink-2); font-size: 14px; }
.foot p { margin: 0; }
.foot p + p { margin-top: 4px; }

/* type */
.crumbs { margin: 34px 0 10px; font-size: 14px; color: var(--ink-2); }
h1 { font-family: var(--serif); font-weight: 500; font-size: 52px; line-height: 1.06; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
.crumbs + h1 { margin-top: 0; }
main > h1:first-child { margin-top: 44px; }
.life { font-family: var(--serif); font-size: 21px; color: var(--ink-2); margin: 10px 0 0; }
.lede { font-family: var(--serif); font-size: 19px; line-height: 1.6; margin: 24px 0 0; max-width: 34em; }
h2 { font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 44px 0 6px; }
h2 small { font-weight: 400; font-size: 14px; margin-left: 8px; }
.private { margin-top: 26px; padding: 16px 18px; background: var(--page-2); border-radius: 3px; max-width: 34em; }

/* claims */
.claims { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.claim { border-bottom: 1px solid var(--rule); padding: 16px 0 16px 20px; position: relative; }
.claim::before, .dot { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--spruce); }
.claim::before { position: absolute; left: 0; top: 24px; }
.claim[data-st="probable"]::before, .dot[data-st="probable"] { background: none; border: 2px solid var(--ochre); }
.claim[data-st="unproven"]::before, .dot[data-st="unproven"] { background: none; border: 2px dotted var(--ink-2); }
.claim[data-st="conflict"]::before, .dot[data-st="conflict"] { background: var(--brick); border-radius: 1px; transform: rotate(45deg); }
.claim[data-st="open"]::before, .dot[data-st="open"] { background: none; border: 2px solid var(--brick); }
.dot { display: inline-block; flex: none; }
.claim .what { font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.3; }
.claim .what a { color: var(--ink); }
.claim .where { color: var(--ink-2); font-size: 15px; margin-top: 3px; }
.st { font-size: 14px; color: var(--ink-2); }
.st[data-st="documented"] { color: var(--spruce); }
.st[data-st="probable"] { color: var(--ochre); }
.st[data-st="conflict"], .st[data-st="open"] { color: var(--brick); }
.claim .note { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink); max-width: 36em; }
.srcs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.src { border: 1px solid var(--rule); background: transparent; border-radius: 3px; padding: 5px 10px; font-size: 14px; }
.src:hover { border-color: var(--ink-2); }
.src[aria-pressed="true"] { background: var(--desk); border-color: var(--desk); color: var(--desk-ink); }
.help { font-size: 14px; margin-left: 6px; align-self: center; }

/* lists of people */
.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; border-top: 1px solid var(--rule); }
.rows.one { grid-template-columns: 1fr; }
.rows a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 17px; }
.rows a:hover .nm { text-decoration: underline; text-underline-offset: 3px; }
.rows a .yr { color: var(--ink-2); font-family: var(--sans); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.rows a .rel { display: block; font-family: var(--sans); font-size: 14px; color: var(--ink-2); }
.linehead { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 44px 0 6px; }
.linehead h2 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--ink); }
.linehead span { font-size: 14px; color: var(--ink-2); text-align: right; }

/* find a person */
.find { position: relative; margin-top: 28px; max-width: 420px; }
.find label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.find input { width: 100%; padding: 11px 14px; border: 1px solid var(--ink-2); border-radius: 3px; background: #fff; font-size: 17px; }
.find ul { list-style: none; margin: 4px 0 0; padding: 4px 0; position: absolute; z-index: 5; left: 0; right: 0; background: #fff; border: 1px solid var(--ink-2); border-radius: 3px; max-height: 300px; overflow: auto; }
.find li a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; color: var(--ink); text-decoration: none; }
.find li a:hover, .find li a:focus { background: var(--page); }
.find li span { color: var(--ink-2); font-size: 14px; }
.find .none { padding: 8px 14px; color: var(--ink-2); }

.callout { margin-top: 30px; padding: 18px 20px; background: var(--desk); color: var(--desk-ink); border-radius: 3px; max-width: 36em; }
.callout b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 500; color: #fff; margin-bottom: 4px; }
.callout p { margin: 0 0 12px; font-size: 15px; }
.callout .src { border-color: #6B807A; color: #fff; }
.callout .src[aria-pressed="true"] { background: #fff; color: var(--desk); border-color: #fff; }

/* filters, timeline, records */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 26px 0 0; }
.filters button { border: 1px solid var(--rule); background: none; border-radius: 3px; padding: 6px 12px; font-size: 15px; }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--page); }
.tl { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.tl li { display: grid; grid-template-columns: 64px 1fr; gap: 0 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.tl .y { font-family: var(--serif); font-size: 20px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tl .who { font-size: 14px; }
.tl .what { font-family: var(--serif); font-size: 18px; font-weight: 500; line-height: 1.3; }
.tl .where { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.reclist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.reclist li { border-bottom: 1px solid var(--rule); }
.reclist button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 13px 12px 13px 0; }
.reclist button:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.reclist button[aria-pressed="true"] { background: var(--page-2); box-shadow: inset 3px 0 0 var(--desk); padding-left: 14px; }
.reclist .t { display: block; font-family: var(--serif); font-size: 18px; font-weight: 500; line-height: 1.3; }
.reclist .w { display: block; color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.tag { display: inline-block; font-size: 13px; padding: 1px 7px; border-radius: 3px; background: #EADDB8; color: #5b4306; margin-left: 8px; vertical-align: 2px; font-family: var(--sans); font-weight: 400; }
.tag.new { background: var(--spruce); color: #fff; }
.wanted { margin: 0; padding: 0 0 0 20px; max-width: 36em; }
.wanted li { padding: 5px 0; }

/* the desk */
.desk { background: var(--desk); color: var(--desk-ink); position: sticky; top: 0; height: 100vh; overflow: auto; padding: 22px 48px 64px; }
.desk-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: var(--desk-dim); padding-bottom: 20px; }
.desk-actions { display: flex; gap: 16px; align-items: center; }
.desk-top a { color: var(--desk-ink); }
#desk-close { display: none; background: none; border: 1px solid #6B807A; border-radius: 3px; padding: 5px 12px; color: #fff; }
.doc-title { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.2; margin: 0; color: #fff; max-width: 24em; text-wrap: balance; }
.doc-where { margin: 6px 0 20px; color: var(--desk-dim); font-size: 15px; max-width: 40em; }
.sheet { background: var(--paper); color: #1b1b18; border-radius: 2px; box-shadow: 0 1px 0 #0003, 0 18px 40px -12px #0009; overflow: hidden; max-width: 680px; }
.sheet + .sheet { margin-top: 18px; }
.viewer { overflow: auto; max-height: 72vh; cursor: grab; background: #d9d6cc; }
.viewer.drag { cursor: grabbing; }
.viewer img { display: block; height: auto; user-select: none; -webkit-user-drag: none; }
.vbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 9px 12px; font-size: 14px; border-top: 1px solid #1b1b1822; }
.vbar .cap { color: #55554c; flex: 1 1 220px; }
.vbar .btns { display: flex; gap: 6px; }
.vbar button { border: 1px solid #1b1b1840; background: #fff; border-radius: 3px; padding: 4px 10px; font-size: 14px; color: #1b1b18; }
.vbar button:disabled { opacity: .4; cursor: default; }
.pages { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; max-width: 680px; }
.pages button { border: 1px solid #6B807A; background: none; color: var(--desk-ink); border-radius: 3px; padding: 5px 11px; font-size: 14px; }
.pages button[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--desk); }
.missing { margin: 0; padding: 12px 22px; background: #EADDB8; color: #5b4306; font-size: 14px; }
.sheet dl { margin: 0; padding: 6px 22px 12px; font-family: var(--serif); }
.sheet .row { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid #1b1b1822; }
.sheet .row:last-child { border-bottom: 0; }
.sheet dt { font-family: var(--sans); font-size: 14px; color: #62625a; padding-top: 3px; }
.sheet dd { margin: 0; font-size: 17px; line-height: 1.45; }
.scroll { overflow-x: auto; }
.sheet table { border-collapse: collapse; width: 100%; font-size: 15px; }
.sheet caption { text-align: left; padding: 12px 22px 8px; font-size: 14px; color: #62625a; }
.sheet th { text-align: left; font-weight: 600; font-size: 13px; color: #62625a; padding: 8px 10px; border-bottom: 1px solid #1b1b1840; white-space: nowrap; }
.sheet td { padding: 8px 10px; border-bottom: 1px solid #1b1b1822; vertical-align: top; font-family: var(--serif); }
.sheet th:first-child, .sheet td:first-child { padding-left: 22px; }
.sheet tr:last-child td { border-bottom: 0; }
.about { max-width: 680px; margin-top: 26px; display: grid; gap: 16px; font-size: 15px; line-height: 1.55; }
.about b { display: block; color: var(--desk-dim); font-weight: 500; font-size: 14px; margin-bottom: 2px; }
.about ul { margin: 0; padding-left: 18px; }
.about li { padding: 2px 0; }
.about a { color: #fff; }
.about .ppl a { display: inline-block; margin: 0 12px 4px 0; }

@media (max-width: 1100px) {
  .left { padding: 0 32px; }
  .desk { padding: 22px 28px 56px; }
  h1 { font-size: 44px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .left { padding: 0 20px; max-width: none; }
  .top { flex-wrap: wrap; }
  .top nav { gap: 18px; width: 100%; overflow-x: auto; }
  h1 { font-size: 38px; }
  .rows { grid-template-columns: 1fr; }
  .desk { position: fixed; inset: 0; height: auto; z-index: 10; padding: 16px 18px 48px; display: none; }
  body.desk-open { overflow: hidden; }
  body.desk-open .desk { display: block; }
  #desk-close { display: inline-block; }
  .sheet .row { grid-template-columns: 1fr; gap: 2px; }
}
@media print { .desk, .top nav, .find, .filters { display: none; } .shell { display: block; } }

/* ───────── family tree (full-width page, no desk) ───────── */
body.wide .shell { grid-template-columns: minmax(0, 1fr); }
body.wide .desk { display: none; }
body.wide .left { max-width: none; justify-self: stretch; min-width: 0; padding: 0 32px; }
body.wide .lede { max-width: 38em; }
body.wide .lede.full { max-width: none; }
body.wide .tl, body.wide .reclist { max-width: 900px; }
/* with no side panel, an opened record slides in from the right */
body.wide.desk-open .desk { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: auto; height: auto; width: min(760px, 100%); z-index: 10; box-shadow: -18px 0 50px -20px #000a; }
body.wide #desk-close { display: inline-block; }
main { min-width: 0; }
main:focus, main:focus-visible { outline: none; }
.intree { margin: 14px 0 0; font-size: 15px; }
.portrait { margin: 20px 0 14px; display: flex; align-items: center; gap: 14px; }
.portrait + h1 { margin-top: 0; }
.portrait img { width: 96px; height: 96px; border-radius: 50%; border: 2.5px solid var(--ink); object-fit: cover; }
.portrait figcaption { font-size: 14px; color: var(--ink-2); max-width: 16em; }
.treehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 44px; }
.treehead h1 { margin: 0; }
.treehead.people { max-width: 1180px; flex-wrap: wrap; align-items: center; row-gap: 12px; margin-bottom: 24px; }
.treehead .find { margin: 6px 0 0 auto; width: 300px; max-width: 100%; }
.treehead .find input { padding: 8px 12px; font-size: 16px; }
@media (max-width: 560px) { .treehead .find { width: 100%; margin-top: 0; } }
#fit { border: 1px solid var(--ink-2); background: none; border-radius: 3px; padding: 6px 12px; font-size: 15px; }
.treewrap { margin-top: 16px; margin-bottom: 8px; background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; overflow-x: auto; overflow-y: hidden; cursor: grab; }
.treewrap.drag { cursor: grabbing; user-select: none; }
#treescale { margin: 0 auto; }
.tree { position: relative; transform-origin: 0 0; }
.tree svg { position: absolute; inset: 0; }
.tree path { fill: none; stroke: var(--ink); stroke-width: 2; }
.tnode { position: absolute; width: 104px; padding: 0 3px; text-align: center; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; align-items: center; }
.tnode .c { width: 52px; height: 52px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #fff; border: 2.5px solid var(--ink); font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: 0.02em; transition: background .12s, color .12s, box-shadow .12s; }
.tnode .c img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tnode .n { margin-top: 7px; font-size: 14px; font-weight: 600; line-height: 1.22; background: var(--paper); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tnode .y { font-size: 12.5px; color: var(--ink-2); background: var(--paper); font-variant-numeric: tabular-nums; }
.tnode:hover .c, .tnode:focus-visible .c { background: var(--desk); color: #fff; box-shadow: 0 0 0 4px #24332F33; }
.tnode:hover .n { text-decoration: underline; text-underline-offset: 3px; }
.tnode.focus .c { box-shadow: 0 0 0 6px #1F6B5755; border-color: var(--spruce); }
.treenote { margin: 12px 0 0; font-size: 15px; color: var(--ink-2); }
.callout a { color: #fff; }
@media (max-width: 860px) { .top nav { gap: 16px; } body.wide .left { padding: 0 16px; } }
@media print { .treebar { display: none; } .treewrap { border: 0; overflow: visible; } }

/* ───────── people list ───────── */
.count { margin: 18px 0 8px; font-size: 14px; color: var(--ink-2); }
.count:empty { margin: 14px 0 0; }
.plist { border-collapse: collapse; width: 100%; max-width: 1180px; font-size: 16px; }
.plist th { text-align: left; padding: 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.plist th button { background: none; border: 0; padding: 10px 14px 10px 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.plist th button:hover { color: var(--ink); }
.plist th button[aria-sort="ascending"]::after { content: " ↑"; color: var(--ink); }
.plist th button[aria-sort="descending"]::after { content: " ↓"; color: var(--ink); }
.plist th button[aria-sort="ascending"], .plist th button[aria-sort="descending"] { color: var(--ink); }
.plist td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; font-variant-numeric: tabular-nums; }
.plist td:first-child, .plist td:nth-child(2) { font-family: var(--serif); font-size: 17px; }
.plist td:nth-child(n+3) { color: var(--ink-2); }
.plist td:nth-child(3), .plist td:nth-child(4) { white-space: nowrap; }
.plist td a { color: var(--ink); text-decoration: none; }
.plist tbody tr { cursor: pointer; }
.plist tbody tr:hover { background: var(--page-2); }
.plist tbody tr:hover a, .plist td a:focus-visible { color: var(--spruce); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
body.wide main > .scroll { overflow-x: auto; }

/* ───────── timeline and records as plain reading pages ───────── */
body.wide .tl { max-width: 780px; margin-top: 30px; border-top: 0; }
.tl li { display: grid; grid-template-columns: 72px 1fr; gap: 0 18px; padding: 9px 0; border-bottom: 0; }
.tl li.first { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 7px; }
.tl li.first:first-child { border-top: 0; margin-top: 0; }
.tl .y { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.tl p { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.5; }
.tl p > a:first-child { color: var(--ink); font-weight: 600; text-decoration: none; }
.tl p > a:first-child:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl .see { font-family: var(--sans); font-size: 14px; white-space: nowrap; margin-left: 4px; }
.reclist li { padding: 12px 0; }
.reclist a.t { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.reclist a.t:hover { color: var(--spruce); text-decoration-color: var(--spruce); }
.reclist a.t::after { content: " ↗"; font-family: var(--sans); font-size: 14px; color: var(--ink-2); }

/* ───────── person pages: one column, with the person's own timeline and records ───────── */
main.person > * { max-width: 780px; }
main.person > .portrait:first-child { margin-top: 40px; }
body.wide main.person .tl { margin-top: 0; border-top: 1px solid var(--rule); }
.tl li > div:last-child { min-width: 0; }
main.person .tl .see { white-space: normal; }
body.wide main.person .reclist { max-width: 780px; }
.tl .more { font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink-2); margin-top: 3px; }

/* a small picture beside each name in the People list: the photo where there is one, initials otherwise */
.plist td { vertical-align: middle; }
.plist .pic { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-right: 12px; vertical-align: middle; border-radius: 50%; overflow: hidden; background: #fff; border: 2px solid var(--ink); color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; }
.plist .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* on a person's page the name itself opens them in the family tree */
main.person h1 a { color: inherit; text-decoration: none; }
main.person h1 a:hover, main.person h1 a:focus-visible { color: var(--spruce); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
