/*
 * WS PressPlay
 *
 * The icons are inline SVG masks painted in the link's own colour, sized in em
 * so they follow the link's font size. Selectors match PressPlay Lite, so
 * existing custom CSS that targets them still applies.
 */

a.sm2_button .btn-pressplay {
	--ws-pressplay-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3v18l16-9z'/%3E%3C/svg%3E");
	--ws-pressplay-play-outline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.75 4.3v15.4L19.2 12z' fill='none' stroke='black' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E");
	--ws-pressplay-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h5v18H5zM14 3h5v18h-5z'/%3E%3C/svg%3E");
	--ws-pressplay-pause-outline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.75 3.75h3.5v16.5h-3.5zM14.75 3.75h3.5v16.5h-3.5z' fill='none' stroke='black' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E");
	--ws-pressplay-icon: var(--ws-pressplay-play-outline);

	display: inline-block;
	width: 1em;
	height: 1em;
	margin-inline-end: 0.3em;
	vertical-align: -0.125em;
	background-color: currentColor;
	-webkit-mask: var(--ws-pressplay-icon) center / contain no-repeat;
	mask: var(--ws-pressplay-icon) center / contain no-repeat;
}

/* Resting states show what the audio is doing. */
a.sm2_button.sm2_playing .btn-pressplay {
	--ws-pressplay-icon: var(--ws-pressplay-play);
}

a.sm2_button.sm2_paused .btn-pressplay {
	--ws-pressplay-icon: var(--ws-pressplay-pause-outline);
}

/* Hover and keyboard focus show what a click will do. */
a.sm2_button:focus-visible .btn-pressplay {
	--ws-pressplay-icon: var(--ws-pressplay-play);
}

a.sm2_button.sm2_playing:focus-visible .btn-pressplay {
	--ws-pressplay-icon: var(--ws-pressplay-pause);
}

a.sm2_button.sm2_paused:focus-visible .btn-pressplay {
	--ws-pressplay-icon: var(--ws-pressplay-play-outline);
}

@media (hover: hover) {
	a.sm2_button:hover .btn-pressplay {
		--ws-pressplay-icon: var(--ws-pressplay-play);
	}

	a.sm2_button.sm2_playing:hover .btn-pressplay {
		--ws-pressplay-icon: var(--ws-pressplay-pause);
	}

	a.sm2_button.sm2_paused:hover .btn-pressplay {
		--ws-pressplay-icon: var(--ws-pressplay-play-outline);
	}
}

/* Touch screens have no hover, so a playing link shows the pause it offers. */
@media (hover: none) {
	a.sm2_button.sm2_playing .btn-pressplay {
		--ws-pressplay-icon: var(--ws-pressplay-pause);
	}
}

@media (forced-colors: active) {
	a.sm2_button .btn-pressplay {
		forced-color-adjust: none;
		background-color: LinkText;
	}
}
