/* DJ-Accessibility – Text reader */

/* Text being read */
::highlight(djacc-tts) {
	background-color: #ffe14d;
	color: #111;
}

.djacc-tts-current {
	outline: 2px dashed #2d79ff !important;
	outline-offset: 4px !important;
	border-radius: 2px;
}

/* Clicking text starts reading, so show that it can be clicked */
.djacc-tts-on body {
	cursor: default;
}

.djacc-tts-on p:hover,
.djacc-tts-on li:hover,
.djacc-tts-on h1:hover,
.djacc-tts-on h2:hover,
.djacc-tts-on h3:hover,
.djacc-tts-on h4:hover,
.djacc-tts-on h5:hover,
.djacc-tts-on h6:hover,
.djacc-tts-on td:hover,
.djacc-tts-on blockquote:hover {
	cursor: pointer;
}

/*
 * DJ-Accessibility panel on phones: never taller than the visible screen (the height is computed in
 * djacc-tts.js; dvh is the fallback). It scrolls inside, and the header with the close button stays
 * on top while scrolling.
 */
.djacc-popup.djacc--sticky .djacc__panel {
	max-height: calc(100vh - 40px) !important;
	max-height: var(--djacc-tts-panel-max, calc(100dvh - 40px)) !important;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.djacc-popup .djacc__header {
	position: sticky;
	top: -16px;
	z-index: 2;
	margin-top: -16px;
	padding-top: 16px;
	background: inherit;
}

/* Player bar */
.djacc-tts-player {
	--djacc-tts-bg: #242424;
	--djacc-tts-fg: #fff;
	--djacc-tts-btn: #2f2f2f;
	--djacc-tts-border: #353536;
	--djacc-tts-accent: #2d79ff;

	position: fixed;
	z-index: 100000;
	left: 50%;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	max-width: calc(100vw - 32px);
	padding: 8px;
	border-radius: 40px;
	background: var(--djacc-tts-bg);
	color: var(--djacc-tts-fg);
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25);
	font: 500 14px/1.2 Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	letter-spacing: normal;
	text-transform: none;
}

.djacc-tts-player[hidden],
.djacc-tts-player [hidden] {
	display: none !important;
}

.djacc-tts-player--light {
	--djacc-tts-bg: #fff;
	--djacc-tts-fg: #404042;
	--djacc-tts-btn: #f8f9fc;
	--djacc-tts-border: #ebecf1;
}

.djacc-tts-player * {
	box-sizing: border-box;
}

.djacc-tts-player__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 44px;
	height: 44px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid var(--djacc-tts-border);
	border-radius: 22px;
	background: var(--djacc-tts-btn);
	color: inherit;
	font: inherit;
	line-height: 1;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.djacc-tts-player__btn:hover {
	border-color: var(--djacc-tts-accent);
}

.djacc-tts-player__btn:disabled {
	opacity: 0.4;
	cursor: default;
	border-color: var(--djacc-tts-border);
}

.djacc-tts-player__btn:focus-visible,
.djacc-tts-player select:focus-visible {
	outline: 3px solid #ffe14d !important;
	outline-offset: 2px !important;
}

.djacc-tts-player__play {
	padding: 0 18px 0 14px;
	background: var(--djacc-tts-accent);
	border-color: var(--djacc-tts-accent);
	color: #fff;
}

.djacc-tts-player__play:hover {
	background: #1f6bf0;
}

.djacc-tts-player__field {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 4px 0 4px;
	font: inherit;
	color: inherit;
}

.djacc-tts-player__field span {
	opacity: 0.75;
}

/* Own look instead of the native control, so the bar looks the same in Safari, Chrome and Firefox */
.djacc-tts-player select {
	-webkit-appearance: none;
	appearance: none;
	height: 44px;
	min-width: 72px;
	margin: 0;
	padding: 0 28px 0 14px;
	border: 1px solid var(--djacc-tts-border);
	border-radius: 22px;
	background: var(--djacc-tts-btn) var(--djacc-tts-chevron) no-repeat right 10px center / 12px 12px;
	color: inherit;
	font: inherit;
	line-height: 1;
	box-shadow: none;
	cursor: pointer;
}

.djacc-tts-player {
	--djacc-tts-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.djacc-tts-player--light {
	--djacc-tts-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23404042' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.djacc-tts-player select:hover {
	border-color: var(--djacc-tts-accent);
}

@media (max-width: 600px) {
	.djacc-tts-player {
		bottom: calc(8px + env(safe-area-inset-bottom, 0px));
		width: max-content;
		max-width: calc(100vw - 16px);
		flex-wrap: nowrap;
		gap: 6px;
		padding: 6px;
		border-radius: 30px;
	}

	/* Icons only: the bar has to fit in one row on a phone */
	.djacc-tts-player__label,
	.djacc-tts-player__field span {
		display: none;
	}

	.djacc-tts-player__btn {
		min-width: 46px;
		height: 46px;
		padding: 0 10px;
	}

	.djacc-tts-player__play {
		padding: 0 14px;
	}

	.djacc-tts-player__field {
		margin: 0;
	}

	.djacc-tts-player select {
		height: 46px;
		border-radius: 23px;
		padding: 0 24px 0 12px;
		background-position: right 8px center;
	}
}

@media (max-width: 340px) {
	.djacc-tts-player {
		gap: 4px;
		padding: 4px;
	}

	.djacc-tts-player__btn {
		min-width: 42px;
		height: 42px;
		padding: 0 8px;
	}

	.djacc-tts-player select {
		height: 42px;
	}
}

@media (forced-colors: active) {
	.djacc-tts-player {
		border: 2px solid CanvasText;
	}

	.djacc-tts-current {
		outline-color: Highlight !important;
	}
}

@media print {
	.djacc-tts-player {
		display: none !important;
	}
}
