/* Bible Bloodline — Angelshrine theme
   Self-contained, no remote fonts or images. Wide reading layout. */

:root {
    --bg: #070a13;
    --bg-2: #0b1020;
    --panel: #111a2e;
    --panel-2: #0d1526;
    --panel-3: #16203a;
    --ink: #e9e5d8;
    --ink-soft: #cfd3e0;
    --muted: #9aa3bb;
    --gold: #f0cf8a;
    --gold-2: #c79a44;
    --line: rgba(240, 207, 138, 0.18);
    --line-2: rgba(154, 163, 187, 0.16);
    --blue: #83b7ff;
    --rose: #ff9db1;
    --green: #8fe3b0;
    --purple: #c7a6ff;
    --red: #ff8585;
    --surface-deep: #070c18;
    --surface-deeper: #070a13;
    --on-gold: #161006;
    --text-strong: #fff8ea;
    --accent-blue-soft: #cfe4ff;
    --accent-rose-soft: #ffd6de;
    --accent-green-soft: #d9ffe8;
    --accent-purple-soft: #ecdcff;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
    --radius: 16px;
    --radius-sm: 10px;
    --max: 1760px;
    --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
    --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
 

html[data-theme="light"] {
    --bg: #f4efe4;
    --bg-2: #ece3d2;
    --panel: #fffaf0;
    --panel-2: #f1e8d8;
    --panel-3: #e7dcc6;
    --ink: #202433;
    --ink-soft: #3a4052;
    --muted: #6a7084;
    --gold: #7a5a22;
    --gold-2: #5e4316;
    --line: rgba(122, 90, 34, 0.22);
    --line-2: rgba(60, 70, 90, 0.16);
    --blue: #2f5f9f;
    --rose: #b94a68;
    --green: #3d7a52;
    --purple: #6b4fa8;
    --red: #a54343;
    --surface-deep: #ddd2bc;
    --surface-deeper: #e7dcc6;
    --on-gold: #1a1306;
    --text-strong: #2a2418;
    --accent-blue-soft: #2f5f9f;
    --accent-rose-soft: #b94a68;
    --accent-green-soft: #3d7a52;
    --accent-purple-soft: #6b4fa8;
    --shadow: 0 18px 48px rgba(80, 50, 10, 0.10);
}

html[data-theme="light"] body.blb-body {
    background:
        radial-gradient(1200px 700px at 15% -10%, rgba(122, 90, 34, 0.08), transparent 60%),
        radial-gradient(900px 600px at 90% 0%, rgba(47, 95, 159, 0.07), transparent 55%),
        radial-gradient(900px 900px at 50% 100%, rgba(107, 79, 168, 0.06), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 45%, #e2d7bf 100%);
}

html[data-theme="light"] .blb-tabs {
    background: rgba(244, 239, 228, 0.86);
}

html[data-theme="light"] .blb-tree-canvas,
html[data-theme="light"] .blb-timeline-shell,
html[data-theme="light"] .blb-timeline-canvas {
    background: var(--panel);
}

html[data-theme="light"] .blb-tree-era-band--antediluvian,
html[data-theme="light"] .blb-tree-era-band--flood,
html[data-theme="light"] .blb-tree-era-band--patriarchs,
html[data-theme="light"] .blb-tree-era-band--egypt,
html[data-theme="light"] .blb-tree-era-band--judges,
html[data-theme="light"] .blb-tree-era-band--united,
html[data-theme="light"] .blb-tree-era-band--divided,
html[data-theme="light"] .blb-tree-era-band--exile,
html[data-theme="light"] .blb-tree-era-band--return,
html[data-theme="light"] .blb-tree-era-band--nt,
html[data-theme="light"] .blb-tree-era-band--revelation {
    opacity: 0.75;
}

html[data-theme="light"] .blb-noscript {
    background: #f4e6c8;
    color: var(--gold);
}

html[data-theme="light"] .blb-detail__close {
    background: rgba(244, 239, 228, 0.9);
}

html[data-theme="light"] .blb-tree-tooltip rect {
    fill: rgba(250, 245, 232, 0.98);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.blb-body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(1200px 700px at 15% -10%, rgba(240, 207, 138, 0.10), transparent 60%),
        radial-gradient(900px 600px at 90% 0%, rgba(131, 183, 255, 0.08), transparent 55%),
        radial-gradient(900px 900px at 50% 100%, rgba(199, 166, 255, 0.06), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 45%, var(--bg-2) 100%);
    background-attachment: fixed;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text-strong); }

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

.blb-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--gold);
    color: var(--on-gold);
    padding: 10px 16px;
    border-radius: 0 0 8px 0;
    font-weight: 700;
}
.blb-skip:focus { left: 0; }

