/* #/collections — an artwork-led workbench for soft holds and bundles. */

.v9-collections { gap: var(--v9-space-6); }
.v9-collections-list,
.v9-collections-detail { display: grid; gap: var(--v9-space-6); min-width: 0; }
.v9-collections-icon { width: 1rem; height: 1rem; display: inline-grid; place-items: center; flex: 0 0 auto; }
.v9-collections-icon svg { width: 100%; height: 100%; display: block; }
.v9-collections .v9-btn:disabled { opacity: 0.38; cursor: default; pointer-events: none; }
.v9-collections-sub { color: var(--v9-text-mute); font-size: var(--v9-text-sm); }

/* ---- overview: one full-width board, each collection reads as a card stack ---- */
.v9-collections-board { display: grid; gap: var(--v9-space-2); }
.v9-collection-strip {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-width: 0;
  border: 1px solid var(--v9-line); border-radius: var(--v9-r-md); background: var(--v9-surface);
  content-visibility: auto; contain-intrinsic-size: auto 132px;
  transition: border-color var(--v9-t-micro) var(--v9-ease), background-color var(--v9-t-micro) var(--v9-ease);
}
.v9-collection-strip:hover { border-color: var(--v9-line-strong); background: var(--v9-raised); }
.v9-collection-strip.has-warning { border-left-color: var(--v9-warn); }
.v9-collection-strip-open {
  width: 100%; min-width: 0; min-height: 8rem; display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) auto; align-items: center; gap: var(--v9-space-5);
  padding: var(--v9-space-3) var(--v9-space-4); border: 0; border-radius: inherit;
  background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.v9-collection-strip-open:focus-visible { outline: none; box-shadow: inset var(--v9-focus-glow); }
.v9-collection-strip > .v9-led-menu { margin-right: var(--v9-space-3); }
.v9-collection-strip:hover > .v9-led-menu .v9-led-menu-btn { opacity: 1; }
.v9-collection-strip-copy { display: grid; gap: var(--v9-space-2); min-width: 0; }
.v9-collection-strip-name {
  color: var(--v9-text); font: 500 var(--v9-text-lg)/1.1 var(--v9-font-ui);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v9-collection-strip-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem var(--v9-space-3); color: var(--v9-text-faint); font: 400 var(--v9-text-xs) var(--v9-font-mono); }
.v9-collection-strip-meta > span + span::before { content: "/"; margin-right: var(--v9-space-3); color: var(--v9-line-strong); }
.v9-collection-strip-meta .is-warning { color: var(--v9-warn); }
.v9-collection-strip-figures { display: grid; justify-items: end; gap: 3px; min-width: 7.5rem; }
.v9-collection-strip-figures strong { color: var(--v9-text); font-size: var(--v9-text-lg); font-weight: 400; white-space: nowrap; }

/* Crisp overlapping previews. Card art supplies the page's colour. */
.v9-collection-stack { position: relative; display: block; width: 8.5rem; height: 6.7rem; flex: 0 0 auto; }
.v9-collection-stack-card {
  position: absolute; top: 50%; left: 0; width: 3.7rem; aspect-ratio: 5 / 7;
  overflow: hidden; display: grid; place-items: center; border: 1px solid var(--v9-line-strong);
  border-radius: var(--v9-r-sm); background: var(--v9-raised); transform-origin: 50% 90%;
  transition: transform var(--v9-t-std) var(--v9-ease), border-color var(--v9-t-micro) var(--v9-ease);
}
.v9-collection-stack-card:nth-child(1) { left: 0; z-index: 1; transform: translateY(-50%) rotate(-8deg); }
.v9-collection-stack-card:nth-child(2) { left: 1.35rem; z-index: 2; transform: translateY(-53%) rotate(-3deg); }
.v9-collection-stack-card:nth-child(3) { left: 2.75rem; z-index: 3; transform: translateY(-53%) rotate(3deg); }
.v9-collection-stack-card:nth-child(4) { left: 4.15rem; z-index: 4; transform: translateY(-50%) rotate(8deg); }
.v9-collection-stack-card:nth-child(5) { left: 5.55rem; z-index: 5; transform: translateY(-46%) rotate(11deg); }
.v9-collection-strip:hover .v9-collection-stack-card:nth-child(1) { transform: translateY(-55%) rotate(-11deg); }
.v9-collection-strip:hover .v9-collection-stack-card:nth-child(2) { transform: translateY(-58%) rotate(-4deg); }
.v9-collection-strip:hover .v9-collection-stack-card:nth-child(3) { transform: translateY(-58%) rotate(4deg); }
.v9-collection-strip:hover .v9-collection-stack-card:nth-child(4) { transform: translateY(-55%) rotate(11deg); }
.v9-collection-stack-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v9-collection-stack-fallback,
.v9-collection-thumb-fallback,
.v9-collection-card-fallback { color: var(--v9-text-faint); font: 500 var(--v9-text-lg) var(--v9-font-mono); }
.v9-collection-stack-card.is-empty {
  background: repeating-linear-gradient(135deg, var(--v9-surface) 0 8px, var(--v9-raised) 8px 16px);
  border-style: dashed; opacity: 0.68;
}

