/* Family history (Sep 29 2026). Sits on top of SHARED_HEAD (kadePages.js):
 * 880px column, green buttons, gold focus ring, dark mode by the system
 * setting. Mobile first: nothing here may make the page scroll sideways;
 * the tree chart and wide tables scroll inside their own frames. Colour is
 * never the only cue: every side is also written, research also has a pill. */

:root {
  --fh-ink: #16181d;
  --fh-soft: #4a5260;
  --fh-surface: #ffffff;
  --fh-sunk: #eef1f4;
  --fh-line: #d3d8df;
  --fh-link: #1d55d0;
  --fh-green: #1f7a49;
  --fh-ring: #ffbf47;
  --fh-edge: #7a818c;
  --fh-self: #1f7a49;
  --fh-self-bg: #e4f4ea;
  --fh-father: #1d55d0;
  --fh-father-bg: #e8f0ff;
  --fh-mother: #ad1f58;
  --fh-mother-bg: #fdeaf2;
  --fh-both: #6a3aa2;
  --fh-both-bg: #f1eafb;
  --fh-marriage: #59616e;
  --fh-marriage-bg: #f0f1f3;
  --fh-research: #8a5600;
  --fh-research-bg: #fff3d1;
  --fh-descendant: #13707a;
  --fh-descendant-bg: #e2f3f4;
  --fh-blood: #5b4a8a;
  --fh-blood-bg: #efedf7;
  --fh-none: #69707c;
  --fh-none-bg: #f6f7f9;
  --fh-warn-bg: #fff1e6;
  --fh-warn-ink: #7a3300;
  --fh-flag-bg: #fff6da;
  --fh-flag-ink: #5f4700;
  --fh-cue-bg: #ffe27a;
  --fh-cue-ink: #16181d;
  --fh-reading-bg: #f4f8ec;
  --fh-proven-bg: #e4f4ea;
  --fh-proven-ink: #145232;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fh-ink: #e9ebf0;
    --fh-soft: #b9c0cc;
    --fh-surface: #1e2127;
    --fh-sunk: #262a31;
    --fh-line: #3a3f49;
    --fh-link: #93c5fd;
    --fh-edge: #8c94a1;
    --fh-self: #6fd49c;
    --fh-self-bg: #163827;
    --fh-father: #86b4ff;
    --fh-father-bg: #19253d;
    --fh-mother: #ff8fbb;
    --fh-mother-bg: #3a1c2a;
    --fh-both: #c8a6f3;
    --fh-both-bg: #2c2240;
    --fh-marriage: #b0b8c4;
    --fh-marriage-bg: #272b32;
    --fh-research: #f3c65e;
    --fh-research-bg: #3a2f17;
    --fh-descendant: #6fd3dc;
    --fh-descendant-bg: #153437;
    --fh-blood: #b9aef0;
    --fh-blood-bg: #26233a;
    --fh-none: #a3aab6;
    --fh-none-bg: #22252c;
    --fh-warn-bg: #3b2414;
    --fh-warn-ink: #ffc59a;
    --fh-flag-bg: #3a3017;
    --fh-flag-ink: #f7dd92;
    --fh-cue-bg: #7a5d00;
    --fh-cue-ink: #ffffff;
    --fh-reading-bg: #202a1f;
    --fh-proven-bg: #163827;
    --fh-proven-ink: #a9ecc5;
  }
}

