/* ==========================================================================
   Home-Playlist-Wrapper (vollbreite Sektion mit Hintergrundbild).
   Wird auf Startseite, Termine, Shop, Projekte, Downloads etc. verwendet —
   überall dort, wo template-parts/home/section-playlist.php gerendert wird.
   ========================================================================== */

.home-playlist {
	position: relative;
	padding: var(--sp-10) 0;
	isolation: isolate;
	overflow: hidden;
	background: var(--color-bg);
}

.home-playlist__media {
	position: absolute;
	inset: 0;
	z-index: 1;
}

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

/* Parallax-Variante: das Bild wird per background-attachment: fixed
 * fixiert (funktioniert nur bei CSS-Backgrounds, nicht bei <img>). */
.home-playlist__media--parallax {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-attachment: fixed;
}

@media (max-width: 768px) {
	.home-playlist__media--parallax {
		background-attachment: scroll;
	}
}

.home-playlist__overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	background:
		radial-gradient(ellipse at center, rgba(10, 10, 10, 0.65) 0%, rgba(10, 10, 10, 0.92) 75%),
		linear-gradient(180deg, rgba(10,10,10,0.3), rgba(10,10,10,0.85));
}

.home-playlist__inner {
	position: relative;
	z-index: 3;
}

.home-playlist__header {
	margin-bottom: var(--sp-7);
}

/* Glass-morphism nur, wenn Hintergrundbild aktiv ist. */
.home-playlist--has-bg .playlist {
	background: rgba(14, 14, 14, 0.85);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-color: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Playlist / Audio Player — Spotify-inspired Dark Style
   ========================================================================== */

.playlist {
	background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 60%, #090909 100%);
	border: 1px solid rgba(200, 169, 110, 0.08);
	border-radius: 16px;
	overflow: hidden;
	max-width: 960px;
	margin: 30px auto 0;
	box-shadow:
		0 12px 48px rgba(0, 0, 0, 0.6),
		0 0 0 1px rgba(200, 169, 110, 0.04),
		inset 0 1px 0 rgba(255, 255, 255, 0.03);
	display: flex;
	flex-direction: column;
}

/* Im eigenständigen Audio-CPT-Abschnitt linksbündig (am Titel ausgerichtet),
   nicht zentriert wie im Home-Playlist-Banner. */
.tian-audio-section .playlist {
	margin-left: 0;
	margin-right: auto;
}

/* Auf der Startseite: groß, zentriert, breiter — wie die übrigen Sektionen
   (überschreibt die linksbündige Variante). */
.tian-audio-section--home .event-section__header {
	text-align: center;
}
.tian-audio-section--home .event-section__lead {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}
.tian-audio-section--home .playlist {
	max-width: 1100px;
	margin-left: auto;
	margin-right: auto;
}

/* --- Now Playing Banner ------------------------------------------------- */

.playlist__now-playing {
	display: flex;
	align-items: center;
	gap: var(--sp-5);
	padding: var(--sp-6) var(--sp-6) var(--sp-5);
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
	min-height: 100px;
	position: relative;
	overflow: hidden;
	background: #0d0d0d;
}

/* Background image — very dark */
.playlist__now-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	opacity: 0.45;
	pointer-events: none;
	filter: brightness(0.65) saturate(0.75);
}

/* Dark overlay on top of image */
.playlist__now-playing::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.5) 100%);
	pointer-events: none;
	z-index: 1;
}

/* Ensure content sits above overlay */
.playlist__now-art,
.playlist__now-info,
.playlist__now-eq {
	position: relative;
	z-index: 2;
}

.playlist__now-art {
	flex-shrink: 0;
	width: 60px;
	height: 60px;
	border-radius: 8px;
	overflow: hidden;
	background: linear-gradient(135deg, rgba(200, 169, 110, 0.15), rgba(200, 169, 110, 0.05));
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
	position: relative;
}

.playlist__now-art svg {
	width: 56px;
	height: 56px;
}

/* Custom Play-Grafik (User-Bild): füllt das Quadrat komplett, cover-cropped. */
.playlist__now-art--custom {
	background: var(--color-bg);
}

.playlist__now-icon-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.playlist__now-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.playlist__now-label {
	font-family: var(--font-sans);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--color-accent);
	font-weight: 600;
}