/* ---- detail summary ---- */
.v9-collections-back {
  display: inline-flex; align-items: center; gap: var(--v9-space-1); justify-self: start;
  border: 0; background: transparent; color: var(--v9-text-mute); font: 500 var(--v9-text-sm) var(--v9-font-ui);
  padding: 0; cursor: pointer;
}
.v9-collections-back:hover { color: var(--v9-text); }
.v9-collection-detail-hero {
  display: grid; grid-template-columns: 16rem minmax(0, 1fr); align-items: center; gap: var(--v9-space-8);
  padding: var(--v9-space-5) var(--v9-space-4); border-block: 1px solid var(--v9-line); min-width: 0;
}
.v9-collection-stack.is-large { width: 15rem; height: 11rem; justify-self: center; }
.v9-collection-stack.is-large .v9-collection-stack-card { width: 6rem; }
.v9-collection-stack.is-large .v9-collection-stack-card:nth-child(1) { left: 0; }
.v9-collection-stack.is-large .v9-collection-stack-card:nth-child(2) { left: 2.15rem; }
.v9-collection-stack.is-large .v9-collection-stack-card:nth-child(3) { left: 4.3rem; }
.v9-collection-stack.is-large .v9-collection-stack-card:nth-child(4) { left: 6.45rem; }
.v9-collection-stack.is-large .v9-collection-stack-card:nth-child(5) { left: 8.6rem; }
.v9-collection-detail-copy { display: grid; align-content: center; gap: var(--v9-space-2); min-width: 0; }
.v9-collection-detail-titleline { display: flex; align-items: center; gap: var(--v9-space-2); min-width: 0; }
.v9-collection-detail-title {
  margin: 0; min-width: 0; color: var(--v9-text); font: var(--v9-weight-display) var(--v9-text-display)/1 var(--v9-font-ui);
  letter-spacing: var(--v9-track-display); overflow-wrap: anywhere;
}
.v9-collection-detail-titleline .v9-led-menu-btn { opacity: 1; }
.v9-collection-detail-copy .v9-statstrip { margin-top: var(--v9-space-3); padding-inline: 0; border-bottom: 0; }

.v9-collections-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--v9-space-4); flex-wrap: wrap;
  padding-bottom: var(--v9-space-4); border-bottom: 1px solid var(--v9-line);
}
.v9-collections-actions { display: flex; align-items: center; gap: var(--v9-space-2); flex-wrap: wrap; margin-left: auto; }
.v9-collections-warning {
  display: flex; align-items: baseline; gap: var(--v9-space-3); padding: var(--v9-space-3) var(--v9-space-4);
  border-left: 2px solid var(--v9-warn); background: color-mix(in srgb, var(--v9-warn) 7%, transparent);
  color: var(--v9-text-mute); font-size: var(--v9-text-sm);
}
.v9-collections-warning strong { color: var(--v9-warn); font: 500 var(--v9-text-xs) var(--v9-font-mono); text-transform: uppercase; white-space: nowrap; }

