/* =============================================================================
   F45 — Firaq genealogy map
   Loaded only on the Firaq Map page + the `firqa` term archives
   (AA\Firqa::enqueue). The per-kind colour custom properties
   (.ft--{kind} / .aa-dark .ft--{kind}) are NOT here — they are generated from
   the editable kind registry and inlined by AA\Firqa::kind_css(). Everything
   below is the structural .ft-* port from the prototype (firaq-data.jsx
   injectFiraqCss), followed by the F45 page/archive layout.
   See docs/F45-design.md.
   ============================================================================= */

/* ── Tree scaffold (indented stemma — depth = indent) ── */
.ft-tree, .ft-tree ul { list-style: none; margin: 0; padding: 0; }
.ft-tree { font-family: var(--aa-fb), Georgia, serif; }
.ft-tree ul { margin-left: 15px; }
.ft-item { position: relative; }

/* connector lines for non-root levels */
.ft-tree ul > .ft-item { padding-left: 20px; }
.ft-tree ul > .ft-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--rule-soft);
}
.ft-tree ul > .ft-item:last-child::before { height: 18px; }
.ft-tree ul > .ft-item::after {
  content: ''; position: absolute; left: 0; top: 18px; width: 15px;
  border-top: 1px solid var(--rule-soft);
}

/* ── Node chip ── */
.ft-node {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 8px;
  margin: 3px 0;
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--ft-c, var(--rule));
  background: var(--paper);
  cursor: pointer;
  text-align: left; width: 100%;
  font: inherit; color: var(--ink);
  transition: background .12s, border-color .12s, box-shadow .12s, opacity .12s;
  position: relative;
}
.ft-node:hover { background: var(--ft-tint, var(--paper-edge)); }
.ft-node__dot {
  flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ft-c, var(--rule));
}
.ft-node__name {
  font-family: var(--aa-fd), Georgia, serif;
  font-size: 15.5px; line-height: 1.15; color: var(--ink);
  text-wrap: pretty;
}
.ft-node__type {
  font-family: var(--aa-fu), monospace;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ft-c, var(--ink-faint)); font-weight: 700;
  border: 1px solid var(--ft-c); border-radius: 2px;
  padding: 1px 4px; opacity: 0.85; flex: 0 0 auto;
}
.ft-node__count {
  margin-left: auto; flex: 0 0 auto;
  font-family: var(--aa-fu), monospace; font-size: 10.5px;
  font-variant-numeric: tabular-nums; color: var(--ink-soft);
  display: flex; align-items: center; gap: 4px;
}
.ft-node__count .lbl { color: var(--ink-faint); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.ft-node__warn { flex: 0 0 auto; color: var(--maroon); font-size: 12px; line-height: 1; }

/* mapped-but-unwritten (count 0): dashed, quieter */
.ft-node.is-mapped { border-style: dashed; background: transparent; }
.ft-node.is-mapped .ft-node__name { color: var(--ink-soft); }

/* ── Life events (deceased + dates) ── */
.ft-node { flex-wrap: wrap; }
.ft-node__died { flex: 0 0 auto; color: var(--ink-faint); font-size: 11px; line-height: 1; }
.ft-node__dates { flex-basis: 100%; font-family: var(--aa-fu), monospace; font-size: 9px; letter-spacing: 0.06em; color: var(--ink-faint); margin: 1px 0 0 16px; }
.ft-node.is-deceased { opacity: 0.85; }
.ft-node.is-deceased .ft-node__name { color: var(--ink-soft); }
.ft-inspect__life { font-family: var(--aa-fu), monospace; font-size: 11px; color: var(--ink-soft); margin: 0 0 8px; }
.ft-inspect__died { color: var(--maroon); }

/* selection / lineage highlighting (tree + graph canvas) */
.ft-tree.has-selection .ft-node,
.ft-graph-canvas.has-selection .ft-node { opacity: 0.4; }
.ft-tree.has-selection .ft-node.is-onpath,
.ft-graph-canvas.has-selection .ft-node.is-onpath { opacity: 1; }
.ft-tree.has-selection .ft-node.is-related,
.ft-graph-canvas.has-selection .ft-node.is-related { opacity: 1; }
.ft-node.is-selected {
  box-shadow: 0 0 0 2px var(--ft-c); background: var(--ft-tint);
  opacity: 1 !important;
}
.ft-node.is-related { box-shadow: inset 0 0 0 1px var(--ft-c); }

/* collapse toggle (accordion) */
.ft-toggle {
  flex: 0 0 auto; width: 18px; height: 18px; padding: 0;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-faint); display: grid; place-items: center;
  font-size: 10px; transition: transform .15s, color .12s;
}
.ft-toggle:hover { color: var(--ink); }
.ft-toggle.is-open { transform: rotate(90deg); }
.ft-toggle.is-leaf { visibility: hidden; }