.blb-shell {
    width: min(100% - 40px, var(--max));
    margin-inline: auto;
}

.blb-muted { color: var(--muted); }
.blb-link { color: var(--gold); }
.blb-ref-link { color: var(--blue); text-decoration: none; border-bottom: 1px dotted rgba(131, 183, 255, 0.5); }
.blb-ref-link:hover { color: var(--accent-blue-soft); border-bottom-color: var(--accent-blue-soft); }

/* ---------------- Hero ---------------- */

.blb-hero {
    position: relative;
    overflow: hidden;
    padding: 44px 0 34px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(240, 207, 138, 0.045), transparent 55%),
        linear-gradient(90deg, rgba(7, 10, 19, 0.2), rgba(11, 16, 32, 0.5));
}
.blb-hero--compact { padding-bottom: 28px; }
.blb-hero--person { padding-bottom: 40px; }

.blb-hero__glow {
    position: absolute;
    inset: -40% 0 auto 0;
    height: 420px;
    width: 100%;
    background: radial-gradient(closest-side, rgba(240, 207, 138, 0.16), transparent 70%);
    pointer-events: none;
    filter: blur(10px);
}

.blb-hero__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.blb-kicker {
    margin: 0;
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-weight: 700;
}

.blb-hero__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.blb-hero__nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 12.5px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: var(--panel-2);
    transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}
.blb-hero__nav a:hover { border-color: var(--line); color: var(--gold); background: rgba(240, 207, 138, 0.06); }
.blb-theme-toggle {
    margin-left: 4px;
    border: 1px solid var(--line-2);
    background: var(--panel-2);
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 7px 12px;
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}
.blb-theme-toggle:hover { border-color: var(--gold-2); color: var(--gold); background: var(--panel-3); }


.blb-hero h1 {
    position: relative;
    z-index: 1;
    margin: 18px 0 12px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(34px, 5vw, 66px);
    line-height: 1.04;
    letter-spacing: 0.01em;
    color: var(--text-strong);
    max-width: 22ch;
}

.blb-lede {
    position: relative;
    z-index: 1;
    margin: 0;
    max-width: 92ch;
    color: var(--ink-soft);
    font-size: clamp(15px, 1.3vw, 18px);
    line-height: 1.7;
}

.blb-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 10px;
    margin-top: 28px;
    max-width: 1040px;
}
.blb-stat {
    padding: 12px 14px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(22, 32, 58, 0.55), rgba(13, 21, 38, 0.7));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.blb-stat strong {
    display: block;
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--gold);
    line-height: 1.1;
}
.blb-stat span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ---------------- Tabs / toolbar ---------------- */

.blb-tabs {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 10, 19, 0.82);
    backdrop-filter: blur(12px);
}
.blb-tabs__inner {
    display: flex;
    -webkit-overflow-scrolling: touch;
    align-items: center;
    gap: 4px;
    min-height: 54px;
    overflow-x: auto;
}
.blb-tab {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 0.03em;
    border: 1px solid transparent;
}
.blb-tab:hover { color: var(--gold); background: rgba(240, 207, 138, 0.06); }
.blb-tab[aria-current="page"] {
    color: var(--on-gold);
    background: linear-gradient(180deg, var(--gold), var(--gold));
    border-color: var(--gold-2);
    font-weight: 700;
}
.blb-tab--quiet { color: var(--muted); margin-left: auto; }
.blb-tabs__spacer { flex: 1 1 auto; }

/* ---------------- Main / controls ---------------- */

.blb-main { padding: 28px 0 70px; }

.blb-controls {
    display: grid;
    grid-template-columns: minmax(220px, 2.4fr) repeat(3, minmax(150px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(17, 26, 46, 0.8), rgba(11, 17, 31, 0.9));
    box-shadow: var(--shadow);
}
.blb-field { display: grid; gap: 6px; min-width: 0; }
.blb-field > span {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}
.blb-field input,
.blb-field select {
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    color: var(--ink);
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
}
.blb-field input::placeholder { color: var(--muted); }
.blb-field input:focus,
.blb-field select:focus { border-color: var(--gold-2); outline: none; box-shadow: 0 0 0 3px rgba(240, 207, 138, 0.12); }

.blb-controls__actions { display: flex; gap: 8px; }
.blb-controls__toggles {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 4px;
}
.blb-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.blb-toggle input { accent-color: var(--gold-2); width: 16px; height: 16px; }

.blb-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--gold-2);
    background: linear-gradient(180deg, var(--gold), var(--gold));
    color: var(--on-gold);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.blb-button:hover { filter: brightness(1.06); color: var(--on-gold); }