/* ---- gallery mode ---- */
.v9-collection-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--v9-space-3); align-items: start;
}
.v9-collection-card {
  min-width: 0; overflow: hidden; border: 1px solid var(--v9-line); border-radius: var(--v9-r-md); background: var(--v9-surface);
  transition: transform var(--v9-t-micro) var(--v9-ease), border-color var(--v9-t-micro) var(--v9-ease), background-color var(--v9-t-micro) var(--v9-ease);
}
.v9-collection-card:hover { transform: translateY(-3px); border-color: var(--v9-line-strong); background: var(--v9-raised); }
.v9-collection-card-art { position: relative; aspect-ratio: 5 / 7; display: grid; place-items: center; overflow: hidden; background: var(--v9-bg); }
.v9-collection-card-art > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.v9-collection-card-qty {
  position: absolute; left: var(--v9-space-2); bottom: var(--v9-space-2); min-width: 2rem; padding: 0.2rem 0.45rem;
  border: 1px solid var(--v9-line-strong); border-radius: var(--v9-r-pill); background: color-mix(in srgb, var(--v9-bg) 88%, transparent);
  color: var(--v9-text); font-size: var(--v9-text-xs); text-align: center;
}
.v9-collection-card-menu { position: absolute; top: var(--v9-space-2); right: var(--v9-space-2); }
.v9-collection-card-menu .v9-led-menu-btn { opacity: 1; background: color-mix(in srgb, var(--v9-bg) 86%, transparent); border-color: var(--v9-line); color: var(--v9-text-mute); }
.v9-collection-card-copy { display: grid; gap: 3px; padding: var(--v9-space-3); min-width: 0; }
.v9-collection-card-name { color: var(--v9-text); font: 500 var(--v9-text-sm)/1.2 var(--v9-font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v9-collection-card-meta { color: var(--v9-text-faint); font: 400 var(--v9-text-xs) var(--v9-font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v9-collection-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--v9-space-2); margin-top: var(--v9-space-2); min-width: 0; }
.v9-collection-card-value { color: var(--v9-text); font-size: var(--v9-text-sm); font-weight: 500; white-space: nowrap; }

/* Stable stepper dimensions prevent the layout moving as quantities change. */
.v9-collection-stepper {
  width: 5.6rem; height: 1.9rem; display: grid; grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr); align-items: stretch;
  border: 1px solid var(--v9-line-strong); border-radius: var(--v9-r-pill); overflow: hidden; background: var(--v9-bg); flex: 0 0 auto;
}
.v9-collection-stepper-btn { display: grid; place-items: center; border: 0; background: transparent; color: var(--v9-text-mute); cursor: pointer; padding: 0; }
.v9-collection-stepper-btn:hover:not(:disabled) { background: var(--v9-hover); color: var(--v9-text); }
.v9-collection-stepper-btn:focus-visible { outline: none; box-shadow: inset var(--v9-focus-glow); }
.v9-collection-stepper-btn:disabled { color: var(--v9-line-strong); cursor: default; }
.v9-collection-stepper-icon { width: 0.75rem; height: 0.75rem; display: grid; place-items: center; }
.v9-collection-stepper-icon svg { width: 100%; height: 100%; display: block; }
.v9-collection-stepper-value { display: grid; place-items: center; color: var(--v9-text); font-size: var(--v9-text-xs); border-inline: 1px solid var(--v9-line); }

/* ---- ledger mode ---- */
.v9-collection-ledger { display: grid; border-top: 1px solid var(--v9-line); }
.v9-collection-ledger-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: var(--v9-space-4);
  min-height: 5.6rem; padding: var(--v9-space-3) var(--v9-space-2); border-bottom: 1px solid var(--v9-line);
  transition: background-color var(--v9-t-micro) var(--v9-ease);
}
.v9-collection-ledger-row:hover { background: var(--v9-surface); }
.v9-collections-thumb {
  width: 3.15rem; aspect-ratio: 5 / 7; overflow: hidden; display: grid; place-items: center;
  background: var(--v9-raised); border: 1px solid var(--v9-line); border-radius: var(--v9-r-sm); flex: 0 0 auto;
}
.v9-collections-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v9-collection-ledger-copy { display: grid; gap: 3px; min-width: 0; }
.v9-collection-ledger-name { color: var(--v9-text); font: 500 var(--v9-text-md) var(--v9-font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v9-collection-ledger-meta { color: var(--v9-text-faint); font: 400 var(--v9-text-xs) var(--v9-font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v9-collection-ledger-value { min-width: 7rem; color: var(--v9-text); font-size: var(--v9-text-md); font-weight: 400; text-align: right; white-space: nowrap; }
.v9-collection-ledger-row:hover .v9-led-menu-btn { opacity: 1; }

.v9-collections-empty {
  min-height: 18rem; display: grid; place-items: center; align-content: center; gap: var(--v9-space-4);
  color: var(--v9-text-faint); text-align: center; border-block: 1px solid var(--v9-line);
}
.v9-collections-empty strong { color: var(--v9-text-mute); font-size: var(--v9-text-md); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .v9-collection-strip,
  .v9-collection-stack-card,
  .v9-collection-card { transition: none; }
  .v9-collection-card:hover { transform: none; }
}

@media (max-width: 900px) {
  .v9-collection-strip-open { grid-template-columns: 7rem minmax(0, 1fr) auto; gap: var(--v9-space-3); }
  .v9-collection-stack { width: 6.5rem; transform: scale(0.84); transform-origin: left center; }
  .v9-collection-detail-hero { grid-template-columns: 13rem minmax(0, 1fr); gap: var(--v9-space-5); }
  .v9-collection-stack.is-large { width: 13rem; transform: scale(0.86); transform-origin: center; }
}

@media (max-width: 700px) {
  .v9-collections-list,
  .v9-collections-detail { gap: var(--v9-space-4); }
  .v9-collection-strip-open { min-height: 7rem; grid-template-columns: 4.5rem minmax(0, 1fr); padding: var(--v9-space-3); }
  .v9-collection-strip-open > .v9-collection-stack { width: 4.5rem; transform: scale(0.56); }
  .v9-collection-strip-figures { grid-column: 2; justify-items: start; min-width: 0; }
  .v9-collection-strip-figures .v9-eyebrow { display: none; }
  .v9-collection-strip-figures strong { font-size: var(--v9-text-md); }
  .v9-collection-strip-name { font-size: var(--v9-text-md); }
  .v9-collection-strip-meta { gap: 0.2rem var(--v9-space-2); }
  .v9-collection-strip-meta > span + span::before { margin-right: var(--v9-space-2); }

  .v9-collection-detail-hero { grid-template-columns: minmax(0, 1fr); gap: var(--v9-space-3); padding-inline: 0; }
  .v9-collection-stack.is-large { height: 9rem; }
  .v9-collection-detail-copy { justify-items: center; text-align: center; }
  .v9-collection-detail-titleline { justify-content: center; width: 100%; }
  .v9-collection-detail-title { font-size: var(--v9-text-xl); }
  .v9-collection-detail-copy .v9-statstrip { justify-content: center; }
  .v9-collections-toolbar { align-items: stretch; }
  .v9-collections-toolbar .v9-segmented { width: 100%; }
  .v9-collections-toolbar .v9-segment { flex: 1; }
  .v9-collections-actions { width: 100%; margin-left: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v9-collections-actions .v9-btn { width: 100%; padding-inline: var(--v9-space-2); }
  .v9-collections-actions .v9-btn-primary { grid-column: 1 / -1; }
  .v9-collections-warning { align-items: flex-start; flex-direction: column; gap: var(--v9-space-1); }

  .v9-collection-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--v9-space-2); }
  .v9-collection-card-copy { padding: var(--v9-space-2); }
  .v9-collection-card-foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--v9-space-2); }
  .v9-collection-card-value { font-size: var(--v9-text-xs); }
  .v9-collection-card-foot .v9-collection-stepper { width: 100%; }
  .v9-collection-card-foot .v9-collection-card-value { grid-row: 1; justify-self: start; }
  .v9-collection-stepper { width: 5rem; grid-template-columns: minmax(0, 1fr) 1.9rem minmax(0, 1fr); }

  .v9-collection-ledger-row {
    grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas:
      "art copy menu"
      "art qty value";
    gap: var(--v9-space-2) var(--v9-space-3); padding-inline: 0;
  }
  .v9-collection-ledger-row .v9-collections-thumb { grid-area: art; }
  .v9-collection-ledger-copy { grid-area: copy; }
  .v9-collection-ledger-row .v9-collection-stepper { grid-area: qty; }
  .v9-collection-ledger-value { grid-area: value; min-width: 0; justify-self: end; font-size: var(--v9-text-sm); }
  .v9-collection-ledger-row > .v9-led-menu { grid-area: menu; justify-self: end; }
}

@media (max-width: 360px) {
  .v9-collection-gallery { grid-template-columns: minmax(0, 1fr); }
  .v9-collection-card-foot { display: flex; }
  .v9-collection-card-foot .v9-collection-stepper { width: 5.6rem; }
  .v9-collection-card-foot .v9-collection-card-value { grid-row: auto; }
}

/* ---- "+" picker / name-prompt overlay ---- */
.v9-colpick-overlay {
  position: fixed; inset: 0; z-index: 260;
  display: grid; place-items: center;
  background: rgba(4, 4, 6, 0.82);
  padding: var(--v9-space-4);
}
.v9-colpick-panel {
  width: min(22rem, 100%);
  display: grid; gap: var(--v9-space-3);
  background: var(--v9-bg-1, #0b0b0e);
  border: 1px solid var(--v9-line);
  padding: var(--v9-space-4);
}
.v9-colpick-head { display: flex; align-items: center; justify-content: space-between; gap: var(--v9-space-3); }
.v9-colpick-list { display: grid; max-height: 14rem; overflow-y: auto; }
.v9-colpick-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--v9-space-3);
  min-height: 2.6rem; padding: 8px 4px;
  border: 0; border-bottom: 1px solid var(--v9-line);
  background: transparent; color: var(--v9-text); text-align: left; cursor: pointer;
}
.v9-colpick-row:hover, .v9-colpick-row:focus-visible { background: color-mix(in srgb, var(--v9-accent) 7%, transparent); }
.v9-colpick-row-count { color: var(--v9-text-faint); font: 500 var(--v9-text-xs) var(--v9-font-mono); }
.v9-colpick-empty { color: var(--v9-text-faint); font-size: var(--v9-text-sm); }
.v9-colpick-new { display: flex; gap: var(--v9-space-2); }
.v9-colpick-new .input { flex: 1 1 auto; min-width: 0; }

@media (max-width: 560px) {
  .v9-colpick-overlay { align-items: end; padding: var(--v9-space-2); }
  .v9-colpick-panel { width: 100%; }
}

/* the dock's square "+" button */
.card-detail-collect-btn { min-width: 2.6rem; padding-left: 0; padding-right: 0; font-size: 1.2em; font-weight: 700; }
