/* ===== Wallgold live feed: the .wg-live cards of widget.css plus a live list in every card ===== */
.wg-feed {
  --wg-buy: #067647;
  --wg-buy-soft: #ECFDF3;
  --wg-sell: #B42318;
  --wg-sell-soft: #FEF3F2;
  --wg-live: #17B26A;
  --wg-ease-out: cubic-bezier(.16, 1, .3, 1);
  --wg-tx-height: 60px;
  --wg-tx-gap: 8px;
  /* Three and a half rows show; the half row says the list scrolls. */
  --wg-tx-visible: 3.5;
}
.wg-feed ::selection { background: var(--wg-gold-line); color: var(--wg-ink); }

/* ---------- Card: head, stats, live list and foot line up across a row ---------- */
/* Containment on the card itself would cancel the subgrid, so its four parts are the size containers. */
.wg-feed .wg-card > * { container-type: inline-size; }
@supports (grid-template-rows: subgrid) {
  .wg-live.wg-feed .wg-card {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    row-gap: 16px;
  }
  /* [wallgold_live_lists]: head, live list and foot only. */
  .wg-live.wg-feed--lists .wg-card { grid-row: span 3; }
}

/* The update countdown sits at the end of the title line. */
.wg-feed .wg-clock {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: left;
}
.wg-feed .wg-clock .wg-time { font-size: 15px; line-height: 1.35; }

/* ---------- Stats ---------- */
.wg-feed .wg-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wg-feed .wg-stats > .wg-box {
  flex: 1 1 auto;
  padding: 10px 14px;
}
.wg-feed .wg-stats > .wg-box--total { margin-top: 0; }
.wg-feed .wg-box__value b { font-size: 20px; }
.wg-feed .wg-box--total .wg-box__value b { font-size: 18px; }

/* ---------- Live list ---------- */
.wg-feed .wg-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  border-radius: 12px;
}
.wg-feed .wg-stream:has(.wg-stream__list:focus-visible) {
  outline: 2px solid var(--wg-gold);
  outline-offset: 4px;
}
.wg-feed .wg-stream__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--wg-ink-2);
}
.wg-feed .wg-stream__dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wg-live);
}
.wg-feed .wg-stream__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: wg-ping 2.4s var(--wg-ease-out) infinite;
}
.wg-feed .wg-stream__list {
  --wg-fade-top: 0px;
  --wg-fade-bottom: 32px;
  display: flex;
  flex-direction: column;
  height: calc(var(--wg-tx-visible) * (var(--wg-tx-height) + var(--wg-tx-gap)));
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: hidden;
  overflow-y: auto;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--wg-gold-line) transparent;
  /* Soft edges where more rows wait: below until the end, above once scrolled. */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--wg-fade-top), #000 calc(100% - var(--wg-fade-bottom)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--wg-fade-top), #000 calc(100% - var(--wg-fade-bottom)), transparent);
}
.wg-feed .wg-stream__list.is-scrolled { --wg-fade-top: 20px; }
.wg-feed .wg-stream__list.is-end { --wg-fade-bottom: 0px; }
.wg-feed .wg-stream__list::-webkit-scrollbar { width: 6px; }
.wg-feed .wg-stream__list::-webkit-scrollbar-track { background: transparent; }
.wg-feed .wg-stream__list::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--wg-gold-line); }
@media (hover: hover) and (pointer: fine) {
  /* Room for the desktop scrollbar, which sits on the left in a right-to-left list. */
  .wg-feed .wg-stream__list { padding-inline-end: 6px; }
}

/* One row = a slot that grows open, a clip, and the tile itself. */
.wg-feed .wg-tx-slot {
  display: grid;
  grid-template-rows: 1fr;
  flex: none;
  margin: 0;
  padding: 0;
  transition: grid-template-rows .6s var(--wg-ease-out);
}
.wg-feed .wg-tx-slot::before,
.wg-feed .wg-tx-slot::marker { content: none; }
.wg-feed .wg-tx-clip { min-height: 0; overflow: hidden; }

.wg-feed .wg-tx {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--wg-tx-height);
  margin-bottom: var(--wg-tx-gap);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--wg-soft);
  transition:
    opacity .45s var(--wg-ease-out),
    transform .6s var(--wg-ease-out),
    filter .45s var(--wg-ease-out),
    background-color 1.4s ease,
    box-shadow 1.4s ease;
}

/* Arrival: the slot opens, the tile settles in from slightly above and sharpens. */
.wg-feed .wg-tx-slot.is-entering { grid-template-rows: 0fr; }
.wg-feed .wg-tx-slot.is-entering .wg-tx,
.wg-feed .wg-tx-slot.is-entering .wg-tl {
  opacity: 0;
  transform: translateY(-12px) scale(.98);
  filter: blur(4px);
}
/* A gold wash marks the newest row, then fades back to the resting tile. */
.wg-feed .wg-tx-slot.is-fresh .wg-tx,
.wg-feed .wg-tx-slot.is-fresh .wg-tl {
  background: var(--wg-gold-soft);
  box-shadow: inset 0 0 0 1px var(--wg-gold-line);
}

