/* Census Checklist: a ruled enumeration-sheet look. Cool paper, dark ink, ledger red for the one accent. */
:root {
  --bg: #f4f6f8;
  --paper: #ffffff;
  --ink: #17212b;
  --muted: #47535f;
  --rule: #c5cfd9;
  --rule-soft: #e2e8ee;
  --accent: #a1281f;
  --accent-ink: #ffffff;
  --link: #1d4f7a;
  --ok: #1f5d3a;
  --part: #7a4b00;
  --gone: #a1281f;
  --shut: #4b4f86;
  --focus: #1d4f7a;
  --head: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --paper: #18202a;
    --ink: #e6ebf0;
    --muted: #aab6c2;
    --rule: #3a4757;
    --rule-soft: #26313d;
    --accent: #ff8a7e;
    --accent-ink: #1a0b09;
    --link: #8fc3ff;
    --ok: #8fd6a8;
    --part: #f0c060;
    --gone: #ff8a7e;
    --shut: #b9bdf5;
    --focus: #8fc3ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 10px 14px; z-index: 10; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.15; letter-spacing: -0.005em; }
h1 { font-size: clamp(30px, 6vw, 44px); margin: 0 0 10px; max-width: 22ch; }
h2 { font-size: 27px; margin: 40px 0 10px; }
h3 { font-size: 22px; margin: 0 0 2px; }

/* Masthead: a red double rule, like the top of a census sheet */
.mast { padding: 26px 0 18px; border-bottom: 1px solid var(--rule); }
.mast::before { content: ""; display: block; height: 0; border-top: 4px solid var(--accent); border-bottom: 1px solid var(--accent); padding-top: 3px; margin-bottom: 22px; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); font-size: 18px; }

