/* Player 03. Same engine as the others (players/player-func.js), own skin.
   Quiet surface, hairline borders, one solid button: the rest is text. */

#player {
	--pl-radius: 8px;
	--pl-border: color-mix(in srgb, var(--pl-fg, #16181f) 14%, transparent);
	--pl-muted: color-mix(in srgb, var(--pl-fg, #16181f) 55%, transparent);
	--pl-hover: color-mix(in srgb, var(--pl-fg, #16181f) 7%, transparent);

	position: sticky;
	top: 0;
	z-index: 1040;
	color: var(--pl-fg, #16181f);
	background: var(--pl-bg, #ffffff);
	line-height: 1.2;
	border: 0;
	border-bottom: 1px solid var(--pl-border);
	font-size: 14px;
}

#player .player-radio {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 15px;
}

/* Transport in one framed group, the way a toolbar is built: hairline around,
   ghost buttons inside and a single solid button for play */
.player-controls {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
	padding: 4px;
	border: 1px solid var(--pl-border);
	border-radius: 10px;
	background: color-mix(in srgb, var(--pl-fg, #16181f) 3%, transparent);
}

.player-controls .playControl {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--pl-bg, #ffffff);
	background: var(--pl-fg, #16181f);
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.player-controls .playControl:hover { opacity: 0.85; }
.player-controls .playControl.inactive { display: none !important; }
.player-controls .playControl svg { margin-left: 1px; width: 18px; height: 18px; }
.player-controls .fallplayer-pause svg { margin-left: 0; }

/* Ghost button: nothing until the pointer is on it */
.player-controls .btnVolume {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--pl-muted);
	background: none;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.player-controls .btnVolume svg { width: 18px; height: 18px; }

.player-controls .btnVolume:hover,
.player-volume.is-open .btnVolume {
	color: var(--pl-fg, #16181f);
	background: color-mix(in srgb, var(--pl-fg, #16181f) 10%, transparent);
}

.player-volume {
	position: relative !important;
	top: auto !important;
	z-index: 1038;
	flex: 0 0 auto;
	align-self: center;
}

.fallplayer-volume .vol-off,
.fallplayer-volume.is-muted .vol-on { display: none; }
.fallplayer-volume.is-muted .vol-off { display: block; }

/* Popover of the slider */
.player-volume-slider {
	position: absolute;
	left: 50%;
	top: calc(100% + 8px);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 0;
	overflow: hidden;
	background: var(--pl-bg, #ffffff);
	border-radius: 8px;
	box-shadow: 0 0 0 1px var(--pl-border), 0 4px 12px -4px rgba(0, 0, 0, 0.18);
	visibility: hidden;
	transform: translateX(-50%);
	transition: height 0.15s ease, visibility 0.15s ease;
}

.player-volume.is-open .player-volume-slider {
	height: 128px;
	visibility: visible;
}

/* The track is drawn here, not by the browser: the filled part comes from
   --pl-vol, which the engine writes on every change of level */
.player-volume .b-slider {
	-webkit-appearance: none;
	appearance: none;
	writing-mode: vertical-lr;
	direction: rtl;
	width: 4px;
	height: 100px;
	margin: 0;
	background: linear-gradient(to top, var(--pl-fg, #16181f) 0 var(--pl-vol, 100%), var(--pl-border) var(--pl-vol, 100%) 100%);
	border-radius: 999px;
	outline: none;
	cursor: pointer;
}

.player-volume .b-slider::-webkit-slider-runnable-track {
	width: 4px;
	background: transparent;
	border-radius: 999px;
}

.player-volume .b-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 12px;
	height: 12px;
	margin-left: -4px;
	background: var(--pl-fg, #16181f);
	border: 2px solid var(--pl-bg, #ffffff);
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--pl-border);
	cursor: pointer;
}

.player-volume .b-slider::-moz-range-track {
	width: 4px;
	background: transparent;
	border-radius: 999px;
}

.player-volume .b-slider::-moz-range-thumb {
	width: 12px;
	height: 12px;
	background: var(--pl-fg, #16181f);
	border: 2px solid var(--pl-bg, #ffffff);
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--pl-border);
	cursor: pointer;
}

@media screen and (max-width: 767px) {
	.player-volume { display: none !important; }
}

/* What is on air */
.player-info {
	display: flex;
	flex: 1 1 auto !important;
	align-items: center;
	gap: 10px;
	min-width: 0;
	padding-left: 6px;
}

.player-info .bras-player-background {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	background-color: var(--pl-hover);
	background-size: cover;
	background-position: center;
	border-radius: var(--pl-radius);
	box-shadow: 0 0 0 1px var(--pl-border);
}

.player-info .text-start {
	width: 100%;
	min-width: 0;
	overflow: hidden;
}

.player-info .now {
	padding: 0 0 2px;
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	color: var(--pl-muted);
}

.player-info .rf-playing-label2 {
	display: block;
	width: 100%;
	font-size: 14px;
	font-weight: 500;
}

/* Soft ends: a strip of the bar colour over each side of the title, so the
   text fades in and out instead of being cut by the box */
.player-info .playing-wrap {
	position: relative;
	overflow: hidden;
}

.player-info .playing-wrap::before,
.player-info .playing-wrap::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 16px;
	pointer-events: none;
	z-index: 2;
}

.player-info .playing-wrap::before {
	left: 0;
	background: linear-gradient(90deg, var(--pl-bg, #ffffff), transparent);
}

.player-info .playing-wrap::after {
	right: 0;
	background: linear-gradient(270deg, var(--pl-bg, #ffffff), transparent);
}

/* Outline buttons for the shortcuts */
.player-links {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	list-style: none;
	margin: 0;
	padding: 0;
}

.player-links a,
.player-links button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	color: var(--pl-fg, #16181f);
	background: none;
	border: 1px solid var(--pl-border);
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.player-links a:hover,
.player-links button:hover { background: var(--pl-hover); }

.bras-player__cast .cast-on,
.bras-player.is-casting .bras-player__cast .cast-off { display: none; }
.bras-player.is-casting .bras-player__cast .cast-on { display: block; }

.bras-player.is-casting .bras-player__cast {
	color: var(--pl-bg, #ffffff);
	background: var(--pl-accent, #16181f);
	border-color: var(--pl-accent, #16181f);
}

@media screen and (max-width: 575px) {
	.player-links li:not(:first-child) { display: none; }
}

/* Keyboard focus keeps the ring the rest of the interface uses */
#player button:focus-visible,
#player a:focus-visible,
#player input:focus-visible {
	outline: 2px solid var(--pl-accent, #16181f);
	outline-offset: 2px;
}

/* Nothing on air */
.bras-player__offline {
	display: none;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	padding-left: 6px;
	color: var(--pl-muted);
}

.bras-player__offline b {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
}

.bras-player.is-offline .player-info,
.bras-player.is-offline .player-controls { display: none; }
.bras-player.is-offline .bras-player__offline { display: flex; }

/* Skeleton until the first data arrives */
.pl-skeleton {
	position: relative;
	overflow: hidden;
	color: transparent !important;
	background-color: var(--pl-hover);
	background-image: none !important;
	border-radius: 6px;
}

.player-info .bras-player-background.pl-skeleton { border-radius: var(--pl-radius); }
.rf-playing-label1.pl-skeleton { max-width: 90px; }
.rf-playing-label2.pl-skeleton { max-width: 220px; }

.pl-skeleton::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
	transform: translateX(-100%);
	animation: plSkeleton 1.4s ease-in-out infinite;
}

@keyframes plSkeleton {
	100% { transform: translateX(100%); }
}

@media (max-width: 575px) {
	#player .player-radio { gap: 10px; padding: 10px 12px; }

	.player-info .rf-playing-label2 { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
	.pl-skeleton::after { animation: none; }
}
