/*
 * Dhivehi TTS player — ElevenLabs-inspired.
 * Off-white/white editorial card, near-black ink play control, pastel gradient
 * waveform. Right-to-left. Colors are scoped to --dtts-* so the theme is left
 * untouched.
 */
.dtts-player {
	--dtts-ink: #0c0a09;
	--dtts-ink-2: #292524;
	--dtts-body: #4e4e4e;
	--dtts-muted: #777169;
	--dtts-surface: #ffffff;
	--dtts-surface-strong: #f0efed;
	--dtts-hairline: #e7e5e4;
	--dtts-hairline-strong: #d6d3d1;
	--dtts-mint: #a7e5d3;
	--dtts-sky: #a8c8e8;
	--dtts-lavender: #c8b8e0;
	--dtts-peach: #f4c5a8;
	--dtts-radius: 16px;
	--dtts-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
	--dtts-num: -apple-system, "Inter", "Segoe UI", system-ui, sans-serif;

	display: flex;
	align-items: center;
	gap: 16px;
	margin: 0 0 28px;
	padding: 14px 16px;
	background: var(--dtts-surface);
	border: 1px solid var(--dtts-hairline);
	border-radius: var(--dtts-radius);
	box-shadow: var(--dtts-shadow);
	box-sizing: border-box;
}

.dtts-player * {
	box-sizing: border-box;
}

/* Play / pause — near-black ink circle */
.dtts-play {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 9999px;
	background: var(--dtts-ink);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	padding: 0;
	transition: transform .15s ease, background .15s ease;
}
.dtts-play:hover { background: #000; transform: scale(1.04); }
.dtts-play:active { transform: scale(0.97); }
.dtts-play:focus-visible { outline: 2px solid var(--dtts-ink); outline-offset: 2px; }
.dtts-play svg { width: 22px; height: 22px; fill: currentColor; display: block; }
.dtts-ic { display: none; line-height: 0; }
.dtts-ic--play { display: block; }
.dtts-player.is-playing .dtts-ic--play { display: none; }
.dtts-player.is-playing .dtts-ic--pause { display: block; }

/* Body */
.dtts-body {
	flex: 1 1 auto;
	min-width: 0;
}
.dtts-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}
.dtts-label {
	color: var(--dtts-ink);
	font-weight: 600;
	font-size: 1rem;
	line-height: 1.3;
	/* Inherit the theme's Thaana font for the label. */
}
.dtts-time {
	flex: 0 0 auto;
	font-family: var(--dtts-num);
	font-size: 12px;
	letter-spacing: .02em;
	color: var(--dtts-muted);
	font-variant-numeric: tabular-nums;
	direction: ltr;
}

/* Waveform */
.dtts-wave {
	position: relative;
	height: 34px;
	cursor: pointer;
	touch-action: none;
	outline: none;
}
.dtts-wave-base,
.dtts-wave-played-inner {
	position: absolute;
	inset-block: 0;
	inset-inline: 0;
	display: flex;
	align-items: center;
	gap: 2px;
}
.dtts-wave-played {
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	inline-size: 0%;
	overflow: hidden;
	pointer-events: none;
}
.dtts-wave-played-inner {
	/* Width is set to the full wave width in JS so bars align with the base. */
	inset-inline: auto;
	inset-inline-start: 0;
}
.dtts-bar {
	flex: 1 1 0;
	min-width: 2px;
	border-radius: 2px;
	background: var(--dtts-hairline-strong);
}
.dtts-wave-played-inner .dtts-bar {
	background: linear-gradient(180deg, var(--dtts-sky), var(--dtts-lavender) 55%, var(--dtts-mint));
}
.dtts-wave:focus-visible { box-shadow: 0 0 0 2px var(--dtts-ink); border-radius: 6px; }

/* Speed pill */
.dtts-speed {
	flex: 0 0 auto;
	border: 1px solid var(--dtts-hairline-strong);
	background: var(--dtts-surface-strong);
	color: var(--dtts-ink-2);
	border-radius: 9999px;
	padding: 6px 12px;
	font-family: var(--dtts-num);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	cursor: pointer;
	direction: ltr;
	transition: background .15s ease;
}
.dtts-speed:hover { background: #e8e6e3; }
.dtts-speed:focus-visible { outline: 2px solid var(--dtts-ink); outline-offset: 2px; }

/* Small screens */
@media (max-width: 480px) {
	.dtts-player { gap: 12px; padding: 12px; }
	.dtts-play { width: 44px; height: 44px; }
	.dtts-speed { padding: 6px 10px; }
}

/* Dark mode: fall back to the brand's dark surfaces */
@media (prefers-color-scheme: dark) {
	.dtts-player:not([data-force-light]) {
		--dtts-surface: #1c1917;
		--dtts-surface-strong: #292524;
		--dtts-hairline: #292524;
		--dtts-hairline-strong: #3a3531;
		--dtts-ink: #f5f5f5;
		--dtts-ink-2: #e7e5e4;
		--dtts-muted: #a8a29e;
		--dtts-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
	}
	.dtts-player:not([data-force-light]) .dtts-play { background: #f5f5f5; color: #0c0a09; }
	.dtts-player:not([data-force-light]) .dtts-play:hover { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
	.dtts-play { transition: none; }
}