.wg-feed .wg-tx__badge {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--wg-line);
  color: var(--wg-gold-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.wg-feed .wg-tx__badge svg { width: 18px; height: 18px; }
.wg-feed .wg-tx--buy .wg-tx__badge { background: var(--wg-buy-soft); box-shadow: none; color: var(--wg-buy); }
.wg-feed .wg-tx--sell .wg-tx__badge { background: var(--wg-sell-soft); box-shadow: none; color: var(--wg-sell); }

.wg-feed .wg-tx__who {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1 0 auto;
  min-width: 0;
}
.wg-feed .wg-tx__what {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 0;
  text-align: left;
}

.wg-feed .wg-tx__phone,
.wg-feed .wg-tx__amount,
.wg-feed .wg-tx__soot {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wg-feed .wg-tx__phone {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--wg-ink);
}
.wg-feed .wg-tx__ago {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--wg-ink-2);
  white-space: nowrap;
}
.wg-feed .wg-tx__value {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  column-gap: 4px;
}
.wg-feed .wg-tx__amount {
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--wg-ink);
}
.wg-feed .wg-tx__unit {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--wg-ink-2);
  white-space: nowrap;
}
.wg-feed .wg-tx__soot {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--wg-gold-deep);
}
/* Hidden digits recede so the visible ones read first. */
.wg-feed .wg-mask {
  font-size: .88em;
  font-weight: 400;
  letter-spacing: .02em;
  color: var(--wg-ink-3);
}

/* Before the first data arrives the list keeps its shape. */
.wg-feed .wg-tx--placeholder .wg-tx__badge,
.wg-feed .wg-tx--placeholder .wg-tx__line {
  background: var(--wg-line);
  box-shadow: none;
}
.wg-feed .wg-tx__line {
  display: block;
  height: 10px;
  border-radius: 5px;
}
.wg-feed .wg-stream__empty {
  margin: 0;
  padding: 18px 12px;
  border-radius: 12px;
  background: var(--wg-soft);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--wg-ink-2);
  text-align: center;
}

/* ---------- One column of every section ([wallgold_live_timeline]) ---------- */
.wg-live.wg-feed--timeline {
  --wg-out: #475467;
  --wg-out-soft: #F2F4F7;
  --wg-tl-height: 68px;
  /* Room for the longest time ago ("۵۹ دقیقه پیش"), so the columns before it never move. */
  --wg-tl-when: 76px;
  /* Six rows show; the rest of the 30 appear on scrolling, with no scrollbar drawn. */
  --wg-tl-visible: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
  margin-inline: auto;
  container-type: inline-size;
}
.wg-feed .wg-timeline {
  --wg-fade-top: 0px;
  --wg-fade-bottom: 44px;
  display: flex;
  flex-direction: column;
  height: calc(var(--wg-tl-visible) * (var(--wg-tl-height) + var(--wg-tx-gap)));
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: hidden;
  overflow-y: auto;
  outline: none;
  border-radius: 14px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--wg-fade-top), #000 calc(100% - var(--wg-fade-bottom)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--wg-fade-top), #000 calc(100% - var(--wg-fade-bottom)), transparent);
}
.wg-feed .wg-timeline::-webkit-scrollbar { display: none; }
.wg-feed .wg-timeline.is-scrolled { --wg-fade-top: 24px; }
.wg-feed .wg-timeline.is-end { --wg-fade-bottom: 0px; }
.wg-feed .wg-timeline:focus-visible { box-shadow: inset 0 0 0 2px var(--wg-gold); }

.wg-feed .wg-tl {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--wg-tl-height);
  margin-bottom: var(--wg-tx-gap);
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--wg-line);
  transition:
    opacity .45s var(--wg-ease-out),
    transform .6s var(--wg-ease-out),
    filter .45s var(--wg-ease-out),
    background-color 1.4s ease,
    box-shadow 1.4s ease;
}
.wg-feed .wg-tl__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--wg-gold-soft);
  color: var(--wg-gold-deep);
}
.wg-feed .wg-tl__icon svg { width: 20px; height: 20px; }
/*
 * The same three columns in every row: who (type, phone), the soot of a trade, and when (time ago) with the
 * amount spanning under both. The time column has a fixed width, so soot and amounts line up down the list.
 */
.wg-feed .wg-tl__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto var(--wg-tl-when);
  grid-template-areas:
    "type  soot   time"
    "phone amount amount";
  align-items: center;
  column-gap: 12px;
  row-gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}
