/* Player 06. Same engine as the others (players/player-func.js), own skin.
   A card that floats at the bottom right corner, audio only, and folds into a
   strip when the arrow is pressed. */

.bras-player-pip {
	--pl-radius: 12px;
	--pl-border: color-mix(in srgb, var(--pl-fg, #ffffff) 16%, transparent);
	--pl-muted: color-mix(in srgb, var(--pl-fg, #ffffff) 60%, transparent);
	--pl-hover: color-mix(in srgb, var(--pl-fg, #ffffff) 10%, transparent);

	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 1045;
	width: 320px;
	max-width: calc(100vw - 24px);
	color: var(--pl-fg, #ffffff);
	font-size: 14px;
	line-height: 1.25;
}

.pip-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
	background: var(--pl-bg, #16181f);
	border: 1px solid var(--pl-border);
	border-radius: var(--pl-radius);
}

/* The handle folds the card: a checkbox holds the state, so the corner works
   with the page script disabled and nothing has to be bound */
.pip-fold {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.pip-handle {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	margin-left: 2px;
	color: var(--pl-muted);
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.pip-handle:hover {
	color: var(--pl-fg, #ffffff);
	background: var(--pl-hover);
}

.pip-handle__up { display: none; }
.pip-fold:checked ~ .pip-card .pip-handle__down { display: none; }
.pip-fold:checked ~ .pip-card .pip-handle__up { display: block; }
.pip-fold:checked ~ .pip-card .pip-body { display: none; }
.pip-fold:checked ~ .pip-card { gap: 0; }
.pip-fold:focus-visible ~ .pip-card .pip-handle { outline: 2px solid var(--pl-accent, #ffffff); outline-offset: 2px; }

/* What is on air */
.pip-body {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.pip-cover {
	flex-shrink: 0;
	width: 52px;
	height: 52px;
	background-color: var(--pl-hover);
	background-size: cover;
	background-position: center;
	border-radius: 8px;
}

.pip-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	overflow: hidden;
}

.pip-now {
	font-size: 12px;
	color: var(--pl-muted);
}

/* Soft ends so the title fades instead of being cut by the box */
.pip-track {
	position: relative;
	display: block;
	overflow: hidden;
}

.pip-track::before,
.pip-track::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 14px;
	pointer-events: none;
	z-index: 2;
}

.pip-track::before {
	left: 0;
	background: linear-gradient(90deg, var(--pl-bg, #16181f), transparent);
}

.pip-track::after {
	right: 0;
	background: linear-gradient(270deg, var(--pl-bg, #16181f), transparent);
}

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

/* Transport */
.pip-bar {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
}

.pip-play {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	padding: 0;
	color: var(--pl-bg, #16181f);
	background: var(--pl-fg, #ffffff);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.pip-play:hover { opacity: 0.85; }
.pip-play.inactive { display: none !important; }
.pip-play svg { margin-left: 2px; }
.fallplayer-pause.pip-play svg { margin-left: 0; }

.pip-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	padding: 0;
	color: var(--pl-fg, #ffffff);
	background: none;
	border: 1px solid var(--pl-border);
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.15s ease;
}

.pip-btn:hover { background: var(--pl-hover); }

.pip-volume {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}

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

.pip-volume__slider {
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	min-width: 0;
	padding-right: 4px;
}

/* The shortcuts need the room when they open */
.bras-player-pip.is-apps .pip-volume__slider { display: none; }

/* The filled part comes from --pl-vol, written by the engine on every change */
.pip-volume input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 4px;
	margin: 0;
	background: linear-gradient(to right, var(--pl-fg, #ffffff) 0 var(--pl-vol, 100%), var(--pl-border) var(--pl-vol, 100%) 100%);
	border-radius: 999px;
	outline: none;
	cursor: pointer;
}

.pip-volume input[type="range"]::-webkit-slider-runnable-track {
	height: 4px;
	background: transparent;
	border-radius: 999px;
}

.pip-volume input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 12px;
	height: 12px;
	margin-top: -4px;
	background: var(--pl-fg, #ffffff);
	border: 2px solid var(--pl-bg, #16181f);
	border-radius: 50%;
	cursor: pointer;
}

.pip-volume input[type="range"]::-moz-range-track {
	height: 4px;
	background: transparent;
	border-radius: 999px;
}

.pip-volume input[type="range"]::-moz-range-thumb {
	width: 12px;
	height: 12px;
	background: var(--pl-fg, #ffffff);
	border: 2px solid var(--pl-bg, #16181f);
	border-radius: 50%;
	cursor: pointer;
}

/* Shortcuts fold behind the dots and open towards the play button */
.pip-links {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 0 auto;
	padding: 0;
	list-style: none;
}

.pip-links li {
	position: relative;
	display: flex;
	align-items: center;
}

.pip-links__apps { gap: 6px; }

.bras-player__apps {
	display: flex;
	align-items: center;
	gap: 6px;
	max-width: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-width 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
}

.bras-player-pip.is-apps .bras-player__apps {
	max-width: 160px;
	margin-right: 6px;
	opacity: 1;
}

.bras-player__more .more-close { display: none; }
.bras-player-pip.is-apps .bras-player__more .more-dots { display: none; }
.bras-player-pip.is-apps .bras-player__more .more-close { display: block; }

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

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

.bras-player__cast svg { width: 19px; height: 19px; }

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

.bras-player__offline b {
	font-size: 13px;
	font-weight: 500;
}

.bras-player-pip.is-offline .pip-body,
.bras-player-pip.is-offline .pip-play,
.bras-player-pip.is-offline .pip-volume { display: none !important; }

.bras-player-pip.is-offline .bras-player__offline { display: flex; }

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

/* 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;
}

.pip-cover.pl-skeleton { border-radius: 8px; }
.rf-playing-label1.pl-skeleton { max-width: 80px; }
.rf-playing-label2.pl-skeleton { max-width: 160px; }

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

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

/* Phones: the card lies on the bottom edge, corner to corner */
@media screen and (max-width: 575px) {
	.bras-player-pip {
		right: 0;
		left: 0;
		bottom: 0;
		width: auto;
		max-width: none;
	}

	.pip-card {
		gap: 8px;
		border-width: 1px 0 0;
		border-radius: 0;
	}

	.pip-cover { width: 44px; height: 44px; }
	.pip-links__apps { display: none; }
}

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