/**
 * Persistent Radio Player
 *
 * Copyright (c) 2026 AJ-Group (https://aj-group.net)
 * Licensed under the GNU General Public License v2 or later.
 *
 * Two layouts in one file: the shell (frame plus bar) and the bar itself.
 * The bar deliberately borrows the theme's font so it reads as part of the
 * site rather than something bolted on.
 */

:root {
	--prp-height: 0px;
}

/* -------------------------------------------------------------- the shell */

/* Only the frame scrolls. The shell itself is fixed furniture. */
html.prp-shell,
html.prp-shell body {
	block-size: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background: #000;
}

.prp-frame {
	position: fixed;
	inset: 0;
	inline-size: 100%;
	block-size: calc( 100% - var( --prp-height ) );
	border: 0;
	/* Hidden until it has content, so the visitor never sees a blank frame
	   sitting on top of the page they already have. */
	visibility: hidden;
}

.prp-frame.is-ready {
	visibility: visible;
}

/* Inside the frame, leave room so the bar never covers the page end. */
html.prp-framed body {
	padding-bottom: 4rem;
}

/* --------------------------------------------------------------- the bar */

.prp {
	--prp-bg: rgba( 169, 52, 0, 1 );
	--prp-fg: #fff;
	--prp-live: #ebd999;

	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 2147483000;

	display: flex;
	align-items: center;
	gap: 0.9rem;

	padding: 0.7rem clamp( 0.9rem, 4vw, 2rem );
	padding-bottom: calc( 0.7rem + env( safe-area-inset-bottom ) );

	background: var( --prp-bg );
	backdrop-filter: blur( 12px );
	color: var( --prp-fg );
	font: inherit;
	font-size: 0.85rem;
	letter-spacing: 0.02em;
	text-transform: lowercase;
}

.prp__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-transform: inherit;
	letter-spacing: inherit;
	cursor: pointer;
}

.prp__toggle:focus-visible {
	outline: 2px solid var( --prp-live );
	outline-offset: 4px;
}

.prp__label {
	font-weight: 700;
}

/* The dot is the only state indicator: hollow when idle, lit when live. */
.prp__dot {
	inline-size: 0.6rem;
	block-size: 0.6rem;
	border: 1px solid currentColor;
	border-radius: 50%;
}

.prp[data-state='playing'] .prp__dot {
	border-color: var( --prp-live );
	background: var( --prp-live );
}

.prp[data-state='loading'] .prp__dot {
	border-color: var( --prp-live );
	animation: prp-pulse 1.1s ease-in-out infinite;
}

.prp__status {
	opacity: 0.6;
}

/* Pushed to the far right. Two stacked rows, quiet enough to stay out of the
   way of the controls but legible against the dark bar. */
.prp__credit {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	margin-inline-start: auto;
	color: rgba( 255, 255, 255, 0.45 );
	font-size: 0.62rem;
	line-height: 1.2;
	letter-spacing: 0;
	text-align: right;
	text-decoration: none;
	text-transform: none; /* The bar lowercases everything; the name has caps. */
	transition: color 0.15s ease;
}

.prp__credit:hover,
.prp__credit:focus-visible {
	color: var( --prp-live );
}

.prp__credit:focus-visible {
	outline: 2px solid var( --prp-live );
	outline-offset: 3px;
}

.prp__credit-name {
	font-weight: 600;
}

@keyframes prp-pulse {
	50% { opacity: 0.25; }
}

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