/* tree-mock.css — styles for the interactive __tree__ simulation only.
   Loaded with the same mobile media query as mobile.css.
   REMOVE LATER with js/gallery-tree-mock.js (+ icons/tree-mock.svg fallback). */

#tree-panel.tree-mock {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* Fill grid area; sheet overlays bottom. */
  height: calc(100dvh - 130px);
  max-height: calc(100dvh - 110px);
  min-height: 360px;
  padding: 0 0 8px;
  box-sizing: border-box;
}
#tree-panel img { /* fallback static SVG if JS missing */
  width: 100%;
  max-width: 460px;
  height: auto;
}

/* Toolbar: banner + reset (outside the pan viewport). */
.tm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 10px 6px;
}
.tm-banner {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.tm-reset {
  flex-shrink: 0;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2, #2a2a32);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tm-reset:active { opacity: 0.85; }

/* Pan / scroll viewport — H + V; contain so page PTR doesn't steal. */
.tm-scroll {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Wide canvas so gen-2/3 require horizontal pan. */
.tm-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: max-content;
  min-width: 100%;
  padding: 12px 28px 100px; /* bottom pad for focus chip / sheet */
  box-sizing: border-box;
}

.tm-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
}
.tm-row-wide {
  gap: 20px;
  padding: 0 8px;
}
.tm-pair, .tm-sibs {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.tm-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
}
.tm-branch-empty {
  min-width: 72px;
  min-height: 1px;
  visibility: hidden;
}

.tm-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 68px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.tm-node.tm-dim { opacity: 0.28; }
.tm-node.tm-path .tm-avatar,
.tm-node.tm-selected .tm-avatar {
  box-shadow: 0 0 0 3px var(--accent, #6b9fd4);
}
.tm-node.tm-selected { transform: scale(1.06); }
.tm-avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.tm-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b4a63;
  border: 2px solid #6b7c9c;
  background-repeat: no-repeat;
}
.tm-node-f .tm-avatar {
  background-color: #5d3b4d;
  border-color: #9c6b84;
}
/* Story badge — same book stroke as gallery .story-badge, scaled for nodes. */
.tm-story-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(20, 20, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #e8d9a8;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.tm-story-badge .book-svg {
  width: 11px;
  height: 11px;
}
.tm-init {
  color: #e8e8ec;
  font-size: 18px;
  font-weight: 600;
}
.tm-name {
  font-size: 11px;
  color: #c9c9d1;
  text-align: center;
  line-height: 1.15;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-subname {
  font-size: 9px;
  color: var(--text-dim);
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-heart {
  align-self: center;
  margin-top: 14px;
  color: #c46a8a;
  font-size: 13px;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.tm-heart.tm-path-on { opacity: 1; }
.tm-link.tm-v {
  width: 2px;
  height: 16px;
  background: #4a4a52;
  border-radius: 1px;
  opacity: 0.7;
  transition: background 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.tm-link.tm-path-on {
  background: var(--accent, #6b9fd4);
  opacity: 1;
}
.tm-link-spacer {
  visibility: hidden;
}
.tm-links-wide {
  width: 100%;
  justify-content: space-around;
  gap: 0;
  max-width: none;
  padding: 0 40px;
  box-sizing: border-box;
}
.tm-links-g3 {
  padding: 0 24px;
}

.tm-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
.tm-add-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px dashed #55555e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #77777f;
}
.tm-add-cap { font-size: 11px; }
.tm-cap {
  margin: 12px 0 0;
  color: #88888f;
  font-size: 11px;
  text-align: center;
}

.tm-focus-chip {
  flex-shrink: 0;
  align-self: center;
  z-index: 5;
  margin: 6px 10px 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface2, #2a2a32);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tm-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--surface2, #25252e);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45);
}
.tm-sheet[hidden] { display: none !important; }
.tm-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin: 2px auto 12px;
}
.tm-sheet-body {
  display: flex;
  gap: 12px;
  align-items: center;
}
.tm-sheet-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #6b7c9c;
  background: #3b4a63 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8e8ec;
  font-size: 22px;
  font-weight: 600;
  overflow: hidden;
}
.tm-sheet-avatar.tm-node-f {
  background-color: #5d3b4d;
  border-color: #9c6b84;
}
.tm-sheet-name { font-size: 18px; font-weight: 600; color: var(--text); }
.tm-sheet-rel { font-size: 13px; color: var(--text-dim); margin-top: 2px; line-height: 1.3; }
.tm-sheet-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; opacity: 0.9; }

/* Mock story block in the person sheet (gallery stories stand-in). */
.tm-sheet-story {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 28vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.tm-sheet-story[hidden] { display: none !important; }
.tm-sheet-story-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #e8d9a8;
  line-height: 1.3;
  margin-bottom: 6px;
}
.tm-sheet-story-title .book-svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.tm-sheet-story-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  opacity: 0.92;
}

.tm-sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.tm-sheet-actions .tb-btn {
  flex: 1;
  min-height: 44px;
  justify-content: center;
}

/* Wider gen rows need a little more breathing room while panning. */
.tm-gen2 { gap: 18px; padding: 0 12px; }
.tm-gen3 .tm-branch { min-width: 88px; gap: 8px; }
.tm-links-g1 { padding: 0 48px; }
.tm-links-g2 { padding: 0 20px; }