.blb-button--ghost {
    background: transparent;
    color: var(--gold);
    border-color: var(--line);
}
.blb-button--ghost:hover { background: rgba(240, 207, 138, 0.08); }
.blb-button--small { min-height: 32px; padding: 4px 11px; font-size: 12px; border-radius: 8px; }

.blb-result-line {
    margin: 14px 2px 0;
    color: var(--muted);
    font-size: 13px;
}

/* ---------------- Rows ---------------- */

.blb-view { margin-top: 20px; }

.blb-era { margin: 30px 0 0; }
.blb-era__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 0 2px 12px;
    border-bottom: 1px solid var(--line);
}
.blb-era__head h2 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(21px, 2.2vw, 30px);
    color: var(--text-strong);
}
.blb-era__head p { margin: 4px 0 0; color: var(--muted); max-width: 90ch; font-size: 14px; }
.blb-era__meta {
    display: grid;
    gap: 3px;
    text-align: right;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    padding-top: 4px;
}

.blb-rows { display: grid; gap: 8px; margin-top: 12px; }

.blb-row {
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(17, 26, 46, 0.55), rgba(11, 17, 31, 0.7));
    overflow: clip;
    transition: border-color 140ms ease, background-color 140ms ease;
}
.blb-row:hover { border-color: rgba(240, 207, 138, 0.36); }
.blb-row[open] { border-color: rgba(240, 207, 138, 0.55); background: linear-gradient(180deg, rgba(22, 32, 58, 0.75), rgba(11, 17, 31, 0.85)); }

.blb-row > summary {
    display: grid;
    grid-template-columns: 48px minmax(180px, 1.8fr) minmax(160px, 0.9fr) minmax(150px, 0.8fr) 18px;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
}
.blb-row > summary::-webkit-details-marker { display: none; }
.blb-row > summary::marker { content: ""; }

.blb-row__gen {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: var(--gold);
    background: rgba(240, 207, 138, 0.06);
    font-family: var(--mono);
    font-size: 11px;
}
.blb-row__main { min-width: 0; }
.blb-row__name {
    display: block;
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.2;
    color: var(--text-strong);
}
.blb-row__sub {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    letter-spacing: 0.03em;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.blb-row__dates { display: grid; gap: 2px; font-size: 13px; color: var(--ink-soft); }
.blb-row__dates small { color: var(--muted); font-size: 11px; }
.blb-row__counts {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
}
.blb-row__counts span { white-space: nowrap; }
.blb-row__chevron {
    width: 9px;
    height: 9px;
    border-right: 1.5px solid var(--gold);
    border-bottom: 1.5px solid var(--gold);
    transform: rotate(45deg);
    transition: transform 160ms ease;
    justify-self: center;
}
.blb-row[open] .blb-row__chevron { transform: rotate(-135deg); }

.blb-row__body {
    padding: 4px 18px 20px 78px;
    border-top: 1px solid var(--line-2);
    animation: blb-fade 180ms ease both;
}
@keyframes blb-fade { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }

/* ---------------- Shared detail content (rows, tree panel, person) ---------------- */

.blb-detail__title { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 400; color: var(--text-strong); }
.blb-detail__sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.blb-detail__dates { margin: 10px 0 0; color: var(--gold); font-size: 13px; }
.blb-detail__summary { color: var(--ink-soft); font-size: 14px; }
.blb-detail__section { margin-top: 16px; }
.blb-detail__section h3 {
    margin: 0 0 6px;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
}
.blb-detail__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blb-detail__list li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; font-size: 13.5px; }
.blb-detail__label { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; min-width: 92px; }
.blb-detail__ref { color: var(--blue); font-size: 12px; }
.blb-detail__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.blb-detail__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: rgba(7, 10, 19, 0.7);
    color: var(--ink);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.blb-detail__close:hover { border-color: var(--gold); color: var(--gold); }

