/* "Pesnička s textom" — player card with the cover's colours as a blurred backdrop. */

.wp-block-blog-song.song {
	--song-fg: #fff;
	--song-dim: rgba(255, 255, 255, 0.72);
	--song-lyrics-h: 300px;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	margin-block: 2rem;
	border-radius: 20px;
	background: #1c1b22;
	color: var(--song-fg);
	box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.55);
	font-size: 1rem;
	line-height: 1.4;
}

.song__backdrop {
	position: absolute;
	inset: -60px;
	z-index: -2;
	background: var(--song-cover, linear-gradient(135deg, #3c2f6b, #16505e)) center / cover no-repeat;
	filter: blur(44px) saturate(1.4) brightness(0.62); /* darker, so white text reads on bright covers too */
	transform: scale(1.15);
}

.wp-block-blog-song.song::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.44) 100%);
	pointer-events: none;
}

/* ── head: cover, title, controls, lyrics button ── */

.song__head {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1.1rem 1.1rem 1rem;
}

.song__cover {
	flex: none;
	width: 92px;
	height: 92px;
	border-radius: 12px;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.1);
	box-shadow: 0 12px 26px -8px rgba(0, 0, 0, 0.55);
}

.song__cover--empty {
	display: grid;
	place-items: center;
	font-size: 2.2rem;
	color: var(--song-dim);
}

.song__info {
	flex: 1;
	min-width: 0;
}

