/* Souk — the stall of Si Salah. Mobile first, then a wider stall on a desktop. */

:root {
  --night: #2a1c16;
  --wall: #3a2820;
  --terracotta: #b4552d;
  --terracotta-dark: #7f3320;
  --indigo: #2b3a67;
  --indigo-light: #4a63a8;
  --brass: #c9963f;
  --sand: #e8cfa2;
  --sand-dim: #c9a874;
  --paper: #f6efe2;
  --gap: 0.75rem;
  --edge: 3px solid var(--night);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* An eight point star, the khatim of a zellige panel. */
  --stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' fill='%232b3a67'/%3E%3Cpath d='M12 2l2.4 6.2L21 12l-6.6 3.8L12 22l-2.4-6.2L3 12l6.6-3.8z' fill='%23c9963f'/%3E%3Cpath d='M12 8l1.4 2.6L16 12l-2.6 1.4L12 16l-1.4-2.6L8 12l2.6-1.4z' fill='%232b3a67'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

/*
 * The page is one screen and it never scrolls. The stall holds still and only
 * the conversation moves. `--vh` follows the visual viewport, so the soft
 * keyboard of a phone shortens the page instead of hiding the composer.
 */
body {
  display: flex;
  flex-direction: column;
  height: var(--vh, 100dvh);
  overflow: hidden;
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font: 1rem/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

img {
  image-rendering: pixelated;
}

/* ---- bars ---------------------------------------------------------------- */

.bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  padding: 0.6rem 0.9rem;
  background: var(--wall);
  border-bottom: var(--edge);
}

.bar h1 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

.bar .ar {
  font-size: 1.4rem;
  letter-spacing: 0;
  margin-inline-end: 0.35rem;
}

.foot {
  border: 0;
  border-top: var(--edge);
  font-size: 0.8rem;
  color: var(--sand-dim);
}

.tabs {
  display: flex;
  gap: 0.4rem;
}

.tab {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  color: var(--sand);
  background: transparent;
  border: 2px solid var(--sand-dim);
  border-radius: 2px;
  cursor: pointer;
}

.tab.on {
  color: var(--night);
  background: var(--brass);
  border-color: var(--brass);
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
}

.view {
  flex: 1;
  min-height: 0;
}

/* ---- the board ----------------------------------------------------------- */

#board {
  overflow-y: auto;
  padding: var(--gap);
}

.tabs.sub {
  margin-bottom: var(--gap);
}

.note {
  margin: 0 0 var(--gap);
  font-size: 0.85rem;
  color: var(--sand-dim);
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  border: var(--edge);
}

.board li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--sand);
  color: var(--night);
  border-bottom: 2px solid var(--night);
}

.board li:last-child {
  border-bottom: 0;
}

.board li:nth-child(odd) {
  background: var(--paper);
}

.board .rank {
  font: 700 0.9rem var(--mono);
  width: 1.8rem;
  color: var(--terracotta-dark);
}

.board .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board .paid {
  font: 700 1rem var(--mono);
}

.board .cut {
  font: 0.8rem var(--mono);
  color: var(--terracotta-dark);
  width: 3.5rem;
  text-align: end;
}

/*
 * D26. The page turns around for Arabic, but a price does not. The digits stay
 * Western and the unit stays "DT", so 250 reads 250 in every language and the
 * leaderboard still compares the same numbers. These few boxes hold a number
 * next to a Latin word or a sign, and only they are pinned left to right.
 *
 * `.count` is not in this list on purpose. A logical margin resolves against the
 * direction of the element itself, so pinning the counter left to right sent its
 * `margin-inline-end: auto` to the wrong side and left a hole in the composer.
 * "0 / 400" needs no help: two numbers around a separator are one run already.
 */
.money,
.deal-price,
.board .paid,
.board .cut,
.deal-past .paid,
.deal-past .cut {
  direction: ltr;
}

[hidden] {
  display: none !important;
}