.blb-rel-group { margin-top: 16px; }
.blb-rel-group h4 {
    margin: 0 0 6px;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
}
.blb-rel-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blb-rel-group li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: rgba(7, 10, 19, 0.25); }
.blb-rel-group .blb-rel-label { color: var(--muted); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; min-width: 80px; }
.blb-rel-group .blb-rel-name { font-family: var(--serif); font-size: 15px; color: var(--text-strong); text-decoration: none; }
.blb-rel-group .blb-rel-name:hover { color: var(--gold); }
.blb-rel-group .blb-rel-date { color: var(--muted); font-size: 11px; }
.blb-rel-group .blb-rel-refs { color: var(--blue); font-size: 11px; }

/* ---------------- Tree ---------------- */

.blb-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: 12px 12px 0 0;
    background: rgba(11, 17, 31, 0.85);
    border-bottom: 0;
}
.blb-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; color: var(--muted); font-size: 11.5px; }
.blb-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.blb-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.blb-dot--messianic { background: var(--gold); box-shadow: 0 0 0 2px rgba(240, 207, 138, 0.18); }
.blb-dot--branch { background: var(--blue); }
.blb-dot--nonblood { background: var(--rose); }
.blb-dot--symbolic { background: var(--purple); }
.blb-line-solid { display: inline-block; width: 22px; height: 0; border-top: 1.5px solid var(--gold); }
.blb-line-dotted { display: inline-block; width: 22px; height: 0; border-top: 1.5px dotted var(--rose); }
.blb-line-dashed { display: inline-block; width: 22px; height: 0; border-top: 1.5px dashed var(--muted); }
.blb-tree-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.blb-tree-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 0;
    border: 1px solid var(--line-2);
    border-radius: 0 0 14px 14px;
    overflow: clip;
    background: var(--surface-deep);
}
.blb-tree-layout:has(.blb-detail[hidden]) { grid-template-columns: 1fr; }
.blb-tree-canvas {
    position: relative;
    min-height: 640px;
    height: min(74vh, 880px);
    overflow: auto;
    background:
        radial-gradient(800px 400px at 20% 0%, rgba(131, 183, 255, 0.06), transparent 60%),
        radial-gradient(700px 500px at 90% 100%, rgba(199, 166, 255, 0.05), transparent 60%),
        var(--surface-deep);
}
.blb-tree-canvas svg { display: block; }
.blb-tree-note { margin: 10px 2px 0; font-size: 12px; }

.blb-detail {
    position: relative;
    padding: 20px;
    border-left: 1px solid var(--line-2);
    background: linear-gradient(180deg, rgba(17, 26, 46, 0.92), rgba(9, 14, 26, 0.98));
    overflow-y: auto;
    max-height: min(74vh, 880px);
}
.blb-detail[hidden] { display: none !important; }

/* Tree SVG elements */
.blb-tree-svg { cursor: grab; }
.blb-tree-svg:active { cursor: grabbing; }
.blb-tree-era-band { stroke: none; }
.blb-tree-era-band--antediluvian { fill: rgba(240, 207, 138, 0.05);}
.blb-tree-era-band--flood { fill: rgba(131, 183, 255, 0.05);  background: rgba(131, 183, 255, 0.35); }
.blb-tree-era-band--patriarchs { fill: rgba(143, 227, 176, 0.05);  background: rgba(143, 227, 176, 0.35); }
.blb-tree-era-band--egypt { fill: rgba(255, 157, 177, 0.05);  background: rgba(255, 157, 177, 0.35); }
.blb-tree-era-band--judges { fill: rgba(199, 166, 255, 0.05);  background: rgba(199, 166, 255, 0.35); }
.blb-tree-era-band--united { fill: rgba(240, 207, 138, 0.06);  background: rgba(240, 207, 138, 0.42); }
.blb-tree-era-band--divided { fill: rgba(131, 183, 255, 0.06);  background: rgba(131, 183, 255, 0.42); }
.blb-tree-era-band--exile { fill: rgba(255, 133, 133, 0.05);  background: rgba(255, 133, 133, 0.35); }
.blb-tree-era-band--return { fill: rgba(143, 227, 176, 0.05);  background: rgba(143, 227, 176, 0.35); }
.blb-tree-era-band--nt { fill: rgba(240, 207, 138, 0.07);  background: rgba(240, 207, 138, 0.42); }
.blb-tree-era-band--revelation { fill: rgba(199, 166, 255, 0.08);  background: rgba(199, 166, 255, 0.42); }
.blb-tree-era-label {
    fill: rgba(233, 229, 216, 0.4);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: var(--sans);
}
.blb-tree-era-range { fill: rgba(154, 163, 187, 0.55); font-size: 8px; font-family: var(--mono); }
.blb-tree-axis-line { stroke: rgba(154, 163, 187, 0.28); stroke-width: 1; }
.blb-tree-axis line,
.blb-tree-axis path { stroke: rgba(154, 163, 187, 0.35); }
.blb-tree-axis text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }

