/* music.css — сторінка "Музика" (template/music-page.php).
   Та сама мова, що в подій/галереї: той самий hero (без власних висот),
   скляні картки (blur + напівпрозорий білий), закруглення з токенів
   main.css (--r-*), заголовки Spectral, текст Inter. Плеєр-«пігулка» — в
   окремому styles/music-player.css (його підключає scripts/music-player.js
   на всіх сторінках). Порядок підключення — після main.css. */

.rd-music {
	position: relative;
	max-width: 1050px;
	margin: 0 auto;
	padding: 0 clamp(16px, 4vw, 40px) 24px;
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: clamp(16px, 2.4vw, 28px);
	align-items: start;
}

.rd-music__aside,
.rd-music__panel {
	background: rgba(255, 255, 255, .5);
	backdrop-filter: blur(16px) saturate(1.6);
	-webkit-backdrop-filter: blur(16px) saturate(1.6);
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: var(--r-lg);
	box-shadow: 0 12px 30px -18px rgba(20, 20, 20, .35);
}

/* ---------- Список релізів ---------- */
.rd-music__aside { padding: 18px 14px 14px; position: sticky; top: 104px; }
.rd-music__label {
	margin: 0 6px 10px;
	font-size: var(--fs-2xs);
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted);
}
.rd-music__releases { display: flex; flex-direction: column; gap: 4px; }
.rd-music__release {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr);
	gap: 12px;
	align-items: center;
	padding: 8px;
	border-radius: var(--r-md);
	color: var(--ink);
	text-decoration: none;
	transition: background .2s ease;
}
.rd-music__release img,
.rd-music__thumb-empty {
	width: 56px;
	height: 56px;
	border-radius: var(--r-sm);
	object-fit: cover;
	background: rgba(20, 20, 20, .08);
	display: block;
}
.rd-music__release-text { display: flex; flex-direction: column; min-width: 0; }
.rd-music__release-text b { font-family: 'Spectral', serif; font-weight: 500; font-size: var(--fs-lg); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-music__release-text i { font-style: normal; font-size: var(--fs-xs); color: var(--muted); }
.rd-music__release:hover { background: rgba(20, 20, 20, .05); }
.rd-music__release.is-active { background: rgba(62, 102, 144, .14); }

/* ---------- Панель релізу ---------- */
.rd-music__panel { padding: clamp(16px, 2.4vw, 26px); }
.rd-music__head { display: flex; gap: clamp(14px, 2.4vw, 24px); align-items: stretch; margin-bottom: 20px; }
.rd-music__coverwrap {
	position: relative;
	flex: 0 0 auto;
	width: clamp(150px, 22vw, 220px);
	border-radius: var(--r-md);
	overflow: hidden;
	box-shadow: 0 14px 30px -14px rgba(20, 20, 20, .45);
	background: rgba(20, 20, 20, .08);
	line-height: 0;
}
.rd-music__cover { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }

/* Велика кнопка ▶ / ❚❚ на обкладинці: грає реліз, а під час звучання — пауза */
.rd-music__cover-play {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 68px;
	height: 68px;
	margin: -34px 0 0 -34px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, .7);
	background: rgba(20, 20, 20, .5);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .2s ease, background .2s ease;
}
.rd-music__cover-play svg { width: 32px; height: 32px; display: block; }
.rd-music__cover-play .i-play { margin-left: 3px; }
.rd-music__cover-play .i-pause { display: none; }
.rd-music__coverwrap.is-playing .rd-music__cover-play .i-play { display: none; }
.rd-music__coverwrap.is-playing .rd-music__cover-play .i-pause { display: block; }
.rd-music__cover-play:hover { transform: scale(1.07); background: rgba(20, 20, 20, .68); }
.rd-music__cover-play:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.rd-music__cover-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .28); }
.rd-music__cover-bar i { display: block; height: 100%; width: 0; background: #fff; }
/* Текст зверху від краю обкладинки, кнопки платформ — по її нижньому краю */
.rd-music__headtext { min-width: 0; padding-top: 2px; display: flex; flex-direction: column; align-items: flex-start; }
.rd-music__type { margin: 0 0 8px; font-size: var(--fs-xs); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.rd-music__title {
	margin: 0;
	font-family: 'Spectral', serif;
	font-weight: 500;
	font-size: clamp(1.35rem, 1.1rem + .9vw, 1.75rem);
	line-height: 1.18;
	letter-spacing: -.005em;
	text-wrap: balance;
}
.rd-music__meta { margin: 12px 0 0; font-size: var(--fs-md); color: var(--muted); }
.rd-music__desc { margin: 0 0 18px; font-size: var(--fs-lg); line-height: 1.65; color: rgba(20, 20, 20, .82); }
.rd-music__desc--release { margin: 22px 0 0; }

/* Платформи — круглі кнопки-логотипи */
.rd-music__links { display: flex; flex-wrap: wrap; gap: 10px; margin: auto 0 0; padding-top: 16px; }
.rd-music__logo {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, .7);
	border: 1px solid rgba(255, 255, 255, .8);
	box-shadow: 0 6px 16px -10px rgba(20, 20, 20, .45);
	color: var(--ink);
	transition: background .2s ease, color .2s ease, transform .2s ease;
}
.rd-music__logo svg { width: 22px; height: 22px; display: block; }
.rd-music__logo:hover { background: var(--ink); color: #fff; transform: translateY(-2px); }
.rd-music__logo:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Треклист ---------- */
.rd-music__tracks { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(20, 20, 20, .08); }
.rd-music__track { border-bottom: 1px solid rgba(20, 20, 20, .08); }
.rd-music__row {
	display: grid;
	grid-template-columns: 30px 22px minmax(0, 1fr) auto;
	gap: 8px;
	align-items: center;
	padding: 13px 10px;
	color: var(--ink);
	text-decoration: none;
	border-radius: var(--r-sm);
	transition: background .2s ease;
}
.rd-music__row:hover { background: rgba(20, 20, 20, .04); }
.rd-music__track.is-selected .rd-music__row { background: rgba(62, 102, 144, .12); }
.rd-music__num { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.rd-music__name { font-family: 'Spectral', serif; font-size: 1.0625rem; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-music__time { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
/* Поточний трек: фон рядка «заповнюється» зліва направо по мірі звучання (--p ставить music.js) */
.rd-music__track.is-current .rd-music__row {
	background: linear-gradient(90deg, rgba(62, 102, 144, .28) 0, rgba(62, 102, 144, .28) var(--p, 0%), rgba(62, 102, 144, .09) var(--p, 0%), rgba(62, 102, 144, .09) 100%);
}
.rd-music__track.is-current .rd-music__name { color: var(--blue); font-weight: 600; }

/* Значок біля треку: ▶ при наведенні/виборі, два стовпчики під час відтворення */
.rd-music__icon { position: relative; width: 14px; height: 14px; color: var(--blue); opacity: 0; transition: opacity .15s; }
.rd-music__icon::before {
	content: '';
	position: absolute;
	left: 2px;
	top: 1px;
	border-left: 10px solid currentColor;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
}
.rd-music__row:hover .rd-music__icon,
.rd-music__track.is-current .rd-music__icon { opacity: 1; }
.rd-music__track.is-playing .rd-music__icon::before {
	left: 1px;
	top: 1px;
	width: 4px;
	height: 12px;
	border: 0;
	background: currentColor;
	box-shadow: 7px 0 0 currentColor;
}
.rd-music__track.is-playing .rd-music__icon { opacity: 1; }

/* ---------- Деталі треку: відео / сет ---------- */
.rd-music__details { margin-top: 20px; }
.rd-music__detail[hidden] { display: none; }
.rd-music__detail-title { margin: 0 0 8px; font-family: 'Spectral', serif; font-size: 1.15rem; font-weight: 500; }

/* Відео одразу з прев'ю (кадр із YouTube) і кнопкою ▶; сам плеєр YouTube
   вантажиться лише після кліку (режим без cookie). */
.rd-music__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	padding: 0;
	border: 0;
	border-radius: var(--r-md);
	overflow: hidden;
	background: radial-gradient(120% 120% at 20% 10%, #2a3a52 0%, #11161f 70%);
	color: #fff;
	margin: 0 0 14px;
	cursor: pointer;
	font: inherit;
	box-shadow: 0 14px 30px -16px rgba(20, 20, 20, .5);
}
.rd-music__media[hidden] { display: none; }
.rd-music__media-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.rd-music__media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .05) 40%, rgba(0, 0, 0, .55)); }
.rd-music__media-label { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 2; display: flex; flex-direction: column; gap: 2px; text-align: left; font-size: var(--fs-md); }
.rd-music__media-label small { font-size: var(--fs-2xs); opacity: .75; }
.rd-music__media-play {
	position: absolute;
	left: 50%;
	top: 46%;
	z-index: 2;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .22);
	border: 1px solid rgba(255, 255, 255, .55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: transform .2s ease, background .2s ease;
}
.rd-music__media-play::before {
	content: '';
	position: absolute;
	left: 25px;
	top: 19px;
	border-left: 19px solid #fff;
	border-top: 12px solid transparent;
	border-bottom: 12px solid transparent;
}
.rd-music__media:hover .rd-music__media-img { transform: scale(1.03); }
.rd-music__media:hover .rd-music__media-play { transform: scale(1.08); background: rgba(255, 255, 255, .34); }
.rd-music__frame { margin: 0 0 14px; border-radius: var(--r-md); overflow: hidden; background: #000; }
.rd-music__frame.is-video { aspect-ratio: 16 / 9; }
.rd-music__frame.is-audio { height: 180px; }
.rd-music__frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Планшет і телефон ---------- */
@media (max-width: 900px) {
	.rd-music { grid-template-columns: minmax(0, 1fr); }
	.rd-music__aside { position: static; padding: 14px 12px 12px; }
	.rd-music__releases { flex-direction: row; overflow-x: auto; gap: 10px; padding: 2px 2px 6px; scrollbar-width: none; }
	.rd-music__releases::-webkit-scrollbar { display: none; }
	.rd-music__release {
		flex: 0 0 auto;
		width: 108px;
		grid-template-columns: minmax(0, 1fr);
		justify-items: center;
		text-align: center;
		gap: 6px;
		padding: 8px 6px;
	}
	.rd-music__release img, .rd-music__thumb-empty { width: 80px; height: 80px; }
	.rd-music__release-text b { max-width: 96px; font-size: var(--fs-sm); }
}

/* Нижній відступ до футера: 24px тут + трохи менший за стандартний спейсер (раніше разом було ~260px) */
.rd-music ~ .rd-footer-spacer { height: calc(var(--space-5) - 60px); }

@media (max-width: 640px) {
	.rd-music ~ .rd-footer-spacer { height: calc(var(--space-5) / 2 - 20px); }
	.rd-music__head { flex-direction: column; align-items: stretch; }
	.rd-music__coverwrap { width: 100%; }
	.rd-music__cover-play { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
	.rd-music__cover-play svg { width: 36px; height: 36px; }
	.rd-music__row { grid-template-columns: 26px 16px minmax(0, 1fr) auto; padding: 14px 6px; }
}

/* Порожній розділ — у стилі сторінки помилки: замість номера помилки значок ноти */
.rd-note__code--icon { display: flex; justify-content: center; }
.rd-note__code--icon svg { width: .8em; height: .8em; display: block; }
