.wrap {
  display: inline-flex;
}

/* Disclosure panel — portaled to body, positioned `fixed` by usePopover. The shared
   disclosure-popover surface (arch 10): elevated --layer-01, hairline border, --radius. */
.pop {
  position: fixed;
  z-index: 1000;
  width: 264px;
  max-height: 60vh;
  overflow: auto;
  padding: var(--space-4);
  background: var(--layer-01);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.title {
  margin: 0 0 var(--space-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.tree {
  font-size: 12px;
}

/* Bare wireframe: a crisp box, fill only the canvas. Passive structure, so the
   boxes carry the function (drop targets, later) — `--border-strong`, no chrome. */
.node {
  border: 1px solid var(--border-strong);
  background: var(--bg);
}
.container {
  padding: var(--space-2);
  cursor: pointer;
}
.leaf {
  min-height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* The mark glyph is a quiet identity hint, not chrome — muted, inherits theme. */
.markIcon {
  color: var(--text-secondary);
}
.node:hover {
  border-color: var(--text-secondary);
}

/* Draggable boxes (draft only) advertise the drag with a grab cursor; the body
   cursor flips to grabbing for the duration of an active drag (set in JS). */
.node[data-draggable] {
  cursor: grab;
}
.node[data-dragging] {
  opacity: 0.4;
}
/* Drop indicator (arch 10 §5): a 3px accent line on the edge the dragged box would
   land. `wrap` mode additionally rings + tints the target box, signalling the two
   pair into a new split rather than just reordering. */
.node[data-drop-edge='left'] {
  box-shadow: inset 3px 0 0 var(--accent);
}
.node[data-drop-edge='right'] {
  box-shadow: inset -3px 0 0 var(--accent);
}
.node[data-drop-edge='top'] {
  box-shadow: inset 0 3px 0 var(--accent);
}
.node[data-drop-edge='bottom'] {
  box-shadow: inset 0 -3px 0 var(--accent);
}
.node[data-drop-mode='wrap'] {
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
/* Selection mirrors the library's active-row language (arch 09 §4). */
.node.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.leaf.selected {
  background: var(--accent-soft);
}
.node:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.children {
  gap: var(--space-2);
}
.row {
  display: flex;
  flex-direction: row;
}
.row > * {
  flex: 1 1 0;
  min-width: 0;
}
.col {
  display: flex;
  flex-direction: column;
}
/* General concat wraps into a grid (honors `columns`). */
.grid {
  display: flex;
  flex-flow: row wrap;
}
.grid > * {
  flex: 1 1 84px;
}
/* Layer: one plotting space holding several marks (z-order). Render it as a single
   frame — a row of the child mark glyphs, badged as layered — not as separate boxes,
   so it reads as one space and the marks stay legible (vs. the concat box-per-view). */
.layerBox {
  position: relative;
}
.layered {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 40px;
}
/* A layer's mark is a bare glyph, not a boxed leaf — the frame is the box. The
   transparent border keeps the hover/selection outline (from `.node`) consistent. */
.layerMark {
  min-height: 0;
  padding: var(--space-2) var(--space-3);
  border-color: transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.layerBadge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  color: var(--text-placeholder);
  pointer-events: none;
}

/* Facet / repeat: one authored child stands for many generated cells — a card
   peeking out behind hints at the multiples. */
.generated {
  position: relative;
}
.generated::before {
  content: '';
  position: absolute;
  inset: 5px -5px -5px 5px;
  border: 1px solid var(--border);
  z-index: -1;
}

.caption {
  margin: var(--space-3) 0 0;
  min-height: 1.4em;
  color: var(--text-secondary);
  font-size: 11px;
}
.caption code {
  font-family: var(--font-mono);
  color: var(--text);
}
.muted {
  color: var(--text-placeholder);
}