.wg-feed .wg-tl__type { grid-area: type; justify-self: start; }
.wg-feed .wg-tl__soot { grid-area: soot; justify-self: end; }
.wg-feed .wg-tl__time { grid-area: time; justify-self: end; }
.wg-feed .wg-tl .wg-tx__phone { grid-area: phone; justify-self: start; }
.wg-feed .wg-tl__amount { grid-area: amount; justify-self: end; }
.wg-feed .wg-tl .wg-tx__value { flex-wrap: nowrap; }
/* Two lines of fixed height, so exactly six rows fill the column. */
.wg-feed .wg-tl .wg-tx__phone,
.wg-feed .wg-tl .wg-tx__amount,
.wg-feed .wg-tl__type,
.wg-feed .wg-tl__soot,
.wg-feed .wg-tl__time { line-height: 1.35; }
.wg-feed .wg-tl__type {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--wg-gold-deep);
}
.wg-feed .wg-tl__soot .wg-tx__soot { font-size: 14px; }
.wg-feed .wg-tl__time {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--wg-ink-2);
}
/* Each kind has its own colour, so a glance tells what happened. */
.wg-feed .wg-tl--buy .wg-tl__icon { background: var(--wg-buy-soft); color: var(--wg-buy); }
.wg-feed .wg-tl--buy .wg-tl__type { color: var(--wg-buy); }
.wg-feed .wg-tl--sell .wg-tl__icon { background: var(--wg-sell-soft); color: var(--wg-sell); }
.wg-feed .wg-tl--sell .wg-tl__type { color: var(--wg-sell); }
.wg-feed .wg-tl--withdraw .wg-tl__icon { background: var(--wg-out-soft); color: var(--wg-out); }
.wg-feed .wg-tl--withdraw .wg-tl__type { color: var(--wg-out); }
.wg-feed .wg-tl--delivery .wg-tl__icon { background: #fff; box-shadow: inset 0 0 0 1px var(--wg-gold-line); }
.wg-feed .wg-tl--delivery .wg-tl__type { color: var(--wg-ink); }
.wg-feed .wg-tl--placeholder .wg-tl__icon,
.wg-feed .wg-tl--placeholder .wg-tx__line { background: var(--wg-line); box-shadow: none; }
.wg-feed .wg-tl--placeholder .wg-tl__body { display: flex; flex-direction: column; gap: 10px; }

@container (max-width: 360px) {
  .wg-feed .wg-tl { gap: 10px; padding: 9px 10px; }
  .wg-feed .wg-tl__icon { width: 34px; height: 34px; border-radius: 10px; }
  .wg-feed .wg-tl__icon svg { width: 17px; height: 17px; }
  .wg-feed .wg-tl__body { column-gap: 8px; }
  .wg-feed .wg-tl__type { font-size: 13px; }
  .wg-feed .wg-tl__soot .wg-tx__soot { font-size: 13px; }
  .wg-feed .wg-tl__time { font-size: 11.5px; }
}
/* Very narrow columns: the coloured type label alone says what happened, so the icon makes room for the numbers. */
@container (max-width: 280px) {
  .wg-feed .wg-tl__icon { display: none; }
}

@keyframes wg-ping {
  0% { transform: scale(1); opacity: .5; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}

/* ---------- Narrow cards (phones, or two columns in a narrow page column) ---------- */
@container (max-width: 340px) {
  .wg-feed .wg-card__icon { width: 36px; height: 36px; border-radius: 10px; }
  .wg-feed .wg-card__title { font-size: 14.5px; }
  .wg-feed .wg-clock .wg-time { font-size: 14px; }
  .wg-feed .wg-stats > .wg-box { padding: 9px 12px; }
  .wg-feed .wg-box__value b { font-size: 18px; }
  .wg-feed .wg-box--total .wg-box__value b { font-size: 16px; }
  /* Keeps a trade row (badge, phone, amount and unit) on one line down to 360px screens. */
  .wg-feed .wg-stream__list { --wg-tx-height: 58px; }
  .wg-feed .wg-tx { padding: 9px 8px; gap: 5px; }
  .wg-feed .wg-tx__badge { min-width: 30px; height: 30px; padding: 0 4px; border-radius: 9px; font-size: 11px; }
  .wg-feed .wg-tx__badge svg { width: 16px; height: 16px; }
  .wg-feed .wg-tx__phone { font-size: 14px; }
  .wg-feed .wg-tx__amount { font-size: 14.5px; }
  .wg-feed .wg-tx__soot { font-size: 12.5px; }
  .wg-feed .wg-mask { letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wg-feed .wg-tx-slot,
  .wg-feed .wg-tx,
  .wg-feed .wg-tl { transition: none; }
  .wg-feed .wg-tx-slot.is-entering { grid-template-rows: 1fr; }
  .wg-feed .wg-tx-slot.is-entering .wg-tx,
  .wg-feed .wg-tx-slot.is-entering .wg-tl { opacity: 1; transform: none; filter: none; }
  .wg-feed .wg-stream__dot::after { animation: none; }
}