/* inline cross-link chips (the only related representation in static/accordion) */
.ft-related-inline {
  margin: 0 0 2px 8px; padding-left: 12px;
  font-family: var(--aa-fu), monospace; font-size: 10px;
  color: var(--ink-faint); letter-spacing: 0.04em;
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
}
.ft-related-inline a { color: var(--ft-c, var(--link)); text-decoration: none; border-bottom: 1px dotted; }
.ft-related-inline a:hover { color: var(--link-hover); }

/* ── Graph mode: gutter for the cross-link arcs ──
   Paper surface + border so the tree sits on a card (not the blue-grey page
   canvas); continues seamlessly from the .ft-controls bar above it. */
.ft-graph {
  position: relative;
  padding: 10px 14px 14px 30px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-top: 0;
}
.ft-graph .ft-edges {
  position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 0;
}
.ft-graph .ft-edges path { fill: none; }
.ft-graph .ft-tree { position: relative; z-index: 1; }

/* ── Legend ── */
.ft-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ft-legend__item {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--aa-fu), monospace; font-size: 10px;
  letter-spacing: 0.06em; color: var(--ink-soft); text-transform: uppercase;
}
.ft-legend__sw { width: 11px; height: 11px; border-radius: 2px; background: var(--ft-c); border: 1px solid var(--ft-c); }

/* ── Controls strip ── */
.ft-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 9px 12px; background: var(--paper-edge);
  border: 1px solid var(--rule-soft); border-bottom: 0;
}
.ft-ctl {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--aa-fu), monospace; font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--rule-soft);
  padding: 4px 9px; cursor: pointer; font-weight: 700;
}
.ft-ctl:hover { border-color: var(--gold-soft); color: var(--ink); }
.ft-ctl.is-on { background: var(--bar); color: var(--bar-text); border-color: var(--bar-deep); }
.ft-ctl__box { width: 11px; height: 11px; border: 1px solid currentColor; display: inline-grid; place-items: center; }
.ft-ctl.is-on .ft-ctl__box::after { content: '✓'; font-size: 9px; line-height: 1; }

/* ── Inspector panel ── */
.ft-inspect { font-family: var(--aa-fb), Georgia, serif; }
.ft-inspect__empty { color: var(--ink-faint); font-style: italic; font-size: 13.5px; line-height: 1.5; }
.ft-inspect__type {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--aa-fu), monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700;
  color: var(--ft-c); margin-bottom: 6px;
}
.ft-inspect__type .sw { width: 9px; height: 9px; border-radius: 50%; background: var(--ft-c); }
.ft-inspect__name {
  font-family: var(--aa-fd), Georgia, serif; font-size: 26px;
  line-height: 1.1; color: var(--ink); margin: 0 0 4px;
}
.ft-inspect__path {
  font-family: var(--aa-fu), monospace; font-size: 10px; color: var(--ink-faint);
  letter-spacing: 0.04em; margin-bottom: 10px;
}
.ft-inspect__path b { color: var(--ink-soft); font-weight: 700; }
.ft-inspect__summary { font-size: 14.5px; line-height: 1.55; color: var(--ink); margin: 0 0 12px; }
.ft-inspect__warn {
  display: flex; gap: 8px; padding: 8px 10px; margin: 0 0 12px;
  background: oklch(0.95 0.03 28); border: 1px solid oklch(0.8 0.06 28);
  font-size: 12.5px; line-height: 1.45; color: oklch(0.4 0.08 28);
}
.aa-dark .ft-inspect__warn { background: oklch(0.28 0.04 28); border-color: oklch(0.5 0.07 28); color: oklch(0.85 0.06 28); }
.ft-inspect__warn b { font-family: var(--aa-fu), monospace; text-transform: uppercase; font-size: 10px; letter-spacing: 0.12em; }
.ft-inspect__cta {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: var(--aa-fu), monospace; font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--link);
  text-decoration: none; border-bottom: 1px solid var(--gold-soft); padding-bottom: 2px;
}
.ft-inspect__cta:hover { color: var(--link-hover); }
.ft-inspect__cta.is-empty { color: var(--ink-faint); border-bottom-style: dashed; }
.ft-inspect__related { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule-soft); }
.ft-inspect__related h5 {
  margin: 0 0 7px; font-family: var(--aa-fu), monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 700;
}
.ft-relchip {
  display: inline-flex; align-items: center; gap: 5px; margin: 0 6px 6px 0;
  padding: 3px 8px; border: 1px solid var(--ft-c); border-radius: 2px;
  font-size: 12.5px; color: var(--ink); cursor: pointer; background: var(--ft-tint);
  font-family: var(--aa-fb), Georgia, serif;
}
.ft-relchip .sw { width: 7px; height: 7px; border-radius: 50%; background: var(--ft-c); }
.ft-relchip:hover { background: var(--ft-tint-2); }

