/* Ticket list: an event's tickets, one ticket-option each, as their block on
   the event's page says. It lays its options out by its own width, so a list
   in the sidebar and one in the page's column each get what fits.
   data-layout  (none)  cards under each other, as tickets always showed
                rows    flat rows parted by a line: name and price, and from
                        32rem the way to take it at the row's end
                tiers   price tiers side by side, the price large
   A ticket its organizer highlights by a frame, band or tint keeps its tile
   in every layout. */
.ticket-list {
  container: ticket-list / inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.ticket-list[data-layout="rows"] {
  gap: 0;

  .ticket-option:where(:not([data-highlight="frame"], [data-highlight="band"], [data-highlight="tint"])) {
    background: none;
    border-block-end: var(--border-width) solid var(--color-subtle);
    border-radius: 0;
    padding-inline: 0;

    &:last-child {
      border-block-end: 0;
    }
  }

  .ticket-option:is([data-highlight="frame"], [data-highlight="band"], [data-highlight="tint"]) {
    margin-block: var(--space-xs);
  }
}

/* Gone, in rows and tiers: its words go quiet instead of the whole tile
   dimming, which a flat row hasn't and which takes the note's contrast */
.ticket-list[data-layout] .ticket-option[data-state="unavailable"] {
  filter: none;
  opacity: 1;

  :is(.ticket-option__title, .ticket-option__price, .ticket-option__features) {
    color: var(--color-muted);
  }
}

@container ticket-list (min-width: 32rem) {
  .ticket-list[data-layout="rows"] .ticket-option {
    column-gap: var(--space-m);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0;

    > * {
      grid-column: 1;
    }

    /* The way to take it: the stepper, the seat map or a note */
    > :is(.stepper, .seat-link, .ticket-option__note) {
      align-self: center;
      grid-column: 2;
      grid-row: 1 / span 4;
    }

    > .seat-link {
      gap: var(--space-s);
    }

    > :is(.ticket-option__admits, .ticket-option__features) {
      margin-block-start: var(--space-3xs);
    }

    > .ticket-option__label {
      justify-self: start;
      margin-block-end: var(--space-3xs);
    }
  }

  /* A band crosses the whole tile, the rest follows under it */
  .ticket-list[data-layout="rows"] .ticket-option[data-highlight="band"] {
    > .ticket-option__label {
      grid-column: 1 / -1;
      justify-self: stretch;
      margin-block-end: var(--space-xs);
    }

    > :is(.stepper, .seat-link, .ticket-option__note) {
      grid-row: 2 / span 4;
    }
  }
}

.ticket-list[data-layout="tiers"] {
  display: grid;
  gap: var(--space-s);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));

  .ticket-option {
    text-align: center;
  }

  /* Name over price */
  .ticket-option > .repel {
    align-items: center;
    flex-direction: column;
  }

  .ticket-option__price {
    font-family: var(--font-display);
    font-size: var(--step-3);
    line-height: var(--leading-flat);
  }

  .ticket-option:where(:not([data-highlight="frame"], [data-highlight="band"])) .ticket-option__label {
    align-self: center;
  }

  .ticket-option__features {
    align-items: center;
  }

  /* The ways to take them line up along the tiers' feet */
  .ticket-option > :is(.stepper, .seat-link, .ticket-option__note) {
    margin-block-start: auto;
  }
}
