/**
 * PJB Mixed Media Player styles.
 *
 * All colours/sizing exposed as CSS custom properties so they can be overridden
 * from the active theme without forking this file. Override any variable by
 * targeting `.pjb-player { --pjb-accent: #yourcolor; }` in your theme CSS.
 */

.pjb-player {
	--pjb-bg: transparent;
	--pjb-bg-row-active: rgba( 255, 255, 255, 0.08 );
	--pjb-text: inherit;
	--pjb-text-active: #6abdd6;
	--pjb-accent: #6abdd6;
	--pjb-divider: rgba( 255, 255, 255, 0.12 );
	--pjb-btn-color: currentColor;
	--pjb-btn-border-width: 2px;
	--pjb-btn-icon-size: 22px;
	--pjb-btn-play-icon-size: 34px;
	--pjb-track-icon-size: 16px;
	--pjb-radius: 4px;

	/* Icon font. Override --pjb-icon-font / --pjb-icon-weight in your theme
	   if you upgrade FontAwesome (e.g. "Font Awesome 6 Free" + 900). */
	--pjb-icon-font: "FontAwesome";
	--pjb-icon-weight: normal;

	/* !important guards against theme rules that target generic descendants
	   (e.g. .x-section .pjb-player) and would otherwise reapply a fill. */
	background: var(--pjb-bg) !important;
	color: var(--pjb-text);
	font-family: inherit;
	font-size: 0.9rem;
	line-height: 1.4;
	padding: 16px 0;
	border-radius: var(--pjb-radius);
	max-width: 420px;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
}

.pjb-player *,
.pjb-player *::before,
.pjb-player *::after {
	box-sizing: border-box;
}

/* ---------- Transport controls ---------- */

.pjb-controls {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 14px;
	margin-bottom: 18px;
}

.pjb-btn {
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	border: var(--pjb-btn-border-width) solid var(--pjb-btn-color);
	border-radius: 50%;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--pjb-btn-color);
	cursor: pointer;
	padding: 0;
	font-size: var(--pjb-btn-icon-size);
	line-height: 1;
	transition: opacity 0.15s ease, transform 0.1s ease, border-color 0.15s ease, color 0.15s ease;
	flex: 0 0 auto;
}

.pjb-btn:hover {
	opacity: 0.85;
}

.pjb-btn:active {
	transform: scale(0.94);
}

.pjb-btn:focus-visible {
	outline: 2px solid var(--pjb-accent);
	outline-offset: 2px;
}

/* The center play button is bigger, matching the screenshot. */
.pjb-btn-play {
	width: 60px;
	height: 60px;
	font-size: var(--pjb-btn-play-icon-size);
}

/* ---------- Icon glyphs (CSS pseudo-elements) ---------- */
/* Glyph codepoints below are FontAwesome 4.7 PUA values; FA5/6 retain the same
   codepoints, so only the font-family / weight need to change to upgrade. */

.pjb-btn::before,
.pjb-track-icon::before {
	font-family: var(--pjb-icon-font);
	font-weight: var(--pjb-icon-weight);
	font-style: normal;
	font-variant: normal;
	text-rendering: auto;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	display: inline-block;
	line-height: 1;
}

.pjb-btn::before {
	color: inherit;
	font-size: inherit;
}

.pjb-btn-prev::before { content: "\f048"; }   /* step-backward */
.pjb-btn-play::before { content: "\f04b"; }   /* play */
.pjb-btn-next::before { content: "\f051"; }   /* step-forward */
.pjb-btn-stop::before { content: "\f04d"; }   /* stop */

/* Single-icon play/pause swap, driven by .is-playing on the root. */
.pjb-player.is-playing .pjb-btn-play::before {
	content: "\f04c"; /* pause */
}

/* Optical centering: the play triangle has visual mass right of geometric center;
   the pause bars are symmetric, so the nudge is removed when paused state ends. */
.pjb-btn-play::before {
	transform: translateX(2px);
}
.pjb-player.is-playing .pjb-btn-play::before {
	transform: none;
}

/* ---------- Progress bar ---------- */

.pjb-progress {
	margin-bottom: 14px;
}

.pjb-progress-track {
	position: relative;
	width: 100%;
	height: 8px;
	background: var(--pjb-divider);
	border-radius: 2px;
	cursor: pointer;
	overflow: hidden;
}

.pjb-progress-track:focus-visible {
	outline: 2px solid var(--pjb-accent);
	outline-offset: 3px;
}

.pjb-progress-fill {
	height: 100%;
	width: 0;
	background: var(--pjb-accent);
	transition: width 0.1s linear;
}

.pjb-time {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	margin-top: 6px;
	color: var(--pjb-text);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

/* ---------- Track list ---------- */

.pjb-tracks {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--pjb-divider);
}

.pjb-track {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid var(--pjb-divider);
}

.pjb-track-btn {
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	border: 0;
	color: inherit;
	font: inherit;
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 8px;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.pjb-track-btn:hover {
	background: rgba( 255, 255, 255, 0.04 );
}

.pjb-track-btn:focus-visible {
	outline: 2px solid var(--pjb-accent);
	outline-offset: -2px;
}

.pjb-track.is-active .pjb-track-btn {
	background: var(--pjb-bg-row-active);
	color: var(--pjb-text-active);
}

.pjb-track-icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 1.25em;
	font-size: var(--pjb-track-icon-size);
	color: inherit;
}

.pjb-track-icon::before {
	color: inherit;
	font-size: inherit;
}

.pjb-track-icon-audio::before { content: "\f001"; } /* music note */
.pjb-track-icon-video::before { content: "\f03d"; } /* video-camera */

.pjb-track-title {
	flex: 1 1 auto;
	font-size: 1rem;
}

/* ---------- Hidden audio element ---------- */

.pjb-audio {
	display: none;
}

/* ---------- Video stage ---------- */

.pjb-video-stage {
	display: none;
	width: 100%;
	max-width: 100%;
	background: #000;
	aspect-ratio: var(--pjb-video-aspect, 16 / 9);
}

.pjb-video-stage.is-active {
	display: block;
}

.pjb-video-stage .pjb-video {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	background: #000;
}
