/* Recently Viewed Songs — theme v4.2.0
 * Personal history rail. Matches the existing card language (radius, border,
 * shadow, hover lift) and reserves its own space, so hydration never shifts
 * layout: the section is `hidden` until it actually has cards.
 * ------------------------------------------------------------------ */

.tgl-rv {
  margin: 34px auto 40px;
}

.tgl-rv[hidden] {
  display: none !important;
}

.tgl-rv__head {
  margin-bottom: 16px;
}

.tgl-rv__title {
  font-family: "Poppins", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.15rem, 3.6vw, 1.5rem);
  line-height: 1.25;
  margin: 0;
  color: var(--tgl-ink, #23180f);
}

.tgl-rv__subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--tgl-muted, #6b6257);
}

/* Mobile-first: 2 columns. */
.tgl-rv__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tgl-rv-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--tgl-line, #ecdfd0);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
  .tgl-rv-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px -16px rgba(40, 25, 10, 0.35);
    border-color: var(--tgl-accent, #e8843a);
  }
}

.tgl-rv-card:focus-within {
  border-color: var(--tgl-accent, #e8843a);
  box-shadow: 0 0 0 3px rgba(232, 132, 58, 0.28);
}

.tgl-rv-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  background: #f4ece3;
  overflow: hidden;
}

.tgl-rv-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tgl-rv-card__img--empty {
  background: linear-gradient(135deg, #f6ece1, #efe1d1);
}

.tgl-rv-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 13px 14px;
  flex: 1;
}

.tgl-rv-card__title {
  margin: 0;
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.tgl-rv-card__title a {
  color: var(--tgl-ink, #23180f);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tgl-rv-card__title a:hover,
.tgl-rv-card__title a:focus-visible {
  color: var(--tgl-accent, #e8843a);
}

.tgl-rv-card__singer {
  margin: 0;
  font-size: 0.8rem;
  color: var(--tgl-muted, #6b6257);
}

.tgl-rv-card__cat {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fdf1e5;
  color: #a4531a;
  text-decoration: none;
}

.tgl-rv-card__cat:hover,
.tgl-rv-card__cat:focus-visible {
  background: #f8e0c9;
}

.tgl-rv-card__btn {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--tgl-accent, #e8843a), #d86f24);
}

.tgl-rv-card__btn:hover,
.tgl-rv-card__btn:focus-visible {
  filter: brightness(1.05);
  color: #fff;
}

/* Per-breakpoint visible counts (Customizer-driven caps enforced below). */
.tgl-rv__grid > *:nth-child(n + 5) {
  display: none;
}

@media (min-width: 640px) {
  .tgl-rv__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
  .tgl-rv__grid > *:nth-child(n + 5) {
    display: flex;
  }
  .tgl-rv__grid > *:nth-child(n + 7) {
    display: none;
  }
}

@media (min-width: 1024px) {
  .tgl-rv__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }
  .tgl-rv__grid > *:nth-child(n + 7) {
    display: flex;
  }
  .tgl-rv__grid > *:nth-child(n + 9) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tgl-rv-card {
    transition: none;
  }
  .tgl-rv-card:hover {
    transform: none;
  }
}
