/* GUX-01 BLOOD ATLAS — engine stylesheet for surfaces/blood-atlas.mjs.
   One <link> is the whole styling contract; estate tokens are used when the
   host surface defines them, standalone fallbacks otherwise. (Named
   blood-atlas because surfaces/atlas.* is the estate front door — different
   family entirely.)
   Classes the engine emits (wiring-locked in tools/genealogy/bloodatlas.test.mjs):
     .atlas-stage .atlas-world .atlas-listview .atlas-cell .atlas-row
     .atlas-ghost .atlas-mirror .atlas-affinity .atlas-sel .atlas-root
     .lod-far .lod-mid .lod-near
   Laws in css form: affinity (spouse) never looks like blood; ghosts are
   dashed coverage-unknown slots, never people; mirrors are ⊙ views of an
   identity that renders once; semantic zoom decides what the eye is owed. */

.atlas-root { --atlas-bg: var(--bg, #0d1117); --atlas-ink: var(--text, #e6e1d5);
  --atlas-dim: var(--dim, #8a8578); --atlas-verified: var(--verified, #3fa66a);
  --atlas-info: var(--info, #4d8fd1); --atlas-gold: var(--gold, #c9a13b);
  --atlas-violet: var(--violet, #8d6fc9); --atlas-line: var(--line, #2a2f36);
  display: block; position: relative; min-width: 0; }
.atlas-stage { position: relative; width: 100%; height: clamp(340px, 62vh, 720px);
  overflow: hidden; background: var(--atlas-bg); border: 1px solid var(--atlas-line);
  border-radius: 12px; touch-action: none; cursor: grab; outline: none; }
.atlas-stage:active { cursor: grabbing; }
.atlas-root:focus-visible .atlas-stage { outline: 2px solid var(--atlas-info); }

.atlas-world { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }

/* cells: blood people carry their evidence-era tone; ghosts/mirrors recede */
.atlas-cell { cursor: pointer; }
.atlas-cell .atlas-box, .atlas-cell .atlas-hex { fill: #1b2027; stroke: var(--atlas-dim); stroke-width: 1.4; }
.atlas-cell.ev-recorded .atlas-box, .atlas-cell.ev-recorded .atlas-hex { stroke: var(--atlas-verified); }
.atlas-cell.ev-colonial  .atlas-box, .atlas-cell.ev-colonial  .atlas-hex { stroke: var(--atlas-info); }
.atlas-cell.ev-medieval  .atlas-box, .atlas-cell.ev-medieval  .atlas-hex { stroke: var(--atlas-gold); }
.atlas-cell.ev-saga      .atlas-box, .atlas-cell.ev-saga      .atlas-hex { stroke: var(--atlas-violet); }
.atlas-cell.ev-living    .atlas-box, .atlas-cell.ev-living    .atlas-hex,
.atlas-cell.ev-unrecorded .atlas-box, .atlas-cell.ev-unrecorded .atlas-hex { stroke: var(--atlas-dim); }
.atlas-cell.kind-empty .atlas-box { fill: none; stroke: var(--atlas-line); stroke-dasharray: 2 5; }

/* L7 — ghost frontier: dashed, hollow, pointed — coverage unknown, never kin */
.atlas-cell.atlas-ghost .atlas-hex, .atlas-cell.atlas-ghost .atlas-box,
.atlas-row.atlas-ghost { fill: none; stroke: var(--atlas-dim); stroke-dasharray: 5 4; stroke-width: 1.6; }
.atlas-ghostmark { fill: var(--atlas-dim); font-size: 15px; pointer-events: none; }

/* L3 — mirror: one identity, rendered once; repeats are ⊙ views of it */
.atlas-cell.atlas-mirror .atlas-hex, .atlas-cell.atlas-mirror .atlas-box,
.atlas-row.atlas-mirror { stroke-dasharray: 3 3; opacity: 0.85; }
.atlas-mirrormark { fill: var(--atlas-dim); font-size: 12px; }

/* L8 — affinity (spouse): dotted stroke + ⚭ mark, visually beside blood */
.atlas-cell.atlas-affinity .atlas-hex, .atlas-cell.atlas-affinity .atlas-box { stroke-dasharray: 1 3; stroke-width: 1.8; }
.atlas-row.atlas-affinity .atlas-mark { opacity: 0.9; }

/* selection + root: selection is state (all occurrences), root is where we stand */
.atlas-cell.atlas-sel .atlas-box, .atlas-cell.atlas-sel .atlas-hex { stroke-width: 3.4; filter: drop-shadow(0 0 6px rgba(77, 143, 209, 0.55)); }
.atlas-cell.atlas-root .atlas-box, .atlas-cell.atlas-root .atlas-hex { stroke-width: 3; stroke: var(--atlas-ink); }
.atlas-row.atlas-sel { background: rgba(77, 143, 209, 0.16); border-radius: 6px; }
.atlas-row.atlas-root .atlas-mark { font-weight: 700; }

.atlas-label { fill: var(--atlas-ink); font-size: 11.5px; pointer-events: none; font-family: inherit; }
.atlas-year { fill: var(--atlas-dim); font-size: 10px; pointer-events: none; }
.atlas-link { fill: none; stroke: var(--atlas-line); stroke-width: 1.2; pointer-events: none; }

/* L2 — semantic zoom: far = structure, mid = near generations, near = reading */
.lod-far .atlas-label, .lod-far .atlas-year { display: none; }
.lod-far .atlas-ghostmark { font-size: 9px; }
.lod-mid .atlas-cell[data-gen]:not([data-gen="0"]):not([data-gen="1"]):not([data-gen="2"]) .atlas-label,
.lod-mid .atlas-cell[data-gen]:not([data-gen="0"]):not([data-gen="1"]) .atlas-year { display: none; }
.lod-near .atlas-label, .lod-near .atlas-year { display: block; }

/* tree view rows */
.atlas-listview { list-style: none; margin: 0; padding: 10px 12px; height: 100%;
  overflow: auto; font-size: 13.5px; color: var(--atlas-ink); position: relative; z-index: 1; }
.atlas-row { display: flex; gap: 7px; align-items: baseline; padding: 3px 8px 3px 0;
  border-left: 1px solid var(--atlas-line); margin-left: 6px; line-height: 1.45; cursor: pointer; }
.atlas-row .atlas-mark { color: var(--atlas-dim); width: 1.1em; flex: none; }
.atlas-row .atlas-year { color: var(--atlas-dim); font-size: 11px; }
.atlas-row[data-section="self"] { font-weight: 700; }
.atlas-row[data-section="spouse"] .atlas-mark,
.atlas-row[data-section="spouse"] .atlas-label { color: var(--atlas-info); }
.atlas-row.ev-recorded .atlas-mark { color: var(--atlas-verified); }
.atlas-row.ev-colonial .atlas-mark { color: var(--atlas-info); }
.atlas-row.ev-medieval .atlas-mark { color: var(--atlas-gold); }
.atlas-row.ev-saga .atlas-mark { color: var(--atlas-violet); }
.atlas-row .atlas-label { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .atlas-cell, .atlas-row, .atlas-pan { transition: none !important; animation: none !important; }
}
