/*
 * SSPS Highlight Player
 * Styled as a callout box using the child theme's CSS variables
 * (--at-highlight, --at-border, --at-radius). Falls back to the
 * hardcoded values if the variables aren't present.
 */

/* ── Container — mirrors .callout-box exactly ─────────────────────────── */

.ssps-hl {
	position: relative;
	display: block;
	background-color: var(--at-highlight, #f4e28a);
	border: 2px solid var(--at-border, #404040);
	border-radius: var(--at-radius, 5px);
	padding: 1rem 1.25rem;
	margin: 0 0 1.5rem;
	background-clip: padding-box;
	overflow: hidden;

	font-family: inherit;
	font-size: inherit;
	line-height: 1;
	color: var(--at-border, #404040);
}

/* ── Controls row ─────────────────────────────────────────────────────── */

.ssps-hl__row {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

/* ── Shared button reset ──────────────────────────────────────────────── */

.ssps-hl__btn {
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	font: inherit;
	color: inherit;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.1s, color 0.1s;
}

.ssps-hl__btn:hover,
.ssps-hl__btn:focus-visible {
	color: var(--at-border, #404040);
	opacity: 0.65;
	outline: none;
}

/* ── Play / Pause ─────────────────────────────────────────────────────── */

.ssps-hl__btn--play,
.ssps-hl__btn--pause {
	width: 1.9em;
	height: 1.9em;
	border: 2px solid var(--at-border, #404040) !important;
	border-radius: var(--at-radius, 5px);
	padding: 0.32em;
	color: var(--at-border, #404040);
	transition: background 0.1s, color 0.1s;
}

.ssps-hl__btn--play svg,
.ssps-hl__btn--pause svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Play triangle is optically off-center; nudge it right */
.ssps-hl__btn--play svg {
	transform: translateX(0.08em);
}

/* Invert: dark box, highlight-yellow icon — uses both theme colors */
.ssps-hl__btn--play:hover,
.ssps-hl__btn--pause:hover,
.ssps-hl__btn--play:focus-visible,
.ssps-hl__btn--pause:focus-visible {
	background: var(--at-border, #404040);
	color: var(--at-highlight, #f4e28a);
	opacity: 1;
}

/* ── Skip buttons ─────────────────────────────────────────────────────── */

.ssps-hl__btn--rwd,
.ssps-hl__btn--fwd {
	letter-spacing: -0.01em;
}

/* ── Progress bar ─────────────────────────────────────────────────────── */

.ssps-hl__progress {
	flex: 1;
	min-width: 40px;
	cursor: pointer;
	/* expand vertical hit area without affecting layout */
	padding: 9px 0;
	margin: -9px 0;
	position: relative;
}

.ssps-hl__progress-track {
	height: 2px;
	background: rgba(64, 64, 64, 0.25);
	position: relative;
}

.ssps-hl__progress-fill {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 0%;
	background: currentColor;
}

.ssps-hl__progress-bead {
	position: absolute;
	top: 50%;
	left: 0%;
	width: 11px;
	height: 11px;
	background: var(--at-border, #404040);
	border: 2px solid var(--at-highlight, #f4e28a);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
	transition: transform 0.1s;
}

.ssps-hl__progress:hover .ssps-hl__progress-bead {
	transform: translate(-50%, -50%) scale(1.25);
}

/* Loading animation — bar that sweeps back and forth */
.ssps-hl__loader {
	position: absolute;
	top: 0;
	left: 0;
	height: 2px;
	width: 30%;
	background: currentColor;
	opacity: 0.5;
	animation: ssps-hl-loading 1.1s ease-in-out infinite alternate;
}

@keyframes ssps-hl-loading {
	from { left: 0;   width: 25%; }
	to   { left: 75%; width: 25%; }
}

/* ── Time display ─────────────────────────────────────────────────────── */

.ssps-hl__time {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	flex-shrink: 0;
	letter-spacing: 0.01em;
}

/* ── Speed button ─────────────────────────────────────────────────────── */

.ssps-hl__btn--speed {
	min-width: 2.2em;
	text-align: center;
}

/* ── Mute button ──────────────────────────────────────────────────────── */

.ssps-hl__btn--mute {
	width: 1.15em;
	height: 1.15em;
}

.ssps-hl__btn--mute svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ── Error state ──────────────────────────────────────────────────────── */

.ssps-hl__error {
	margin: 0.5em 0 0;
	font-style: italic;
	opacity: 0.7;
}

/* ── Utility ──────────────────────────────────────────────────────────── */

.ssps-hl--hidden {
	display: none !important;
}

/* ── Narrow screens — match child theme's .callout-box breakpoint ─────── */

@media only screen and (max-width: 430px) {
	.ssps-hl {
		padding: 0.5rem 1rem;
	}

	.ssps-hl__btn--rwd,
	.ssps-hl__btn--fwd,
	.ssps-hl__btn--speed {
		display: none;
	}
}
