/* ============================================================================
   NEAR MINT — Boxes

   Homage: Secret Wars #8 — the machine that dispenses the suit. Here the boxes
   are the vessels and the collection flows into them.

   Design premise: 932 books, 7 boxes, 0 assignments. Assigning book-by-book is
   932 decisions and nobody will ever do it. The unit of work is therefore the
   SERIES — 241 of them, and in practice a whole run goes in one box together.
   ========================================================================== */

.boxes__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* --- the vessels --------------------------------------------------------- */

.vessels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--gutter);
  margin-bottom: 22px;
}

.vessel {
  position: relative;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 11px 12px 10px;
  background: var(--paper-hi);
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  cursor: pointer;
  transition: transform 0.09s, box-shadow 0.09s;
}

.vessel:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lift); }

.vessel[aria-pressed='true'] {
  background: var(--yellow);
  box-shadow: var(--shadow-panel), inset 0 0 0 3px var(--ink);
}

.vessel__name {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 1.25rem;
  line-height: 1;
  margin: 0 0 7px;
}

.vessel__count {
  font-family: var(--display);
  font-weight: 900;
  font-size: 2rem;
  line-height: 0.9;
}

.vessel__cap { font-size: 0.74rem; opacity: 0.7; }

/* the fill meter reads as comics standing upright in a long box */
.vessel__meter {
  height: 16px;
  margin-top: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--paper-2) 0 2px,
    var(--paper-3) 2px 4px
  );
  overflow: hidden;
}

.vessel__fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    #2E2A38 2px 4px
  );
}

.vessel__fill--over { background: repeating-linear-gradient(90deg, var(--red) 0 2px, #A5171F 2px 4px); }

.vessel--new {
  display: grid;
  place-items: center;
  border-style: dashed;
  box-shadow: none;
  min-height: 118px;
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1.05rem;
}

/* --- the work list ------------------------------------------------------- */

.work {
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-hi);
  overflow: hidden;
}

.work__bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 11px;
  border-bottom: var(--rule) solid var(--ink);
  background: var(--paper-2);
}

.work__list { max-height: 62vh; overflow-y: auto; }

.run {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px 11px;
  border-bottom: 1px solid rgba(20, 18, 26, 0.16);
  background: none;
  border-left: none; border-right: none; border-top: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.run:last-child { border-bottom: none; }
.run:hover { background: var(--paper-2); }
.run[aria-pressed='true'] { background: var(--yellow); }

.run__check {
  width: 19px; height: 19px;
  border: var(--rule) solid var(--ink);
  border-radius: 1px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 0.85rem; line-height: 1;
  background: var(--paper-hi);
}

.run[aria-pressed='true'] .run__check { background: var(--ink); color: var(--yellow); }

.run__name {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1.05rem;
  line-height: 1.05;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.run__meta { font-size: 0.72rem; opacity: 0.66; white-space: nowrap; }

.run__n {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.15rem;
  min-width: 2.2ch;
  text-align: right;
}

.run__where {
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 5px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  white-space: nowrap;
  max-width: 17ch;
  overflow: hidden; text-overflow: ellipsis;
}

.run__where--none { border-style: dashed; opacity: 0.45; }

/* --- the action bar ------------------------------------------------------ */

.assign {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 11px 13px;
  background: var(--ink);
  color: var(--paper-hi);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

.assign[hidden] { display: none; }

.assign__n {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
}

.assign__target { font-size: 0.86rem; opacity: 0.85; }

@media (max-width: 640px) {
  .vessels { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }
  .vessel__count { font-size: 1.6rem; }
  .run { grid-template-columns: 24px 1fr auto; gap: 8px; }
  .run__meta { display: none; }
  .work__list { max-height: none; }
}

/* ── homage art ────────────────────────────────────────────────────────────
   The capacity meter is filled with the dispensed ooze rather than a striped
   gradient — Secret Wars #8's machine doing actual work. */
.vessel__fill {
  background: var(--art-ooze) left top / auto 100% repeat-x, var(--ink);
}
.vessel__fill--over {
  background: repeating-linear-gradient(90deg, var(--red) 0 2px, #A5171F 2px 4px);
}

/* The machine sits along the bottom, where the ooze pours toward the boxes. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--art-backdrop-desktop) center bottom / cover no-repeat;
  mix-blend-mode: multiply;
  opacity: 0.22;
  pointer-events: none;
}
.nm-header, .nm-shell, .nm-toast { position: relative; z-index: 1; }
.nm-header { z-index: 40; }
