/* Reusable pieces: buttons, artwork, cards, rows, meters, chips, badges. */

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 32px;
  border-radius: var(--r-pill);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform var(--dur-2) var(--ease), background var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}

.btn svg {
  width: 20px;
  height: 20px;
  fill: currentcolor;
}

.btn:hover {
  transform: scale(1.04);
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  color: var(--on-green);
  background: var(--green);
}

.btn-primary:hover {
  background: var(--green-bright);
}

.btn-ghost {
  min-height: 40px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.875rem;
}

.btn-ghost:hover {
  border-color: var(--text);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--subdued);
  transition: transform var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentcolor;
}

.icon-button:hover {
  color: var(--text);
  transform: scale(1.06);
}

.play-fab {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--on-green);
  background: var(--green);
  box-shadow: var(--shadow-fab);
  transition: transform var(--dur-2) var(--ease), background var(--dur-2) var(--ease),
    opacity var(--dur-2) var(--ease);
}

.play-fab svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
  fill: currentcolor;
}

.play-fab:hover {
  background: var(--green-bright);
  transform: scale(1.06);
}

/* ---------- Artwork ---------- */

.cover {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--elevated-hover);
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-fallback {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  color: var(--quiet);
  background: linear-gradient(135deg, #2a2a2a, #101010);
  font-size: 1.25rem;
}

.cover-lg {
  border-radius: var(--r-md);
  box-shadow: var(--shadow-cover);
}

.avatar,
.avatar .cover,
.avatar .cover-fallback {
  border-radius: 50%;
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--elevated);
  transition: background var(--dur-3) var(--ease);
  isolation: isolate;
}

.card:hover,
.card:focus-within {
  background: var(--elevated-hover);
}

.card-art {
  position: relative;
  margin-bottom: 8px;
}

.card-art .cover,
.card-art .cover-fallback {
  border-radius: var(--r-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.44);
}

.card-fab {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  opacity: 0;
  transform: translateY(8px);
}

.card:hover .card-fab,
.card:focus-within .card-fab,
.card-fab:focus-visible {
  opacity: 1;
  transform: none;
}

.card-title {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-meta {
  color: var(--subdued);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.panel {
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--elevated);
}

/* ---------- Section headings ---------- */

.section {
  display: grid;
  gap: 16px;
  margin-top: 36px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-head .heading {
  color: var(--text);
}

.section-link {
  color: var(--subdued);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  transition: color var(--dur-2) var(--ease);
}

.section-link:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ---------- Rows ---------- */

.rows {
  display: grid;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--row-columns, 28px 40px minmax(0, 1fr) auto);
  gap: 16px;
  align-items: center;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: background var(--dur-2) var(--ease);
}

.row:hover {
  background: var(--row-hover);
}

.row-index {
  display: grid;
  place-items: center;
  color: var(--subdued);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.row-index .row-play {
  display: none;
  width: 14px;
  height: 14px;
  fill: var(--text);
}

.row:hover .row-index .row-number,
.row:focus-within .row-index .row-number {
  display: none;
}

.row:hover .row-index .row-play,
.row:focus-within .row-index .row-play {
  display: block;
}

.row-art .cover,
.row-art .cover-fallback {
  width: 40px;
  height: 40px;
}

.row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.row-title {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
}

.row:hover .row-title {
  text-decoration: underline;
}

.row-sub {
  color: var(--subdued);
  font-size: 0.8125rem;
}

.row-sub a {
  position: relative;
  z-index: 2;
}

.row-sub a:hover {
  color: var(--text);
  text-decoration: underline;
}

.row-value {
  color: var(--subdued);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.row-value strong {
  display: block;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 700;
}

.row-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.rank {
  color: var(--quiet);
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rank-1,
.rank-2,
.rank-3 {
  color: var(--green);
}

/* ---------- Meters, chips, badges ---------- */

.meter {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.09);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), rgba(30, 215, 96, 0.35));
  transform-origin: left center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--subdued);
  font-size: 0.75rem;
  font-weight: 700;
}

.chip-green {
  border-color: transparent;
  color: var(--on-green);
  background: var(--green);
}

.dot-sep::before {
  content: "•";
  margin: 0 6px;
  color: var(--quiet);
}

.empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--subdued);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.875rem;
  text-align: center;
}

/* ---------- Equalizer ---------- */

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 14px;
  height: 13px;
}

.eq-bars span {
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--green);
  transform-origin: bottom center;
  animation: eq-bounce 900ms var(--ease-emph) infinite alternate;
}

.eq-bars span:nth-child(1) {
  animation-delay: -600ms;
}

.eq-bars span:nth-child(2) {
  animation-delay: -300ms;
}

.eq-bars span:nth-child(3) {
  animation-delay: -900ms;
}

.eq-bars span:nth-child(4) {
  animation-delay: -150ms;
}

@keyframes eq-bounce {
  from {
    transform: scaleY(0.22);
  }

  to {
    transform: scaleY(1);
  }
}
