/*
  Printed surfaces are game pieces, not pictures to keep: a hold on one must not raise the
  browser's save-this-image callout or select the text printed on it. WebKit is told here;
  the engines that answer a hold with a context menu are told where the surface is built.
*/
.card-face-host,
.oche-card-back,
.packaging-art,
.card-viewer-trigger {
  user-select: none;
  -webkit-touch-callout: none;
  /* Android washes whatever was pressed in its own colour and holds it there for the length of
     the press, which on a card is the card. */
  -webkit-tap-highlight-color: transparent;
}

.card-face-host {
  display: inline-block;
  flex: 0 0 auto;
  width: max-content;
  height: max-content;
  line-height: 1;
  vertical-align: top;
}

.card-face--tiny {
  --blokemon-card-scale: 0.055;
}

.card-face--bench {
  --blokemon-card-scale: 0.13;
}

.card-face--hand {
  --blokemon-card-scale: 0.23;
}

.card-face--battle {
  --blokemon-card-scale: 0.26;
}

.card-face--catalogue {
  --blokemon-card-scale: 0.21;

  @media (max-width: 720px) {
    --blokemon-card-scale: 0.18;
  }
}

.card-face--leader {
  --blokemon-card-scale: 0.24;
}

.card-face--preview {
  --blokemon-card-scale: 0.43;
}

.card-face--showcase {
  --blokemon-card-scale: 0.5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;

  @media (max-width: 720px) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 12px;
  }
}

.card-tile {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
}

.card-tile > b,
.card-tile > span:not(.qty):not(.card-viewer-trigger) {
  width: 100%;
}

.card-tile > b {
  margin-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tile > span:not(.qty):not(.card-viewer-trigger) {
  color: var(--muted);
  font-size: 13px;
}

.card-viewer-trigger {
  min-width: 0;
  display: inline-block;
  border-radius: 13px;
}

.card-viewer-trigger > .card-press-surface {
  padding: 0;
  border: 0;
  border-radius: 13px;
  color: inherit;
  background: transparent;
}

.card-viewer-trigger:has(> .card-press-surface:focus-visible) {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}

/* Keeps the printed aspect ratio and fills the viewport less a 20px margin. */
.card-viewer {
  position: fixed;
  z-index: 600;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  /*
    No blur behind this one. The scrim already keeps 86% of the light off the page, and animated
    cards underneath it must not make the browser re-blur the whole screen while a card is read.
  */
  background: rgb(2 3 2 / 86%);
  animation: fade-in 0.16s ease-out both;
}

/* The viewer lays its illustration out at its own size, so the browser fetches the file that size
   needs rather than enlarging the one the small face was given. */
.card-viewer .card-face-host {
  --blokemon-card-scale: var(--viewer-scale, 0.5);
  filter: drop-shadow(0 12px 22px #000c);
  animation: viewer-in 0.2s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.qty,
.count-pill {
  position: absolute;
  z-index: 5;
  border: 1px solid #5a543e;
  border-radius: 100px;
  color: var(--ink);
  background: rgb(9 11 8 / 92%);
  font-size: 11px;
  font-weight: 700;
}

.qty {
  top: 7px;
  right: 7px;
  padding: 5px 8px;
}