.blb-tree-link { fill: none; stroke-linecap: round; }
.blb-tree-link--blood { stroke: rgba(240, 207, 138, 0.5); stroke-width: 1.3; }
.blb-tree-link--blood.is-alt { stroke-dasharray: 5 4; stroke: rgba(240, 207, 138, 0.28); }
.blb-tree-link--marriage { stroke: rgba(255, 157, 177, 0.4); stroke-width: 1.1; stroke-dasharray: 1 4; }
.blb-tree-link--nonblood { stroke: rgba(154, 163, 187, 0.28); stroke-width: 0.9; stroke-dasharray: 4 4; }
.blb-tree-link.is-active { stroke: var(--gold); stroke-width: 2; stroke-dasharray: none; }
.blb-tree-link.is-dim { opacity: 0.18; }

.blb-tree-node { cursor: pointer; }
.blb-tree-node circle { stroke-width: 1.2; transition: r 120ms ease; }
.blb-tree-node--messianic circle { fill: var(--gold); stroke: var(--text-strong); }
.blb-tree-node--branch circle { fill: var(--blue); stroke: var(--accent-blue-soft); }
.blb-tree-node--nonblood circle { fill: var(--rose); stroke: var(--accent-rose-soft); }
.blb-tree-node--angelic circle { fill: var(--green); stroke: var(--accent-green-soft); }
.blb-tree-node--divine circle { fill: #fff; stroke: var(--gold); }
.blb-tree-node--symbolic circle { fill: var(--purple); stroke: var(--accent-purple-soft); }
.blb-tree-node--group circle { fill: var(--muted); stroke: #c3cadb; }
.blb-tree-node:hover circle { r: 8; }
.blb-tree-node.is-selected circle { r: 9; stroke: #fff; stroke-width: 2; }
.blb-tree-node.is-ancestor circle { stroke: var(--gold); stroke-width: 2; }
.blb-tree-node.is-descendant circle { stroke: var(--green); stroke-width: 2; }
.blb-tree-node.is-dim { opacity: 0.18; }
.blb-tree-label {
    fill: rgba(233, 229, 216, 0.72);
    font-size: 9px;
    font-family: var(--sans);
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(7, 12, 24, 0.9);
    stroke-width: 2.5px;
}
.blb-tree-label.is-messianic { fill: var(--gold); font-weight: 700; }
.blb-tree-event { fill: var(--purple); opacity: 0.8; cursor: pointer; }
.blb-tree-event-label { fill: rgba(199, 166, 255, 0.7); font-size: 8px; font-family: var(--sans); }
.blb-tree-tooltip { pointer-events: none; }
.blb-tree-tooltip rect { fill: rgba(7, 10, 19, 0.95); stroke: var(--line); }
.blb-tree-tooltip text { fill: var(--ink); font-size: 11px; font-family: var(--sans); }

/* ---------------- Timeline ---------------- */

.blb-timeline-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    overflow: clip;
    background: var(--surface-deep);
}
.blb-timeline-layout:has(.blb-detail[hidden]) { grid-template-columns: 1fr; }
.blb-timeline-layout .blb-detail { max-height: none; }
.blb-timeline-canvas { height: 320px; min-height: 240px; overflow: auto; }
.blb-timeline-canvas svg { display: block; }
.blb-timeline-axis line, .blb-timeline-axis path { stroke: rgba(154, 163, 187, 0.35); }
.blb-timeline-axis text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.blb-timeline-band { opacity: 0.5; }
.blb-timeline-event { fill: var(--gold); cursor: pointer; }
.blb-timeline-event:hover { fill: var(--text-strong); }
.blb-timeline-event-label { fill: rgba(233, 229, 216, 0.6); font-size: 9px; font-family: var(--sans); }
.blb-timeline-era-label { fill: rgba(233, 229, 216, 0.6); font-size: 9px; font-family: var(--sans); }
.blb-timeline-era-range { fill: rgba(154, 163, 187, 0.55); font-size: 8px; font-family: var(--mono); }
.blb-timeline-axis-line { stroke: rgba(154, 163, 187, 0.28); stroke-width: 1; }
.blb-timeline-event-line { stroke: rgba(240, 207, 138, 0.25); stroke-width: 1; }

.blb-event-list { margin-top: 24px; display: grid; gap: 20px; }
.blb-event-era h2 {
    margin: 0 0 8px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 24px;
    color: var(--text-strong);
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
}
.blb-event {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-2);
}
.blb-event__when { display: grid; gap: 2px; color: var(--gold); font-family: var(--mono); font-size: 12px; }
.blb-event__when small { color: var(--muted); font-family: var(--sans); }
.blb-event__body h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 19px; color: var(--text-strong); }
.blb-event__body p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.blb-event__people, .blb-event__refs { font-size: 12.5px; }
.blb-event__people small { color: var(--muted); }

