/* =========================================================================
   Family Tree ("Brazos Roots") — self-contained stylesheet.
   The token block below is the ONLY thing to change for a ShiffCo reskin.
   Library-zone feel: cream ground, Cormorant display, gold/crimson accents.
   ========================================================================= */
:root {
  --ft-cream:      #FAF7F2;
  --ft-parchment:  #F5F0E8;
  --ft-card:       #FFFFFF;
  --ft-ink:        #1f1b16;
  --ft-ink-light:  #4a4238;
  --ft-ink-faint:  #8a7f70;
  --ft-line:       #e6ded1;
  --ft-gold:       #B8860B;
  --ft-gold-light: #D4A843;
  --ft-crimson:    #8B1A1A;
  --ft-crimson-faint: rgba(139,26,26,0.06);
  --ft-gold-faint: rgba(184,134,11,0.10);
  --ft-shadow:     0 2px 10px rgba(60,45,20,0.08);
  --ft-radius:     12px;
  --ft-font-display: 'Cormorant Garamond', Georgia, serif;
  --ft-font-body:    'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body.ft-body {
  margin: 0;
  background: var(--ft-cream);
  color: var(--ft-ink);
  font-family: var(--ft-font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.ft-wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }

/* ---- Header / masthead ---- */
.ft-masthead {
  text-align: center;
  padding: 44px 20px 30px;
  border-bottom: 1px solid var(--ft-line);
  margin-bottom: 30px;
  background: linear-gradient(180deg, var(--ft-parchment), var(--ft-cream));
}
.ft-eyebrow {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ft-gold); margin-bottom: 8px;
}
.ft-masthead h1 {
  font-family: var(--ft-font-display); font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 8px; line-height: 1.05;
}
.ft-masthead p { color: var(--ft-ink-light); margin: 4px 0 0; font-size: 1rem; }
.ft-back { display: inline-block; margin-top: 14px; color: var(--ft-crimson);
  text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.ft-back:hover { text-decoration: underline; }

/* ---- Search box ---- */
.ft-searchbar { display: flex; gap: 10px; max-width: 560px; margin: 22px auto 0; }
.ft-searchbar input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--ft-line);
  border-radius: 999px; font-family: var(--ft-font-body); font-size: 0.95rem;
  background: #fff; color: var(--ft-ink);
}
.ft-searchbar input:focus { outline: none; border-color: var(--ft-gold); }
.ft-btn {
  border: none; cursor: pointer; font-family: var(--ft-font-body); font-weight: 600;
  padding: 12px 22px; border-radius: 999px; font-size: 0.9rem;
  background: var(--ft-crimson); color: #fff;
}
.ft-btn:hover { background: #6f1414; }
.ft-btn.ft-ghost { background: transparent; color: var(--ft-crimson); border: 1px solid var(--ft-crimson); }

/* ---- Branch index cards ---- */
.ft-branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 20px; }
.ft-branch-card {
  background: var(--ft-card); border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius); padding: 22px 24px; box-shadow: var(--ft-shadow);
  text-decoration: none; color: inherit; display: block; transition: transform .12s, box-shadow .12s;
}
.ft-branch-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(60,45,20,0.13); }
.ft-branch-card h2 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.5rem; margin: 0 0 4px; }
.ft-branch-card .ft-couple { color: var(--ft-ink-light); font-size: 0.9rem; margin-bottom: 12px; }
.ft-branch-card .ft-credit { color: var(--ft-ink-faint); font-size: 0.75rem; font-style: italic; margin-top: 10px; }
.ft-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ft-count { font-size: 0.8rem; color: var(--ft-ink-faint); font-weight: 600; }