@media (prefers-contrast: more) {
  :root {
    --fh-soft: var(--fh-ink);
    --fh-edge: var(--fh-ink);
    --fh-line: var(--fh-ink);
  }
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

body.fh-page { overflow-wrap: anywhere; }
.fh-page a.back { display: inline-flex; align-items: center; min-height: 44px; }
.fh-view, .fh-section { min-width: 0; max-width: 100%; }
.fh-section > h2 { font-size: 1.35rem; margin-top: 1rem; }
.fh-section h2:focus, .fh-section h3:focus, .fh-section h4:focus, .fh-section h5:focus, .fh-section p:focus, .fh-section li:focus { outline: none; }
.fh-section h2:focus-visible, .fh-section h3:focus-visible, .fh-section h4:focus-visible, .fh-section h5:focus-visible,
.fh-section p:focus-visible, .fh-section li:focus-visible { outline: 3px solid var(--fh-ring); outline-offset: 3px; border-radius: 4px; }
.fh-section h3 { font-size: 1.12rem; margin: 1.6rem 0 .5rem; }
.fh-section h4 { font-size: 1rem; margin: 1.1rem 0 .35rem; }
.fh-section h5 { font-size: .95rem; margin: .9rem 0 .25rem; }
.fh-section a { color: var(--fh-link); }
.fh-section a:focus-visible, .fh-section button:focus-visible, .fh-section select:focus-visible,
.fh-section input:focus-visible, .fh-section textarea:focus-visible, .fh-section summary:focus-visible, .fh-tablewrap:focus-visible,
.fh-nav a:focus-visible, .fh-dialog button:focus-visible, .fh-dialog a:focus-visible, .fh-dialog summary:focus-visible {
  outline: 3px solid var(--fh-ring); outline-offset: 2px;
}

/* The live region stays rendered when empty (display:none would drop it from
 * the accessibility tree, and a message set a moment later might never be
 * spoken); it only collapses its look. */
.fh-status { padding: .6rem .9rem; border-radius: 10px; background: var(--fh-flag-bg); color: var(--fh-flag-ink); margin: .6rem 0; }
.fh-status.err { background: #ffe3e3; color: #8a1f1f; }
@media (prefers-color-scheme: dark) { .fh-status.err { background: #401b1b; color: #ffb4b4; } }
.fh-status:empty, .fh-status.err:empty { padding: 0; margin: 0; background: transparent; }

.fh-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 .4rem; }
.fh-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: .45rem .85rem;
  border: 1px solid var(--fh-line); border-radius: 999px; background: var(--fh-surface);
  color: var(--fh-ink); text-decoration: none; font-weight: 600;
}
.fh-nav a[aria-current="page"] { background: var(--fh-green); border-color: var(--fh-green); color: #fff; }
@media (prefers-color-scheme: dark) { .fh-nav a[aria-current="page"] { background: #1f7a49; border-color: #2e9e62; } }

.fh-btn, .fh-tool, .fh-pick, .fh-pickperson {
  font: inherit; font-weight: 600; min-height: 44px; padding: .5rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--fh-green); background: var(--fh-green); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
a.fh-btn { color: #fff; }
.fh-btn.quiet, .fh-tool, .fh-pick, .fh-pickperson { background: var(--fh-surface); color: var(--fh-ink); border-color: var(--fh-line); }
a.fh-btn.quiet, a.fh-pick { color: var(--fh-ink); }
.fh-btn.danger { color: #9b1c1c; border-color: #c0392b; }
@media (prefers-color-scheme: dark) { .fh-btn.danger { color: #ff9c8f; border-color: #7a2c22; } }
.fh-btn[aria-disabled="true"], .fh-pickperson[aria-disabled="true"] { opacity: .6; cursor: default; }
.fh-pick[aria-pressed="true"], .fh-pick[aria-current] { background: var(--fh-green); border-color: var(--fh-green); color: #fff; }
a.fh-pick[aria-current] { color: #fff; }
.fh-pickperson { text-align: left; justify-content: flex-start; width: 100%; font-weight: 500; }
.fh-linkbtn { font: inherit; background: none; border: 0; padding: .35rem 0; min-height: 44px; color: var(--fh-link); text-decoration: underline; cursor: pointer; text-align: left; }
.fh-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.fh-small { font-size: .9rem; color: var(--fh-soft); }
a.fh-small { color: var(--fh-link); }
.fh-lead { font-size: 1.08rem; font-weight: 600; margin: .2rem 0 .5rem; }
.fh-note { color: var(--fh-soft); }
.fh-lifespan { font-size: 1.05rem; color: var(--fh-soft); margin-top: -.2rem; }
.fh-pretext { white-space: pre-line; }

/* ── start ── */
.fh-hero { padding: 1rem 1.2rem; }
.fh-hello { font-size: 1.05rem; margin: 0; }
.fh-headline { font-size: 1.45rem; font-weight: 700; line-height: 1.25; margin: .2rem 0 .5rem; }
.fh-faces { list-style: none; padding: 0; margin: .8rem 0 .2rem; display: flex; flex-wrap: wrap; gap: .6rem .8rem; }
.fh-faces a { display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 64px; text-decoration: none; color: var(--fh-ink); }
.fh-facename { font-size: .85rem; font-weight: 600; }
.fh-portrait { margin: .8rem 0 0; }
.fh-portrait-img { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; }
.fh-portrait figcaption { margin-top: .35rem; color: var(--fh-soft); }
.fh-news { font-weight: 600; }
.fh-cards { list-style: none; padding: 0; margin: .4rem 0 1rem; display: grid; grid-template-columns: 1fr; gap: .6rem; }
@media (min-width: 640px) { .fh-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.fh-featured h4 { margin-top: 0; }
.fh-featured-img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; background: var(--fh-sunk); }

.fh-big { display: grid; grid-template-columns: 1fr; gap: .6rem; margin: 1rem 0; }
@media (min-width: 560px) { .fh-big { grid-template-columns: 1fr 1fr; } }
a.fh-bigbtn, .fh-bigbtn {
  display: block; min-height: 72px; padding: .9rem 1.1rem; border-radius: 14px; text-decoration: none;
  background: var(--fh-green); color: #fff;
}
.fh-bigbtn strong { display: block; font-size: 1.15rem; }
.fh-bigbtn small { display: block; opacity: .92; margin-top: .15rem; }
a.fh-bigbtn:focus-visible { outline: 3px solid var(--fh-ring); outline-offset: 2px; }
.fh-bigbtn.is-off { background: var(--fh-sunk); color: var(--fh-soft); border: 1px dashed var(--fh-line); }

ul.fh-list { padding-left: 1.2rem; margin: .3rem 0 .6rem; }
ul.fh-list li, ol.fh-list li { margin: .3rem 0; }
.fh-stories { padding-left: 1.2rem; }
.fh-stories li { margin: .5rem 0; font-size: 1.05rem; }

/* ── people in lists ── */
.fh-people { list-style: none; padding: 0; margin: .3rem 0 .8rem; }
.fh-personrow { display: flex; align-items: flex-start; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--fh-line); }
.fh-personrow:last-child { border-bottom: 0; }
.fh-personrow-text { flex: 1; min-width: 0; padding-top: .25rem; }
.fh-personrow > a.fh-small { align-self: center; padding: .6rem 0; }
.fh-years { color: var(--fh-soft); }
.fh-face {
  flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--fh-sunk);
  border: 2px solid var(--fh-none);
}
.fh-face.is-big { width: 72px; height: 72px; border-width: 3px; }
.fh-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; color: var(--fh-ink); background: var(--fh-none-bg); }
.fh-face.is-big.fh-initials { font-size: 1.4rem; }
.fh-face.side-father { border-color: var(--fh-father); }
.fh-face.side-mother { border-color: var(--fh-mother); }
.fh-face.side-both { border-color: var(--fh-both); }
.fh-face.side-marriage { border-color: var(--fh-marriage); border-style: dashed; }
.fh-face.side-self { border-color: var(--fh-self); }
.fh-face.side-descendant { border-color: var(--fh-descendant); }
.fh-face.side-research { border-color: var(--fh-research); border-style: dotted; }
.fh-initials.side-father { background: var(--fh-father-bg); }
.fh-initials.side-mother { background: var(--fh-mother-bg); }
.fh-initials.side-both { background: var(--fh-both-bg); }
.fh-initials.side-marriage { background: var(--fh-marriage-bg); }
.fh-initials.side-self { background: var(--fh-self-bg); }
.fh-initials.side-descendant { background: var(--fh-descendant-bg); }
.fh-initials.side-research { background: var(--fh-research-bg); }
.fh-personrow.is-unknown .fh-personrow-text { color: var(--fh-soft); }

/* The Research pill and the proof words */
.fh-pill {
  display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; font-weight: 700; line-height: 1.2;
  padding: .15rem .55rem; border-radius: 999px; border: 2px dotted var(--fh-research); background: var(--fh-research-bg); color: var(--fh-ink);
  vertical-align: baseline; white-space: nowrap;
}
.fh-pillicon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.fh-proof { margin: .35rem 0; }
.fh-proof.is-proven { display: inline-block; font-weight: 700; font-size: .9rem; padding: .15rem .7rem; border-radius: 999px; background: var(--fh-proven-bg); color: var(--fh-proven-ink); }

/* ── tree ── */
.fh-skip { margin: .3rem 0; font-size: .92rem; }
.fh-treebar { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: flex-end; margin: .6rem 0; }
.fh-toolgroup { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: flex-end; }
.fh-tool { min-width: 44px; padding: .4rem .7rem; font-size: 1.05rem; }
.fh-field { display: inline-flex; flex-direction: column; font-size: .85rem; gap: .15rem; }
.fh-field.fh-inline { flex-direction: row; align-items: center; gap: .5rem; font-size: 1rem; }
.fh-field select { font: inherit; font-size: 1rem; min-height: 44px; padding: .3rem .5rem; border-radius: 10px; border: 1px solid var(--fh-line); background: var(--fh-surface); color: var(--fh-ink); }
/* Only sideways scrolling is held inside the frame (so a swipe cannot turn
 * into Back on an iPhone); at the top or bottom edge the page scrolls on. */
.fh-treeframe {
  position: relative; overflow: auto; max-width: 100%; height: min(68vh, 640px); min-height: 280px;
  border: 1px solid var(--fh-line); border-radius: 14px; background: var(--fh-sunk);
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
@media (max-width: 560px) { .fh-treeframe { height: min(55vh, 460px); } }
.fh-chart { display: block; }
.fh-chart text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; fill: var(--fh-ink); }
.fh-chart .fh-name { font-size: 14px; font-weight: 700; }
.fh-chart .fh-years { font-size: 12.5px; fill: var(--fh-soft); }
.fh-chart .fh-rel { font-size: 12.5px; }
.fh-chart .fh-tag { font-size: 11px; font-weight: 700; letter-spacing: .02em; fill: var(--fh-soft); }
.fh-edge { fill: none; stroke: var(--fh-edge); stroke-width: 2; }
.fh-edge.kind-step { stroke-dasharray: 7 5; }
.fh-edge.kind-probable { stroke: var(--fh-research); stroke-dasharray: 1.5 4.5; stroke-linecap: round; stroke-width: 2.6; }
.fh-edge.kind-couple { stroke-width: 3; }
.fh-lineswatch { vertical-align: middle; }

.fh-box .fh-boxbg { fill: var(--fh-none-bg); stroke: var(--fh-none); stroke-width: 1.5; }
.fh-box .fh-boxbar { fill: var(--fh-none); }
.fh-box .fh-ring { fill: none; stroke: none; stroke-width: 4; }
.fh-boxlink { cursor: pointer; }
.fh-boxlink:focus { outline: none; }
.fh-boxlink:focus-visible .fh-ring, .fh-boxlink:hover .fh-ring { stroke: var(--fh-ring); }
.fh-boxlink:focus-visible .fh-ring { stroke-width: 5; }
.fh-box.cat-self .fh-boxbg { fill: var(--fh-self-bg); stroke: var(--fh-self); stroke-width: 4; }
.fh-box.cat-self .fh-boxbar { fill: var(--fh-self); }
.fh-box.cat-father .fh-boxbg { fill: var(--fh-father-bg); stroke: var(--fh-father); stroke-width: 2; }
.fh-box.cat-father .fh-boxbar { fill: var(--fh-father); }
.fh-box.cat-mother .fh-boxbg { fill: var(--fh-mother-bg); stroke: var(--fh-mother); stroke-width: 2; }
.fh-box.cat-both .fh-boxbg { fill: var(--fh-both-bg); stroke: var(--fh-both); stroke-width: 2; }
.fh-box.cat-marriage .fh-boxbg { fill: var(--fh-marriage-bg); stroke: var(--fh-marriage); stroke-width: 2; stroke-dasharray: 7 4; }
.fh-box.cat-marriage .fh-boxbar { fill: var(--fh-marriage); }
.fh-box.cat-research .fh-boxbg { fill: var(--fh-research-bg); stroke: var(--fh-research); stroke-width: 2.6; stroke-dasharray: 1.5 4; stroke-linecap: round; }
.fh-box.cat-descendant .fh-boxbg { fill: var(--fh-descendant-bg); stroke: var(--fh-descendant); stroke-width: 2; }
.fh-box.cat-blood .fh-boxbg { fill: var(--fh-blood-bg); stroke: var(--fh-blood); stroke-width: 2; }
.fh-box.cat-blood .fh-boxbar { fill: var(--fh-blood); }
.fh-box.cat-mother .fh-boxbar { fill: url(#fh-pat-mother); }
.fh-box.cat-both .fh-boxbar { fill: url(#fh-pat-both); }
.fh-box.cat-descendant .fh-boxbar { fill: url(#fh-pat-descendant); }
.fh-box.cat-research .fh-boxbar { fill: url(#fh-pat-research); }
.fh-box.is-focus .fh-boxbg { stroke-width: 4.5; filter: drop-shadow(0 2px 5px rgba(0,0,0,.25)); }
.fh-box.is-repeat .fh-boxbg { opacity: .8; }
.fh-pat-bg.cat-mother { fill: var(--fh-mother-bg); }
.fh-pat-ink.cat-mother { fill: var(--fh-mother); }
.fh-pat-bg.cat-both { fill: var(--fh-both-bg); }
.fh-pat-ink.cat-both { fill: var(--fh-both); }
.fh-pat-bg.cat-descendant { fill: var(--fh-descendant-bg); }
.fh-pat-ink.cat-descendant { fill: var(--fh-descendant); }
.fh-pat-bg.cat-research { fill: var(--fh-research-bg); }
.fh-pat-ink.cat-research { fill: var(--fh-research); }
.fh-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.fh-centre { cursor: pointer; }
.fh-centre .fh-centrehit { fill: none; stroke: none; }
.fh-centre .fh-centrebg { fill: var(--fh-surface); stroke: var(--fh-edge); stroke-width: 1.5; }
.fh-centre .fh-centreink { fill: none; stroke: var(--fh-ink); stroke-width: 2; }
.fh-centre:hover .fh-centrebg, .fh-centre:focus-visible .fh-centrebg { stroke: var(--fh-ring); stroke-width: 4; }
.fh-centre:focus { outline: none; }

.fh-legendbox { margin: .7rem 0; }
.fh-legendbox summary, .fh-more > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.fh-legend { list-style: none; padding: 0; margin: .4rem 0; display: grid; grid-template-columns: 1fr; gap: .35rem; }
@media (min-width: 560px) { .fh-legend { grid-template-columns: 1fr 1fr; } }
.fh-legend li { display: flex; align-items: center; gap: .5rem; }
.fh-legend svg { flex: none; }

.fh-textversion { margin-top: 1.4rem; padding-top: .4rem; border-top: 2px solid var(--fh-line); }

/* ── the family sky (sky.js): decoration, hidden from screen readers ──
 * Always a dusk sky (the site's navy and lamp amber), in light mode too.
 * Its height is set before anything loads, so the page never shifts; if the
 * drawing cannot load, this plain sky stays. Its one line of words sits on a
 * solid strip, never on the drawing, and shows only once the lights are
 * drawn. It steps aside wherever the paintings do (history.js leaves it out
 * at those times; this is the backstop), and the key's sentence about it
 * goes with it.
 * Where it goes: in a wide, tall window it sits above the chart, and leaves
 * about 35rem of the window for the heading, the sections, the chart's
 * buttons and the site's tab bar, so those buttons are in view on arrival.
 * On a phone, or a window too short for a 200px sky above the buttons,
 * history.js puts it after the chart frame instead, at its full height. */
.fh-sky {
  display: flex; flex-direction: column; margin: .8rem 0 .7rem; overflow: hidden;
  height: 240px; /* for browsers without clamp() (iOS before 13.4) */
  height: clamp(180px, 50vw, 380px); max-height: max(200px, min(46vh, 100vh - 35rem));
  border: 1px solid #2b3466; border-radius: 16px;
  background:
    radial-gradient(70% 55% at 50% 108%, rgba(255, 183, 92, .30) 0%, rgba(255, 183, 92, 0) 70%),
    radial-gradient(120% 95% at 50% 100%, #3a3160 0%, #1c2452 48%, #0b1130 100%);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.fh-treeframe ~ .fh-sky { max-height: max(180px, 46vh); }
.fh-skystage { position: relative; flex: 1; min-height: 0; }
/* Once the lights are drawn, one finger scrolls the page up and down or
 * turns the sky, and two fingers always zoom the page, as they do everywhere
 * else. Until then (or if they never draw) a touch here does what it does
 * anywhere on the page, and so it does while the page is zoomed in (sky.js
 * sets touch-action: auto then). */
.fh-skycanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; }
.fh-sky.is-drawn .fh-skycanvas { touch-action: pan-y pinch-zoom; }
.fh-skyhint { margin: 0; padding: .4rem .85rem; background: #0a0f24; color: #d7ddf6; font-size: .85rem; line-height: 1.35; }
.fh-sky:not(.is-drawn) .fh-skyhint { visibility: hidden; }
.fh-skynote { margin: .5rem 0 .2rem; }
@media (prefers-color-scheme: light) { .fh-sky { box-shadow: 0 8px 24px rgba(16, 22, 58, .2); } }
@media (forced-colors: active), (prefers-contrast: more), (prefers-reduced-data: reduce), (max-width: 22.5em), (max-height: 30em), print {
  .fh-sky, .fh-skynote { display: none !important; }
}
/* A lit star gives the same person's box in the chart a soft amber wash and
 * glow, and their line in the text version a highlight. It is never a crisp
 * solid ring, so it cannot pass for the keyboard focus ring, which stays on
 * top when a box is both. */
.fh-box.is-lit .fh-ring { fill: var(--fh-ring); fill-opacity: .18; stroke: var(--fh-ring); stroke-opacity: .35; stroke-width: 9; }
.fh-box.is-lit .fh-boxlink:focus-visible .fh-ring { stroke-opacity: 1; stroke-width: 5; }
.fh-personrow.is-lit { background: var(--fh-flag-bg); box-shadow: -.5rem 0 0 var(--fh-flag-bg), .5rem 0 0 var(--fh-flag-bg); border-radius: 6px; }

/* ── person ── */
.fh-personhead { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin: .6rem 0; }
.fh-personhead .fh-headpic { width: 180px; max-width: 45vw; }
.fh-personhead .fh-headpic img { aspect-ratio: 4 / 5; }
.fh-personfacts { flex: 1; min-width: 14rem; }
.fh-more { margin: .8rem 0; border-top: 1px solid var(--fh-line); padding-top: .2rem; }
.fh-more > summary { font-size: 1.05rem; }
.fh-relation { background: var(--fh-surface); border: 1px solid var(--fh-line); border-radius: 14px; padding: .4rem 1.1rem .8rem; margin: 1rem 0; }
.fh-relation h3 { margin-top: .6rem; }
.fh-sidetag { display: inline-block; font-weight: 700; font-size: .9rem; padding: .15rem .65rem; border-radius: 999px; border: 2px solid var(--fh-none); background: var(--fh-none-bg); }
.fh-sidetag.side-father { border-color: var(--fh-father); background: var(--fh-father-bg); }
.fh-sidetag.side-mother { border-color: var(--fh-mother); background: var(--fh-mother-bg); }
.fh-sidetag.side-both { border-color: var(--fh-both); background: var(--fh-both-bg); }
.fh-sidetag.side-marriage { border-color: var(--fh-marriage); background: var(--fh-marriage-bg); border-style: dashed; }
.fh-sidetag.side-research { border-color: var(--fh-research); background: var(--fh-research-bg); border-style: dotted; }
.fh-sidetag.side-descendant { border-color: var(--fh-descendant); background: var(--fh-descendant-bg); }
.fh-chain { list-style: none; padding: 0; margin: .6rem 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: stretch; }
.fh-chain li { display: flex; align-items: center; gap: .35rem; font-size: .92rem; max-width: 100%; }
.fh-chain li { background: var(--fh-sunk); border: 1px solid var(--fh-line); border-radius: 10px; padding: .3rem .6rem; }
.fh-chain li.fh-chain-start { font-weight: 700; background: var(--fh-self-bg); border-color: var(--fh-self); }
.fh-chain li + li::before { content: "→"; content: "→" / ""; font-weight: 700; color: var(--fh-soft); margin-right: .15rem; }

.fh-warn { background: var(--fh-warn-bg); color: var(--fh-warn-ink); border-left: 5px solid currentColor; border-radius: 8px; padding: .55rem .8rem; }
.fh-flagnote { background: var(--fh-flag-bg); color: var(--fh-flag-ink); border-left: 5px dotted currentColor; border-radius: 8px; padding: .45rem .8rem; }

dl.fh-fields { display: grid; grid-template-columns: 1fr; gap: 0; margin: .5rem 0; }
dl.fh-fields > div { display: grid; grid-template-columns: 1fr; padding: .35rem 0; border-bottom: 1px solid var(--fh-line); }
dl.fh-fields dt { font-weight: 600; color: var(--fh-soft); font-size: .9rem; }
dl.fh-fields dd { margin: 0; }
@media (min-width: 520px) {
  dl.fh-fields > div { grid-template-columns: minmax(8rem, 36%) 1fr; gap: .8rem; }
  dl.fh-fields dt { font-size: inherit; }
}

.fh-timeline { padding-left: 0; list-style: none; margin: .4rem 0; border-left: 3px solid var(--fh-line); }
.fh-timeline li { position: relative; padding: .35rem 0 .45rem .9rem; }
.fh-timeline li::before { content: ""; position: absolute; left: -7px; top: .8rem; width: 11px; height: 11px; border-radius: 50%; background: var(--fh-green); }
.fh-when { display: inline-block; min-width: 4.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fh-sources { display: inline; }

.chip {
  display: inline-flex; align-items: center; font: inherit; font-size: .78rem; font-weight: 700; line-height: 1.2;
  padding: .2rem .55rem; margin: 0 .1rem; border-radius: 999px; border: 1px solid var(--fh-line);
  background: var(--fh-sunk); color: var(--fh-ink); vertical-align: baseline; cursor: default;
}
button.chip { cursor: pointer; min-height: 44px; padding: .35rem .75rem; margin: .15rem .1rem; }
/* In a story's lines a source number stays small to see; its tap area is
 * still 44px, drawn around it without moving the words. */
.fh-story button.chip { min-height: 0; padding: .05rem .45rem; margin: 0 .1rem; position: relative; vertical-align: super; font-size: .72rem; }
.fh-story button.chip::after { content: ""; position: absolute; inset: -14px -8px; }

.fh-record, .fh-memorial, .fh-finding, .fh-account, .fh-notecard { overflow-wrap: anywhere; }
.fh-record.is-wrong, .fh-memorial.is-wrong { border-color: #c2410c !important; border-width: 2px !important; border-style: dashed !important; }
.fh-record h4, .fh-memorial h4 { margin-top: 0; font-size: 1.02rem; }
.fh-recname { font-weight: 600; margin: .1rem 0 .3rem; }
.fh-cite { color: var(--fh-soft); }
.fh-tablewrap { overflow-x: auto; max-width: 100%; margin: .6rem 0; border-radius: 8px; }
.fh-tablewrap table { margin: 0; min-width: 18rem; }
.fh-tablewrap caption { text-align: left; font-weight: 700; padding: .3rem 0; }
.fh-tablewrap tbody th { font-weight: 600; background: transparent; }
.fh-inscription { margin: .6rem 0; }
.fh-inscription figcaption { font-weight: 600; color: var(--fh-soft); font-size: .9rem; }
.fh-inscription blockquote { margin: .2rem 0; padding: .5rem .8rem; border-left: 4px solid var(--fh-line); font-style: italic; white-space: pre-line; }
.fh-bio { white-space: pre-line; }

/* ── pictures ── */
.fh-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .5rem 0 1rem; }
@media (min-width: 560px) { .fh-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; } }
.fh-grid > li { min-width: 0; }
.fh-thumb {
  font: inherit; display: flex; flex-direction: column; gap: .3rem; padding: .35rem; cursor: pointer; text-align: left; width: 100%; height: 100%;
  border: 1px solid var(--fh-line); border-radius: 12px; background: var(--fh-surface); color: var(--fh-ink); min-width: 0;
}
.fh-thumb img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: var(--fh-sunk); }
.fh-thumbtext {
  font-size: .8rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.fh-thumb:hover, .fh-doclink:hover { border-color: var(--fh-link); }
.fh-doclink {
  font: inherit; display: flex; flex-direction: column; justify-content: center; gap: .25rem; padding: .6rem; cursor: pointer; text-align: left; width: 100%;
  min-height: 7rem; height: 100%; border: 1px dashed var(--fh-line); border-radius: 12px; background: var(--fh-sunk); color: var(--fh-ink); min-width: 0;
}
.fh-docicon { font-size: 1.6rem; line-height: 1; }
.fh-doclink:focus-visible, .fh-thumb:focus-visible { outline: 3px solid var(--fh-ring); outline-offset: 2px; }
.fh-scan .fh-thumb { max-width: 220px; }
.fh-scan .fh-thumb img { aspect-ratio: 4 / 3; }
.fh-nopic { display: block; font-size: .85rem; color: var(--fh-soft); padding: .5rem; }
.fh-pager { margin: 1rem 0; }

.fh-dialog { width: min(96vw, 1000px); max-width: 96vw; max-height: 94vh; padding: 0; border: 1px solid var(--fh-line); border-radius: 14px; background: var(--fh-surface); color: var(--fh-ink); }
.fh-dialog::backdrop { background: rgba(10, 12, 16, .72); }
.fh-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--fh-line); }
.fh-dialog-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.1rem; }
.fh-dialog-head > button { flex: 0 0 auto; white-space: nowrap; }
.fh-dialog-head h2:focus { outline: none; }
.fh-dialog-head h2:focus-visible { outline: 3px solid var(--fh-ring); outline-offset: 3px; }
.fh-dialog-body { padding: .6rem; text-align: center; background: var(--fh-sunk); }
.fh-full { max-width: 100%; max-height: 66vh; height: auto; }
.fh-viewer-doc { text-align: left; padding: .4rem .6rem; }
.fh-dialog .fh-actions, .fh-dialog .fh-restoredline, .fh-dialog .fh-viewer-info, .fh-dialog .fh-status { margin-left: .9rem; margin-right: .9rem; }
.fh-dialog .fh-viewer-actions { padding-bottom: .9rem; }
.fh-viewer-pos { font-weight: 600; min-width: 5rem; text-align: center; }
.fh-restoredline { background: var(--fh-flag-bg); color: var(--fh-flag-ink); border-radius: 8px; padding: .45rem .8rem; }
.fh-restoredline .fh-btn { margin-left: .3rem; }
.fh-viewer-info h3 { font-size: 1rem; margin: .8rem 0 .3rem; }

/* ── people ── */
.fh-search { margin: .6rem 0; }
.fh-search label { display: block; font-weight: 700; }
.fh-search .fh-small { margin: .1rem 0 .4rem; }
.fh-searchrow { display: flex; gap: .5rem; }
.fh-searchrow input { flex: 1; min-width: 0; font: inherit; min-height: 44px; padding: .5rem .7rem; border-radius: 10px; border: 1px solid var(--fh-line); background: var(--fh-surface); color: var(--fh-ink); }
.fh-picker { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .6rem; }
.fh-finder { margin-top: .5rem; }

/* ── stories and Listen ── */
.fh-story { font-size: 1.06rem; line-height: 1.65; }
.fh-story blockquote { margin: .8rem 0; padding: .4rem .9rem; border-left: 4px solid var(--fh-line); color: var(--fh-soft); }
.fh-story pre { white-space: pre-wrap; background: var(--fh-sunk); padding: .6rem; border-radius: 8px; }
.fh-story img { max-width: 100%; }
.fh-story .fh-reading { background: var(--fh-reading-bg); box-shadow: -.5rem 0 0 var(--fh-reading-bg), .5rem 0 0 var(--fh-reading-bg), -.5rem 0 0 .2rem var(--fh-green); border-radius: 4px; }
::highlight(fh-cue) { background-color: var(--fh-cue-bg); color: var(--fh-cue-ink); }
.fh-sourcelist li:focus-visible { outline: 3px solid var(--fh-ring); outline-offset: 2px; }
.fh-listen { padding: .6rem 1rem .8rem; margin: 1rem 0; border: 2px solid var(--fh-green); background: var(--fh-surface); }
.fh-listen h3 { margin-top: .3rem; }
.fh-listen .fh-actions + .fh-actions { margin-top: .5rem; }
.fh-listen.is-playing { position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
@media (max-width: 560px) { .fh-listen.is-playing > .fh-small, .fh-listen.is-playing .fh-check { display: none; } }
.fh-play { min-width: 6.5rem; }
.fh-listen-part { font-weight: 600; }
.fh-check { display: flex; align-items: center; gap: .5rem; min-height: 44px; margin: .3rem 0 0; }
.fh-check input { width: 1.25rem; height: 1.25rem; }
/* The caption: the sentence being read, on a solid panel, two lines at most. */
.fh-caption {
  margin: .6rem 0 0; padding: .5rem .8rem; min-height: 1.4em; border-radius: 10px; background: var(--fh-ink); color: var(--fh-surface);
  font-size: 1.1rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fh-caption:empty { display: none; }

.fh-mysteries { margin-top: 1.4rem; }

/* ── notes ── */
.fh-noteform label { display: block; font-weight: 700; }
.fh-noteform textarea { display: block; width: 100%; box-sizing: border-box; font: inherit; padding: .6rem .7rem; border-radius: 10px; border: 1px solid var(--fh-line); background: var(--fh-surface); color: var(--fh-ink); }
.fh-note-about { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-start; margin: .6rem 0; }
.fh-note-about .fh-thumb { max-width: 180px; }
.fh-note-pic { max-width: 180px; border-radius: 10px; }
.fh-notecard h4 { margin-top: 0; }
.fh-account.is-asking { border-left: 5px dotted var(--fh-research); }

@media (prefers-reduced-motion: no-preference) {
  .fh-thumb, .fh-btn, .fh-tool, .fh-nav a { transition: border-color .15s ease, background-color .15s ease; }
}

@media (prefers-contrast: more) {
  .fh-box .fh-boxbg { stroke-width: 3; }
  .fh-box.cat-research .fh-boxbg, .fh-box.cat-marriage .fh-boxbg { stroke-width: 3.5; }
  .fh-edge { stroke-width: 2.6; }
  .fh-chart .fh-years, .fh-chart .fh-tag { fill: var(--fh-ink); }
  .fh-nav a, .fh-thumb, .fh-chain li, .chip, .fh-pill, .fh-face { border-width: 2px; }
  .fh-face.is-big { border-width: 4px; }
}

@media (forced-colors: active) {
  .fh-box .fh-boxbg, .fh-box .fh-boxbar, .fh-pat-bg, .fh-centre .fh-centrebg { fill: Canvas; stroke: CanvasText; }
  .fh-pat-ink, .fh-box.cat-father .fh-boxbar, .fh-box.cat-self .fh-boxbar { fill: CanvasText; }
  .fh-chart text { fill: CanvasText; }
  .fh-edge { stroke: CanvasText; }
  .fh-centre .fh-centreink { stroke: CanvasText; }
  .fh-boxlink:focus-visible .fh-ring, .fh-centre:focus-visible .fh-centrebg { stroke: Highlight; }
  .fh-nav a[aria-current="page"], .fh-pick[aria-pressed="true"], .fh-pick[aria-current] { border: 3px solid Highlight; }
  .fh-pill, .fh-face, .fh-proof.is-proven { border: 2px solid CanvasText; }
  .fh-pillicon { stroke: CanvasText; }
  .fh-caption { background: Canvas; color: CanvasText; border: 2px solid CanvasText; }
  .fh-story .fh-reading { box-shadow: none; outline: 2px solid Highlight; }
  ::highlight(fh-cue) { background-color: Highlight; color: HighlightText; }
}
