/* Level design, the hierarchy panel (levelhier.js). Everything is under .lh- so it
   cannot touch the rest of the page. */

.lh-root {
  --lh-shadable: var(--accent);
  --lh-tiled: #3cc4b1;
  --lh-group: var(--warn);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  font-size: 12px; line-height: 1.4; color: var(--text);
  -webkit-user-select: none; user-select: none;
  position: relative;
}
.lh-root[hidden], .lh-root [hidden] { display: none !important; }

/* ---------------------------------------------------------------- header */
.lh-head {
  flex: none; display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px 8px; border-bottom: 1px solid var(--line);
}
.lh-title-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lh-title { font-weight: 600; }
.lh-status {
  margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--dim); font-size: 11px;
}
.lh-status.lh-flash { color: var(--warn); }
.lh-count { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }

.lh-filter-row { display: flex; align-items: center; gap: 4px; }
.lh-filter-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.lh-filter {
  width: 100%; padding: 3px 22px 3px 7px;
  background: var(--bg); color: var(--text); font: inherit;
  border: 1px solid var(--line); border-radius: 4px;
  -webkit-user-select: text; user-select: text;
}
.lh-filter:focus { outline: none; border-color: var(--accent); }
.lh-clear {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 3px;
  background: none; color: var(--dim); font: inherit; font-size: 14px; line-height: 16px; cursor: pointer;
}
.lh-clear:hover { color: var(--text); background: rgba(255, 255, 255, .08); }

/* ---------------------------------------------------------------- buttons */
.lh-btn {
  flex: none; padding: 2px 8px; font: inherit; line-height: 1.5; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
}
.lh-btn:hover:not(:disabled) { border-color: var(--accent); }
.lh-btn:disabled { opacity: .4; cursor: default; }
.lh-btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.lh-btn.on { background: rgba(78, 161, 255, .22); border-color: var(--accent); }

.lh-btn { display: inline-flex; align-items: center; gap: 5px; }
.lh-btn .ll-ico { color: var(--dim); }
.lh-btn:hover:not(:disabled) .ll-ico, .lh-btn.on .ll-ico { color: var(--text); }

