/* Vanilla BounceCards: a fan of photo cards that bounce in and spread on hover. */

.bounce-cards {
  position: relative;
  width: 760px;
  height: 300px;
  margin: 0 auto;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.bounce-cards__card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--bounce-cards-size, 168px);
  aspect-ratio: 1;
  overflow: hidden;
  border: var(--bounce-cards-border, 3px) solid var(--bounce-cards-border-color, rgba(255, 255, 255, 0.82));
  border-radius: var(--bounce-cards-radius, 20px);
  background:
    radial-gradient(circle at 50% 35%, rgba(211, 84, 46, 0.22), transparent 60%),
    var(--surface-2);
  box-shadow: var(--bounce-cards-shadow, 0 1px 2px rgba(0, 0, 0, 0.12), 0 14px 30px -8px rgba(35, 25, 12, 0.4));
  transform: translate(-50%, -50%) scale(0);
  transition: box-shadow 0.3s ease;
  will-change: transform;
}

.bounce-cards__card[data-active] {
  box-shadow: var(--bounce-cards-shadow-active, 0 2px 4px rgba(0, 0, 0, 0.16), 0 26px 50px -12px rgba(35, 25, 12, 0.52));
}

.bounce-cards__card--clickable {
  cursor: pointer;
}

.bounce-cards__card--clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.bounce-cards__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.bounce-cards__card.is-empty img {
  display: none;
}

.bounce-cards__card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 40%, rgba(0, 0, 0, 0.72) 100%);
}

.bounce-cards__label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  overflow: hidden;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(8, 7, 6, 0.38);
  color: #fff;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

.bounce-cards__card[data-index="5"] .bounce-cards__label {
  color: #f5e4c7;
}

@media (prefers-reduced-motion: reduce) {
  .bounce-cards__card {
    transition: none;
  }
}
