/* Tree view chrome (js/views/viewTree.js): the lineage readout and the zoom cluster that the
 * view adds to #viz-container. The tree itself is drawn on #canvas-tree. */

.tree-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ---- Lineage readout (top-left): what the highlighted branch is and where it joins the tree ---- */

.tree-lineage {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  z-index: var(--z-viz-ui);
  /* Narrow enough to sit beside a centred milestone toast on a desktop stage. */
  width: min(256px, calc(100% - var(--s-6)));
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-1);
}

.tree-lineage-kicker {
  margin-bottom: 2px;
}

.tree-lineage-title {
  font-size: var(--fs-h3);
  color: var(--text-1);
}

.tree-lineage-sci {
  font-size: var(--fs-small);
  color: var(--text-3);
}

.tree-lineage-sci:empty {
  display: none;
}

.tree-lineage-note {
  margin-top: var(--s-1);
  font-size: var(--fs-small);
  line-height: 1.45;
  color: var(--text-2);
}

.tree-lineage-note:empty {
  display: none;
}

.tree-lineage-path {
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--text-3);
}

.tree-lineage-step {
  white-space: nowrap;
}

.tree-lineage-step:last-child {
  color: var(--text-1);
}

.tree-lineage-sep {
  margin-right: 5px;
  color: var(--text-4);
}

/* ---- Zoom cluster (bottom-right) ---- */

.tree-zoom {
  position: absolute;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: var(--z-viz-ui);
  display: flex;
  flex-direction: column;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-1);
  pointer-events: auto;
}

.tree-zoom-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.tree-zoom-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-zoom-btn:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--text-1);
}

.tree-zoom-btn:disabled {
  color: var(--text-4);
  cursor: default;
}

/* Touch screens: 44px targets */
@media (pointer: coarse) {
  .tree-zoom-btn {
    width: 44px;
    height: 44px;
  }
}

/* Phones: the readout spans the stage and stays compact */
@media (max-width: 720px) {
  .tree-lineage {
    top: var(--s-2);
    left: var(--s-2);
    width: calc(100% - var(--s-4));
    padding: var(--s-2) var(--s-3);
  }

  .tree-lineage-title {
    font-size: var(--fs-lead);
  }

  .tree-zoom {
    right: var(--s-2);
    bottom: var(--s-2);
  }
}

/* Capture mode records the canvas only */
body.capture-mode .tree-hud {
  display: none !important;
}
