/* The case cards on the Cases list: the art is the card (no box), with a name, a chip and a footer.
   Every card in a row has the same slots, so the rows stay even. */

.case-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-grid > li {
  display: flex;
  min-width: 0;
}

@media (max-width: 1199px) {
  .case-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 20px;
    row-gap: 28px;
  }
}

@media (max-width: 1023px) {
  .case-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 24px;
  }
}

@media (max-width: 760px) {
  .case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 20px;
  }
}

.case-card {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  text-align: center;
  isolation: isolate;
}

/* The kind and the name at the top, the art under them, the Open button at the bottom */
.case-card-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}

.case-card-link:focus-visible {
  outline: 2px solid var(--ember-light);
  outline-offset: 4px;
}

.case-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 3.4em;
  justify-content: flex-start;
  margin-bottom: var(--sp-2);
}

.case-card-kind {
  color: var(--tier, var(--ember));
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.case-card-title {
  overflow: hidden;
  max-width: 100%;
  color: var(--white-hot);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The closed chest. The art is cut out of its square; the tier glow behind it is its only light, so it casts no shadow */
.case-art-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.case-art-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.15);
  transform-origin: 50% 60%;
  transition: transform 220ms var(--ease-out), filter 220ms var(--ease-out);
}

/* The tier glow behind the chest and the tier line under the card are the only decoration */
.case-card::before {
  content: "";
  position: absolute;
  inset: 8% 6% 30%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tier, var(--ember)) 38%, transparent), transparent 72%);
  opacity: 0.55;
  transition: opacity 220ms var(--ease-out);
}

.case-card::after {
  content: "";
  position: absolute;
  right: 20%;
  bottom: 0;
  left: 20%;
  height: 2px;
  border-radius: 2px;
  background: var(--tier, var(--ember));
  transform: scaleX(0);
  transition: transform 220ms var(--ease-out);
}

.case-card:not(.is-unavailable):hover .case-art-wrap img,
.case-card:not(.is-unavailable):focus-within .case-art-wrap img {
  transform: scale(1.21) translateY(-6px);
  filter: brightness(1.08);
}

.case-card:not(.is-unavailable):hover::before,
.case-card:not(.is-unavailable):focus-within::before {
  opacity: 1;
}

.case-card:not(.is-unavailable):hover::after,
.case-card:not(.is-unavailable):focus-within::after {
  transform: scaleX(1);
}

.case-card:not(.is-unavailable):active .case-art-wrap img {
  transform: scale(1.16);
  transition-duration: 80ms;
}

/* The footer under the art: the same height on every card */
.case-card-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 84px;
  margin-top: var(--sp-3);
}

.case-card-price {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  color: var(--ember-light);
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.case-card-price .coin {
  width: 20px;
  height: 20px;
}

.case-card-foot-note {
  color: var(--ash);
  font-size: var(--text-xs);
}

.case-card-button {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Narrower than the shared big button (base.css min-width), so it fits its card and never runs into the next */
  min-width: 0;
  max-width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: var(--text-sm);
  white-space: nowrap;
}

/* The whole card is the way in, so pointing at it lights its button's edge */
.case-card:not(.is-unavailable):hover .case-card-button:not(.is-disabled) {
  background: var(--surface-hover);
  border-color: var(--ember);
}

.case-card-button.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.case-card.is-unavailable .case-art-wrap img,
.case-card.is-unavailable .case-card-title {
  opacity: 0.45;
  filter: grayscale(0.8);
}

/* Loading: empty shapes in the places of the cards */
.case-card-skeleton {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
}

.case-skeleton {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.02) 30%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.02) 70%);
  background-size: 200% 100%;
  animation: case-shimmer 1.4s linear infinite;
}

.case-skeleton-art {
  aspect-ratio: 1 / 1;
}

.case-skeleton-line {
  height: 14px;
  width: 70%;
}

@keyframes case-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