/* ---------------- Person profile ---------------- */

.blb-hero--person h1 { max-width: 26ch; }
.blb-profile-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: end; position: relative; z-index: 1; }
.blb-breadcrumb { margin: 0 0 10px; font-size: 12px; }
.blb-alt { margin: 4px 0 10px; color: var(--muted); font-style: italic; }
.blb-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.blb-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: rgba(17, 26, 46, 0.55);
    color: var(--ink-soft);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.blb-chip--gold { color: var(--on-gold); background: var(--gold); border-color: var(--gold-2); font-weight: 700; }
.blb-profile-dates {
    display: grid;
    gap: 4px;
    text-align: right;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(17, 26, 46, 0.55);
    min-width: 220px;
}
.blb-profile-dates strong { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--gold); }
.blb-profile-dates span { color: var(--ink-soft); font-size: 13px; }
.blb-profile-dates small { color: var(--muted); font-size: 11px; }
.blb-profile-gen { margin-top: 8px; color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }

.blb-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.blb-card {
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    padding: 20px;
    background: linear-gradient(180deg, rgba(17, 26, 46, 0.7), rgba(9, 14, 26, 0.85));
    box-shadow: var(--shadow);
}
.blb-card--wide { grid-column: 1 / -1; }
.blb-card h2 { margin: 0 0 12px; font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--text-strong); }
.blb-card h3 {
    margin: 18px 0 8px;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
}
.blb-card h3:first-of-type { margin-top: 8px; }

.blb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.blb-facts div { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(7, 10, 19, 0.3); }
.blb-facts dt { color: var(--muted); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.blb-facts dd { margin: 3px 0 0; font-family: var(--serif); font-size: 19px; color: var(--ink); }
.blb-note { margin-top: 16px; padding: 12px 14px; border-left: 2px solid var(--gold); background: rgba(240, 207, 138, 0.05); color: var(--ink-soft); font-size: 13.5px; }

.blb-rel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blb-rel { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: rgba(7, 10, 19, 0.28); }
.blb-rel__label { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; min-width: 82px; }
.blb-rel__name { font-family: var(--serif); font-size: 16px; color: var(--text-strong); text-decoration: none; }
.blb-rel__name:hover { color: var(--gold); }
.blb-rel__date { color: var(--muted); font-size: 11px; }
.blb-rel__note { color: var(--muted); font-size: 11.5px; flex: 1 1 100%; }
.blb-rel__refs { color: var(--blue); font-size: 11px; flex: 1 1 100%; }

.blb-ref { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.blb-ref:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.blb-ref__head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.blb-ref__head h3 { margin: 0; color: var(--gold); font-family: var(--serif); font-size: 19px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.blb-verses { margin-top: 8px; display: grid; gap: 4px; }
.blb-verse { margin: 0; font-family: var(--serif); font-size: 16px; line-height: 1.75; color: var(--ink-soft); }
.blb-verse sup { color: var(--gold); font-family: var(--mono); font-size: 10px; margin-right: 6px; }
.blb-verses-more { margin-top: 10px; }
.blb-verses-more summary { cursor: pointer; color: var(--gold); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

.blb-event-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.blb-event-mini li { display: grid; grid-template-columns: 86px 1.2fr 1fr 2fr; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: rgba(7, 10, 19, 0.28); font-size: 13px; }
.blb-event-mini__when { color: var(--gold); font-family: var(--mono); font-size: 11px; }
.blb-event-mini__title { color: var(--ink); font-family: var(--serif); font-size: 15px; }
.blb-event-mini__role { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.blb-event-mini__desc { color: var(--muted); font-size: 12px; }

.blb-link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blb-link-list small { color: var(--muted); }

/* ---------------- About ---------------- */

.blb-prose { max-width: 104ch; }
.blb-prose section { margin-bottom: 34px; }
.blb-prose h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 2.6vw, 34px); color: var(--text-strong); }
.blb-prose p, .blb-prose li { color: var(--ink-soft); font-size: 15.5px; }
.blb-prose code { font-family: var(--mono); color: var(--gold); background: rgba(240, 207, 138, 0.08); padding: 1px 5px; border-radius: 4px; }
.blb-bullets, .blb-tag-list { padding-left: 20px; }
.blb-bullets li, .blb-tag-list li { margin: 6px 0; }
.blb-tag-list strong { color: var(--gold); }

.blb-table-wrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--line-2); border-radius: 12px; }
.blb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.blb-table th, .blb-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.blb-table th { color: var(--gold); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; background: rgba(240, 207, 138, 0.04); }
.blb-table td { color: var(--ink-soft); }

.blb-empty { padding: 40px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; }
.blb-empty h2 { margin: 0; font-family: var(--serif); font-weight: 400; }

/* ---------------- Footer / misc ---------------- */

.blb-footer { border-top: 1px solid var(--line); background: rgba(7, 10, 19, 0.7); padding: 26px 0 40px; }
.blb-footer__inner p { margin: 4px 0; font-size: 13px; color: var(--ink-soft); }
.blb-footer__inner .blb-muted { color: var(--muted); font-size: 12px; }

.blb-noscript { position: fixed; inset: auto 16px 16px 16px; z-index: 60; padding: 12px 16px; border: 1px solid var(--gold-2); border-radius: 10px; background: var(--panel-3); color: var(--gold); font-size: 13px; }

/* ---------------- Era jump / timeline legend ---------------- */

.blb-era-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid var(--line-2);
    border-top: 0;
    border-bottom: 0;
    background: rgba(9, 14, 26, 0.7);
}
.blb-era-jump__btn {
    border: 1px solid var(--line-2);
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 4px 9px;
    font: inherit;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.blb-era-jump__btn:hover { color: var(--gold); border-color: var(--gold-2); background: rgba(240, 207, 138, 0.06); }

.blb-timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 10px 2px 0;
    color: var(--muted);
    font-size: 11px;
}
.blb-timeline-legend__item { display: inline-flex; align-items: center; gap: 5px; }
.blb-timeline-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.blb-timeline-note { margin: 8px 2px 0; font-size: 12px; }

