/* ---------------------------------------------------------------
   THE BASKET — the compact view
   ---------------------------------------------------------------
   The deck is one card at a time and every pixel is given to the post. This
   is the opposite: a hundred and twenty-two rows, all readable at once, with
   just enough of each to recognise it and a box to reply in.

   It sits over the deck rather than replacing it, so closing puts you back
   exactly where you were.
   --------------------------------------------------------------- */

.basket {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
}

/* ---------- head ---------- */

.basket__head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.basket__title {
  font: 700 15px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}

.basket__hint {
  margin: 7px 0 0;
  font: 500 11.5px/1.5 var(--mono);
  letter-spacing: .03em;
  color: var(--ink-faint);
  max-width: 62ch;
}

.basket__close {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  padding: 7px 11px;
  cursor: pointer;
  font: 700 9.5px/1 var(--mono);
  letter-spacing: .12em;
  transition: all 200ms var(--ease);
}
.basket__close:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- half a link ----------

   A mode with no words in it is a mode nobody understands. This says which
   post is being linked and what the next click will do, because the second
   click looks exactly like the first without it. */

.basket__banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 22px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.basket__banner[hidden] { display: none; }

.basket__bannerText {
  font: 700 11px/1.4 var(--mono);
  letter-spacing: .06em;
  color: var(--accent);
  /* a long chain wraps rather than pushing DONE off the edge */
  min-width: 0;
  overflow-wrap: anywhere;
}

.basket__bannerStop {
  margin-left: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  padding: 6px 10px;
  cursor: pointer;
  font: 700 9px/1 var(--mono);
  letter-spacing: .12em;
}
.basket__bannerStop:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* ---------- the rows ---------- */

.basket__list {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0;
}

.brow {
  display: grid;
  /* number | what it is | its money | the box | price | link */
  grid-template-columns: 34px minmax(0, 1fr) 62px minmax(0, 1.1fr) 68px 58px;
  align-items: start;
  gap: 12px;
  padding: 9px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.brow:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }

.brow__n {
  font: 600 10.5px/1.7 var(--mono);
  letter-spacing: .1em;
  color: var(--ink-faint);
}

.brow__snip { min-width: 0; }

.brow__label {
  display: block;
  font: 600 11px/1.5 var(--mono);
  letter-spacing: .04em;
  color: var(--accent);
}

.brow__text {
  display: block;
  font: 400 11.5px/1.5 var(--sans, inherit);
  color: var(--ink-faint);
  /* two lines is enough to recognise a post without turning the list into
     the deck it exists to be an alternative to */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brow__vol {
  font: 700 10.5px/1.7 var(--mono);
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: right;
}

.brow__say,
.brow__usd {
  font: 500 11.5px/1.4 var(--mono);
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}
.brow__say {
  resize: none;
  min-height: 32px;
  width: 100%;
}
.brow__say::placeholder { color: color-mix(in srgb, var(--ink-faint) 70%, transparent); }
.brow__say:focus,
.brow__usd:focus {
  outline: none;
  border-color: var(--accent);
}

.brow__usd {
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.brow__link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  padding: 7px 6px;
  cursor: pointer;
  font: 700 8.5px/1 var(--mono);
  letter-spacing: .1em;
  transition: all 200ms var(--ease);
}
.brow__link:hover { color: var(--accent); border-color: var(--accent); }

/* While a link is half-made, the row it started from stays lit and every
   other row invites the second click. Without this the mode is invisible and
   the next click looks like it did nothing. */
.basket.is-linking .brow__link { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.basket.is-linking .brow.is-linkSource { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.basket.is-linking .brow.is-linkSource .brow__link {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ---------- the link a row's comment makes ----------

   Under the row rather than beside it: a link is a property of what was
   written above it, not another column competing with the price. */

.brow__chip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0 2px 34px;
}
.brow__chip[hidden] { display: none; }

.brow__chipHint {
  font: 700 9.5px/1 var(--mono);
  letter-spacing: .08em;
  color: var(--accent);
}

.brow__pick {
  flex: 1 1 220px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 500 10px/1.2 var(--mono);
  cursor: pointer;
}
.brow__pick:focus { outline: none; border-color: var(--accent); }

.brow__label {
  width: 160px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 500 10px/1.2 var(--mono);
}
.brow__label::placeholder { color: color-mix(in srgb, var(--ink-faint) 70%, transparent); }
.brow__label:focus { outline: none; border-color: var(--accent); }
.brow__label[hidden] { display: none; }

.brow__drop {
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font: 700 13px/1 var(--mono);
  padding: 0 4px;
}
.brow__drop:hover { color: var(--accent); }

/* ---------- foot ---------- */

.basket__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.basket__tokens { display: flex; gap: 6px; flex-wrap: wrap; }

.basket__spacer { flex: 1 1 auto; }

.basket__sum {
  font: 700 12px/1 var(--mono);
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: right;
}

.basket__pay {
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: var(--bg);
  padding: 11px 18px;
  cursor: pointer;
  font: 700 10px/1 var(--mono);
  letter-spacing: .14em;
  transition: opacity 200ms var(--ease);
}
.basket__pay:hover { opacity: .85; }
.basket__pay:disabled {
  background: transparent;
  color: var(--ink-faint);
  border-color: var(--line);
  cursor: not-allowed;
}
.basket__pay:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- narrow ----------

   The two-column body is what has to go. The snippet and the box stack, and
   the price and LINK sit under them — still one row per post, just taller. */

@media (max-width: 860px) {
  .brow {
    grid-template-columns: 30px minmax(0, 1fr) 62px;
    gap: 8px 10px;
    padding: 11px 15px;
  }
  .brow__say { grid-column: 2 / -1; }
  .brow__usd { grid-column: 2 / 3; width: 84px; }
  .brow__link { grid-column: 3 / -1; }
  /* .basket__links was in this padding list until the chain UI went; taking
     the line out merged the padding into the rule below and hid the head and
     foot on every narrow screen. */
  .basket__head,
  .basket__foot { padding-left: 15px; padding-right: 15px; }
  .basket__hint { display: none; }
}