/* Buttons and fields */
.btn { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.subtle { background: transparent; border-color: transparent; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { background: var(--gone); border-color: var(--gone); color: var(--accent-ink); }
.btn.small { min-height: 44px; padding: 6px 12px; }
.btn.icon { min-width: 44px; padding: 0; font-size: 24px; line-height: 1; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
input[type="text"], select { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); max-width: 100%; }
input::placeholder { color: var(--muted); opacity: 1; }
label { font-size: 16px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.note { padding: 10px 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; }
.note.warn { border-color: var(--gone); }
.ed-warn { margin: 10px 0 0; }
.held-note { margin: 0 0 12px; font-weight: 600; }
.offer { background: var(--paper); border: 2px solid var(--accent); border-radius: 6px; padding: 12px 16px; margin: 12px 0; }
.offer p { margin: 0; }
.quiet { margin-left: 12px; }

/* Ancestor editors */
.tool { padding-top: 18px; }
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.person { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; }
.person.open { border-color: var(--ink); }
.p-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.p-sum { min-width: 0; flex: 1 1 260px; }
.p-sum b { display: block; font-size: 18px; }
.p-sum span { color: var(--muted); overflow-wrap: anywhere; }
.p-btns { display: flex; gap: 6px; }
.field.name { display: grid; gap: 4px; max-width: 420px; }
.field.name input { width: 100%; }
.whens { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 760px) { .whens { grid-template-columns: 1fr 1fr; } }
.when-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.when-row .q { width: 8.5em; }
.when-row .year { width: 5.2em; }
.when-row .month { width: 8.6em; }
.when-row .day { width: 5em; }
.when-row .and { padding: 0 2px; }
.places { margin-top: 16px; }
.place-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 10px; }
.place { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; align-items: end; padding-bottom: 10px; border-bottom: 1px dashed var(--rule); }
.place .pf { display: grid; gap: 2px; min-width: 0; }
.place .pf label { color: var(--muted); font-size: 16px; }
.place .pf select, .place .pf input { width: 100%; }
.place .btn.icon { grid-column: 2; justify-self: end; }
@media (min-width: 640px) {
  .place { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.5fr) 5.6em 5.6em 44px; }
  .place .btn.icon { grid-column: auto; }
}
.err { color: var(--gone); font-weight: 600; margin: 10px 0 0; }
.add-row { margin: 14px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* Results */
.results h2#results-h { margin-top: 34px; }
.plan { margin: 0 0 14px; max-width: 70ch; }
.empty { color: var(--muted); }
.sheet { margin: 18px 0 28px; }
.sheet .count { margin: 0 0 10px; font-weight: 600; }
.sheet .meta { margin: 0 0 4px; color: var(--muted); overflow-wrap: anywhere; }
.rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); container-type: inline-size; background: var(--paper); }
.row { display: grid; gap: 4px 14px; padding: 12px 12px; border-bottom: 1px solid var(--rule); grid-template-columns: fit-content(8.5rem) minmax(0, 1fr); }
.row > .c-what, .row > .c-log { grid-column: 1 / -1; }
.row.cannot { background: transparent; }
.row.cannot .c-what, .row.cannot .c-age { color: var(--muted); }
.c-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.yr { font-family: var(--head); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.nm { font-weight: 600; }
.cday { color: var(--muted); }
.c-age { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.c-age b { font-variant-numeric: tabular-nums; }
.row .alive { grid-column: 1 / -1; margin: 0; color: var(--part); font-weight: 600; }
.c-rec { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.st { font-weight: 700; }
.st-ok { color: var(--ok); }
.st-part { color: var(--part); }
.st-gone { color: var(--gone); }
.st-shut { color: var(--shut); }
.why { color: var(--ink); }
.c-log { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; }
.tick { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.tick input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
.c-log .ref { flex: 1 1 12em; min-width: 0; }
.gap { color: var(--muted); margin: 8px 0 0; }
@container (min-width: 760px) {
  .row { grid-template-columns: 11rem 9.5rem minmax(0, 1fr) 15rem; align-items: start; }
  .row > .c-what, .row > .c-log { grid-column: auto; }
  .c-what { flex-direction: column; gap: 0; }
  .c-age { flex-direction: column; gap: 0; }
  .c-log { margin-top: 0; }
  .c-log .ref { flex-basis: 100%; }
}

/* Family view */
.sub { margin: 0 0 10px; color: var(--muted); }
.family { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); background: var(--paper); }
.fam { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.f-what { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.f-who { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 18px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 8px; }
.share-url { width: 100%; margin-top: 8px; }
.removed { margin: 18px 0 0; }
.removed summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.removed ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.removed li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clear-row { margin: 12px 0 0; }
.undo-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(520px, calc(100% - 32px)); background: var(--ink); color: var(--bg); border-radius: 8px; padding: 8px 8px 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 20; box-shadow: 0 6px 24px rgb(0 0 0 / 25%); }
.undo-bar .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }

/* Guide */
.guide { padding-bottom: 30px; }
.guide p { max-width: 70ch; }
.faq h3 { font-size: 20px; margin: 22px 0 4px; }
.faq p { margin: 0; }
.sources p { color: var(--ink); }

.site-foot { border-top: 1px solid var(--rule); margin-top: 30px; padding: 22px 0 40px; color: var(--muted); }
.sb-footer p { margin: 0 0 10px; }
.sb-more { overflow-wrap: anywhere; }
.sb-privacy, .sb-credit { color: var(--muted); }

.print-sheet { display: none; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Print: one checklist per ancestor, then the family view. Screen UI hidden. */
@page { margin: 14mm 12mm; }
@media print {
  :root { --ink: #000; --muted: #333; --rule: #777; }
  body { background: #fff; color: #000; font: 10.5pt/1.35 var(--body); }
  body > *:not(main), main > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; }
  .pp { break-after: page; }
  .pp:last-child { break-after: auto; }
  .pp h2 { font-family: var(--head); font-size: 17pt; margin: 0 0 2pt; }
  .pmeta { margin: 0 0 2pt; font-size: 11pt; }
  .pcount { margin: 0 0 8pt; font-size: 10.5pt; font-weight: 600; }
  .pt { width: calc(100% - 2px); margin-left: 1px; border-collapse: collapse; table-layout: fixed; }
  .pt th { text-align: left; font-size: 9.5pt; border-bottom: 1.5pt solid #000; padding: 3pt 4pt; }
  .pt td { border-bottom: 0.75pt solid #777; padding: 4pt 4pt; vertical-align: top; overflow-wrap: anywhere; }
  .pt tbody { break-inside: avoid; }
  .pt thead { display: table-header-group; }
  .pt .runhead th { border-bottom: 0; font-weight: 400; font-size: 8.5pt; color: #444; padding: 0 4pt 2pt; }
  .pt .nosearch td { color: #444; font-style: italic; }
  .pt .small { font-size: 8.5pt; color: #333; margin-top: 1pt; }
  .pt tr.has-sub td { border-bottom: 0; padding-bottom: 1pt; }
  .pt tr.sub td { font-size: 8.5pt; font-style: italic; padding-top: 0; color: #333; }
  .w-cen { width: 20%; } .w-day { width: 13.5%; } .w-age { width: 8.5%; } .w-rec { width: 22.5%; } .w-box { width: 8.5%; } .w-ref { width: 18%; }
  .pt th:nth-child(5), .pt th:nth-child(6) { text-align: center; }
  .bx { text-align: center; }
  .box { display: inline-block; width: 12pt; height: 12pt; border: 1pt solid #000; line-height: 11pt; text-align: center; font-weight: 700; }
  .pt tr.blank td { height: 24pt; }
  .pf th:nth-child(1) { width: 26%; } .pf th:nth-child(2) { width: 15%; } .pf th:nth-child(3) { width: 17%; }
  .pnote { font-size: 9.5pt; margin: 0 0 4pt; }
  .pfoot { font-size: 9pt; margin: 0 0 8pt; color: #333; }
}