/* ---------------- Light theme surfaces ---------------- */

html[data-theme="light"] .blb-hero {
    background: linear-gradient(180deg, #f8f2e6 0%, #efe5d3 60%, #e9ddc8 100%);
}
html[data-theme="light"] .blb-stat,
html[data-theme="light"] .blb-controls,
html[data-theme="light"] .blb-row,
html[data-theme="light"] .blb-card,
html[data-theme="light"] .blb-profile-dates,
html[data-theme="light"] .blb-tree-toolbar,
html[data-theme="light"] .blb-era-jump,
html[data-theme="light"] .blb-detail {
    background: var(--panel);
}
html[data-theme="light"] .blb-row[open] { background: var(--panel-3); }
html[data-theme="light"] .blb-facts div,
html[data-theme="light"] .blb-rel,
html[data-theme="light"] .blb-event-mini li,
html[data-theme="light"] .blb-rel-group li { background: var(--panel-2); }
html[data-theme="light"] .blb-note { background: rgba(122, 90, 34, 0.08); }
html[data-theme="light"] .blb-footer { background: var(--panel-2); }
html[data-theme="light"] .blb-detail__close { background: var(--panel-2); }
html[data-theme="light"] .blb-tabs { background: rgba(244, 239, 228, 0.9); }
html[data-theme="light"] .blb-tree-tooltip rect { fill: var(--panel); }
html[data-theme="light"] .blb-tree-canvas { background: var(--panel); }

/* ---------------- Light theme tree / timeline text ---------------- */

html[data-theme="light"] .blb-tree-era-label { fill: #2a2418; }
html[data-theme="light"] .blb-tree-era-range { fill: #5e4316; }
html[data-theme="light"] .blb-tree-axis-line { stroke: rgba(60, 70, 90, 0.35); }
html[data-theme="light"] .blb-tree-label { fill: #2a2418; stroke: rgba(255, 250, 240, 0.92); }
html[data-theme="light"] .blb-tree-label.is-messianic { fill: #5e4316; }
html[data-theme="light"] .blb-tree-link--blood { stroke: rgba(122, 90, 34, 0.65); }
html[data-theme="light"] .blb-tree-link--blood.is-alt { stroke: rgba(122, 90, 34, 0.4); }
html[data-theme="light"] .blb-tree-link--marriage { stroke: rgba(185, 74, 104, 0.55); }
html[data-theme="light"] .blb-tree-link--nonblood { stroke: rgba(60, 70, 90, 0.35); }
html[data-theme="light"] .blb-tree-node--messianic circle { stroke: #5e4316; }
html[data-theme="light"] .blb-tree-node--branch circle { stroke: #2f5f9f; }
html[data-theme="light"] .blb-tree-node--nonblood circle { stroke: #b94a68; }
html[data-theme="light"] .blb-tree-node--angelic circle { stroke: #3d7a52; }
html[data-theme="light"] .blb-tree-node--divine circle { fill: var(--gold); stroke: #5e4316; }
html[data-theme="light"] .blb-tree-node--symbolic circle { stroke: #6b4fa8; }
html[data-theme="light"] .blb-tree-node--group circle { fill: #6a7084; stroke: #3a4052; }
html[data-theme="light"] .blb-tree-node.is-selected circle { stroke: #2a2418; }
html[data-theme="light"] .blb-tree-event { fill: #6b4fa8; }
html[data-theme="light"] .blb-tree-event-label { fill: rgba(107, 79, 168, 0.75); }
html[data-theme="light"] .blb-timeline-era-label { fill: #2a2418; }
html[data-theme="light"] .blb-timeline-era-range { fill: #5e4316; }
html[data-theme="light"] .blb-timeline-axis text { fill: var(--muted); }
html[data-theme="light"] .blb-timeline-axis-line { stroke: rgba(60, 70, 90, 0.35); }
html[data-theme="light"] .blb-timeline-event { fill: #7a5a22; }
html[data-theme="light"] .blb-timeline-event-line { stroke: rgba(122, 90, 34, 0.35); }
html[data-theme="light"] .blb-timeline-event-label { fill: rgba(60, 70, 90, 0.7); }

/* ---------------- Responsive ---------------- */

@media (max-width: 1100px) {
    .blb-controls { grid-template-columns: minmax(200px, 2fr) repeat(2, minmax(140px, 1fr)); }
    .blb-controls__actions { grid-column: 1 / -1; }
    .blb-tree-layout { grid-template-columns: 1fr; }
    .blb-timeline-layout { grid-template-columns: 1fr; }
    .blb-detail { border-left: 0; border-top: 1px solid var(--line-2); max-height: none; }
    .blb-row > summary { grid-template-columns: 44px minmax(160px, 1.6fr) minmax(140px, 0.9fr) 18px; }
    .blb-row__counts { display: none; }
}

@media (max-width: 760px) {
    .blb-shell { width: min(100% - 24px, var(--max)); }
    .blb-hero { padding-top: 28px; }
    .blb-hero h1 { max-width: 18ch; }
    .blb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .blb-controls { grid-template-columns: 1fr 1fr; }
    .blb-field--search { grid-column: 1 / -1; }
    .blb-controls__toggles { grid-column: 1 / -1; }
    .blb-row > summary { grid-template-columns: 40px minmax(0, 1fr) 18px; gap: 10px; padding: 12px; }
    .blb-row__dates { display: none; }
    .blb-row__body { padding-left: 16px; padding-right: 16px; }
    .blb-profile-head { grid-template-columns: 1fr; }
    .blb-profile-dates { text-align: left; min-width: 0; }
    .blb-profile-grid { grid-template-columns: 1fr; }
    .blb-event { grid-template-columns: 1fr; gap: 4px; }
    .blb-event-mini li { grid-template-columns: 1fr; gap: 2px; }
    .blb-tree-toolbar { align-items: flex-start; }
    .blb-tree-canvas { min-height: 480px; height: 68vh; }
.blb-tree-canvas, .blb-timeline-canvas { -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
    .blb-legend { font-size: 10.5px; }
}

@media (max-width: 420px) {
    .blb-stats { grid-template-columns: 1fr 1fr; }
    .blb-controls { grid-template-columns: 1fr; }
    .blb-controls__actions { flex-wrap: wrap; }
    .blb-button { width: 100%; }
    .blb-controls__actions .blb-button { width: auto; flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media print {
    body.blb-body { background: #fff; color: #111; }
    .blb-tabs, .blb-controls, .blb-footer, .blb-hero__nav, .blb-detail__close, .blb-tree-toolbar { display: none !important; }
    .blb-hero, .blb-card { background: #fff; box-shadow: none; border-color: #ccc; }
    .blb-hero h1, .blb-card h2, .blb-row__name { color: #111; }
    .blb-muted, .blb-lede, .blb-verse, .blb-rel__note { color: #333; }
    a { color: #111; }
}
