.title-card-preview-art {
  container-type: size;
  isolation: isolate;
}

.title-card-preview-art .title-card-preview-image {
  transition: scale .35s ease, filter .3s ease;
}

.has-title-preview:is([data-preview-hover], [data-preview-open], :has(:focus-visible)) .title-card-preview-image {
  scale: 1.055;
}

.title-card-preview {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, rgb(0 0 0 / .22), rgb(0 0 0 / .42) 52%, rgb(0 0 0 / .76));
  color: #fff;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease, visibility 0s linear .24s;
}

.title-card-preview::before {
  position: absolute;
  inset: 0;
  content: '';
  background:
    radial-gradient(ellipse at 10% 86%, rgb(0 0 0 / .68) 1%, transparent 64%),
    radial-gradient(ellipse at 92% 44%, rgb(0 0 0 / .60) 5%, transparent 64%),
    radial-gradient(ellipse at 43% 68%, rgb(0 0 0 / .36) 15%, transparent 72%);
  translate: 0 7%;
  transition: translate .5s ease-out;
}

.has-title-preview:is([data-preview-hover], [data-preview-open], :has(:focus-visible)) .title-card-preview {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.has-title-preview:is([data-preview-hover], [data-preview-open], :has(:focus-visible)) .title-card-preview::before {
  translate: 0 0;
}

.title-card-preview-content {
  position: relative;
  display: grid;
  justify-items: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px clamp(7px, 6cqw, 17px);
  gap: clamp(3px, 2.2cqh, 8px);
  text-align: center;
  text-shadow: 0 2px 6px #000;
}

.title-card-preview .title-card-preview-play {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: clamp(28px, 14.5cqh, 42px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  color: #0b0b0d;
  text-decoration: none;
}

.title-card-preview .title-card-preview-play::before {
  content: '';
  width: 33%;
  height: 33%;
  margin-inline-start: 8%;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.title-card-preview .title-card-preview-play::after {
  position: absolute;
  inset: -5px;
  content: '';
}

.has-title-preview:is([data-preview-hover], [data-preview-open], :has(:focus-visible)) .title-card-preview-play {
  pointer-events: auto;
}

.title-card-preview .title-card-preview-play:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.title-card-preview-name {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: clamp(11px, 5.4cqh, 15px);
  font-weight: 700;
  overflow-wrap: anywhere;
  line-height: 1.14;
}

.title-card-preview-meta,
.title-card-preview-score {
  font-size: clamp(9px, 4.4cqh, 11px);
  line-height: 1.25;
  white-space: nowrap;
}

.title-card-preview-meta { color: #ddd; }

.title-card-preview-score {
  position: absolute;
  z-index: 1;
  inset: 6px auto auto 6px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgb(0 0 0 / .77);
  color: #edb3ff;
  font-weight: 700;
}

@container (max-height: 125px) {
  .title-card-preview-score { display: none; }
}

@container (max-height: 80px) {
  .title-card-preview-content { padding-block: 2px; }
  .title-card-preview-name { -webkit-line-clamp: 1; }
}

/* Leave room for Play when there isn't space to repeat the card's details. */
@container (max-height: 62px) {
  .title-card-preview-name,
  .title-card-preview-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .has-title-preview .title-card-preview-art .title-card-preview-image { scale: none; }
  .title-card-preview,
  .title-card-preview::before { transition: none; }
}