/* ── Static / no-JS baseline list ── */
.ft-baseline { font-family: var(--aa-fb), Georgia, serif; }
.ft-baseline ul { list-style: none; margin: 0; padding: 0; }
.ft-baseline ul ul { margin-left: 16px; border-left: 1px solid var(--rule-soft); padding-left: 14px; }
.ft-baseline li { padding: 3px 0; }
.ft-baseline a { color: var(--link); text-decoration: none; font-size: 14.5px; }
.ft-baseline a:hover { color: var(--link-hover); text-decoration: underline; }
.ft-baseline .ft-b-type {
  font-family: var(--aa-fu), monospace; font-size: 9.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-faint); margin-left: 7px;
}
.ft-baseline .ft-b-count { color: var(--ink-faint); font-family: var(--aa-fu), monospace; font-size: 10px; }
.ft-baseline .ft-b-warn { color: var(--maroon); font-size: 11px; }
.ft-baseline .ft-b-summary { color: var(--ink-soft); font-style: italic; font-size: 12.5px; line-height: 1.4; margin: 1px 0 4px; max-width: 64ch; }

/* ── Accordion (mobile) touch sizing ── */
.ft-node--touch { padding: 9px 10px; min-height: 44px; margin: 4px 0; }
.ft-node--touch .ft-toggle { width: 28px; height: 28px; font-size: 12px; margin: -4px 0; }
.ft-node--touch .ft-node__name { font-size: 16px; }
.ft-hide-inline .ft-related-inline { display: none; }

/* ── Mobile inline detail card (opens under the tapped node) ── */
.ft-acc-detail {
  position: relative;
  margin: 2px 0 8px 26px;
  padding: 13px 15px 15px;
  background: var(--ft-tint, var(--paper-cool));
  border: 1px solid var(--ft-c, var(--rule-soft));
  border-left-width: 4px;
  animation: ft-open .16s ease-out;
}
.ft-acc-detail .ft-inspect__name { font-size: 22px; }
.ft-acc-detail .ft-inspect__summary { font-size: 14px; }
.ft-acc-detail__close {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 14px; border: 1px solid var(--rule-soft);
  background: var(--paper); color: var(--ink-soft);
  font-size: 17px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
@keyframes ft-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }


/* =============================================================================
   F45 layout — landing page header, desktop two-column shell, archive.
   (Everything above is the shared .ft-* port; everything below is F45-only.)
   ============================================================================= */

/* ── Landing header ── */
.firaq-map__head { margin: 0 0 18px; }
.firaq-map__title {
  font-family: var(--aa-fd), Georgia, serif;
  font-size: clamp(28px, 5vw, 42px); line-height: 1.05;
  color: var(--ink); margin: 0 0 8px;
}
.firaq-map__intro {
  font-family: var(--aa-fb), Georgia, serif;
  font-size: 15.5px; line-height: 1.6; color: var(--ink-soft);
  max-width: 68ch; margin: 0 0 14px;
}
.firaq-map__head .ft-legend { margin: 14px 0 6px; }
.firaq-map__note {
  font-family: var(--aa-fb), Georgia, serif;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-faint);
  max-width: 64ch; margin: 6px 0 0;
}
.firaq-map__note em { font-style: italic; color: var(--ink-soft); }
.firaq-map__empty { color: var(--ink-faint); font-style: italic; }

