/* The React family chart re-dressed in the archive's sepia and gold. Inline
   colours from the bundle are overridden here, hence the !important flags. */

.akt-tree-panel,
.akt-tree-solo {
  --tk-gold: var(--akt-gold, #d4aa6a);
  --tk-panel: var(--akt-panel, #120d09);
  --tk-sheet: var(--akt-sheet, #f1e6cf);
  --tk-ink: var(--akt-ink, #3b2a1a);
  position: relative;
  margin: 0 0 2.5rem;
  border: 1px solid color-mix(in srgb, var(--tk-gold) 55%, transparent);
  border-radius: 6px;
  overflow: hidden;
  background: var(--tk-panel) var(--akt-scene, none) left bottom / cover no-repeat;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), inset 0 0 0 4px rgba(0, 0, 0, .35);
}

.akt-tree-solo { height: 820px; }

.akt-tree-panel::before,
.akt-tree-solo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, var(--akt-dim, .3));
  pointer-events: none;
}

.akt-tree-panel[hidden] { display: none; }

.akt-tree-panel .apple-tree-mount,
.akt-tree-solo .apple-tree-mount {
  position: relative;
  z-index: 1;
  height: 100% !important;
  min-height: 0 !important;
}

/* the sidebar is fixed but trapped in the mount's stacking context; lift it above the sticky site menu */
.akt-tree-panel .apple-tree-mount:has(.ff-sidebar-overlay),
.akt-tree-solo .apple-tree-mount:has(.ff-sidebar-overlay) { z-index: 1000; }

.apple-tree-embed {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 0;
  box-sizing: border-box;
  font-family: var(--font-body, Georgia, serif);
  color: var(--text-main, #ede8e1);
}

.apple-tree-embed > div:first-child { margin-bottom: 12px !important; flex: 0 0 auto; }

.apple-tree-embed input[type="text"] {
  background: rgba(18, 13, 9, .82) !important;
  color: var(--tk-sheet, #f1e6cf) !important;
  border-width: 1px !important;
  border-radius: 999px !important;
  font-family: var(--font-body, Georgia, serif) !important;
  padding-top: .7rem !important;
  padding-bottom: .7rem !important;
}
.apple-tree-embed input[type="text"]::placeholder { color: rgba(241, 230, 207, .55); }

.apple-tree-embed > div:first-child > div:last-child {
  background: rgba(18, 13, 9, .82) !important;
  border-color: color-mix(in srgb, var(--tk-gold, #d4aa6a) 50%, transparent) !important;
  border-radius: 999px !important;
}
.apple-tree-embed > div:first-child > div:last-child button {
  border-radius: 999px !important;
  font-family: var(--font-cinzel, Georgia, serif) !important;
  letter-spacing: .06em;
}

.apple-tree-embed .ff-container {
  flex: 1 1 auto;
  width: 100% !important;
  height: auto !important;
  min-height: 0;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.apple-tree-embed .ff-status { color: var(--text-muted, #c8c0b5); height: 100%; }

/* portrait cards */

.apple-tree-embed .ff-node {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 150px;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  padding: 8px 8px 10px;
  text-align: center;
  background: linear-gradient(180deg, #2b1e13, #18110b) !important;
  border: 1px solid color-mix(in srgb, var(--tk-gold, #d4aa6a) 70%, transparent) !important;
  border-radius: 3px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
}
.apple-tree-embed .ff-node:hover { box-shadow: 0 0 0 1px var(--tk-gold, #d4aa6a), 0 10px 26px rgba(0, 0, 0, .55); }
.apple-tree-embed .ff-node-selected {
  border-color: var(--tk-gold, #d4aa6a) !important;
  box-shadow: 0 0 0 2px var(--tk-gold, #d4aa6a), 0 0 26px color-mix(in srgb, var(--tk-gold, #d4aa6a) 45%, transparent) !important;
}

.apple-tree-embed .ff-node-photo {
  width: 118px;
  height: 150px;
  border-radius: 2px;
  border: 1px solid color-mix(in srgb, var(--tk-gold, #d4aa6a) 45%, transparent) !important;
  background: #3a2a1b;
  color: #c9a26a;
}
.apple-tree-embed .ff-node-photo svg { stroke: #c9a26a; width: 46px; height: 46px; }
.apple-tree-embed .ff-node-photo img { filter: sepia(.5) contrast(1.03); }

.apple-tree-embed .ff-node-info { width: 100%; }
.apple-tree-embed .ff-node-name {
  font-family: var(--font-body, Georgia, serif);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--tk-sheet, #f1e6cf);
}
.apple-tree-embed .ff-node-years {
  margin-top: 3px;
  font-size: .78rem;
  color: var(--tk-gold, #d4aa6a);
  white-space: normal;
}

/* connectors */

.apple-tree-embed .react-flow__edge-path {
  stroke: var(--tk-gold, #d4aa6a) !important;
  stroke-opacity: .75;
}
.apple-tree-embed .akt-edge-couple .react-flow__edge-path {
  stroke-width: 2.2px !important;
  stroke-opacity: 1;
}

/* zoom controls */

.apple-tree-embed .react-flow__controls { box-shadow: 0 4px 14px rgba(0, 0, 0, .5) !important; border-radius: 999px !important; }
.apple-tree-embed .react-flow__controls-button {
  background: rgba(18, 13, 9, .9) !important;
  border-color: color-mix(in srgb, var(--tk-gold, #d4aa6a) 40%, transparent) !important;
  color: var(--tk-gold, #d4aa6a) !important;
}
.apple-tree-embed .react-flow__controls-button:hover { background: #2a1d12 !important; }
.apple-tree-embed .react-flow__attribution { background: transparent !important; opacity: .35; }

/* the side panel that opens from a portrait */

.ff-sidebar-overlay { background: rgba(5, 4, 3, .55) !important; z-index: 100000 !important; }
.ff-sidebar {
  background: var(--akt-sheet, #f1e6cf) !important;
  color: var(--akt-ink, #3b2a1a);
  border-left: 3px solid var(--akt-gold, #d4aa6a) !important;
  font-family: var(--font-body, Georgia, serif);
  box-shadow: -18px 0 40px rgba(0, 0, 0, .45);
  scrollbar-width: thin;
  scrollbar-color: var(--akt-gold, #d4aa6a) rgba(59, 42, 26, .12);
}
.ff-sidebar::-webkit-scrollbar { width: 8px; }
.ff-sidebar::-webkit-scrollbar-track { background: rgba(59, 42, 26, .12); }
.ff-sidebar::-webkit-scrollbar-thumb { background: var(--akt-gold, #d4aa6a); border-radius: 8px; }
.ff-sidebar-close { background: transparent !important; border-color: rgba(59, 42, 26, .35) !important; color: var(--akt-ink, #3b2a1a) !important; }
.ff-sidebar-photo {
  width: 140px;
  height: 178px;
  border-radius: 2px;
  border: 1px solid var(--akt-gold, #d4aa6a) !important;
  background: #e2d3b4;
}
.ff-sidebar-photo img { filter: sepia(.45); }
.ff-sidebar-name { font-family: var(--font-cinzel, Georgia, serif) !important; color: var(--akt-ink, #3b2a1a) !important; font-weight: 600 !important; }
.ff-sidebar-surname { color: #7a5c3c !important; }
.ff-sidebar-accent { background: var(--akt-gold, #d4aa6a) !important; width: 90px; height: 2px; }
.ff-sidebar-detail, .ff-sidebar-rel { color: var(--akt-ink, #3b2a1a) !important; }
.ff-sidebar-detail strong { color: #6b4a2b !important; }
.ff-sidebar-cause { color: #7a3b22 !important; }
.ff-sidebar-section h4 {
  font-family: var(--font-cinzel, Georgia, serif) !important;
  color: #7a5c3c !important;
  border-bottom-color: rgba(59, 42, 26, .2) !important;
}
.ff-sidebar-rel { border-left-color: var(--akt-gold, #d4aa6a) !important; }
