/*
 * Souk — the shell. Si Salah never scrolls away.
 *
 * Wide: two columns. The stall on the left holds still, the conversation on the
 * right scrolls on its own, and the composer sits at the foot of that column.
 * Narrow: one column. The stall becomes a compact bar pinned to the top.
 */

#stall {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

.stage {
  min-height: 0;
}

.talk {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- the name gate ------------------------------------------------------- */

/* No composer exists until the player has a name. Nothing can be refused. */
.entry {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: min(26rem, 100% - 1.5rem);
  margin: auto;
  padding: 1rem;
  background: var(--wall);
  border: var(--edge);
}

.entry::before {
  content: "";
  display: block;
  height: 12px;
  margin: -1rem -1rem 0.6rem;
  background-image: var(--stars);
  background-size: 12px 12px;
  border-bottom: var(--edge);
}

.entry h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass);
}

.entry-story {
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--sand-dim);
}

.entry label {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--sand-dim);
}

.entry .hint {
  margin: 0;
  font-size: 0.85rem;
  color: #c8503c;
}

.enter {
  margin-top: 0.3rem;
  font: 700 1rem var(--sans);
  padding: 0.6rem 1rem;
  color: var(--night);
  background: var(--brass);
  border: var(--edge);
  cursor: pointer;
}

/* ---- two columns --------------------------------------------------------- */

@media (min-width: 56.25rem) {
  #stall {
    grid-template-columns: 22rem minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: var(--gap);
    padding: var(--gap);
  }

  .stage {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .talk {
    background: var(--wall);
    border: var(--edge);
  }

  .seller {
    width: 128px;
    height: 128px;
    margin-bottom: -24px;
  }

  .counter .art {
    width: 148px;
    height: 148px;
  }

  .price {
    font-size: 2.8rem;
  }

  /* The left column already carries the story. Do not print it twice. */
  .entry-story {
    display: none;
  }
}

/* ---- one column, the stall as a bar -------------------------------------- */

@media (max-width: 56.24rem) {
  .stage {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    background: var(--wall);
    border-bottom: var(--edge);
  }

  .stage .scene {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: 0;
    overflow: visible;
  }

  .awning,
  .band,
  .story,
  .foot {
    display: none;
  }

  .seller {
    width: 42px;
    height: 42px;
    margin: 0;
  }

  .counter {
    padding: 0;
    background: none;
    border: 0;
  }

  .counter .art {
    width: 42px;
    height: 42px;
  }

  .ticket {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    background: none;
    color: var(--paper);
    border: 0;
  }

  .price {
    font-size: 1.7rem;
  }

  .unit {
    color: var(--brass);
  }

  .facts {
    flex-direction: column;
    gap: 0;
    margin-inline-start: auto;
    font-size: 0.6rem;
  }

  .facts > div {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.3rem;
  }

  .facts dt {
    color: var(--sand-dim);
  }

  .facts dd {
    font-size: 0.8rem;
    color: var(--sand);
  }
}

/* ---- the end of a deal (D25) --------------------------------------------- */

/*
 * The panel takes the place of the composer. It never grows past half the
 * column, because the conversation above it is the reason he is here.
 */
.deal {
  flex: 0 0 auto;
  max-height: 55%;
  overflow-y: auto;
  padding: 0.7rem 0.9rem;
  background: var(--wall);
  border-top: var(--edge);
}

.deal h2 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}

.deal h3 {
  margin: 0.7rem 0 0.3rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sand-dim);
}

.deal-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

.deal-item {
  color: var(--sand);
}

.deal-price {
  font: 700 1.6rem var(--mono);
  color: var(--brass);
}

.deal-cut,
.deal-rank,
.deal-left {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--sand-dim);
}

.deal-rank {
  color: var(--sand);
}

.deal-past {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 2px solid var(--night);
}

.deal-past li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  background: var(--sand);
  color: var(--night);
  border-bottom: 2px solid var(--night);
}

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

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

.deal-past .when {
  width: 4.2rem;
  font: 0.75rem var(--mono);
  color: var(--terracotta-dark);
}

.deal-past .what {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-past .paid {
  font: 700 0.9rem var(--mono);
}

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

.deal .enter {
  width: 100%;
  margin-top: 0.7rem;
}
