/* The ticket design an event prints in, chosen by sight (TicketingDesignChoiceComponent, packs/ticketing/app/components/ticketing_design_choice_component.rb).
   Each design is a tile: the radio, the design's name and stock and whether it is in use on top, then its picture at the ticket's own proportions (the
   custom property the tile is given), the printer's black on white with a hairline in both modes; a sentence stands in the same box where there is no
   picture. The tiles wrap in a grid as wide as the panel allows, one to a row on a phone. The chosen tile is marked as a chosen option row is, and the
   ring of focus is on the tile.

   Tokens only and logical properties only, both enforced (test/styles/tokens_test.rb, test/styles/components_test.rb), so it reads on the light shell
   and the console, in light and in dark, and mirrors in a right-to-left language. Nothing pinned to an edge, no height in vh, and everything that holds
   words may shrink and wrap, so a language 40% longer never widens the page (WCAG 1.4.10). */

.ticketing-design-choice {
  min-inline-size: 0;
}

.ticketing-design-choice__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-3);
  margin: 0;
  margin-block-start: var(--space-2);
  padding: 0;
  list-style: none;
}

.ticketing-design-choice__option {
  display: grid;
  min-inline-size: 0;
}

.ticketing-design-choice__tile {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  min-inline-size: 0;
  padding: var(--space-3);
  color: var(--fg1);
  background: var(--surface-raised);
  border: 1px solid var(--control-line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.ticketing-design-choice__tile:hover {
  border-color: var(--fg3);
}

.ticketing-design-choice__tile:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ticketing-design-choice__tile:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ticketing-design-choice__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  min-inline-size: 0;
}

.ticketing-design-choice__head input[type="radio"] {
  flex: none;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  margin: 0.1rem 0 0;
  cursor: pointer;
}

/* The ring is on the tile, so the radio does not draw a second one. */
.ticketing-design-choice__head input:focus-visible {
  outline: none;
}

.ticketing-design-choice__words-block {
  display: grid;
  flex: 1 1 8rem;
  gap: var(--space-1);
  min-inline-size: 0;
}

.ticketing-design-choice__name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ticketing-design-choice__stock {
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.ticketing-design-choice__in-use {
  flex: none;
}

/* The ticket's own shape; a sentence that needs more room makes the box taller rather than spilling out of it. */
.ticketing-design-choice__paper {
  display: grid;
  align-items: center;
  min-inline-size: 0;
  aspect-ratio: var(--ticketing-design-choice-ratio, 1650 / 600);
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.ticketing-design-choice__paper turbo-frame {
  display: grid;
  align-items: center;
  min-inline-size: 0;
}

/* The picture is drawn at the stock's own proportions, so it fills the box. */
.ticketing-design-choice__picture {
  display: block;
  inline-size: 100%;
  block-size: auto;
  border-radius: var(--radius-sm);
}

.ticketing-design-choice__words {
  padding: var(--space-2) var(--space-3);
  color: var(--fg2);
  font-size: var(--text-sm);
  text-align: center;
  overflow-wrap: anywhere;
}

@media (pointer: coarse) {
  .ticketing-design-choice__tile {
    min-block-size: var(--target-min);
  }
}

@media (forced-colors: active) {
  .ticketing-design-choice__tile:has(input:checked) {
    border-width: 2px;
  }
}