/* ---- Status badge ---- */
.ft-badge {
  display: inline-block; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
}
.ft-badge.open-debate { background: var(--ft-crimson-faint); color: var(--ft-crimson); }
.ft-badge.documented { background: rgba(31,110,60,0.08); color: #1f6e3c; }
.ft-badge.draft { background: var(--ft-gold-faint); color: var(--ft-gold); }

/* ---- Tree outline ---- */
.ft-tree { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.ft-tree ul.ft-children { list-style: none; margin: 0 0 0 14px; padding: 0 0 0 16px;
  border-left: 1px solid var(--ft-line); }
.ft-node { margin: 3px 0; }
.ft-card {
  display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; transition: background .1s, border-color .1s;
}
.ft-card:hover { background: var(--ft-parchment); border-color: var(--ft-line); }
.ft-toggle {
  border: none; background: var(--ft-gold-faint); color: var(--ft-gold);
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  font-weight: 700; line-height: 1; font-size: 0.9rem; align-self: center;
  flex: 0 0 auto;
}
.ft-leaf-dot { color: var(--ft-ink-faint); width: 20px; text-align: center; align-self: center; }
.ft-name { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.12rem; }
.ft-life { color: var(--ft-ink-faint); font-size: 0.82rem; }
.ft-gen { color: var(--ft-ink-faint); font-size: 0.62rem; border: 1px solid var(--ft-line);
  border-radius: 4px; padding: 0 4px; margin-left: 2px; }
.ft-spouse { color: var(--ft-ink-light); font-size: 0.8rem; font-style: italic;
  padding-left: 6px; border-left: 2px solid var(--ft-gold-light); margin-left: 4px; }
.ft-uncertain .ft-q { color: var(--ft-crimson); font-weight: 700; font-style: normal;
  cursor: help; border: 1px solid var(--ft-crimson); border-radius: 50%; padding: 0 4px; font-size: 0.7rem; }
.ft-placeholder .ft-stub { color: var(--ft-ink-faint); font-style: italic; font-size: 0.85rem;
  padding: 4px 12px; display: inline-block; }
/* collapsed state (JS adds .ft-collapsed to the <li>) */
.ft-node.ft-collapsed > ul.ft-children { display: none; }

/* ---- Toolbar above tree ---- */
.ft-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0 20px; }
.ft-toolbar .ft-mini { font-size: 0.78rem; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--ft-line); background: #fff; cursor: pointer; color: var(--ft-ink-light); font-weight: 600; }
.ft-toolbar .ft-mini:hover { border-color: var(--ft-gold); color: var(--ft-gold); }

/* ---- View switch (Outline / Diagram) ---- */
.ft-viewswitch { display: inline-flex; border: 1px solid var(--ft-line); border-radius: 999px; overflow: hidden; }
.ft-viewswitch .ft-mini { border: none; border-radius: 0; margin: 0; }
.ft-mini.ft-active { background: var(--ft-crimson); color: #fff; border-color: var(--ft-crimson); }
.ft-mini.ft-active:hover { color: #fff; }

/* ---- SVG diagram ---- */
#ftDiagram { position: relative; border: 1px solid var(--ft-line); border-radius: var(--ft-radius);
  background: linear-gradient(180deg,#fff, var(--ft-cream)); box-shadow: var(--ft-shadow);
  height: 74vh; min-height: 460px; overflow: hidden; margin-bottom: 8px; }
.ft-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.ft-svg.ft-grabbing { cursor: grabbing; }
.ft-diagram-controls { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; gap: 6px;
  background: rgba(255,255,255,0.9); padding: 6px; border-radius: 999px; box-shadow: var(--ft-shadow); align-items: center; }
.ft-diagram-controls .ft-mini { margin: 0; }
.ft-diagram-hint { position: absolute; bottom: 10px; left: 12px; font-size: 0.72rem; color: var(--ft-ink-faint);
  background: rgba(255,255,255,0.8); padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.ftedge { fill: none; stroke: #d9cdb8; stroke-width: 1.5; }
.ftnode-box { fill: #fff; stroke: var(--ft-line); stroke-width: 1.5; transition: stroke .1s; }
.ftnode:hover .ftnode-box { stroke: var(--ft-gold); }
.ftnode-hit { cursor: pointer; }
.ftnode-ph .ftnode-box { fill: var(--ft-parchment); stroke: var(--ft-ink-faint); stroke-dasharray: 4 3; }
.ftnode-name { font-family: var(--ft-font-display); font-weight: 700; font-size: 15px; fill: var(--ft-ink); }
.ftnode-ph .ftnode-name { font-style: italic; fill: var(--ft-ink-faint); font-weight: 500; }
.ftnode-life { font-size: 11px; fill: var(--ft-ink-faint); font-family: var(--ft-font-body); }
.ftnode-sp { font-size: 11px; fill: var(--ft-ink-light); font-style: italic; font-family: var(--ft-font-body); }
.fttoggle { cursor: pointer; }
.fttoggle-c { fill: var(--ft-cream); stroke: var(--ft-gold); stroke-width: 1.5; }
.fttoggle:hover .fttoggle-c { fill: var(--ft-gold-faint); }
.fttoggle-t { fill: var(--ft-gold); font-size: 15px; font-weight: 700; font-family: var(--ft-font-body); }
.fttoggle-n { fill: var(--ft-ink-faint); font-size: 10px; font-family: var(--ft-font-body); }

/* ---- Import button pulse (draws the eye after a convert) ---- */
@keyframes ftPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(139,26,26,0.5); } 50% { box-shadow: 0 0 0 8px rgba(139,26,26,0); } }
.ft-pulse { animation: ftPulse 1.1s ease-out 4; }

/* ---- Smart Paste (AI convert) ---- */
.ft-smartpaste { background: var(--ft-gold-faint); border: 1px solid var(--ft-line); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }

/* ---- Photo harvest review ---- */
.ft-harvest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.ft-hv-card { background: var(--ft-card); border: 1px solid var(--ft-line); border-radius: 10px; padding: 10px; box-shadow: var(--ft-shadow); font-size: 0.82rem; }
.ft-hv-img { width: 100%; height: 150px; object-fit: cover; border-radius: 7px; border: 1px solid var(--ft-line); background: var(--ft-parchment); }
.ft-hv-cap { font-style: italic; color: var(--ft-ink-light); margin: 6px 0 2px; font-size: 0.78rem; }
.ft-hv-match { margin: 4px 0 2px; }
.ft-hv-note { font-size: 0.72rem; color: var(--ft-ink-faint); margin-bottom: 6px; }
.ft-hv-search { width: 100%; padding: 6px 8px; border: 1px solid var(--ft-line); border-radius: 6px; font-size: 0.78rem; font-family: var(--ft-font-body); }
.ft-hv-picks { max-height: 150px; overflow: auto; }
.ft-hv-pick { padding: 5px 7px; border-bottom: 1px dashed var(--ft-line); cursor: pointer; font-size: 0.78rem; }
.ft-hv-pick:hover { background: var(--ft-parchment); }
.ft-hv-actions { display: flex; gap: 6px; margin-top: 8px; }
.ft-hv-actions button { border: none; border-radius: 6px; padding: 5px 10px; font-size: 0.76rem; font-weight: 600; cursor: pointer; }

/* ---- Photo gallery ---- */
.ft-gal-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.ft-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.ft-gal-card { margin: 0; cursor: pointer; background: var(--ft-card); border: 1px solid var(--ft-line);
  border-radius: 10px; overflow: hidden; box-shadow: var(--ft-shadow); transition: transform .12s, box-shadow .12s; }
.ft-gal-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(60,45,20,0.16); }
.ft-gal-img { width: 100%; aspect-ratio: 1 / 1; background-size: cover; background-position: center 22%; background-color: var(--ft-parchment); }
.ft-gal-card figcaption { padding: 8px 10px; }
.ft-gal-name { display: block; font-family: var(--ft-font-display); font-weight: 700; font-size: 1rem; line-height: 1.15; }
.ft-gal-life { font-size: 0.76rem; color: var(--ft-ink-faint); }
/* lightbox */
.ft-lb { position: fixed; inset: 0; z-index: 1000; background: rgba(20,14,8,0.9); display: flex; align-items: center; justify-content: center; }
.ft-lb[hidden] { display: none; }
.ft-lb-fig { margin: 0; max-width: 90vw; max-height: 88vh; text-align: center; }
.ft-lb-fig img { max-width: 90vw; max-height: 72vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.ft-lb-fig figcaption { color: #f3ecdf; margin-top: 12px; font-size: 0.95rem; line-height: 1.5; }
.ft-lb-caption { font-style: italic; color: #d8cdbb; font-size: 0.85rem; }
.ft-lb-credit { color: #a99; font-size: 0.75rem; }
.ft-lb-link { color: var(--ft-gold-light); font-weight: 600; text-decoration: none; }
.ft-lb-link:hover { text-decoration: underline; }
.ft-lb-close { position: absolute; top: 16px; right: 20px; background: none; border: none; color: #f3ecdf; font-size: 2.2rem; cursor: pointer; line-height: 1; }
.ft-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.12); border: none;
  color: #fff; font-size: 2.4rem; width: 52px; height: 72px; cursor: pointer; border-radius: 8px; }
.ft-lb-nav:hover { background: rgba(255,255,255,0.24); }
.ft-lb-prev { left: 14px; } .ft-lb-next { right: 14px; }
@media (max-width: 560px) { .ft-lb-nav { width: 40px; font-size: 1.8rem; } }

/* ---- Faces / photos ---- */
.ft-face { display: inline-block; width: 26px; height: 26px; border-radius: 50%; background-size: cover;
  background-position: center 20%; border: 1.5px solid var(--ft-gold-light); vertical-align: middle;
  margin-right: 2px; flex: 0 0 auto; box-shadow: 0 1px 3px rgba(60,45,20,0.18); }
.ft-drawer-photo { margin: 0 0 12px; text-align: center; }
.ft-drawer-photo img { max-width: 100%; max-height: 300px; border-radius: 10px; border: 1px solid var(--ft-line);
  box-shadow: var(--ft-shadow); }
.ft-photo-cap { font-size: 0.78rem; color: var(--ft-ink-faint); font-style: italic; margin-top: 6px; }
.ft-photo-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.ft-photo-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--ft-line); cursor: pointer; }
.ft-admin-photo { background: var(--ft-parchment); border: 1px solid var(--ft-line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.ft-photo-manage { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ft-pm-item { position: relative; }
.ft-pm-item img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--ft-line); display: block; }
.ft-pm-item button { position: absolute; border: none; cursor: pointer; font-size: 0.7rem; width: 18px; height: 18px; border-radius: 50%; line-height: 1; padding: 0; }
.ft-pm-primary { top: -6px; left: -6px; background: var(--ft-gold); color: #fff; }
.ft-pm-del { top: -6px; right: -6px; background: var(--ft-crimson); color: #fff; }
.ft-pm-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ft-pm-url, .ft-pm-caption { flex: 1; min-width: 140px; padding: 7px 9px; border: 1px solid var(--ft-line); border-radius: 7px; font-size: 0.82rem; font-family: var(--ft-font-body); }
.ft-pm-fetch, .ft-pm-file { border: 1px solid var(--ft-line); background: #fff; border-radius: 7px; padding: 7px 12px; font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--ft-ink-light); }
.ft-pm-fetch:hover, .ft-pm-file:hover { border-color: var(--ft-gold); color: var(--ft-gold); }
.ftnode-face { }

/* ---- Lineage trace ---- */
.ft-trace-btn { display: block; width: 100%; margin: 4px 0 16px; padding: 10px 14px; border: 1px solid var(--ft-gold);
  background: var(--ft-gold-faint); color: var(--ft-gold); border-radius: 9px; font-family: var(--ft-font-body);
  font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.ft-trace-btn:hover { background: var(--ft-gold); color: #fff; }
.ft-trace-back { border: none; background: none; color: var(--ft-crimson); font-weight: 600; cursor: pointer; font-size: 0.85rem; padding: 0; }
.ft-strand { list-style: none; margin: 0; padding: 0; }
.ft-strand-step { position: relative; padding: 10px 12px 10px 26px; border-radius: 9px; margin: 2px 0; }
.ft-strand-step.ft-strand-subject { background: var(--ft-gold-faint); border: 1px solid var(--ft-line); }
.ft-strand-step.ft-strand-cross { background: var(--ft-crimson-faint); }
.ft-strand-rail { position: absolute; left: 8px; top: 8px; color: var(--ft-ink-faint); }
.ft-strand-tag { display: block; font-size: 0.72rem; color: var(--ft-ink-faint); font-style: italic; margin-top: 2px; }
.ft-strand-named { font-family: var(--ft-font-display); font-weight: 700; color: var(--ft-ink-light); }
.ft-strand-terminal { padding-left: 26px; }
.ft-strand-foot { font-size: 0.78rem; color: var(--ft-ink-faint); margin-top: 12px; text-align: center; }

/* ---- Migration map ---- */
.ft-map-panel { background: linear-gradient(180deg,#fff,var(--ft-cream)); border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius); box-shadow: var(--ft-shadow); padding: 16px 18px; }
.ft-map-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ft-map-slider { flex: 1; min-width: 180px; accent-color: var(--ft-gold); cursor: pointer; }
.ft-map-decade { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.3rem; color: var(--ft-crimson);
  min-width: 96px; text-align: center; }
.ft-map-modes { display: inline-flex; gap: 4px; }
#ftMapWrap { position: relative; }
#ftMapSvg { width: 100%; height: auto; display: block; background: #e7edeb; border-radius: 8px; }
.ftmap-land { fill: #faf7f2; stroke: #c9b79a; stroke-width: 1.2; stroke-linejoin: round; }
.ftmap-state { font-family: var(--ft-font-body); font-size: 11px; fill: #bdae92; font-weight: 600; pointer-events: none; }
.ftmap-pt { cursor: pointer; transition: r .15s, opacity .3s; }
.ft-map-tip { position: absolute; z-index: 10; background: #2b241c; color: #f3ecdf; font-size: 0.78rem; line-height: 1.4;
  padding: 8px 11px; border-radius: 8px; pointer-events: none; max-width: 240px; box-shadow: var(--ft-shadow); }
.ftmap-tip-n { color: var(--ft-gold-light); font-weight: 600; }
.ft-map-legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.76rem; color: var(--ft-ink-faint); flex-wrap: wrap; }
.ftmap-leg-grad { display: inline-block; width: 120px; height: 10px; border-radius: 6px; }
.ftmap-leg-sep { opacity: 0.5; }

/* ---- Front-page tools row ---- */
.ft-tools-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.ft-tool-link { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--ft-card); border: 1px solid var(--ft-line); border-radius: var(--ft-radius); padding: 16px 18px;
  box-shadow: var(--ft-shadow); color: inherit; transition: transform .12s, box-shadow .12s; }
.ft-tool-link:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(60,45,20,0.13); }
.ft-tool-ico { font-size: 1.6rem; }
.ft-tool-link h3 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.2rem; margin: 0; }
.ft-tool-link p { margin: 2px 0 0; font-size: 0.8rem; color: var(--ft-ink-faint); }

/* ---- Front-page relationship tool ---- */
.ft-relate-tool { background: var(--ft-card); border: 1px solid var(--ft-line); border-radius: var(--ft-radius);
  padding: 22px 24px; box-shadow: var(--ft-shadow); margin-bottom: 28px; }
.ft-relate-tool h2 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.5rem; margin: 0 0 4px; }
.ft-rt-sub { font-size: 0.85rem; color: var(--ft-ink-faint); margin: 0 0 14px; }
.ft-rt-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: start; }
.ft-rt-vs { font-family: var(--ft-font-display); font-size: 1.5rem; color: var(--ft-gold); padding-top: 8px; text-align: center; }
.ft-rt-field { position: relative; }
.ft-rt-field .ft-rel-picks { position: absolute; z-index: 20; left: 0; right: 0; background: #fff; border: 1px solid var(--ft-line);
  border-radius: 0 0 8px 8px; box-shadow: var(--ft-shadow); max-height: 280px; overflow: auto; }
.ft-rt-hint { font-size: 0.85rem; color: var(--ft-ink-faint); text-align: center; padding: 14px; }
.ft-rt-out { margin-top: 16px; }
.ft-rel-pick.ft-muted { color: var(--ft-ink-faint); cursor: default; }
@media (max-width: 560px) { .ft-rt-inputs { grid-template-columns: 1fr; } .ft-rt-vs { padding: 0; } }

/* ---- Relationship finder ---- */
.ft-relate-btn { display: block; width: 100%; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--ft-crimson);
  background: var(--ft-crimson-faint); color: var(--ft-crimson); border-radius: 9px; font-family: var(--ft-font-body);
  font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.ft-relate-btn:hover { background: var(--ft-crimson); color: #fff; }
.ft-rel-search { width: 100%; padding: 10px 12px; border: 1px solid var(--ft-line); border-radius: 8px; font-family: var(--ft-font-body); font-size: 0.9rem; }
.ft-rel-pick { padding: 8px 10px; border-bottom: 1px dashed var(--ft-line); cursor: pointer; font-size: 0.88rem; }
.ft-rel-pick:hover { background: var(--ft-parchment); }
.ft-rel-result { margin-top: 14px; }
.ft-rel-headline { font-family: var(--ft-font-display); font-size: 1.35rem; font-weight: 700; color: var(--ft-ink);
  background: var(--ft-gold-faint); border: 1px solid var(--ft-line); border-radius: 10px; padding: 14px 16px; line-height: 1.3; }
.ft-rel-mrca { font-size: 0.85rem; color: var(--ft-ink-light); margin: 12px 0 6px; }
.ft-rel-legs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ft-rel-leg { background: var(--ft-card); border: 1px solid var(--ft-line); border-radius: 9px; padding: 10px 12px; }
.ft-rel-leg-who { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ft-gold); font-weight: 700; margin-bottom: 6px; }
.ft-rel-leg ol { margin: 0; padding-left: 18px; font-size: 0.85rem; }
.ft-rel-leg li { padding: 2px 0; }
@media (max-width: 520px) { .ft-rel-legs { grid-template-columns: 1fr; } }

/* ---- Connections review (admin) ---- */
.ft-conn { background: var(--ft-card); border: 1px solid var(--ft-line); border-radius: 9px; padding: 12px 14px; margin: 8px 0; font-size: 0.85rem; }
.ft-conn .ft-conn-rel { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.ft-conn-rel.same_person { background: var(--ft-gold-faint); color: var(--ft-gold); }
.ft-conn-rel.parent { background: rgba(31,110,60,0.08); color: #1f6e3c; }
.ft-conn-actions { margin-top: 8px; display: flex; gap: 8px; }
.ft-conn-actions button { border: none; border-radius: 7px; padding: 6px 14px; font-weight: 600; font-size: 0.78rem; cursor: pointer; font-family: var(--ft-font-body); }
.ft-conf { background: #1f7a3d; color: #fff; }
.ft-rej { background: #fff; color: var(--ft-crimson); border: 1px solid var(--ft-crimson) !important; }

/* ---- Verified spelling marks ---- */
.ft-verified { color: #1f7a3d; font-weight: 700; font-size: 0.72em; margin-left: 3px; cursor: help; vertical-align: middle; }
.ft-verified-lg { font-size: 0.6em; }
.ftnode-verified { fill: #1f7a3d; font-size: 13px; font-weight: 700; }
/* Admin verify/correct control in the drawer */
.ft-admin-verify { background: var(--ft-gold-faint); border: 1px solid var(--ft-line); border-radius: 10px;
  padding: 12px 14px; margin: 14px 0; }
.ft-av-label { display: block; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ft-gold); font-weight: 700; margin-bottom: 6px; }
.ft-av-name { width: 100%; padding: 8px 10px; border: 1px solid var(--ft-line); border-radius: 7px;
  font-family: var(--ft-font-body); font-size: 0.9rem; }
.ft-av-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ft-av-save { border: none; background: #1f7a3d; color: #fff; border-radius: 7px; padding: 7px 14px;
  font-family: var(--ft-font-body); font-weight: 600; font-size: 0.82rem; cursor: pointer; }
.ft-av-save:hover { background: #17612f; }
.ft-av-unverify { border: 1px solid var(--ft-line); background: #fff; color: var(--ft-ink-light);
  border-radius: 7px; padding: 7px 12px; font-size: 0.78rem; cursor: pointer; }
.ft-av-status { font-size: 0.78rem; color: var(--ft-ink-faint); }

/* ---- Spellings audit ---- */
.ft-spelling-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ft-spelling-chip { font-size: 0.8rem; background: var(--ft-gold-faint); color: var(--ft-ink-light);
  border: 1px solid var(--ft-line); border-radius: 999px; padding: 4px 12px; }
.ft-spelling-chip em { color: var(--ft-gold); font-style: normal; font-weight: 700; margin-left: 4px; }

/* ---- Person drawer ---- */
.ft-drawer-overlay {
  position: fixed; inset: 0; background: rgba(30,20,10,0.35);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 900;
}
.ft-drawer-overlay.ft-open { opacity: 1; pointer-events: auto; }
.ft-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(460px, 92vw);
  background: var(--ft-cream); box-shadow: -6px 0 30px rgba(40,25,10,0.2);
  transform: translateX(100%); transition: transform .24s ease; z-index: 901;
  overflow-y: auto; padding: 28px 26px 60px;
}
.ft-drawer.ft-open { transform: translateX(0); }
.ft-drawer-close { position: absolute; top: 16px; right: 18px; border: none; background: none;
  font-size: 1.6rem; cursor: pointer; color: var(--ft-ink-faint); line-height: 1; }
.ft-drawer h2 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.8rem; margin: 6px 0 2px; padding-right: 30px; }
.ft-drawer .ft-sub { color: var(--ft-ink-faint); font-size: 0.85rem; margin-bottom: 18px; }
.ft-drawer .ft-section { margin: 18px 0; }
.ft-drawer .ft-section h3 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ft-gold); font-weight: 700; margin: 0 0 8px; }
.ft-drawer dl { display: grid; grid-template-columns: 92px 1fr; gap: 4px 12px; margin: 0; font-size: 0.9rem; }
.ft-drawer dt { color: var(--ft-ink-faint); }
.ft-drawer dd { margin: 0; }
.ft-drawer ul.ft-list { list-style: none; margin: 0; padding: 0; }
.ft-drawer ul.ft-list li { padding: 4px 0; border-bottom: 1px dashed var(--ft-line); font-size: 0.88rem; }
.ft-link { color: var(--ft-crimson); cursor: pointer; text-decoration: none; }
.ft-link:hover { text-decoration: underline; }
.ft-note { font-size: 0.85rem; color: var(--ft-ink-light); padding: 6px 0; border-left: 2px solid var(--ft-gold-light); padding-left: 10px; margin: 6px 0; }
.ft-private-note { background: var(--ft-gold-faint); border-radius: 8px; padding: 12px 14px; font-size: 0.85rem; color: var(--ft-ink-light); }

/* ---- Archive / narrative footer ---- */
.ft-archive { margin-top: 50px; border-top: 2px solid var(--ft-line); padding-top: 30px; }
.ft-archive h2 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.7rem; }
.ft-narrative { font-size: 1.02rem; color: var(--ft-ink-light); line-height: 1.7; max-width: 720px; }
.ft-source {
  background: var(--ft-card); border: 1px solid var(--ft-line); border-left: 4px solid var(--ft-gold);
  border-radius: 8px; padding: 18px 22px; margin: 16px 0; box-shadow: var(--ft-shadow);
}
.ft-source .ft-source-type { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ft-gold); font-weight: 700; }
.ft-source h4 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.2rem; margin: 4px 0 10px; }
.ft-source .ft-source-text { font-family: var(--ft-font-display); font-size: 1.05rem; line-height: 1.6;
  color: var(--ft-ink-light); white-space: pre-wrap; }
.ft-credit-footer { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--ft-line);
  font-size: 0.82rem; font-style: italic; color: var(--ft-ink-faint); text-align: center; }
.ft-statusnote { background: var(--ft-crimson-faint); border-radius: 8px; padding: 12px 16px;
  color: var(--ft-crimson); font-size: 0.85rem; margin: 14px 0; }

/* ---- Site byline (every public page) ---- */
.ft-site-footer { max-width: 720px; margin: 60px auto 30px; padding: 18px 16px 0; border-top: 1px solid var(--ft-line);
  font-size: 0.78rem; font-style: italic; color: var(--ft-ink-faint); text-align: center; line-height: 1.6; }
.ft-site-footer a { color: var(--ft-ink-light); text-decoration: none; border-bottom: 1px dotted var(--ft-ink-faint); }
.ft-site-footer a:hover { color: var(--ft-crimson); border-bottom-color: var(--ft-crimson); }

/* ---- Search results ---- */
.ft-results-group { margin: 24px 0; }
.ft-results-group h3 { font-family: var(--ft-font-display); font-weight: 700; font-size: 1.3rem;
  border-bottom: 1px solid var(--ft-line); padding-bottom: 6px; }
.ft-result { padding: 10px 0; border-bottom: 1px dashed var(--ft-line); }
.ft-result a { color: var(--ft-ink); text-decoration: none; font-weight: 600; }
.ft-result a:hover { color: var(--ft-crimson); }
.ft-result .ft-r-meta { color: var(--ft-ink-faint); font-size: 0.82rem; }
.ft-empty { text-align: center; color: var(--ft-ink-faint); padding: 50px 20px; font-size: 1rem; }
.ft-empty .ft-big { font-family: var(--ft-font-display); font-size: 1.6rem; color: var(--ft-ink-light); margin-bottom: 8px; }

/* ---- Admin ---- */
.ft-admin-panel { background: var(--ft-card); border: 1px solid var(--ft-line); border-radius: var(--ft-radius);
  padding: 24px; box-shadow: var(--ft-shadow); margin: 20px 0; }
.ft-dropzone { border: 2px dashed var(--ft-gold-light); border-radius: var(--ft-radius); padding: 40px 20px;
  text-align: center; color: var(--ft-ink-faint); cursor: pointer; transition: background .12s, border-color .12s; }
.ft-dropzone.ft-hover { background: var(--ft-gold-faint); border-color: var(--ft-gold); color: var(--ft-gold); }
.ft-admin-out { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; white-space: pre-wrap;
  background: #2b241c; color: #f3ecdf; border-radius: 8px; padding: 16px; margin-top: 16px; max-height: 380px; overflow: auto; }
.ft-dup { background: var(--ft-crimson-faint); border-radius: 8px; padding: 10px 14px; margin: 8px 0; font-size: 0.85rem; }

@media (max-width: 620px) {
  .ft-name { font-size: 1rem; }
  .ft-tree ul.ft-children { margin-left: 8px; padding-left: 10px; }
}

/* ---- Print ---- */
@media print {
  .ft-searchbar, .ft-toolbar, .ft-drawer, .ft-drawer-overlay, .ft-back, .ft-btn, .ft-masthead, #ftDiagram { display: none !important; }
  #ftZoomLayer { display: block !important; }
  body.ft-body { background: #fff; }
  .ft-node.ft-collapsed > ul.ft-children { display: block !important; }
  .ft-card { border: none; padding: 2px 0; }
  .ft-tree { font-size: 11pt; }
  .ft-source { break-inside: avoid; box-shadow: none; }
}
