/* Read Mode player
   Consumes the theme's own tokens where they exist, with fallbacks so the
   plugin still looks right if it is ever used on another theme. */

:root {
	--rm-accent: var(--accent, #3458FA);
	--rm-pink: var(--data, #EC4899);
	--rm-pink-soft: var(--data-soft, #FCE7F3);
	--rm-highlight: var(--data-soft, #FCE7F3);
	--rm-highlight-edge: var(--data, #EC4899);
}

.rm-player {
	--rm-ink: var(--ink, #131B2E);
	--rm-muted: var(--muted, #5B6478);
	--rm-line: var(--line, #E3E9F5);
	--rm-line-strong: var(--line-strong, #C7D0E8);
	--rm-paper: var(--paper, #fff);
	--rm-radius: var(--radius, 14px);

	margin: 0 0 1.75rem;
	font-family: var(--display, system-ui, sans-serif);
	font-size: 15px;
}

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

/* Bar */

.rm-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--rm-paper);
	border: 1px solid var(--rm-line);
	border-radius: 999px;
	padding: 0.5rem 0.9rem;
	box-shadow: var(--sh-card, 0 2px 10px rgba(52, 88, 250, 0.07));
	position: sticky;
	top: 12px;
	z-index: 20;
}

.rm-bar button {
	appearance: none;
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid transparent;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--rm-ink);
	padding: 0;
}

.rm-bar button:hover,
.rm-bar button:focus-visible {
	border-color: var(--rm-line-strong);
}

.rm-play {
	background: var(--rm-accent) !important;
	color: #fff;
	width: 40px !important;
	height: 40px !important;
}

.rm-play:hover {
	background: var(--accent-hover, #2B49E0) !important;
}

.rm-icon-play {
	width: 0;
	height: 0;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
	border-left: 10px solid #fff;
	margin-left: 3px;
}

.rm-player.is-playing .rm-icon-play {
	width: 10px;
	height: 12px;
	border: 0;
	margin-left: 0;
	background: linear-gradient( to right, #fff 0 3px, transparent 3px 7px, #fff 7px 10px );
}

.rm-icon-prev,
.rm-icon-next {
	width: 0;
	height: 0;
	border-top: 5px solid transparent;
	border-bottom: 5px solid transparent;
}

.rm-icon-prev { border-right: 8px solid currentColor; }
.rm-icon-next { border-left: 8px solid currentColor; }

/* Progress, in the site pink */

.rm-progress {
	flex: 1 1 auto;
	height: 5px;
	min-width: 60px;
	background: var(--rm-line);
	border-radius: 999px;
	overflow: hidden;
	cursor: pointer;
}

.rm-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--rm-pink);
	border-radius: 999px;
	transition: width 0.25s linear;
}

.rm-time {
	font-family: var(--mono, ui-monospace, monospace);
	font-size: 0.78em;
	color: var(--rm-muted);
	font-variant-numeric: tabular-nums;
	flex: 0 0 auto;
	white-space: nowrap;
}

.rm-total {
	opacity: 0.65;
}

/* Volume */

.rm-volume {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
}

/* Icons */

.rm-svg {
	width: 19px;
	height: 19px;
	display: block;
}

.rm-svg-cone {
	fill: currentColor;
}

.rm-svg-wave {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
}

.rm-svg-cross {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	opacity: 0;
}

/* Quieter than half volume drops the outer wave, muted swaps both for a cross. */
.is-muted .rm-svg-wave,
.is-low .rm-svg-wave-2 {
	opacity: 0;
}

.is-muted .rm-svg-cross {
	opacity: 1;
}

.rm-mute.is-muted,
.rm-mini-mute.is-muted {
	color: var(--rm-muted);
}

.rm-svg-bars {
	fill: currentColor;
	opacity: 0;
}

.rm-svg-triangle {
	fill: currentColor;
}

.rm-player.is-playing .rm-svg-bars {
	opacity: 1;
}

.rm-player.is-playing .rm-svg-triangle {
	opacity: 0;
}

.rm-volume-slider {
	appearance: none;
	width: 68px;
	height: 4px;
	border-radius: 999px;
	background: linear-gradient(
		to right,
		var(--rm-accent) 0 var(--rm-vol, 100%),
		var(--rm-line) var(--rm-vol, 100%) 100%
	);
	cursor: pointer;
}

.rm-volume-slider::-webkit-slider-thumb {
	appearance: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--rm-accent);
	border: 2px solid var(--rm-paper);
	box-shadow: 0 0 0 1px var(--rm-line-strong);
}

.rm-volume-slider::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--rm-accent);
	border: 2px solid var(--rm-paper);
}

.rm-speed-select {
	font: inherit;
	font-size: 0.78em;
	border: 1px solid var(--rm-line);
	border-radius: 8px;
	background: var(--rm-paper);
	color: var(--rm-ink);
	padding: 4px 6px;
	cursor: pointer;
}

.rm-icon-follow {
	width: 13px;
	height: 13px;
	border: 2px solid currentColor;
	border-radius: 50%;
	position: relative;
}

.rm-icon-follow::after {
	content: "";
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: currentColor;
}

.rm-follow[aria-pressed="false"] {
	color: var(--rm-muted);
	opacity: 0.55;
}

.rm-follow[aria-pressed="true"] {
	color: var(--rm-accent);
}

@media (max-width: 782px) {
	.rm-volume,
	.rm-speed,
	.rm-total {
		display: none;
	}
}

/* The section being read */

[data-rm-block].rm-active {
	position: relative;
	background: var(--rm-highlight, #FCE7F3);
	box-shadow:
		-0.6em 0 0 var(--rm-highlight, #FCE7F3),
		0.6em 0 0 var(--rm-highlight, #FCE7F3);
	border-radius: 2px;
	transition: background 0.25s ease;
}

[data-rm-block].rm-active::before {
	content: "";
	position: absolute;
	left: -1.1em;
	top: 0;
	bottom: 0;
	width: 3px;
	border-radius: 2px;
	background: var(--rm-highlight-edge, #EC4899);
}

@media (prefers-reduced-motion: reduce) {
	[data-rm-block].rm-active,
	.rm-progress-fill {
		transition: none;
	}
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}


/* Floating controls, for when the bar has scrolled out of reach */

/* The hidden attribute is display:none from the user agent stylesheet, and any
   author display declaration beats it. Without this the panel below is visible
   on load no matter what the markup says. */
.rm-mini[hidden],
.rm-mini-slider[hidden] {
	display: none !important;
}

.rm-mini {
	position: fixed;
	z-index: 30;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 8px 6px;
	background: var(--rm-paper, #fff);
	border: 1px solid var(--rm-line, #E3E9F5);
	border-radius: 999px;
	box-shadow: var(--sh-lift, 0 12px 28px -8px rgba(52, 88, 250, 0.24));
	animation: rm-mini-in 0.18s ease;
}

@keyframes rm-mini-in {
	from { opacity: 0; transform: translateX(-6px); }
	to   { opacity: 1; transform: none; }
}

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

.rm-mini button {
	appearance: none;
	border: 0;
	background: transparent;
	padding: 0;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--rm-ink, #131B2E);
}

.rm-mini button:hover,
.rm-mini button:focus-visible {
	background: var(--accent-soft, #E9EDFE);
	color: var(--rm-accent);
}

/* Triangles for stepping through sections, as in the reference. */
.rm-caret {
	width: 0;
	height: 0;
	border-left: 7px solid transparent;
	border-right: 7px solid transparent;
}

.rm-caret-up {
	border-bottom: 9px solid currentColor;
}

.rm-caret-down {
	border-top: 9px solid currentColor;
}

.rm-mini-play {
	width: 40px !important;
	height: 40px !important;
	border: 1.6px solid var(--rm-accent) !important;
	color: var(--rm-accent) !important;
}

.rm-mini-play:hover {
	background: var(--rm-accent) !important;
	color: #fff !important;
}

/* Volume opens sideways so it never covers the text being read. */
.rm-mini-volume {
	position: relative;
}

.rm-mini-slider {
	position: absolute;
	left: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%);
	background: var(--rm-paper, #fff);
	border: 1px solid var(--rm-line, #E3E9F5);
	border-radius: 999px;
	padding: 8px 12px;
	box-shadow: var(--sh-card, 0 2px 10px rgba(52, 88, 250, 0.07));
}

.rm-mini-volume-slider {
	appearance: none;
	display: block;
	width: 86px;
	height: 4px;
	border-radius: 999px;
	background: linear-gradient(
		to right,
		var(--rm-accent) 0 var(--rm-vol, 100%),
		var(--rm-line) var(--rm-vol, 100%) 100%
	);
	cursor: pointer;
}

.rm-mini-volume-slider::-webkit-slider-thumb {
	appearance: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--rm-accent);
	border: 2px solid var(--rm-paper);
	box-shadow: 0 0 0 1px var(--rm-line-strong, #C7D0E8);
}

.rm-mini-volume-slider::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--rm-accent);
	border: 2px solid var(--rm-paper);
}

/* No room beside the text on a phone, so dock it in the corner. */
@media (max-width: 900px) {
	.rm-mini {
		top: auto !important;
		left: auto !important;
		right: 14px;
		bottom: 14px;
		flex-direction: row;
	}

	.rm-mini-slider {
		left: auto;
		right: 0;
		top: auto;
		bottom: calc(100% + 8px);
		transform: none;
	}
}
