/* ─ Album Row Container ─ */
.album-row-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
}

.album-row-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.album-row-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.album-row-nav .nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.album-row-nav .nav-btn:hover:not(.disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.album-row-nav .nav-btn.disabled {
  opacity: 0.3;
  cursor: default;
}

.album-grid-wrapper {
  position: relative;
}

.album-grid {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
  scroll-snap-type: none;
  scroll-behavior: smooth;
  /* Hide scrollbar for Webkit */
  -webkit-overflow-scrolling: touch;
}

.album-grid::-webkit-scrollbar {
  display: none;
}

.album-grid {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.album-grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.album-grid-wrap .album-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 220px;
}

/* Same wrap as Albums grid; defer layout/paint for off-screen artist tiles (helps scroll on WebKit/Linux). */
.album-grid-wrap > .artist-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 220px;
}

/* Text search / plain grid: no deferred paint — stale scroll + content-visibility blanks tiles. */
.album-grid-wrap--plain > .artist-card {
  content-visibility: visible;
  contain-intrinsic-size: auto;
}


@media (min-width: 1024px) {
  .album-grid-wrap {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.album-grid .album-card,
.album-grid .artist-card {
  flex: 0 0 clamp(140px, 15vw, 180px);
}

/* Horizontal rails (Home Discover, etc.): WebKitGTK + scroll — no content-visibility:auto,
   no .card transition, hover pinned to cover, dim via overlay background not opacity. */
.album-grid .album-card {
  contain: none;
  transition: none;
}

.album-grid .album-card:hover {
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

/* Dim below badges/play controls (all horizontal rails: Home, Favorites, Statistics, …). */
.album-grid .album-card-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: transparent;
}

.album-grid .album-card-cover:hover::before,
.album-grid .album-card-cover:focus-within::before {
  background: rgba(0, 0, 0, 0.4);
}

.album-grid .album-card .album-card-play-overlay {
  z-index: 4;
  transform: translateZ(0);
  opacity: 1;
  background-color: transparent;
  transition: none;
  pointer-events: none;
}

.album-grid .album-card .album-card-details-btn {
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transition: none;
}

.album-grid .album-card-cover:hover .album-card-play-overlay,
.album-grid .album-card-cover:focus-within .album-card-play-overlay {
  background-color: transparent;
}

.album-grid .album-card-cover:hover .album-card-details-btn,
.album-grid .album-card-cover:focus-within .album-card-details-btn {
  opacity: 1;
  pointer-events: auto;
}

.album-grid .artist-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 240px;
}

.album-card-more {
  flex: 0 0 clamp(140px, 15vw, 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.album-card-more:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.album-card-cover-badges-tr {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 5;
  transform: translateZ(0);
  pointer-events: none;
}

.album-card-offline-badge {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 85%, transparent);
  color: var(--text-on-accent);
  border-radius: var(--radius-sm);
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-card-new-badge {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--text-on-accent);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.album-card-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform: translateZ(0);
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.album-card:hover .album-card-play-overlay,
.album-card:focus-within .album-card-play-overlay,
.album-card:has(.album-card-details-btn:hover) .album-card-play-overlay {
  opacity: 1;
}

.album-card-details-btn {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  pointer-events: none;
  transition: filter var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.album-card:hover .album-card-details-btn,
.album-card:focus-within .album-card-details-btn,
.because-card:hover .album-card-details-btn,
.because-card:focus-within .album-card-details-btn {
  pointer-events: auto;
}

.album-card-details-btn:hover {
  filter: brightness(1.08);
  background: var(--accent);
}

.long-press-play-btn {
  position: relative;
  overflow: hidden;
}

.long-press-play-btn__icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes long-press-slosh {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.long-press-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: currentColor;
  opacity: 0;
  transform: translateY(calc(100% + 15px));
  transition: none;
  pointer-events: none;
  z-index: 0;
}

.long-press-wave--compact {
  transform: translateY(calc(100% + 10px));
}

.long-press-wave--active {
  opacity: 0.25;
  transform: translateY(0);
  transition: transform 900ms linear;
}

.long-press-wave--compact.long-press-wave--active {
  opacity: 0.35;
}

.long-press-wave__crest {
  position: absolute;
  top: -10px;
  left: 0;
  width: 200%;
  height: 12px;
  animation: none;
}

.long-press-wave--compact .long-press-wave__crest {
  top: -6px;
  height: 8px;
}

.long-press-wave--active .long-press-wave__crest {
  animation: long-press-slosh 1.2s linear infinite;
}

.long-press-wave__fill {
  position: absolute;
  top: 2px;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: currentColor;
}


/* ── Album card selection ── */
.album-card--selectable {
  cursor: pointer;
}

.album-card--selected {
  outline: none;
}

/* Inset overlay ring — same approach as `.card:focus-visible::after` in card.css:
   outline + overflow:hidden clips on WebKitGTK/Wayland; inset box-shadow on ::after
   paints above the cover without growing the card box. */
.album-card--selected::after,
.album-card.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--accent);
  z-index: 4;
  pointer-events: none;
}

.album-card-select-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

.album-card-select-check--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

