/* Diagram "levels": everything goes in, very little gets pushed. See SPEC.md. */

[data-diagram="levels"] { height: 440px; }
@media (max-width: 759px) { [data-diagram="levels"] { height: 480px; } }
@media (max-width: 599px) { [data-diagram="levels"] { height: 590px; } }

.dg-levels {
  height: 100%;
  display: flex;
  flex-direction: column;
  color: var(--ink, #0e3b2c);
  font-family: var(--font-do, "Geist", "Helvetica Neue", Arial, sans-serif);
}

.dg-levels-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line, #c4d6ca);
  border-radius: var(--radius-panel, 8px);
  background: var(--paper, #ffffff);
  overflow: hidden;
}

.dg-levels-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* One level per row: what it is, the shelf where its items sit, how many. */
.dg-levels-row {
  flex: 7 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(180px, 33%, 300px) minmax(0, 1fr) 64px;
  grid-template-areas: "label shelf count";
  column-gap: 16px;
  align-items: center;
  padding: 0 22px;
  border-top: 1px solid var(--grid, #dfe9e1);
}
.dg-levels-row--announce { border-top: 0; }
/* The two levels that interrupt someone share the soft surface. */
.dg-levels-row--announce,
.dg-levels-row--you { background: var(--bar, #eaf3ea); }
.dg-levels-row--feed { flex-grow: 9; border-top-color: var(--line-strong, #9fbba9); }
.dg-levels-row--lib { flex-grow: 15; }

.dg-levels-label {
  grid-area: label;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
}
.dg-levels-bell {
  grid-row: 1;
  grid-column: 1;
  width: 18px;
  height: 18px;
  color: var(--ink, #0e3b2c);
  transform-origin: 50% 18%;
}
.dg-levels-bell path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dg-levels-name {
  grid-row: 1;
  grid-column: 2;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 500;
}
.dg-levels-line {
  grid-row: 2;
  grid-column: 2;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft, #4a6b5d);
}

.dg-levels-shelf {
  grid-area: shelf;
  align-self: stretch;
  margin: 8px 0;
}

.dg-levels-count {
  grid-area: count;
  position: relative;
  z-index: 2;
  justify-self: end;
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Shown only during the animation, beside the item that colleagues took. */
.dg-levels-tag {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink, #0e3b2c);
  background: var(--paper, #ffffff);
  border: 1px solid var(--line-strong, #9fbba9);
  border-radius: var(--radius-control, 6px);
  opacity: 0;
  pointer-events: none;
}

.dg-levels-note {
  flex: 0 0 auto;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft, #4a6b5d);
}

@media (max-width: 599px) {
  .dg-levels-row {
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "label count" "shelf shelf";
    column-gap: 12px;
    align-items: start;
    padding: 10px 14px 6px;
  }
  .dg-levels-label { column-gap: 8px; }
  .dg-levels-count { font-size: 22px; padding-top: 1px; }
  .dg-levels-shelf { align-self: stretch; margin: 4px 0 0; min-height: 26px; }
  .dg-levels-row--feed .dg-levels-shelf { min-height: 58px; }
  .dg-levels-row--lib { flex-grow: 3; }
  .dg-levels-row--lib .dg-levels-shelf { min-height: 84px; }
  .dg-levels-note { margin-top: 10px; }
}