.playlist__now-title {
	font-family: var(--font-display);
	font-size: var(--fs-lg);
	color: var(--color-white);
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.playlist__now-artist {
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	color: var(--color-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Equalizer animation */
.playlist__now-eq {
	display: flex;
	align-items: flex-end;
	gap: 3px;
	height: 24px;
	flex-shrink: 0;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.playlist.is-playing .playlist__now-eq {
	opacity: 1;
}

.playlist__now-eq span {
	display: block;
	width: 3px;
	border-radius: 2px;
	background: var(--color-accent);
	animation: eq-idle 0.4s ease infinite alternate;
}

.playlist.is-playing .playlist__now-eq span {
	animation-name: eq-bounce;
}

.playlist__now-eq span:nth-child(1) { height: 30%; animation-duration: 0.45s; }
.playlist__now-eq span:nth-child(2) { height: 60%; animation-duration: 0.35s; animation-delay: 0.1s; }
.playlist__now-eq span:nth-child(3) { height: 40%; animation-duration: 0.5s; animation-delay: 0.05s; }
.playlist__now-eq span:nth-child(4) { height: 20%; animation-duration: 0.4s; animation-delay: 0.15s; }

@keyframes eq-bounce {
	0%   { height: 15%; }
	100% { height: 100%; }
}

@keyframes eq-idle {
	0%   { height: 15%; }
	100% { height: 25%; }
}

/* --- Search Bar --------------------------------------------------------- */

.playlist__search {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	padding: var(--sp-3) var(--sp-5);
	background: rgba(0, 0, 0, 0.2);
}

.playlist__search-icon {
	flex-shrink: 0;
	color: var(--color-text-muted);
	opacity: 0.6;
}

.playlist__search-input {
	flex: 1;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid transparent;
	border-radius: 24px;
	padding: 9px 18px;
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	color: var(--color-white);
	outline: none;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.playlist__search-input::placeholder {
	color: rgba(255, 255, 255, 0.3);
}

.playlist__search-input:focus {
	background: rgba(255, 255, 255, 0.09);
	border-color: rgba(200, 169, 110, 0.4);
	box-shadow: 0 0 0 3px rgba(200, 169, 110, 0.08);
}

.playlist__track-count {
	flex-shrink: 0;
	font-family: var(--font-sans);
	font-size: var(--fs-xs);
	color: var(--color-text-muted);
	opacity: 0.6;
}

.playlist__meta {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	padding: var(--sp-3) var(--sp-5);
	background: rgba(0, 0, 0, 0.2);
}

/* --- Scrollable Track List ---------------------------------------------- */

.playlist__scroll {
	max-height: 440px;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	scroll-behavior: smooth;
	padding: var(--sp-2) 0;
}

/* Custom Scrollbar */
.playlist__scroll::-webkit-scrollbar {
	width: 6px;
}

.playlist__scroll::-webkit-scrollbar-track {
	background: transparent;
}

.playlist__scroll::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.12);
	border-radius: 3px;
}

.playlist__scroll::-webkit-scrollbar-thumb:hover {
	background: rgba(200, 169, 110, 0.3);
}

/* Firefox scrollbar */
.playlist__scroll {
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* --- Track-Liste -------------------------------------------------------- */

.playlist__tracks {
	list-style: none;
	margin: 0;
	padding: 0;
}

.playlist__track {
	display: grid;
	grid-template-columns: 42px 1fr auto 36px;
	align-items: center;
	gap: var(--sp-4);
	padding: 15px var(--sp-5);
	margin: 3px 6px;
	background: transparent;
	border: none;
	border-radius: 8px;
	transition: background 0.2s ease, box-shadow 0.2s ease;
	cursor: pointer;
	font-family: var(--font-sans);
	position: relative;
}

.playlist__track:hover {
	background: rgba(255, 255, 255, 0.05);
}

.playlist__track.is-active {
	background: rgba(200, 169, 110, 0.08);
	box-shadow: inset 0 0 0 1px rgba(200, 169, 110, 0.06);
}

/* --- Track Number / Play Icon ------------------------------------------- */

.playlist__num {
	text-align: center;
	color: var(--color-text-muted);
	font-variant-numeric: tabular-nums;
	font-size: var(--fs-sm);
	position: relative;
	width: 42px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.playlist__num-text {
	opacity: 0.6;
}

.playlist__num-play,
.playlist__num-pause {
	display: none;
	color: var(--color-white);
}

.playlist__track:hover .playlist__num-text { display: none; }
.playlist__track:hover .playlist__num-play { display: block; }

.playlist__track.is-active .playlist__num-text { color: var(--color-accent); }

.playlist.is-playing .playlist__track.is-active .playlist__num-text { display: none; }
.playlist.is-playing .playlist__track.is-active .playlist__num-pause { display: block; }
.playlist.is-playing .playlist__track.is-active .playlist__num-pause { color: var(--color-accent); }

.playlist.is-playing .playlist__track.is-active:hover .playlist__num-pause { display: block; }
.playlist.is-playing .playlist__track.is-active:hover .playlist__num-play { display: none; }

.playlist__track.is-active:not(.playlist.is-playing .playlist__track.is-active):hover .playlist__num-play { display: block; }

/* --- Track Info --------------------------------------------------------- */

.playlist__trigger {
	background: none;
	border: none;
	text-align: left;
	padding: 0;
	cursor: pointer;
	color: inherit;
	display: flex;
	flex-direction: column;
	gap: 5px;
	font-family: var(--font-sans);
	font-size: var(--fs-base);
	width: 100%;
	min-width: 0;
}

.playlist__name {
	font-family: var(--font-display);
	font-size: var(--fs-base);
	color: var(--color-white);
	font-weight: 500;
	line-height: 1.35;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.15s ease;
}

.playlist__track.is-active .playlist__name {
	color: var(--color-accent);
}

.playlist__composer {
	font-family: var(--font-sans);
	font-size: var(--fs-xs);
	color: var(--color-text-muted);
	opacity: 0.7;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.playlist__track:hover .playlist__composer {
	color: var(--color-white);
	opacity: 0.5;
}

.playlist__duration {
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	font-variant-numeric: tabular-nums;
	color: var(--color-text-muted);
	opacity: 0.5;
	white-space: nowrap;
}

.playlist__track:hover .playlist__duration {
	opacity: 0.8;
}

.playlist__track.is-active .playlist__duration {
	color: var(--color-accent);
	opacity: 0.7;
}

/* --- Download Button ---------------------------------------------------- */

.playlist__dl {
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
	border: none;
	border-radius: 50%;
	transition: all 0.15s ease;
	opacity: 0;
	text-decoration: none;
}

.playlist__track:hover .playlist__dl {
	opacity: 0.6;
}

.playlist__dl:hover,
.playlist__dl:focus-visible {
	color: var(--color-accent);
	background: rgba(200, 169, 110, 0.12);
	opacity: 1 !important;
	outline: none;
}

/* --- No Results --------------------------------------------------------- */

.playlist__no-results {
	text-align: center;
	padding: var(--sp-7) var(--sp-5);
	color: var(--color-text-muted);
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
}

/* ==========================================================================
   Transport Bar — Spotify-style
   ========================================================================== */

.playlist__bar {
	display: flex;
	align-items: center;
	gap: var(--sp-4);
	padding: var(--sp-4) var(--sp-6);
	background: linear-gradient(180deg, rgba(18, 18, 18, 0.95) 0%, #0a0a0a 100%);
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- Prev / Next / Play Buttons ----------------------------------------- */

.playlist__btn {
	background: none;
	border: none;
	color: var(--color-text-muted);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s ease, transform 0.15s ease;
	padding: 0;
}

.playlist__btn:hover {
	color: var(--color-white);
}

.playlist__btn--prev,
.playlist__btn--next {
	width: 32px;
	height: 32px;
}

.playlist__btn--play {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--color-accent);
	color: var(--color-bg);
	flex-shrink: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.playlist__btn--play svg {
	margin-left: 2px;
}

.playlist__btn--play:hover {
	background: var(--color-accent-soft);
	transform: scale(1.06);
	color: var(--color-bg);
	box-shadow: 0 4px 16px rgba(200, 169, 110, 0.25);
}

.playlist.is-playing .playlist__btn--play svg {
	margin-left: 0;
}

.playlist__btn--play .icon-pause { display: none; }
.playlist.is-playing .playlist__btn--play .icon-play  { display: none; }
.playlist.is-playing .playlist__btn--play .icon-pause { display: block; }

/* --- Progress Group ----------------------------------------------------- */

.playlist__progress-group {
	flex: 1;
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	min-width: 0;
}

.playlist__time--current,
.playlist__time--total {
	font-family: var(--font-sans);
	font-size: 11px;
	color: var(--color-text-muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	min-width: 36px;
	opacity: 0.7;
}

.playlist__time--current {
	text-align: right;
}

.playlist__track-bar {
	position: relative;
	height: 4px;
	background: rgba(255, 255, 255, 0.09);
	border-radius: 2px;
	cursor: pointer;
	outline: none;
	flex: 1;
	min-width: 80px;
	transition: height 0.1s ease;
}

.playlist__track-bar:hover {
	height: 6px;
}

.playlist__track-fill {
	position: absolute;
	inset: 0 auto 0 0;
	height: 100%;
	width: 0;
	background: var(--color-accent);
	border-radius: 2px;
	transition: width 0.08s linear;
}

.playlist__track-bar:hover .playlist__track-fill {
	background: var(--color-accent);
}

.playlist__track-handle {
	position: absolute;
	top: 50%;
	left: 0;
	transform: translate(-50%, -50%) scale(0);
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--color-accent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	transition: left 0.08s linear, transform 0.15s ease;
}

.playlist__track-bar:hover .playlist__track-handle {
	transform: translate(-50%, -50%) scale(1);
}

/* --- Volume ------------------------------------------------------------- */

.playlist__volume {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	flex-shrink: 0;
}

.playlist__btn--mute {
	width: 32px;
	height: 32px;
	background: none;
	border: none;
	color: var(--color-text-muted);
	cursor: pointer;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s ease;
	padding: 0;
}

.playlist__btn--mute:hover {
	color: var(--color-white);
}

.playlist__btn--mute .icon-mute { display: none; }
.playlist.is-muted .playlist__btn--mute .icon-vol  { display: none; }
.playlist.is-muted .playlist__btn--mute .icon-mute { display: block; }

.playlist__volume-bar {
	position: relative;
	width: 90px;
	height: 4px;
	background: rgba(255, 255, 255, 0.09);
	border-radius: 2px;
	cursor: pointer;
	outline: none;
	transition: height 0.1s ease;
}

.playlist__volume-bar:hover {
	height: 6px;
}

.playlist__volume-fill {
	position: absolute;
	inset: 0 auto 0 0;
	height: 100%;
	width: 80%;
	background: var(--color-accent);
	border-radius: 2px;
}

.playlist__volume-handle {
	position: absolute;
	top: 50%;
	left: 80%;
	transform: translate(-50%, -50%) scale(0);
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--color-white);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	transition: left 0.08s linear, transform 0.15s ease;
}

.playlist__volume-bar:hover .playlist__volume-handle {
	transform: translate(-50%, -50%) scale(1);
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 840px) {
	.playlist__volume {
		display: none;
	}
	.playlist__bar {
		padding: var(--sp-4);
	}
}

/* Mobile (≤768px): die Playlist soll die Seite NICHT vom Scrollen abhalten.
 * Statt eines eigenen Scroll-Containers (overflow + overscroll-behavior:
 * contain) wird die komplette Trackliste inline ausgegeben — ein Finger
 * irgendwo auf der Liste scrollt dann ganz normal die ganze Seite. */
@media (max-width: 768px) {
	.playlist__scroll {
		max-height: none;
		overflow: visible;
		overscroll-behavior: auto;
		touch-action: pan-y;
	}
	.playlist__track {
		touch-action: pan-y;
	}

	/* Titel/Artist im "Wird gespielt"-Banner sollen umbrechen statt mit „…" abgeschnitten zu werden. */
	.playlist__now-title,
	.playlist__now-artist {
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
		overflow-wrap: anywhere;
		line-height: 1.3;
	}
}

@media (max-width: 520px) {
	.playlist__track {
		grid-template-columns: 32px 1fr auto 28px;
		padding: 8px var(--sp-3);
		gap: var(--sp-3);
	}
	.playlist__composer { display: none; }

	.playlist__now-playing {
		padding: var(--sp-4);
		gap: var(--sp-3);
	}
	.playlist__now-art {
		width: 44px;
		height: 44px;
	}
	.playlist__now-art svg {
		width: 44px;
		height: 44px;
	}
	.playlist__now-title {
		font-size: var(--fs-base);
	}

	.playlist__search {
		padding: var(--sp-3) var(--sp-4);
	}

	.playlist__btn--play {
		width: 36px;
		height: 36px;
	}
	.playlist__btn--prev,
	.playlist__btn--next {
		width: 28px;
		height: 28px;
	}
	.playlist__bar {
		padding: var(--sp-3);
		gap: var(--sp-2);
	}
	.playlist__progress-group {
		gap: var(--sp-2);
	}
	.playlist__time--current,
	.playlist__time--total {
		font-size: 10px;
		min-width: 28px;
	}
}