/* The baseline is the real content; it shows until JS enhances. When the
   enhancement mounts, JS hides the baseline and appends the graph/accordion. */
.firaq-mount { margin-top: 6px; }

/* Mobile accordion (<1024px) sits on a paper card too, not the page canvas. */
.ft-accordion { background: var(--paper); border: 1px solid var(--rule-soft); padding: 6px 12px; }

/* ── Desktop two-column shell (built by firqa-map.js at ≥1024px) ── */
.firaq-desktop { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.firaq-graph-col { min-width: 0; }
.firaq-inspect-col {
  position: sticky;
  top: calc(var(--aa-sticky-header-offset, 0px) + 16px);
  align-self: start;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 16px 16px 18px;
}

/* ── Graph view (family-tree / DAG) ── */
.firaq-graph-view .firaq-graph-col { min-width: 0; }
.firaq-graph-scroll { overflow: auto; max-width: 100%; border: 1px solid var(--rule-soft); background: var(--paper); }
.firaq-graph-canvas { position: relative; }
.firaq-graph-canvas .ft-graph-edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 0; }
.firaq-graph-canvas .ft-node { z-index: 1; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
/* fixed-width graph chips: keep the name to one line so the dates line (and only
   it) wraps — prevents tall chips overlapping the row below */
.firaq-graph-canvas .ft-node__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-graph-edges path { fill: none; stroke-width: 1.6; }
.ft-graph-edges path.ft-descent { stroke: var(--rule); stroke-width: 1.6; }
.ft-graph-edges .ft-edge-label {
  font-family: var(--aa-fu), monospace; font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; text-anchor: middle;
}

/* ── Cross-link arcs ── */
.ft-edges path {
  stroke: var(--gold-soft); stroke-width: 1.5;
  stroke-dasharray: 3 4; opacity: 0.6;
}
.ft-edges path.is-pinned { stroke: var(--maroon); stroke-dasharray: none; opacity: 1; }
.ft-edges.is-hidden { display: none; }

@media (max-width: 1023.98px) {
  .firaq-desktop { display: block; }
  .firaq-inspect-col { display: none; }
}

/* ── Per-term archive (taxonomy-firqa.php) ── */
.aa-firqa-archive .firqa-archive__head { margin: 0 0 18px; border-left: 3px solid var(--ft-c, var(--rule)); padding-left: 14px; }
.firqa-archive__back {
  display: inline-block; margin: 0 0 10px;
  font-family: var(--aa-fu), monospace; font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--link); text-decoration: none;
}
.firqa-archive__back:hover { color: var(--link-hover); }
.firqa-archive__kind {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--aa-fu), monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700;
  color: var(--ft-c, var(--ink-soft)); margin-bottom: 6px;
}
.firqa-archive__sw { width: 9px; height: 9px; border-radius: 50%; background: var(--ft-c, var(--rule)); }
.firqa-archive__title {
  font-family: var(--aa-fd), Georgia, serif;
  font-size: clamp(26px, 4.5vw, 38px); line-height: 1.08;
  color: var(--ink); margin: 0 0 8px;
}
.firqa-archive__summary {
  font-family: var(--aa-fb), Georgia, serif;
  font-size: 15px; line-height: 1.6; color: var(--ink-soft);
  max-width: 66ch; margin: 0 0 10px;
}
.firqa-archive__warn {
  display: flex; gap: 8px; padding: 8px 10px; max-width: 66ch;
  background: oklch(0.95 0.03 28); border: 1px solid oklch(0.8 0.06 28);
  font-family: var(--aa-fb), Georgia, serif;
  font-size: 12.5px; line-height: 1.45; color: oklch(0.4 0.08 28);
}
.aa-dark .firqa-archive__warn { background: oklch(0.28 0.04 28); border-color: oklch(0.5 0.07 28); color: oklch(0.85 0.06 28); }
.firqa-archive__warn b { font-family: var(--aa-fu), monospace; text-transform: uppercase; font-size: 10px; letter-spacing: 0.12em; }
.firqa-archive__list { display: grid; gap: 4px; }
.firqa-archive__empty { color: var(--ink-faint); font-style: italic; font-size: 14px; line-height: 1.55; }