.song__title,
.song__artist {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.song__title {
	font-size: 1.08rem;
	font-weight: 650;
	letter-spacing: -0.01em;
}

.song__artist {
	margin-top: 0.1rem;
	font-size: 0.9rem;
	color: var(--song-dim);
}

/* editor preview only */
.song__editor-note {
	margin-top: 0.6rem;
	font-size: 0.8rem;
	color: var(--song-dim);
}

.song__controls {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	margin-top: 0.7rem;
}

.song__controls[hidden] {
	display: none;
}

.song__play {
	flex: none;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #16151b;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.song__play:hover {
	transform: scale(1.06);
}

.song__play:active {
	transform: scale(0.95);
}

.song__play svg {
	width: 20px;
	height: 20px;
}

.song__icon-pause,
.song.is-playing .song__icon-play {
	display: none;
}

.song.is-playing .song__icon-pause {
	display: block;
}

/* seek bar: white fill up to --p, set by the script */
.song__seek {
	--p: 0%;
	flex: 1;
	min-width: 0;
	height: 20px;
	margin: 0;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.song__seek::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 4px;
	background: linear-gradient(90deg, #fff var(--p), rgba(255, 255, 255, 0.28) var(--p));
}

.song__seek::-moz-range-track {
	height: 4px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.28);
}

.song__seek::-moz-range-progress {
	height: 4px;
	border-radius: 4px;
	background: #fff;
}

.song__seek::-webkit-slider-thumb {
	width: 13px;
	height: 13px;
	margin-top: -4.5px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	opacity: 0;
	transition: opacity 0.15s ease;
	-webkit-appearance: none;
}

.song__seek::-moz-range-thumb {
	width: 13px;
	height: 13px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.song__seek:hover::-webkit-slider-thumb,
.song__seek:focus-visible::-webkit-slider-thumb {
	opacity: 1;
}

.song__seek:hover::-moz-range-thumb,
.song__seek:focus-visible::-moz-range-thumb {
	opacity: 1;
}

.song__time {
	flex: none;
	font-size: 0.78rem;
	color: var(--song-dim);
	font-variant-numeric: tabular-nums;
}

.song__lyrics-toggle {
	align-self: flex-start;
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.38rem 0.75rem;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.song__lyrics-toggle[hidden] {
	display: none;
}

.song__lyrics-toggle svg {
	width: 14px;
	height: 14px;
}

.song__lyrics-toggle[aria-pressed="true"] {
	border-color: transparent;
	background: rgba(255, 255, 255, 0.92);
	color: #16151b;
}

.song .song__play:focus-visible,
.song .song__lyrics-toggle:focus-visible,
.song .song__seek:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* native player: only until the script has taken over */
.song__audio {
	display: block;
	width: calc(100% - 2.2rem);
	margin: 0 1.1rem 1.1rem;
}

.song.is-ready .song__audio {
	display: none;
}

/* ── lyrics: the panel folds open and shut ── */

.song__lyrics-wrap {
	display: grid;
	grid-template-rows: 1fr;
	transition: grid-template-rows 0.4s ease;
}

.song.lyrics-off .song__lyrics-wrap {
	grid-template-rows: 0fr;
}

.song__lyrics {
	position: relative;
	min-height: 0;
	max-height: var(--song-lyrics-h);
	padding: 0.4rem 1.4rem 2.4rem;
	overflow: hidden auto;
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(transparent 0, #000 14%, #000 78%, transparent 100%);
	mask-image: linear-gradient(transparent 0, #000 14%, #000 78%, transparent 100%);
}

.song__lyrics::-webkit-scrollbar {
	display: none;
}

/* Phones and tablets: the lyrics move on their own and a swipe over them scrolls the page,
   so the player never traps the reader on the way down to the photos. */
@media (hover: none) and (pointer: coarse) {
	.song__lyrics {
		overflow: hidden;
	}
}

.song.lyrics-off .song__lyrics {
	padding-block: 0;
}

/* Synced lyrics get room above and below, so the first and the last line can also sit
   at the focus height (36 % of the panel, see FOCUS in view.js) instead of under the fade. */
.song.is-ready.is-synced .song__lyrics {
	padding-block: 0;
}

.song.is-ready.is-synced .song__lyrics::before,
.song.is-ready.is-synced .song__lyrics::after {
	content: "";
	display: block;
}

.song.is-ready.is-synced .song__lyrics::before {
	height: calc(var(--song-lyrics-h) * 0.36 - 0.95rem);
}

.song.is-ready.is-synced .song__lyrics::after {
	height: calc(var(--song-lyrics-h) * 0.64 - 0.95rem);
}

.song__lyrics:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.55);
	outline-offset: -6px;
	border-radius: 14px;
}

.song__line {
	margin: 0 0 0.55em;
	font-size: clamp(1.12rem, 1rem + 0.6vw, 1.45rem);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--song-fg);
	opacity: 0.36;
	transform-origin: left center;
	/* translate = the glide between lines (view.js sets --lag per line for the wave) */
	transition: opacity 0.8s ease, scale 0.8s ease, translate 1.1s cubic-bezier(0.33, 0.1, 0.2, 1) var(--lag, 0ms);
}

.song__lyrics.is-jumping .song__line {
	transition: none;
}

.song.is-synced .song__line[data-t] {
	cursor: pointer;
}

.song__line.is-past {
	opacity: 0.52;
}

.song__line:not(.is-active):hover {
	opacity: 0.8;
}

.song__line.is-active {
	opacity: 1;
	scale: 1.03;
}

.song__line.is-break {
	font-size: 1rem;
	letter-spacing: 0.3em;
}

/* lyrics without timestamps: ordinary readable text */
.song:not(.is-synced) .song__line {
	font-size: 1.05rem;
	font-weight: 500;
	opacity: 0.92;
}

.song__gap {
	height: 0.6em;
	margin: 0;
}

/* ── big photo (coverLarge): the whole picture on top, credit in its corner ── */

.song__hero {
	position: relative;
	line-height: 0;
}

.song__hero-img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 75vh;
	object-fit: cover;
}

.song__hero::after {
	content: "";
	position: absolute;
	inset: auto 0 0;
	height: 40%;
	background: linear-gradient(180deg, rgba(20, 19, 26, 0) 0%, rgba(20, 19, 26, 0.5) 100%);
	pointer-events: none;
}

.song__credit {
	position: absolute;
	right: 0.75rem;
	bottom: 0.55rem;
	z-index: 1;
	max-width: calc(100% - 1.5rem);
	font-size: 0.68rem;
	line-height: 1.3;
	color: rgba(255, 255, 255, 0.8);
	text-align: right;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.song__credit a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap; /* "CC BY-SA 4.0" and the author's name never split */
}

.song.has-hero .song__head {
	padding-top: 0.95rem;
}

@media (max-width: 480px) {
	.song__head {
		gap: 0.8rem;
		padding: 1rem 0.9rem 0.9rem;
	}

	.song__cover {
		width: 72px;
		height: 72px;
	}

	.song__lyrics {
		padding-inline: 1rem;
	}

	.song__time {
		display: none;
	}

	.song__credit {
		font-size: 0.62rem;
		right: 0.6rem;
		bottom: 0.45rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.song__lyrics-wrap,
	.song__line,
	.song__play {
		transition: none;
	}
}
