/* ===========================================================================
   The Line of Scripture — interactive Biblical family tree (/family-tree)
   A collapsible genealogy explorer: a golden "Messianic spine" from Adam to
   Jesus, with expandable side-branches, era colour-coding, search, honest
   notes, and a left-slide detail drawer. Vanilla; no framework.
   Palette follows the site: parchment, charcoal ink, stone, antique gold.
   =========================================================================== */

.bt-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px clamp(14px, 3.5vw, 40px) 96px;
  position: relative;
  z-index: 1;
}

/* ---- Hero ------------------------------------------------------------- */
.bt-hero {
  text-align: center;
  max-width: 820px;
  margin: 0 auto 26px;
  background: rgba(246, 239, 223, 0.92);
  border: 1px solid rgba(168, 130, 63, 0.34);
  border-radius: 20px;
  box-shadow: 0 14px 40px rgba(60, 45, 20, 0.14);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  padding: 30px clamp(18px, 4vw, 40px) 26px;
}
.bt-eyebrow {
  font-family: 'Cinzel', serif; font-size: 12.5px; letter-spacing: 0.24em;
  text-transform: uppercase; color: #a8823f; font-weight: 700; margin: 0 0 10px;
}
.bt-title {
  font-family: 'Cinzel', serif; font-weight: 800;
  font-size: clamp(30px, 5vw, 50px); line-height: 1.04; color: #3b3630;
  margin: 0 0 12px; letter-spacing: 0.01em; text-wrap: balance;
}
.bt-sub { font-size: clamp(15px, 2.2vw, 18.5px); line-height: 1.6; color: #4a4335; margin: 0 auto; max-width: 60ch; }

/* ---- Search ----------------------------------------------------------- */
.bt-search-wrap {
  position: relative; display: flex; align-items: center; gap: 10px;
  max-width: 460px; margin: 22px auto 0;
  background: #fbf6ea; border: 1px solid rgba(168, 130, 63, 0.42);
  border-radius: 999px; padding: 9px 16px;
  box-shadow: inset 0 1px 3px rgba(60, 45, 20, 0.08);
}
.bt-search-wrap svg { color: #a8823f; flex-shrink: 0; }
.bt-search {
  flex: 1; border: 0; background: transparent; outline: none;
  font-family: 'Cormorant Garamond', serif; font-size: 17px; color: #3b3630;
}
.bt-search::placeholder { color: #9a8e74; }
.bt-search-clear {
  border: 0; background: transparent; color: #9a8e74; cursor: pointer;
  display: none; padding: 2px; border-radius: 50%;
}
.bt-search-clear.is-visible { display: inline-flex; }
.bt-search-clear:hover { color: #6b5a2e; }

/* Search results dropdown */
.bt-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: #fbf6ea; border: 1px solid rgba(168, 130, 63, 0.42);
  border-radius: 14px; box-shadow: 0 18px 44px rgba(60, 45, 20, 0.22);
  overflow: hidden; z-index: 40; max-height: 320px; overflow-y: auto;
}
.bt-search-results[hidden] { display: none; }
.bt-search-result {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 10px 16px; border: 0; background: transparent; cursor: pointer;
  text-align: left; border-bottom: 1px solid rgba(168, 130, 63, 0.16);
}
.bt-search-result:last-child { border-bottom: 0; }
.bt-search-result:hover, .bt-search-result.is-active { background: rgba(201, 162, 78, 0.16); }
.bt-search-result-name { font-family: 'Cinzel', serif; font-weight: 700; font-size: 15px; color: #3b3630; }
.bt-search-result-role { font-size: 13.5px; color: #7a6f57; }
.bt-search-empty { padding: 14px 16px; color: #7a6f57; font-size: 14.5px; }

/* ---- Controls row (legend + buttons) --------------------------------- */
.bt-controls {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: center; margin: 22px auto 8px; max-width: 1000px;
}
.bt-legend { display: flex; flex-wrap: wrap; gap: 7px 10px; justify-content: center; }
.bt-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: #4a4335; background: rgba(246, 239, 223, 0.8);
  border: 1px solid rgba(168, 130, 63, 0.28); border-radius: 999px; padding: 4px 10px;
}
.bt-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.bt-legend-item--thread .bt-legend-dot {
  background: linear-gradient(180deg, #ffe9ab, #c9a24e); box-shadow: 0 0 0 2px rgba(201,162,78,0.28);
}
.bt-btnrow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bt-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 12.5px; letter-spacing: 0.04em;
  color: #6b5a2e; background: rgba(246, 239, 223, 0.9);
  border: 1px solid rgba(168, 130, 63, 0.4); border-radius: 999px; padding: 7px 14px;
  transition: background 0.15s, color 0.15s;
}
.bt-btn:hover { background: rgba(201, 162, 78, 0.2); color: #4a3c18; }

/* ---- Tree ------------------------------------------------------------- */
.bt-tree { margin: 16px auto 0; max-width: 1040px; }

/* The Messianic spine: a centred vertical column of portrait cards linked
   by a golden thread. */
.bt-spine { position: relative; display: flex; flex-direction: column; align-items: center; }
.bt-spine-node { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 0 30px; }
.bt-spine-node:last-child { padding-bottom: 0; }
/* Golden thread linking consecutive spine cards */
.bt-spine-node:not(:last-child)::after {
  content: ''; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 24px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #e6c974, #c9a24e); border-radius: 3px; z-index: 0;
}

/* ---- Portrait node card ---------------------------------------------- */
.bt-node {
  position: relative; z-index: 1;
  width: 236px; display: flex; flex-direction: column; align-items: center; text-align: center;
  background: #fffdf8; border: 1px solid rgba(120, 104, 74, 0.24);
  border-radius: 16px; padding: 31px 14px 15px;
  box-shadow: 0 5px 16px rgba(60, 45, 20, 0.1);
  cursor: pointer; font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.bt-node:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(60, 45, 20, 0.18); }
.bt-node:focus-visible { outline: 3px solid #c9a24e; outline-offset: 2px; }
.bt-node.is-focused { border-color: #c9a24e; box-shadow: 0 0 0 3px rgba(201, 162, 78, 0.5), 0 12px 28px rgba(60, 45, 20, 0.2); }

/* Gender / thread accent colours (FamilySearch-style blue / rose) */
.bt-node--m { --acc: #2f93c0; --acc2: #86cbe3; }
.bt-node--f { --acc: #cf6394; --acc2: #edaecb; }

/* Colored top bar */
.bt-node-bar { position: absolute; top: 0; left: 0; right: 0; height: 7px; border-radius: 16px 16px 0 0; background: var(--acc); }
.bt-node--messianic .bt-node-bar { background: linear-gradient(90deg, #e9cf82, #c9a24e, #e9cf82); }

/* Circular portrait avatar */
.bt-node-av {
  width: 60px; height: 60px; border-radius: 50%; margin: -6px 0 9px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(160deg, var(--acc2), var(--acc));
  border: 3px solid #fff; box-shadow: 0 3px 9px rgba(40, 30, 12, 0.22);
}
.bt-node-av svg { width: 32px; height: 32px; stroke-width: 1.6; }
.bt-node--messianic .bt-node-av { box-shadow: 0 0 0 3px #e6c974, 0 3px 9px rgba(140, 105, 40, 0.32); }

.bt-node-name { font-family: 'Cinzel', serif; font-weight: 700; font-size: 16.5px; color: #3b3630; line-height: 1.16; text-wrap: balance; }
.bt-node--messianic .bt-node-name { color: #5a4212; }
.bt-node-aka { font-size: 12px; color: #8a7c5e; font-style: italic; margin-top: 1px; }
.bt-node-role { font-size: 12.5px; color: #7a6f57; margin-top: 4px; }
.bt-node-dates { font-size: 12px; color: #9a8e74; margin-top: 4px; font-variant-numeric: tabular-nums; }
.bt-node-badges { margin-top: 9px; display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.bt-node-era { font-family: 'Cinzel', serif; font-size: 9.5px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 700; color: #fff; padding: 2px 9px; border-radius: 999px; }
.bt-node-note { display: inline-flex; align-items: center; color: #9c3b26; }
.bt-node-note svg { width: 15px; height: 15px; }

/* ---- Branch toggles + sub-trees -------------------------------------- */
.bt-branch-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 2px 0 4px;
  font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: 0.03em; color: #6b5a2e;
  background: rgba(233, 220, 181, 0.55); border: 1px dashed rgba(168, 130, 63, 0.5);
  border-radius: 999px; padding: 5px 13px; transition: background 0.15s;
}
.bt-branch-toggle:hover { background: rgba(201, 162, 78, 0.26); }
.bt-branch-toggle .bt-chev { transition: transform 0.2s; }
.bt-branch-toggle[aria-expanded="true"] .bt-chev { transform: rotate(90deg); }

.bt-branch-group { width: 100%; margin: 2px 0 6px; display: flex; flex-direction: column; align-items: center; }
.bt-branch-group[hidden] { display: none; }

/* Non-spine descendants: children sit in a centred, wrapping row under the
   parent (a family-tree feel), each linked by a short connector tick. */
.bt-subtree { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 16px 18px; }
.bt-subtree-item { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 20px; }
.bt-subtree-item::before {
  content: ''; position: absolute; top: 0; left: 50%; width: 2px; height: 20px;
  transform: translateX(-50%); background: rgba(168, 130, 63, 0.42);
}
.bt-subtree .bt-node { width: 208px; padding-top: 28px; }
.bt-subtree .bt-node-av { width: 50px; height: 50px; margin-bottom: 7px; }
.bt-subtree .bt-node-av svg { width: 27px; height: 27px; }
.bt-subtree .bt-node-name { font-size: 15px; }

.bt-sub-toggle {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; margin: 8px 0 0;
  font-size: 11.5px; color: #6b5a2e; background: rgba(233, 220, 181, 0.45);
  border: 1px dashed rgba(168, 130, 63, 0.45); border-radius: 999px; padding: 3px 10px;
}
.bt-sub-toggle .bt-chev { transition: transform 0.2s; }
.bt-sub-toggle[aria-expanded="true"] .bt-chev { transform: rotate(90deg); }
.bt-sub-children { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 16px 18px; }
.bt-sub-children[hidden] { display: none; }

/* ---- Couples (spouse pairing) ---------------------------------------- */
.bt-couple { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 4px; }
.bt-couple-link { display: inline-flex; align-items: center; color: #cf6394; flex: 0 0 auto; padding: 0 2px; }
.bt-couple-link svg { width: 18px; height: 18px; }
.bt-node--spouse { width: 212px; }
.bt-node--spouse .bt-node-av { width: 54px; height: 54px; }
.bt-node--spouse .bt-node-av svg { width: 28px; height: 28px; }
.bt-subtree .bt-node--spouse { width: 192px; }

/* Uploaded portrait photos fill the avatar circle */
.bt-node-av--photo { padding: 0; overflow: hidden; }
.bt-node-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ---- Focus mode: spotlight the line to Jesus ------------------------- */
.bt-node, .bt-couple-link, .bt-branch-toggle, .bt-sub-toggle { transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.25s, filter 0.25s; }
.bt-tree--focus .bt-node:not(.bt-node--messianic) { opacity: 0.3; filter: grayscale(0.4); }
.bt-tree--focus .bt-couple-link,
.bt-tree--focus .bt-branch-toggle,
.bt-tree--focus .bt-sub-toggle { opacity: 0.4; }
.bt-tree--focus .bt-node--messianic { box-shadow: 0 0 0 3px rgba(230, 201, 116, 0.65), 0 12px 30px rgba(140, 105, 40, 0.28); }

/* Focus toggle active state */
.bt-btn.is-active { background: linear-gradient(90deg, #e9cf82, #c9a24e); color: #4a3c18; border-color: #c9a24e; }

/* ---- Honest note callout (intro + methodology) ----------------------- */
.bt-note {
  max-width: 940px; margin: 30px auto 0; border-left: 3px solid #c9a24e;
  background: rgba(233, 220, 181, 0.42); padding: 14px 18px; border-radius: 0 12px 12px 0;
}
.bt-note b {
  display: block; font-family: 'Cinzel', serif; font-size: 11px; letter-spacing: 0.07em;
  text-transform: uppercase; color: #a8823f; margin-bottom: 5px;
}
.bt-note p { margin: 0; font-size: 15.5px; line-height: 1.6; color: #4a4335; }

/* ---- Drawer (slides from LEFT, like the other exhibits) -------------- */
.bt-scrim {
  position: fixed; inset: 0; background: rgba(30, 24, 12, 0.5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 0.3s; z-index: 90;
}
.bt-scrim.is-open { opacity: 1; }
.bt-scrim[hidden] { display: none; }

.bt-drawer {
  position: fixed; top: 0; left: 0; height: 100%; width: min(440px, 92vw);
  background: linear-gradient(180deg, #fbf6ea, #f4ead4);
  border-right: 1px solid rgba(168, 130, 63, 0.4);
  box-shadow: 18px 0 50px rgba(40, 28, 10, 0.32);
  transform: translateX(-102%); transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 95; display: flex; flex-direction: column; overflow: hidden;
}
.bt-drawer.is-open { transform: translateX(0); }
.bt-drawer[hidden] { display: none; }
.bt-drawer-head {
  position: relative; padding: 20px 22px 16px; border-bottom: 1px solid rgba(168, 130, 63, 0.28);
  background: var(--drawer-era, #a8823f);
}
.bt-drawer-head::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.82); }
.bt-drawer-head > * { position: relative; z-index: 1; }
.bt-drawer-era {
  font-family: 'Cinzel', serif; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; color: #fff; padding: 3px 9px; border-radius: 999px;
  background: var(--drawer-era, #a8823f); display: inline-block;
}
.bt-drawer-name { font-family: 'Cinzel', serif; font-weight: 800; font-size: 26px; color: #3b3630; margin: 9px 0 2px; line-height: 1.08; }
.bt-drawer-aka { font-size: 14px; color: #8a7c5e; font-style: italic; }
.bt-drawer-role { font-size: 15px; color: #7a5e26; font-weight: 600; margin-top: 4px; }
.bt-drawer-close {
  position: absolute; top: 14px; right: 14px; z-index: 2; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(120,104,74,0.35);
  background: rgba(255,255,255,0.85); color: #6b5a2e; display: inline-flex; align-items: center; justify-content: center;
}
.bt-drawer-close:hover { background: #fff; color: #3b3630; }
.bt-drawer-body { padding: 20px 22px 40px; overflow-y: auto; }
.bt-drawer-thread {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  font-family: 'Cinzel', serif; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
  color: #a67f2f; background: #fff6df; border: 1px solid rgba(201,162,78,0.5);
  border-radius: 999px; padding: 4px 11px;
}
.bt-drawer-dates { font-size: 13.5px; color: #8a7c5e; margin: 0 0 14px; }
.bt-drawer-summary { font-size: 17px; line-height: 1.55; color: #4a4335; font-style: italic; margin: 0 0 14px; }
.bt-drawer-detail { font-size: 15.5px; line-height: 1.68; color: #43402f; margin: 0 0 18px; }
.bt-drawer-section { margin-bottom: 16px; }
.bt-drawer-label {
  font-family: 'Cinzel', serif; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; color: #a8823f; margin: 0 0 6px;
}
.bt-drawer-relations { display: flex; flex-wrap: wrap; gap: 7px; }
.bt-relation {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 13.5px; color: #4a4335; background: rgba(246, 239, 223, 0.9);
  border: 1px solid rgba(168, 130, 63, 0.36); border-radius: 999px; padding: 5px 11px;
  transition: background 0.15s;
}
.bt-relation:hover { background: rgba(201, 162, 78, 0.22); }
.bt-relation--parent { border-style: solid; }
.bt-drawer-spouses { font-size: 15px; color: #4a4335; }
.bt-drawer-scriptures {
  font-size: 14.5px; color: #5f5647; font-style: italic;
  background: rgba(233, 220, 181, 0.4); border-radius: 8px; padding: 8px 12px;
}
.bt-drawer-honest {
  border-left: 3px solid #9c3b26; background: rgba(156, 59, 38, 0.07);
  padding: 12px 15px; border-radius: 0 10px 10px 0; margin-top: 4px;
}
.bt-drawer-honest .bt-drawer-label { color: #9c3b26; }
.bt-drawer-honest p { margin: 0; font-size: 14.5px; line-height: 1.6; color: #5a4136; }

/* ---- Methodology modal ----------------------------------------------- */
.bt-modal-scrim {
  position: fixed; inset: 0; background: rgba(30, 24, 12, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.bt-modal-scrim[hidden] { display: none; }
.bt-modal {
  background: linear-gradient(180deg, #fbf6ea, #f4ead4); border: 1px solid rgba(168, 130, 63, 0.4);
  border-radius: 18px; box-shadow: 0 24px 60px rgba(40, 28, 10, 0.4);
  max-width: 640px; width: 100%; max-height: 86vh; overflow: hidden; display: flex; flex-direction: column;
}
.bt-modal-head { position: relative; padding: 20px 24px; border-bottom: 1px solid rgba(168, 130, 63, 0.28); }
.bt-modal-head h2 { font-family: 'Cinzel', serif; font-weight: 800; font-size: 22px; color: #3b3630; margin: 0; }
.bt-modal-close {
  position: absolute; top: 16px; right: 16px; cursor: pointer; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(120,104,74,0.35); background: rgba(255,255,255,0.85); color: #6b5a2e;
  display: inline-flex; align-items: center; justify-content: center;
}
.bt-modal-close:hover { background: #fff; color: #3b3630; }
.bt-modal-body { padding: 20px 24px 28px; overflow-y: auto; }
.bt-modal-body p { font-size: 15.5px; line-height: 1.66; color: #4a4335; margin: 0 0 12px; }
.bt-modal-body ul { margin: 0 0 12px; padding-left: 20px; }
.bt-modal-body li { font-size: 15px; line-height: 1.6; color: #4a4335; margin-bottom: 9px; }
.bt-modal-body strong { color: #7a5e26; }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 640px) {
  .bt-node-role { margin-left: 0; width: 100%; }
  .bt-branch-toggle, .bt-branch-group { margin-left: 10px; }
  .bt-branch-group { padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bt-drawer, .bt-scrim, .bt-node, .bt-chev { transition: none; }
}