/* ---------------------------------------------------------------- filter chips */
/* They say which rows the list shows. They do not mark anything. */
.lh-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px 0; }
.lh-chips-label { color: var(--dim); font-size: 11px; }
.lh-chip {
  --edge: var(--accent);
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px;
  font: inherit; line-height: 1.4; cursor: pointer; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px;
}
.lh-chip .ll-ico { color: var(--edge); }
.lh-chip-shadable { --edge: var(--lh-shadable); }
.lh-chip-tiled { --edge: var(--lh-tiled); }
.lh-chip-group { --edge: var(--lh-group); }
.lh-chip:hover { border-color: var(--edge); }
.lh-chip:focus-visible { outline: 1px solid var(--edge); outline-offset: 1px; }
.lh-chip-n { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.lh-chip.on { border-color: var(--edge); }
.lh-chip-shadable.on { background: rgba(78, 161, 255, .24); }
.lh-chip-tiled.on { background: rgba(60, 196, 177, .24); }
.lh-chip-group.on { background: rgba(224, 163, 62, .24); }
.lh-chip.on .lh-chip-n { color: var(--text); }

.lh-bar {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 6px 10px; border-bottom: 1px solid var(--line);
}
.lh-break { flex-basis: 100%; height: 0; margin-top: -4px; }
.lh-push { margin-left: auto; }

/* ---------------------------------------------------------------- drop strip */
/* It floats over the bottom of the list instead of taking room above it: when it
   appeared in the flow it pushed every row down by its own height the moment a drag
   began, and the row the pointer was on was no longer under it. */
.lh-toplevel {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 6;
  padding: 7px 10px; text-align: center;
  color: var(--dim); font-size: 11px;
  background: rgba(35, 36, 40, .94); border: 1px dashed var(--accent); border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.lh-toplevel.lh-drop { color: var(--text); background: rgba(78, 161, 255, .22); border-color: var(--accent); }

/* ---------------------------------------------------------------- list */
.lh-list {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow-x: hidden; overflow-y: auto;
}
.lh-list:focus { outline: none; }
.lh-list:focus-visible { box-shadow: inset 0 0 0 1px rgba(78, 161, 255, .45); }
.lh-rows { flex: none; }
/* Empty space under the rows is a drop target for "top level", so it keeps some height. */
.lh-tail { flex: 1 0 28px; }
.lh-tail.lh-drop { background: rgba(78, 161, 255, .1); box-shadow: inset 0 2px 0 var(--accent); }
.lh-empty { flex: none; padding: 18px 12px; text-align: center; color: var(--dim); }

.lh-row {
  display: flex; align-items: center; gap: 5px; height: 48px; padding: 3px 8px 3px 4px;
  cursor: default;
}
.lh-row:hover { background: rgba(255, 255, 255, .04); }
.lh-row.lh-sel { background: rgba(78, 161, 255, .18); }
.lh-row.lh-primary { background: rgba(78, 161, 255, .34); box-shadow: inset 2px 0 0 var(--accent); }
.lh-row.lh-drop { background: rgba(78, 161, 255, .28); outline: 1px dashed var(--accent); outline-offset: -1px; }
/* Between two rows: a line where the dragged rows would land. */
.lh-row { position: relative; }
.lh-row.lh-drop-before::before, .lh-row.lh-drop-after::after {
  content: ''; position: absolute; left: var(--lh-line-left, 4px); right: 4px; height: 2px;
  background: var(--accent); border-radius: 1px; pointer-events: none; z-index: 2;
}
.lh-row.lh-drop-before::before { top: -1px; }
.lh-row.lh-drop-after::after { bottom: -1px; }
.lh-row.lh-dragging { opacity: .4; }
/* Inside a marked parent: its own mark or default is overridden, so it reads as not counting. */
.lh-row.lh-shadowed > :not(.lh-disc) { opacity: .5; }

/* The disclosure triangle. */
.lh-disc { flex: none; position: relative; width: 14px; height: 14px; cursor: pointer; }
.lh-disc::before {
  content: ''; position: absolute; left: 5px; top: 3px;
  border-left: 5px solid var(--dim); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.lh-disc:hover::before { border-left-color: var(--text); }
.lh-disc.open::before { transform: rotate(90deg); }
.lh-disc.leaf { cursor: default; pointer-events: none; }
.lh-disc.leaf::before { display: none; }

.lh-thumb {
  flex: none; width: 40px; height: 40px; object-fit: contain;
  background: #14151a; border: 1px solid var(--line); border-radius: 4px;
}
.lh-thumb-empty { border-style: dashed; opacity: .5; }

/* Kind glyphs, drawn rather than imported: file, node, mesh, folder. */
.lh-glyph { flex: none; position: relative; width: 11px; height: 11px; }
.lh-glyph-file { width: 9px; height: 12px; margin: 0 1px; border: 1.5px solid var(--dim); border-radius: 2px 4px 2px 2px; }
.lh-glyph-node { border: 1.5px solid var(--dim); border-radius: 50%; }
.lh-glyph-mesh { background: var(--text); opacity: .75; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.lh-glyph-folder { width: 12px; height: 9px; margin-top: 2px; background: var(--dim); border-radius: 1px 2px 2px 2px; }
.lh-glyph-folder::before {
  content: ''; position: absolute; left: 0; top: -2px; width: 5px; height: 3px;
  background: var(--dim); border-radius: 1px 2px 0 0;
}

.lh-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-kind-file > .lh-name { font-weight: 600; }
.lh-kind-folder > .lh-name { font-style: italic; }
.lh-filtering .lh-row:not(.lh-match) > .lh-name { color: var(--dim); }
.lh-filtering .lh-row.lh-match > .lh-name { color: var(--accent); }
.lh-rename {
  width: 100%; padding: 1px 4px; font: inherit;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent); border-radius: 3px; outline: none;
  -webkit-user-select: text; user-select: text;
}

/* ---------------------------------------------------------------- pills */
.lh-pills { flex: none; display: flex; align-items: center; gap: 4px; }
.lh-pill {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px 1px 5px; font-size: 11px; font-weight: 600; line-height: 14px; white-space: nowrap;
  border: 1px solid currentColor; border-radius: 9px;
}
/* The label of a row's kind opens the menu that changes it. */
.lh-pill-btn { cursor: pointer; }
.lh-pill-btn:hover { filter: brightness(1.3); box-shadow: 0 0 0 1px currentColor; }
.lh-pill-shadable { color: var(--lh-shadable); background: rgba(78, 161, 255, .14); }
.lh-pill-tiled { color: var(--lh-tiled); background: rgba(60, 196, 177, .14); }
.lh-pill-group { color: var(--lh-group); background: rgba(224, 163, 62, .14); }
/* The default — every mesh is a shadable of its own — says so, but as an outline: it is not a decision. */
.lh-pill-auto { background: none; border-style: dashed; font-weight: 500; opacity: .8; }
.lh-pill-auto:hover { opacity: 1; }
/* Whether a group is hidden from the picker: a switch, not a kind. */
.lh-pill-hide { color: var(--lh-group); font-weight: 500; cursor: pointer; }
.lh-pill-hide:hover { background: rgba(224, 163, 62, .25); }
/* The role of a piece inside a tiled group: informational, so no fill. */
.lh-pill-special { color: var(--lh-tiled); font-weight: 400; }
.lh-pill-tile { color: var(--dim); font-weight: 400; }
.lh-num { flex: none; color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.lh-warn {
  flex: none; width: 14px; height: 14px; text-align: center; font-size: 10px; font-weight: 700; line-height: 13px;
  color: #1b1c1f; background: var(--warn); border-radius: 50%; cursor: help;
}
