/* The seat picker on an event's page (ticketing/tickets/_picker.html.erb, script ticketing--picker): the price legend, the seat map and its List view, "Find N
   together", the general-admission steppers, and the cart. Phone first: one column, the map square, and the cart's count, total and clock in a bar at the foot of
   the screen while the picker is in view; wider, the cart stands beside the map.

   Seats show three states, each told by shape as well as color: open is a dot in its zone's color with a ring of the text color, yours is a disk of the text
   color with a check (a mark no price uses), not available is a small faint dot; a wheelchair place is square and a companion seat a diamond. A zone's color
   is the office's own, from the data, moved until it stands out from the page (PickerView), and arrives on the element as two custom properties, one for a
   light page and one for a dark one; everything else is a token, so it reads in light and in dark.

   Tokens only and logical properties only. Nothing pinned without the safe area; no height in vh. */

.tk-picker {
  /* A zone's colors when an element names none: the markup sets both on each swatch, seat path and area. */
  --tk-zone-light: var(--fg2);
  --tk-zone-dark: var(--fg2);

  display: grid;
  gap: var(--space-4);
  margin-block: var(--space-5);
}

.tk-picker__heading {
  margin: 0;
}

.tk-picker__subheading {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--fg1);
}

.tk-picker__note {
  margin: 0;
  color: var(--fg2);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.tk-picker__whole {
  margin: 0;
  color: var(--fg1);
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ── The legend ─────────────────────────────────────────────────────────── */
.tk-picker__legend {
  display: grid;
  gap: var(--space-2);
}

.tk-picker__zones,
.tk-picker__key {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tk-picker__zone,
.tk-picker__key li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.tk-picker__zone-name {
  font-weight: 600;
}

.tk-picker__zone-price {
  color: var(--fg2);
}

.tk-picker__swatch {
  flex: none;
  inline-size: 1.25rem;
  block-size: 1.25rem;
}

.tk-picker__swatches {
  display: inline-flex;
  flex: none;
  gap: 0.125rem;
}

/* A general-admission area's swatch: the map's shaded box, small. */
.tk-picker__swatch-area {
  fill: var(--tk-zone-light);
  fill-opacity: 0.55;
  stroke: var(--rule-strong);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/* ── Views, floors and the stage ────────────────────────────────────────── */
.tk-picker__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.tk-picker__switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.tk-picker__switch--level {
  align-items: center;
  padding-inline-start: var(--space-4);
  border-inline-start: 1px solid var(--rule);
}

.tk-picker__switch-label {
  margin-inline-end: var(--space-1);
  color: var(--fg2);
  font-size: 0.875rem;
  font-weight: 650;
}

.tk-picker__switch [aria-pressed="true"] {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-fg);
  --btn-border: var(--accent);
}

.tk-picker__map {
  display: grid;
  gap: var(--space-2);
}

.tk-picker__stage {
  position: relative;
  inline-size: 100%;
  aspect-ratio: 1 / 1;
  max-block-size: 72dvh;
}

.tk-picker__svg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  /* The page keeps a finger: one finger scrolls it, and the picker's own handler takes two (it cancels the page's move only then). */
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.tk-picker__svg [hidden] {
  display: none;
}

.tk-picker__surface {
  fill: var(--surface-tint);
  stroke: var(--rule-strong);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

.tk-picker__section {
  fill: var(--surface);
  stroke: var(--rule-strong);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

/* A general-admission area is shaded in its price's color: a tap on it goes to its card. */
.tk-picker__section--general {
  fill: var(--tk-zone-light);
  fill-opacity: 0.55;
}

.tk-picker__section--closed {
  fill: var(--st-ineligible);
  cursor: default;
}

.tk-picker__section:focus {
  outline: none;
}

.tk-picker__section:focus-visible {
  stroke: var(--focus);
  stroke-width: 3px;
}

/* A ring on a shape in the map would be drawn in the plan's meters, a band as wide as an aisle up close and a hair across a stadium: the map's own frame
   takes the ring while the keyboard is on a section or a seat in it, as a field's frame does, and the section's stroke or the seat's circle says which. */
.tk-picker__svg:has(:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.tk-picker__labels text {
  fill: var(--fg1);
  font-family: var(--font-sans);
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* Close enough to pick seats, the section names step back so the seats lead; a name too small to read is not drawn. */
.tk-picker__svg--near .tk-picker__labels text {
  fill-opacity: 0.35;
}

.tk-picker__svg .tk-picker__label--small {
  display: none;
}

.tk-picker__surface-label {
  fill: var(--fg2);
  font-family: var(--font-sans);
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.tk-picker__seats path {
  stroke-linecap: round;
}

.tk-picker__seats .tk-seat-square,
.tk-picker__swatch .tk-seat-square {
  stroke-linecap: square;
}

/* The map and the legend draw a seat the same way: the legend's swatch is a seat at the map's own size, in a box 0.8 m across. */
.tk-seat-halo { fill: none; stroke: var(--fg1); stroke-width: 0.46; stroke-linecap: round; }
.tk-seat-open { fill: none; stroke: var(--tk-zone-light); stroke-width: 0.34; stroke-linecap: round; }
.tk-seat-companion { fill: var(--tk-zone-light); stroke: var(--fg1); stroke-width: 0.06; stroke-linejoin: round; }
.tk-seat-mine { fill: none; stroke: var(--fg1); stroke-width: 0.5; stroke-linecap: round; }
.tk-seat-check { fill: none; stroke: var(--surface); stroke-width: 0.075; stroke-linecap: round; stroke-linejoin: round; }
.tk-seat-taken { fill: none; stroke: var(--st-held-other); stroke-width: 0.2; stroke-linecap: round; }

/* A dark page takes each zone's dark color (lifted until it stands out from the dark surface); a browser without light-dark() keeps the light one. */
@supports (color: light-dark(currentcolor, currentcolor)) {
  .tk-seat-open { stroke: light-dark(var(--tk-zone-light), var(--tk-zone-dark)); }
  .tk-seat-companion,
  .tk-picker__section--general,
  .tk-picker__swatch-area { fill: light-dark(var(--tk-zone-light), var(--tk-zone-dark)); }
}

.tk-seat-suggested {
  fill: none;
  stroke: var(--focus);
  stroke-width: 0.12;
}

.tk-seat-released {
  fill: none;
  stroke: var(--st-attention);
  stroke-width: 0.09;
  stroke-dasharray: 0.14 0.09;
}

.tk-picker__focus {
  pointer-events: none;
  fill: none;
  stroke: var(--focus);
  stroke-width: 0.14;
  outline: none;
}

/* Under the map, never over it. */
.tk-picker__zoom {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-1);
}

/* ── The List view ──────────────────────────────────────────────────────── */
.tk-picker__list {
  display: grid;
  gap: var(--space-2);
}

.tk-picker__group {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.tk-picker__tier {
  display: grid;
  gap: var(--space-2);
}

.tk-picker__tier-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: var(--space-2) 0 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.tk-picker__tier-price {
  color: var(--fg2);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
}

.tk-picker__group summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  min-block-size: var(--target-min);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  overflow-wrap: anywhere;
}

/* A chevron says the section opens: across while it is closed, down while it is open. */
.tk-picker__group summary::after {
  content: "";
  flex: none;
  align-self: center;
  inline-size: 0.5rem;
  block-size: 0.5rem;
  margin-inline-start: auto;
  border-block-end: 2px solid var(--fg2);
  border-inline-end: 2px solid var(--fg2);
  transform: rotate(-45deg);
}

.tk-picker__group[open] > summary::after {
  transform: rotate(45deg);
}

.tk-picker__group-name {
  font-weight: 650;
}

.tk-picker__group-meta {
  color: var(--fg2);
  font-size: 0.875rem;
}

.tk-picker__rows {
  display: grid;
  gap: var(--space-2);
  padding: 0 var(--space-3) var(--space-3);
}

/* A row's name in one column and its seats wrapping in the other, so a second line of seats still reads as the same row. */
.tk-picker__row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: start;
  gap: var(--space-2);
}

.tk-picker__row-name {
  padding-block-start: var(--space-3);
  color: var(--fg2);
  font-size: 0.875rem;
}

.tk-picker__row-seats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-inline-size: 0;
}

.tk-picker__seat-button {
  position: relative;
  min-inline-size: var(--target-min);
  min-block-size: var(--target-min);
  padding: 0 var(--space-1);
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg1);
  font: inherit;
  cursor: pointer;
}

.tk-picker__seat-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--surface);
}

/* A wheelchair place and a companion seat wear the map's shapes, a square and a diamond, in a corner. */
.tk-picker__seat-button[data-access]::after {
  content: "";
  position: absolute;
  inset-block-start: 0.25rem;
  inset-inline-end: 0.25rem;
  inline-size: 0.5rem;
  block-size: 0.5rem;
  background: currentcolor;
}

.tk-picker__seat-button[data-access="c"]::after {
  inset-block-start: 0.375rem;
  inset-inline-end: 0.375rem;
  inline-size: 0.4375rem;
  block-size: 0.4375rem;
  transform: rotate(45deg);
}

.tk-picker__seat-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ── Seats together and general admission ──────────────────────────────── */
.tk-picker__together,
.tk-picker__general {
  display: grid;
  gap: var(--space-2);
}

.tk-picker__together {
  grid-template-columns: minmax(0, 1fr);
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.tk-picker__stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.tk-picker__count {
  min-inline-size: 2ch;
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
}

.tk-picker__suggestions {
  display: grid;
  gap: var(--space-2);
}

.tk-picker__suggestion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.tk-picker__suggestion-words {
  flex: 1 1 14rem;
  margin: 0;
  overflow-wrap: anywhere;
}

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

.tk-picker__area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.tk-picker__area-words {
  display: grid;
  flex: 1 1 12rem;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.tk-picker__area-name {
  font-weight: 650;
}

.tk-picker__area-meta,
.tk-picker__area-left {
  color: var(--fg2);
  font-size: 0.875rem;
}

/* ── The cart ───────────────────────────────────────────────────────────── */
.tk-picker__cart {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.tk-picker__cart:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.tk-picker__clock {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tk-picker__clock--low {
  color: var(--tone-bad-fg);
}

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

.tk-picker__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.tk-picker__line-price {
  font-variant-numeric: tabular-nums;
}

.tk-picker__total {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0;
  padding-block-start: var(--space-2);
  border-block-start: 1px solid var(--rule);
}

.tk-picker__checkout {
  inline-size: 100%;
  white-space: normal;
}

.tk-picker__expired {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--tone-warn-line);
  border-radius: var(--radius-md);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
}

.tk-picker__expired .tk-picker__note {
  color: var(--tone-warn-fg);
}

.tk-picker__expired-heading {
  margin: 0;
  font-weight: 700;
}

.tk-picker__expired-lines {
  margin: 0;
  padding-inline-start: var(--space-4);
  text-decoration: line-through;
}

/* The phone's bar: the cart's count, total and clock at the foot of the screen while the picker is in view. */
.tk-picker__bar {
  position: sticky;
  inset-block-end: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-inline: calc(-1 * var(--space-2));
  padding: var(--space-2) var(--space-3);
  padding-block-end: max(var(--space-2), var(--safe-bottom));
  border-block-start: 1px solid var(--rule);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lift);
}

.tk-picker__bar[hidden] {
  display: none;
}

.tk-picker__bar-count {
  font-weight: 700;
}

.tk-picker__bar-clock {
  font-variant-numeric: tabular-nums;
}

.tk-picker__bar .btn {
  margin-inline-start: auto;
}

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

.tk-picker__main {
  display: grid;
  gap: var(--space-4);
  min-inline-size: 0;
}

@media (min-width: 960px) {
  .tk-picker__layout {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    align-items: start;
  }

  .tk-picker__stage {
    aspect-ratio: 4 / 3;
  }

  .tk-picker__cart {
    position: sticky;
    inset-block-start: max(var(--space-4), var(--safe-top));
  }

  .tk-picker__bar,
  .tk-picker__bar[hidden] {
    display: none;
  }
}

@media (hover: none) {
  .tk-picker__keys {
    display: none;
  }
}

/* A zone's prices by kind of buyer, the buyer's own first and marked in words. */
.tk-picker__zone {
  align-items: flex-start;
}

.tk-picker__zone-words {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}

.tk-picker__zone-name {
  margin: 0;
  font-size: 1rem;
}

.tk-picker__prices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin: 0;
}

.tk-picker__price {
  display: inline-flex;
  gap: var(--space-1);
}

.tk-picker__price dt {
  color: var(--fg2);
}

.tk-picker__price dd {
  margin: 0;
  font-weight: 650;
}

.tk-picker__mine {
  margin-inline-start: var(--space-1);
  color: var(--accent-text);
  font-weight: 650;
}
