/* A design on the designer's canvas (TicketingDesignerTileComponent) and its ticket on the office's stock (TicketingDesignerTicketComponent).

   A tile is a card: the letter in a round mark beside the design's name, the ticket, a sentence, then what can be done. The ticket is drawn in the
   picture's own proportions (the stock's length to its width, from the component's inline custom properties) on white paper that is white in both modes,
   since it is paper; the stock's pre-printed stub and the code's window lie under the picture, which is multiplied over them, so the printer's black stays
   black and its white shows the stock. The stock's color is not recorded, so its stub is one neutral tone. Until it is drawn, the ticket's outline is
   dashed and holds a word.

   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 (the stock layer is the ticket's own and is set left to right in the
   markup). Nothing pinned to an edge, no height in vh, and everything that holds words may shrink and wrap (WCAG 1.4.10). */

.ticketing-designer-tile {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  min-inline-size: 0;
  padding: var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.ticketing-designer-tile[data-featured] {
  gap: var(--space-4);
  padding: var(--space-5);
}

.ticketing-designer-tile__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  min-inline-size: 0;
}

.ticketing-designer-tile__letter {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  /* A letter is the same in every language (it is marked an identifier), but it is drawn in the page's own face, not the identifiers' mono one. */
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 800;
  overflow-wrap: normal;
}

.ticketing-designer-tile__name {
  margin: 0;
  min-inline-size: 0;
  font-size: var(--text-base);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ticketing-designer-tile[data-featured] .ticketing-designer-tile__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
}

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

.ticketing-designer-tile__aside {
  margin-inline-start: auto;
}

.ticketing-designer-tile__caption {
  margin: 0;
  min-block-size: 2.75em;
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.ticketing-designer-tile__caption[data-kind="direction"] {
  font-style: italic;
}

.ticketing-designer-tile__label {
  font-style: normal;
  font-weight: 650;
}

.ticketing-designer-tile__note {
  margin: 0;
}

.ticketing-designer-tile__checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticketing-designer-tile__check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-inline-size: 0;
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2);
  border-radius: 999px;
  background: var(--tone-good-bg);
  color: var(--tone-good-fg);
  border: 1px solid var(--tone-good-line);
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ticketing-designer-tile__check[data-passed="false"] {
  background: var(--tone-bad-bg);
  color: var(--tone-bad-fg);
  border-color: var(--tone-bad-line);
}

.ticketing-designer-tile__mark {
  flex: none;
  inline-size: 0.875rem;
  block-size: 0.875rem;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ticketing-designer-tile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.ticketing-designer-tile__actions form {
  margin: 0;
}

/* The ticket. Its proportions and zones are the component's custom properties, given inline from the stock; these are what a ticket with none shows. */
.ticketing-designer-ticket {
  --ticketing-designer-ticket-ratio: 1650 / 600;
  --ticketing-designer-ticket-printed: 100%;
  --ticketing-designer-ticket-stub: 100%;
  --ticketing-designer-ticket-window-x: 0%;
  --ticketing-designer-ticket-window-y: 0%;
  --ticketing-designer-ticket-window-w: 0%;
  --ticketing-designer-ticket-window-h: 0%;

  inline-size: 100%;
  min-inline-size: 0;
}

.ticketing-designer-ticket__paper {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ticketing-designer-ticket-ratio);
  inline-size: 100%;
  background: var(--plan-paper);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lift);
}

.ticketing-designer-ticket:not([data-state="ready"]) .ticketing-designer-ticket__paper {
  background: var(--surface-raised);
  border: 1px dashed var(--control-line);
  box-shadow: none;
}

.ticketing-designer-ticket:not([data-state="ready"]) .ticketing-designer-ticket__stock {
  display: none;
}

.ticketing-designer-ticket__stock,
.ticketing-designer-ticket__picture {
  position: absolute;
  inset: 0;
}

.ticketing-designer-ticket__stub {
  position: absolute;
  inset-block: 0;
  inset-inline-start: var(--ticketing-designer-ticket-stub);
  inset-inline-end: 0;
  background: var(--color-gray-300);
}

.ticketing-designer-ticket__window {
  position: absolute;
  inset-inline-start: var(--ticketing-designer-ticket-window-x);
  inset-block-start: var(--ticketing-designer-ticket-window-y);
  inline-size: var(--ticketing-designer-ticket-window-w);
  block-size: var(--ticketing-designer-ticket-window-h);
  background: var(--plan-paper);
  border-radius: var(--radius-lg);
}

.ticketing-designer-ticket__picture {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  mix-blend-mode: multiply;
}

.ticketing-designer-ticket__picture--long {
  display: none;
}

.ticketing-designer-ticket__words,
.ticketing-designer-ticket__busy {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ticketing-designer-ticket__words {
  position: absolute;
  inset: 0;
  justify-content: center;
  padding: var(--space-3);
  color: var(--fg2);
  text-align: center;
}

.ticketing-designer-ticket[data-state="failed"] .ticketing-designer-ticket__words {
  color: var(--tone-bad-fg);
}

.ticketing-designer-ticket__busy {
  position: absolute;
  inset-block-end: var(--space-2);
  inset-inline-start: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--fg1);
  box-shadow: var(--shadow-soft);
}

.ticketing-designer-ticket__spinner {
  flex: none;
  inline-size: 0.875rem;
  block-size: 0.875rem;
  border: 2px solid var(--accent-line);
  border-block-start-color: var(--accent);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .ticketing-designer-ticket__spinner {
    animation: ticketing-designer-turn 0.8s linear infinite;
  }
}

@media (forced-colors: active) {
  .ticketing-designer-ticket__paper {
    border: 1px solid CanvasText;
  }
}
