/* Paper tickets (ticketing/paper/_ticket.html.erb): the window's Sold page, a holder's print sheet (ticketing/prints) and will call (ticketing/office/will_call),
   and the links of a ticket on the order page and on My tickets. On screen a paper ticket is a card in the page's own tokens; printed, it is black on white, one
   to a page, and nothing else of the page prints. The code is always dark on a light box, in both modes, so a scanner reads it from the screen too. */

.tk-paper {
  display: grid;
  gap: var(--space-3);
  overflow-wrap: anywhere;
}

.tk-paper p {
  margin: 0;
}

.tk-paper__issuer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding-block-end: var(--space-2);
  border-block-end: 1px solid var(--rule-strong);
  font-size: var(--text-sm);
}

.tk-paper__mark {
  max-block-size: 2rem;
  max-inline-size: 8rem;
  inline-size: auto;
}

.tk-paper__institution {
  font-weight: 700;
}

.tk-paper__body {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: var(--space-3) var(--space-5);
}

.tk-paper__facts {
  display: grid;
  flex: 1 1 14rem;
  gap: var(--space-1);
}

.tk-paper__event {
  font-size: var(--text-lg);
  font-weight: 700;
}

.tk-paper__gate {
  font-weight: 700;
}

.tk-paper__place {
  margin-block: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
}

.tk-paper__number {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.tk-paper__scan {
  display: grid;
  flex: 0 1 11rem;
  gap: var(--space-2);
  justify-items: center;
  text-align: center;
}

.tk-paper__code {
  display: grid;
  place-items: center;
  inline-size: min(100%, 11rem);
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--plan-paper);
  color: var(--color-ink);
}

.tk-paper__code svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  fill: var(--color-ink);
}

.tk-paper__code p {
  padding: var(--space-2);
  font-size: var(--text-sm);
}

/* The words a code box holds until its code is drawn: out of sight for the few seconds a drawing may take, then shown, so a code that never draws says so. */
.tk-paper__no-code {
  opacity: 0;
  animation: tk-paper-late 0s linear 4s forwards;
}

.tk-paper__code[data-drawn="no"] .tk-paper__no-code {
  opacity: 1;
  animation: none;
}

@keyframes tk-paper-late {
  to {
    opacity: 1;
  }
}

.tk-paper__once {
  font-weight: 700;
}

/* "Admits once" is said of a code, so it is drawn only under one. */
.tk-paper__code:not([data-drawn="yes"]) + .tk-paper__once {
  display: none;
}

.tk-paper__blocked {
  flex: 1 1 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ---- A sheet of paper tickets, with what the page says around them ---- */

.tk-sheet {
  display: grid;
  gap: var(--space-4);
}

.tk-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.tk-sheet__print-note {
  flex: 1 1 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.tk-sheet__note {
  margin: 0;
  color: var(--fg2);
}

.tk-sheet__tickets {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tk-sheet__ticket {
  padding: var(--space-4);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* ---- The order page: what became of a ticket, its own link and Print, under its place ---- */

.tk-order-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
}

.tk-order-links__all {
  margin: 0;
}

/* ---- My tickets: a ticket's next actions, as links under its place ---- */

.tk-shelf-actions {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tk-shelf-actions a,
.tk-order-links a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-min);
}

/* ---- Print: the tickets alone, black on white, one to a page ---- */

@media print {
  body:has(.tk-sheet__tickets) * {
    visibility: hidden;
  }

  body:has(.tk-sheet__tickets) .tk-sheet__tickets,
  body:has(.tk-sheet__tickets) .tk-sheet__tickets * {
    visibility: visible;
  }

  .tk-sheet__tickets {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    display: block;
    inline-size: 100%;
  }

  .tk-sheet__ticket {
    break-after: page;
    break-inside: avoid;
    border: 1px solid;
  }

  /* Paper is white whatever mode the screen is in. */
  .tk-sheet__ticket,
  .tk-window__ticket {
    color-scheme: light;
    background: Canvas;
    color: CanvasText;
  }

  .tk-paper__code {
    inline-size: 11rem;
    background: Canvas;
  }

  .tk-paper__no-code {
    opacity: 1;
    animation: none;
  }

  .tk-paper__code svg {
    fill: CanvasText;
  }

  .tk-paper__issuer,
  .tk-paper__blocked {
    border-color: CanvasText;
  }
}
