/*
 * The unit cards of the three phone layouts being play tested
 * (docs/plans/19-phone-layouts.md). A has cards with the unit's name written
 * out; B and C have a picture, a price and a count. Where the cards sit comes
 * from the layout's own file.
 */

:root[data-kit='on'][data-phone][data-orient] .deck__list {
  top: var(--dk-t, auto);
  right: var(--dk-r, auto);
  bottom: var(--dk-b, 0);
  left: var(--dk-l, 0);
  grid-template-columns: var(--dk-cols);
  grid-template-rows: var(--dk-rows);
  gap: var(--gap);
  width: var(--dk-w, auto);
  height: auto;
  padding: 0;
  background: none;
  border: 0;
}

:root[data-kit='on'][data-phone][data-orient] .card {
  min-width: 0;
  min-height: 0;
  background: var(--bg-veil);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

:root[data-kit='on'][data-phone][data-orient] .card[data-picked='true'] {
  border-color: var(--accent);
  background: var(--lit);
}

:root[data-kit='on'][data-phone][data-orient]
  .card:is([data-locked='true'], [data-locked='ready']) {
  border-style: dashed;
  background:
    repeating-linear-gradient(135deg, transparent 0 6px, rgb(255 255 255 / 0.05) 6px 12px),
    var(--bg-veil);
}

:root[data-kit='on'][data-phone][data-orient] .card[data-locked='ready'] {
  border-color: var(--warn);
}

:root[data-kit='on'][data-phone][data-orient] .card__pick {
  height: 100%;
  /* A card can be held, and in B dragged: the browser must leave the touch alone. */
  touch-action: none;
}

/* Waiting orders are cancelled in the Terminal, where a stray thumb cannot do it. */
:root[data-kit='on'][data-phone][data-orient] .card__cancel,
:root[data-kit='on'][data-phone][data-orient] .card__short {
  display: none;
}

/* A: the name on top, then the unit's shape, its price, and how many are out. */
:root[data-hud='a'][data-phone][data-orient] .card__pick {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.25rem;
  align-content: center;
  align-items: center;
  padding: 0 0.375rem;
}

:root[data-hud='a'][data-phone][data-orient] .card__name {
  position: static;
  grid-area: 1 / 1 / 2 / 4;
  width: auto;
  height: auto;
  overflow: hidden;
  clip-path: none;
  font: 600 0.75rem / 1.1 var(--font-ui);
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root[data-hud='a'][data-phone][data-orient] .card__icon {
  display: block;
  grid-area: 2 / 1;
}

:root[data-hud='a'][data-phone][data-orient] .card__cost {
  grid-area: 2 / 2;
  font-size: 0.6875rem;
  line-height: 1;
}

:root[data-hud='a'][data-phone][data-orient] .card__status {
  grid-area: 2 / 3;
  justify-content: flex-end;
  overflow: hidden;
  font-size: 0.6875rem;
  line-height: 1;
}

/* Locked: the count toward the unlock takes the whole second line. */
:root[data-hud='a'][data-phone][data-orient]
  .card:is([data-locked='true'], [data-locked='ready'])
  .card__icon,
:root[data-hud='a'][data-phone][data-orient]
  .card:is([data-locked='true'], [data-locked='ready'])
  .card__cost {
  display: none;
}

:root[data-hud='a'][data-phone][data-orient]
  .card:is([data-locked='true'], [data-locked='ready'])
  .card__status {
  grid-column: 1 / 4;
  justify-content: flex-start;
  font: 500 0.625rem / 1 var(--font-ui);
}

/* B and C: how many are out, the unit's shape, its price. */
:root:is([data-hud='b'], [data-hud='c'])[data-phone][data-orient] .card__pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  row-gap: 0;
  padding: 0.1875rem 0.125rem 0.3125rem;
}

:root:is([data-hud='b'], [data-hud='c'])[data-phone][data-orient] .card__status {
  grid-area: 1 / 1;
  justify-self: end;
  overflow: hidden;
  padding-right: 0.1875rem;
  font-size: 0.6875rem;
  line-height: 1;
}

:root:is([data-hud='b'], [data-hud='c'])[data-phone][data-orient] .card__icon {
  display: block;
  grid-area: 2 / 1;
  scale: 1.5;
}

:root:is([data-hud='b'], [data-hud='c'])[data-phone][data-orient] .card__cost {
  grid-area: 3 / 1;
  font-size: 0.6875rem;
  line-height: 1;
}

/* A locked card's count is too long for a small card; its padlock says it. */
:root:is([data-hud='b'], [data-hud='c'])[data-phone][data-orient]
  .card:is([data-locked='true'], [data-locked='ready'])
  .card__tally {
  display: none;
}
