/* Heritage Tree viewer. Colors are variables so a theme can override them. */
.ht-app {
	font-size: 1rem;
	--ht-ink: #1f2a2e;
	--ht-muted: #5c686c;
	--ht-paper: #ffffff;
	--ht-wash: #edf1ee;
	--ht-edge: #d3dad6;
	--ht-line: #9fada8;
	--ht-accent: #2f5d50;
	--ht-accent-wash: #e2ece6;
	--ht-m: #45657f;
	--ht-f: #8d5a70;
	--ht-u: #a3aba8;
	--ht-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--ht-gap: 2.5rem;
	color: var(--ht-ink);
	line-height: 1.45;
	margin: 1.5rem 0;
}
.ht-app *, .ht-app *::before, .ht-app *::after { box-sizing: border-box; }
.ht-app button { font: inherit; color: inherit; cursor: pointer; }
.ht-app a { color: var(--ht-accent); }
.ht-app :focus-visible { outline: 2px solid var(--ht-accent); outline-offset: 2px; }

/* Top bar */
.ht-bar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.ht-search { position: relative; flex: 1 1 18rem; max-width: 30rem; }
.ht-search-input { width: 100%; padding: .6rem .8rem; border: 1px solid var(--ht-edge); border-radius: 4px; background: var(--ht-paper); color: var(--ht-ink); font: inherit; }
.ht-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .25rem 0; list-style: none; background: var(--ht-paper); border: 1px solid var(--ht-edge); border-radius: 4px; box-shadow: 0 6px 20px rgba(31, 42, 46, .12); max-height: 22rem; overflow-y: auto; }
.ht-results li { display: flex; flex-direction: column; padding: .4rem .8rem; border-left: 3px solid transparent; cursor: pointer; }
.ht-results li.is-active { background: var(--ht-accent-wash); border-left-color: var(--ht-accent); }
.ht-results .ht-r-name { font-family: var(--ht-serif); font-size: 1rem; font-weight: 600; }
.ht-results .ht-r-meta { font-size: .82rem; color: var(--ht-muted); }
.ht-results .ht-noresult { color: var(--ht-muted); cursor: default; font-size: .9rem; }
.ht-views { display: inline-flex; border: 1px solid var(--ht-edge); border-radius: 4px; overflow: hidden; background: var(--ht-paper); }
.ht-views button { border: 0; background: transparent; padding: .5rem .9rem; font-size: .92rem; }
.ht-views button + button { border-left: 1px solid var(--ht-edge); }
.ht-views button[aria-pressed="true"] { background: var(--ht-accent); color: #fff; }

.ht-stage { min-height: 12rem; transition: opacity .15s; }
.ht-stage.is-loading { opacity: .45; }
.ht-message { padding: 2rem 0; color: var(--ht-muted); }
.ht-muted, .ht-none { color: var(--ht-muted); }
.ht-none { font-size: .9rem; margin: .25rem 0; }

/* Person card */
.ht-card { display: flex; flex-direction: column; width: 14rem; padding: .45rem .7rem .5rem; background: var(--ht-paper); border: 1px solid var(--ht-edge); border-left: 3px solid var(--ht-u); border-radius: 3px; color: var(--ht-ink); text-decoration: none; line-height: 1.25; }
.ht-app a.ht-card { color: var(--ht-ink); text-decoration: none; }
.ht-app a.ht-card:hover { border-color: var(--ht-accent); border-left-color: var(--ht-accent); }
.ht-card.ht-sex-M { border-left-color: var(--ht-m); }
.ht-card.ht-sex-F { border-left-color: var(--ht-f); }
.ht-card.is-current { background: var(--ht-accent-wash); }
.ht-card.is-small { width: 12.5rem; }
.ht-card.is-empty { border-style: dashed; border-left-width: 1px; border-left-style: dashed; background: transparent; }
.ht-card.is-empty .ht-name, .ht-card.is-private .ht-name { font-weight: 400; font-style: italic; color: var(--ht-muted); }
.ht-name { font-family: var(--ht-serif); font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.ht-card.is-small .ht-name { font-size: .93rem; }
.ht-years { font-size: .8rem; color: var(--ht-muted); font-variant-numeric: tabular-nums; }
.ht-place { font-size: .78rem; color: var(--ht-muted); }

/* Chart frame */
.ht-caption { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; justify-content: space-between; margin-bottom: .5rem; }
.ht-caption-title { font-family: var(--ht-serif); font-size: 1.3rem; font-weight: 400; margin: 0; }
.ht-caption-title a { font-weight: 600; text-decoration: none; }
.ht-zoom { display: inline-flex; border: 1px solid var(--ht-edge); border-radius: 4px; background: var(--ht-paper); }
.ht-zoom button { border: 0; background: transparent; padding: .25rem .65rem; min-width: 2.2rem; }
.ht-zoom button + button { border-left: 1px solid var(--ht-edge); }
.ht-canvas { overflow: auto; max-height: 78vh; background: var(--ht-wash); border-radius: 4px; cursor: grab; touch-action: pan-x pan-y; }
.ht-canvas.is-dragging { cursor: grabbing; user-select: none; }
.ht-canvas-inner { display: inline-block; min-width: 100%; padding: 1.5rem; }

/* Ancestor chart: one column per generation, brackets drawn with pseudo-elements. */
.ht-pedigree { display: grid; column-gap: var(--ht-gap); row-gap: 0; }
.ht-slot { position: relative; display: flex; align-items: center; padding: .2rem 0; }
.ht-slot.has-parents::after { content: ""; position: absolute; right: calc(var(--ht-gap) / -2); width: calc(var(--ht-gap) / 2); top: 50%; border-top: 1.5px solid var(--ht-line); }
.ht-slot.is-father::before,
.ht-slot.is-mother::before { content: ""; position: absolute; left: calc(var(--ht-gap) / -2); width: calc(var(--ht-gap) / 2); border-left: 1.5px solid var(--ht-line); }
.ht-slot.is-father::before { top: 50%; bottom: 0; border-top: 1.5px solid var(--ht-line); }
.ht-slot.is-mother::before { top: 0; bottom: 50%; border-bottom: 1.5px solid var(--ht-line); }
.ht-slot.is-root .ht-card { width: 15rem; }
.ht-slot.is-root .ht-name { font-size: 1.1rem; }
.ht-more { position: absolute; right: -1.9rem; top: 50%; transform: translateY(-50%); width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--ht-edge); background: var(--ht-paper); text-decoration: none; font-size: 1.1rem; line-height: 1; }
.ht-app a.ht-more:hover { border-color: var(--ht-accent); background: var(--ht-accent-wash); }

/* Descendant chart: left to right and top-aligned, so each person sits level
   with their first child. Names stay on one line to keep rows even. */
.ht-desc { display: inline-block; --ht-dc: 1.85rem; }
.ht-desc .ht-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-d-node { display: flex; align-items: flex-start; }
.ht-d-kids { position: relative; display: flex; flex-direction: column; margin: -.25rem 0 0 2rem; }
.ht-d-kids::before { content: ""; position: absolute; left: -2rem; width: 1rem; top: var(--ht-dc); border-top: 1.5px solid var(--ht-line); }
.ht-d-item { position: relative; padding: .25rem 0 .25rem 1rem; }
.ht-d-item::before { content: ""; position: absolute; left: 0; width: 1rem; top: var(--ht-dc); border-top: 1.5px solid var(--ht-line); }
.ht-d-item::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1.5px solid var(--ht-line); }
.ht-d-item:first-child::after { top: var(--ht-dc); }
.ht-d-item:last-child::after { bottom: auto; height: var(--ht-dc); }
.ht-d-item:only-child::after { display: none; }
.ht-expand, .ht-d-node > .ht-none { align-self: center; }
.ht-spouse { display: flex; align-items: center; gap: .4rem; }
.ht-spouse-label { font-size: .78rem; color: var(--ht-muted); font-style: italic; white-space: nowrap; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.ht-expand { margin-left: .75rem; padding: .3rem .7rem; border: 1px solid var(--ht-edge); border-radius: 3px; background: var(--ht-paper); font-size: .82rem; white-space: nowrap; }
.ht-expand:hover { border-color: var(--ht-accent); }
.ht-d-node > .ht-none { margin-left: .75rem; font-size: .82rem; }

/* Outline */
.ht-outline, .ht-o-sub { list-style: none; margin: 0; padding: 0; }
.ht-o-sub { margin-left: .7rem; padding-left: 1rem; border-left: 1px solid var(--ht-edge); }
.ht-o-row { display: flex; align-items: baseline; gap: .5rem; padding: .18rem 0; }
.ht-o-toggle, .ht-o-leaf { flex: none; width: 1.2rem; height: 1.2rem; }
.ht-o-toggle { position: relative; top: .2rem; border: 1px solid var(--ht-edge); border-radius: 3px; background: var(--ht-paper); padding: 0; }
.ht-o-toggle::before { content: ""; position: absolute; left: 50%; top: 50%; width: .38rem; height: .38rem; border-right: 1.5px solid var(--ht-ink); border-bottom: 1.5px solid var(--ht-ink); transform: translate(-65%, -50%) rotate(-45deg); transition: transform .15s; }
.ht-o-toggle[aria-expanded="true"]::before { transform: translate(-50%, -70%) rotate(45deg); }
.ht-o-toggle.is-loading { opacity: .4; }
.ht-o-name { font-family: var(--ht-serif); font-size: 1rem; font-weight: 600; text-decoration: none; }
.ht-o-name.is-private { font-weight: 400; font-style: italic; color: var(--ht-muted); }
.ht-o-years { font-size: .82rem; color: var(--ht-muted); font-variant-numeric: tabular-nums; margin-left: .35rem; }
.ht-o-spouse { font-size: .9rem; color: var(--ht-muted); padding: .1rem 0 .1rem 1.7rem; }
.ht-o-spouse a { font-family: var(--ht-serif); }
.ht-o-none { font-size: .85rem; color: var(--ht-muted); padding: .1rem 0 .1rem 1.7rem; }

/* Family page */
.ht-family { max-width: 60rem; }
.ht-person-head { border-left: 4px solid var(--ht-u); padding: .1rem 0 .1rem 1.1rem; margin-bottom: 1.75rem; }
.ht-person-head.ht-sex-M { border-left-color: var(--ht-m); }
.ht-person-head.ht-sex-F { border-left-color: var(--ht-f); }
.ht-person-name { font-family: var(--ht-serif); font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 600; line-height: 1.15; margin: 0; }
.ht-person-years { font-size: 1.05rem; color: var(--ht-muted); margin: .2rem 0 .8rem; font-variant-numeric: tabular-nums; }
.ht-vitals { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 .75rem; }
.ht-vitals dt { color: var(--ht-muted); }
.ht-vitals dd { margin: 0; }
.ht-vitals .ht-date { margin-right: .6rem; }
.ht-vitals .ht-where { color: var(--ht-muted); }
.ht-aka, .ht-note { font-size: .9rem; color: var(--ht-muted); margin: .25rem 0 .75rem; }
.ht-jump { display: flex; flex-wrap: wrap; gap: 1.1rem; margin: .5rem 0 0; font-size: .92rem; }
.ht-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.5rem 2.5rem; }
.ht-block { margin-bottom: 1.75rem; }
.ht-block h3 { font-family: var(--ht-serif); font-size: 1.15rem; font-weight: 600; margin: 0 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--ht-edge); }
.ht-block h4 { font-size: .88rem; font-weight: 600; color: var(--ht-muted); margin: .9rem 0 .4rem; }
.ht-couple { display: flex; flex-wrap: wrap; gap: .5rem; }
.ht-union { margin-bottom: 1.25rem; }
.ht-union + .ht-union { padding-top: 1rem; border-top: 1px dashed var(--ht-edge); }
.ht-marriage { font-size: .88rem; color: var(--ht-muted); margin: .35rem 0 0; }
.ht-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.ht-table-wrap { overflow-x: auto; }
.ht-events table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ht-events td { padding: .4rem .6rem .4rem 0; border-bottom: 1px solid var(--ht-edge); vertical-align: top; }
.ht-ev-date { white-space: nowrap; font-variant-numeric: tabular-nums; width: 9rem; }
.ht-ev-type { font-weight: 600; margin-right: .4rem; }
.ht-ev-val { display: block; }
.ht-ev-note { display: block; color: var(--ht-muted); font-size: .86rem; }
.ht-ev-place { color: var(--ht-muted); }
.ht-sources summary { cursor: pointer; font-family: var(--ht-serif); font-size: 1.05rem; font-weight: 600; }
.ht-sources ol { font-size: .86rem; padding-left: 1.4rem; margin-top: .6rem; }
.ht-sources li { margin-bottom: .45rem; }
.ht-sources cite { display: block; font-style: italic; }
.ht-src-page { display: block; color: var(--ht-muted); overflow-wrap: anywhere; }
.ht-notes p { white-space: pre-line; font-size: .92rem; }

@media (max-width: 600px) {
	.ht-views { width: 100%; }
	.ht-views button { flex: 1; padding: .5rem .3rem; }
	.ht-card { width: 11.5rem; }
	.ht-card.is-small { width: 100%; }
	.ht-app { --ht-gap: 1.75rem; }
}
@media (prefers-reduced-motion: reduce) {
	.ht-stage, .ht-o-toggle::before { transition: none; }
}
