/* Shared parts of the value pages (app/components/market.js): a completed trade's row (Just traded, an item's past
   trades). Prefix jt-. Colours: tokens only; tier colours come from pop.css.

   A completed trade is drawn like an open trade on the item page (adcard.css .ac-rows > .ac-row, its no-who form: the
   owner's pick D of spec/pasttrades-variations), made compact at the owner's ask ("compact it even more"): each side's
   line "[face] titanic_ty gave 🔥33" over its items, each a 40px picture with its name and value beside it, ⇄ between,
   the time where the open trade's button would be, nothing in a row a button. Phones: a card a trade, the time on the
   first side's line. */

.ac-row.jt-row {
  --ac-mid: calc(20px + 8px + 20px);   /* the first line of items' middle: the side's line, its gap, half a picture */
  cursor: default; padding: 12px 20px;
}
.ac-row.jt-row.ac-row--nohead { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 96px; }
.ac-row.jt-row .ac-half__top { min-height: 20px; margin-bottom: 8px; }
.ac-row.jt-row .ac-half__label { font-size: 14px; line-height: 20px; }
.ac-row.jt-row .ac-half__total { font-size: 16px; line-height: 20px; }
.ac-row.jt-row .ac-half__total .u-coin { width: 13px; height: 16px; }
/* each item: its 40px picture with its name and value beside it; a side's items wrap */
.ac-row.jt-row .ac-items { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ac-row.jt-row .ac-items > li { display: block; min-width: 0; }
.ac-row.jt-row .ac-items .u-item { display: grid; grid-template-columns: 40px auto; grid-template-rows: auto auto; column-gap: 8px; align-content: center; width: auto; }
.ac-row.jt-row .ac-items .u-pic--fill { grid-row: 1 / 3; width: 40px; border-radius: 10px; }
.ac-row.jt-row .ac-items .u-pic--fill[data-tier] { padding: 4px; }   /* its 12% would be of the item's width here */
.ac-row.jt-row .ac-items .u-item__name { display: block; grid-column: 2; align-self: end; margin: 0; font-size: 13px; line-height: 16px; white-space: nowrap; }
.ac-row.jt-row .ac-items .u-item__val { display: block; grid-column: 2; align-self: start; margin: 0; font-size: 12px; line-height: 16px; }
.ac-row.jt-row .ac-items .u-item__qty { right: 1px; bottom: 1px; padding: 0 3px; border-radius: 5px; font-size: 10px; line-height: 13px; }
.ac-row.jt-row.is-new { background: var(--color-iguana); transition: none; }
.ac-row.jt-row.is-skel { pointer-events: none; }

/* "[face] titanic_ty gave 🔥33": the name, then the side's word and its total (a word space apart, UX.md rule 16) */
.jt-who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--color-eel); font: 700 14px/20px var(--font); text-decoration: none; border-radius: 8px; }
.jt-who > .u-avatar { flex-shrink: 0; }
.jt-who__name { min-width: 0; overflow-wrap: anywhere; }
@media (hover: hover) { a.jt-who:hover .jt-who__name { color: var(--color-macaw); } }
.jt-who:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: 2px; }
.jt-who.is-gone { color: var(--color-label); }

/* the time, level with the middle of the tiles like the button it stands in for */
/* (.ac-foot is a column: its <time> stretched across the 96px and sat on the left, 51px off the row's right edge) */
.ac-row.jt-row > .jt-time { display: flex; align-items: flex-end; margin-top: calc(var(--ac-mid) - 9px); color: var(--color-label); font: 700 14px/18px var(--font); white-space: nowrap; text-align: right; }

/* loading: each side's line and two items, the size of the real ones */
.jt-skel { display: grid; grid-template-columns: 40px 72px; grid-template-rows: 20px 20px; column-gap: 8px; align-items: center; }
.jt-skel > .m-skel:first-child { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 10px; }
.jt-skel > .m-skel--text { height: 12px; margin: 0; }

/* phones (the open trades' phone card, adcard.css): a card a trade; each side a line, "[face] titanic_ty gave" on the
   left and its total on the right, then its items as tiles four a row with the name under each (three on the narrowest
   phones; a side of one item doesn't say its value twice); one line between the two sides (adcard.css); when it
   happened at the card's foot. Nothing in it is a button: the names go to the traders' pages, the tiles to the items' */
@media (max-width: 699px) {
  .ac-row.jt-row { padding: 16px; row-gap: 16px; }
  .ac-row.jt-row.ac-row--nohead { grid-template-columns: minmax(0, 1fr); grid-template-areas: "give" "get" "act"; }
  .ac-row.jt-row .ac-half__top { flex-wrap: nowrap; column-gap: 5px; min-height: 24px; margin: 0 0 12px; }
  .ac-row.jt-row .jt-who { gap: 8px; font-size: 15px; line-height: 24px; }
  .ac-row.jt-row .jt-who > .u-avatar { width: 24px; height: 24px; }
  .ac-row.jt-row .ac-half__label { flex-shrink: 0; font-size: 15px; line-height: 24px; }
  .ac-row.jt-row .ac-half__total { order: 3; flex-shrink: 0; margin-left: auto; font-size: 19px; line-height: 24px; }
  .ac-row.jt-row .ac-half__total .u-coin { width: 16px; height: 20px; }
  /* the items: tiles, four a row, named (the open trades' tiles) */
  .ac-row.jt-row .ac-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 8px; }
  .ac-row.jt-row .ac-items > li { display: flex; }
  .ac-row.jt-row .ac-items .u-item { display: flex; flex-direction: column; width: 100%; }
  .ac-row.jt-row .ac-items .u-pic--fill { width: 100%; border-radius: 16px; }
  .ac-row.jt-row .ac-items .u-pic--fill[data-tier] { padding: 6%; }
  .ac-row.jt-row .ac-items .u-item__name { align-self: auto; margin: 8px 0 0; font-size: 14px; line-height: 17px; white-space: normal; overflow-wrap: anywhere; }   /* breaks at the <wbr> in its name first */
  .ac-row.jt-row .ac-items .u-item__val { align-self: auto; margin: 2px 0 0; font-size: 14px; line-height: 17px; }
  .ac-row.jt-row .ac-items > li:only-child .u-item__val { display: none; }
  .ac-row.jt-row .ac-items .u-item__qty { right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 8px; font-size: 13px; line-height: 18px; }
  .ac-row.jt-row > .jt-time { grid-area: act; justify-self: start; align-self: auto; margin: 0; }
  .ac-row.jt-row .jt-who { position: relative; }
  .ac-row.jt-row .jt-who::after { content: ""; position: absolute; inset: -10px -4px; }   /* a 44px tap on the 24px line */
  /* loading: the same shapes, a square tile and its name */
  .jt-skel { display: flex; flex-direction: column; gap: 6px; }
  .jt-skel > .m-skel:first-child { width: 100%; height: auto; aspect-ratio: 1; border-radius: 16px; }
}
/* a narrow phone (320px): three a row, so names stay whole (adcard.css, the open trades the same) */
@media (max-width: 359px) {
  .ac-row.jt-row .ac-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .ac-row.jt-row { transition: none; } }
