.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 700px;
  font-family: system-ui, sans-serif;
  padding: 1rem;
}

.card {
  cursor: pointer;
  background: #1a1a2e;
  border-radius: 8px;
  overflow: hidden;
  color: #eee;
}

.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.card span {
  display: block;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.detail-card {
  max-width: 600px;
  background: #1a1a2e;
  border-radius: 8px;
  overflow: hidden;
  color: #eee;
  margin: 1rem;
  font-family: system-ui, sans-serif;
}

.detail-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.detail-card h2,
.detail-card p {
  padding: 0 1rem;
}

/* ONE rule targets ALL cards by their shared class */
/* The asterisk (*) is a wildcard - matches any name with class "card" */
::view-transition-group(*.card) {
  animation-duration: 0.4s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fix the taffy problem for ALL cards at once */
::view-transition-old(*.card),
::view-transition-new(*.card) {
  object-fit: cover;
  overflow: hidden;
}