/*
 * LemkoTran Lektor: same dark smoky glass as the translator block, Lemko Republic flag accents.
 * Selectors are doubled (.ltk.ltk) and button backgrounds use !important because the theme
 * styles everything inside .entry-content at specificity 0,1,4 and forces button backgrounds.
 */

.ltk.ltk {
	--ltk-glass: rgba(11, 20, 38, 0.9);
	--ltk-field: rgba(13, 27, 50, 0.95);
	--ltk-stroke: rgba(210, 225, 255, 0.22);
	--ltk-stroke-strong: rgba(210, 225, 255, 0.4);
	--ltk-hover: rgba(255, 255, 255, 0.08);
	--ltk-text: #f4f7ff;
	--ltk-muted: #bac9e2;
	--ltk-focus: #ffd45c;
	--ltk-error: #ff9c9c;
	--ltk-blue: #6666ff;
	--ltk-gold: #cc9933;
	--ltk-green: #33cc66;
	--ltk-gold-1: #f2cf7e;
	--ltk-gold-2: #cc9933;
	--ltk-ink: #1d1503;
	--ltk-happy: #33cc66;
	--ltk-meh: #f2cf7e;
	--ltk-sad: #ff8a8a;
	--ltk-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;

	box-sizing: border-box;
	max-width: 760px;
	margin-inline: auto;
	color: var(--ltk-text);
	font-family: var(--ltk-font);
	font-size: 16px;
	line-height: 1.5;
}

.ltk.ltk *,
.ltk.ltk *::before,
.ltk.ltk *::after {
	box-sizing: border-box;
	font-family: inherit;
}

.ltk.ltk .ltk__card {
	background: var(--ltk-glass);
	border: 1px solid var(--ltk-stroke);
	border-radius: 22px;
	padding: clamp(18px, 4vw, 32px);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
	-webkit-backdrop-filter: blur(22px);
	backdrop-filter: blur(22px);
}

.ltk.ltk .ltk__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 6px;
}

/* Lemko Republic flag: blue, gold, green */
.ltk.ltk .ltk__flag {
	width: 28px;
	height: 18px;
	border-radius: 3px;
	flex: none;
	background: linear-gradient(var(--ltk-blue) 0 33.4%, var(--ltk-gold) 33.4% 66.7%, var(--ltk-green) 66.7%);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.ltk.ltk .ltk__kicker {
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ltk-gold-1);
}

.ltk.ltk .ltk__lead {
	margin: 0 0 18px;
	color: var(--ltk-muted);
	font-size: 1.02rem;
}

.ltk.ltk .ltk__notice,
.ltk.ltk .ltk__gate p {
	margin: 0 0 14px;
}

.ltk.ltk .ltk__gate-actions,
.ltk.ltk .ltk__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.ltk.ltk .ltk__actions {
	justify-content: space-between;
	margin-top: 14px;
}

.ltk.ltk .ltk__label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
}

/* Letter keys */
.ltk.ltk .ltk__letters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 8px;
}

.ltk.ltk .ltk-key {
	min-width: 40px;
	min-height: 40px;
	padding: 0 10px;
	border: 1px solid var(--ltk-stroke) !important;
	border-radius: 10px;
	background: var(--ltk-field) !important;
	background-color: var(--ltk-field) !important;
	color: var(--ltk-text) !important;
	font-size: 1.1rem;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	text-transform: none;
	letter-spacing: 0;
}

.ltk.ltk .ltk-key:hover {
	border-color: var(--ltk-stroke-strong) !important;
	background-color: #1a2a48 !important;
}

.ltk.ltk .ltk__text,
.ltk.ltk .ltk__note-text {
	display: block;
	width: 100%;
	min-height: 150px;
	padding: 14px 16px;
	border: 1px solid var(--ltk-stroke-strong);
	border-radius: 14px;
	background: var(--ltk-field);
	color: var(--ltk-text);
	font-size: 1.15rem;
	line-height: 1.55;
	resize: vertical;
}

.ltk.ltk .ltk__note-text {
	min-height: 64px;
	font-size: 1rem;
}

.ltk.ltk .ltk__text::placeholder,
.ltk.ltk .ltk__note-text::placeholder {
	color: rgba(186, 201, 226, 0.6);
}

.ltk.ltk .ltk__meta {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 16px;
	margin-top: 6px;
	font-size: 0.88rem;
	color: var(--ltk-muted);
}

.ltk.ltk .ltk__meta .is-over {
	color: var(--ltk-error);
	font-weight: 600;
}

.ltk.ltk .ltk__hint,
.ltk.ltk .ltk__fine {
	margin: 8px 0 0;
	font-size: 0.86rem;
	color: var(--ltk-muted);
}

.ltk.ltk .ltk__fine a {
	color: var(--ltk-gold-1);
	text-decoration: underline;
}

.ltk.ltk .ltk__fine--foot {
	margin-top: 22px;
	padding-top: 14px;
	border-top: 1px solid var(--ltk-stroke);
}

/* Buttons */
.ltk.ltk .ltk-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 0 20px;
	border: 1px solid var(--ltk-stroke-strong) !important;
	border-radius: 999px;
	background: transparent !important;
	background-color: transparent !important;
	color: var(--ltk-text) !important;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none !important;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}

.ltk.ltk .ltk-btn:hover {
	background-color: var(--ltk-hover) !important;
}

.ltk.ltk .ltk-btn--primary {
	border-color: transparent !important;
	background: linear-gradient(180deg, var(--ltk-gold-1), var(--ltk-gold-2)) !important;
	background-color: var(--ltk-gold-2) !important;
	color: var(--ltk-ink) !important;
	padding: 0 28px;
}

.ltk.ltk .ltk-btn--primary:hover {
	filter: brightness(1.06);
}

.ltk.ltk .ltk-btn[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.ltk.ltk.is-busy .ltk__go::before {
	content: "";
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ltk-spin 0.8s linear infinite;
}

@keyframes ltk-spin {
	to { transform: rotate(360deg); }
}

/* Voice switch */
.ltk.ltk .ltk__voices {
	display: inline-flex;
	padding: 4px;
	border: 1px solid var(--ltk-stroke);
	border-radius: 999px;
	background: var(--ltk-field);
}

.ltk.ltk .ltk-voice {
	min-height: 38px;
	padding: 0 16px;
	border: 0 !important;
	border-radius: 999px;
	background: transparent !important;
	background-color: transparent !important;
	color: var(--ltk-muted) !important;
	font-size: 0.95rem;
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}

.ltk.ltk .ltk-voice[aria-checked="true"] {
	background-color: rgba(102, 102, 255, 0.35) !important;
	color: var(--ltk-text) !important;
	box-shadow: inset 0 0 0 1px rgba(160, 160, 255, 0.6);
}

/* Status */
.ltk.ltk .ltk__status {
	min-height: 1.5em;
	margin: 12px 0 0;
	font-size: 0.95rem;
	color: var(--ltk-muted);
}

.ltk.ltk .ltk__status.is-error {
	color: var(--ltk-error);
}

/* Result */
.ltk.ltk .ltk__result {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 14px;
	margin-top: 10px;
	padding: 16px;
	border: 1px solid var(--ltk-stroke);
	border-radius: 16px;
	background: rgba(13, 27, 50, 0.6);
}

.ltk.ltk .ltk__result[hidden] {
	display: none;
}

.ltk.ltk .ltk__audio {
	width: 100%;
	min-width: 0;
	height: 44px;
}

/* "Try another take" sits under Download MP3, in the same column */
.ltk.ltk .ltk__retake {
	grid-column: 2;
}

.ltk.ltk .ltk__rate {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 14px;
	padding-top: 12px;
	border-top: 1px solid var(--ltk-stroke);
}

.ltk.ltk .ltk__rate-label {
	font-weight: 600;
}

.ltk.ltk .ltk__faces {
	display: inline-flex;
	gap: 4px;
}

.ltk.ltk .ltk-face {
	display: inline-flex;
	padding: 4px;
	border: 0 !important;
	border-radius: 50%;
	background: transparent !important;
	background-color: transparent !important;
	color: var(--ltk-muted) !important;
	cursor: pointer;
	line-height: 0;
}

.ltk.ltk .ltk-face:hover {
	background-color: var(--ltk-hover) !important;
}

.ltk.ltk .ltk-face--happy[aria-checked="true"] { color: var(--ltk-happy) !important; }
.ltk.ltk .ltk-face--meh[aria-checked="true"] { color: var(--ltk-meh) !important; }
.ltk.ltk .ltk-face--sad[aria-checked="true"] { color: var(--ltk-sad) !important; }

.ltk.ltk .ltk__rate .ltk__fine {
	flex-basis: 100%;
	margin: 0;
}

.ltk.ltk .ltk__note {
	flex-basis: 100%;
	display: grid;
	gap: 8px;
	justify-items: start;
}

.ltk.ltk .ltk__note[hidden] {
	display: none;
}

.ltk.ltk .ltk__note-label {
	font-size: 0.95rem;
}

.ltk.ltk button:focus-visible,
.ltk.ltk a:focus-visible,
.ltk.ltk textarea:focus-visible {
	outline: 3px solid var(--ltk-focus);
	outline-offset: 2px;
}

@media (max-width: 560px) {
	.ltk.ltk .ltk__result {
		grid-template-columns: 1fr;
	}
	.ltk.ltk .ltk__retake {
		grid-column: auto;
	}
	.ltk.ltk .ltk__actions {
		flex-direction: column;
		align-items: stretch;
	}
	.ltk.ltk .ltk__voices {
		align-self: flex-start;
	}
	.ltk.ltk .ltk__go {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ltk.ltk.is-busy .ltk__go::before {
		animation: none;
	}
}

.ltk.ltk .ltk__more {
	margin-top: 4px;
}

.ltk.ltk .ltk__ask {
	flex-basis: 100%;
	margin: 0;
	color: var(--ltk-text);
	font-size: 0.95rem;
}

/* Quick letters + keyboard toggle */
.ltk.ltk .ltk__letters {
	align-items: center;
}

.ltk.ltk .ltk__quick {
	display: contents;
}

.ltk.ltk .ltk__quick[hidden] {
	display: none;
}

.ltk.ltk .ltk-key--toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: auto;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--ltk-muted) !important;
}

.ltk.ltk .ltk-key--toggle[aria-expanded="true"] {
	color: var(--ltk-text) !important;
	border-color: rgba(160, 160, 255, 0.6) !important;
	background-color: rgba(102, 102, 255, 0.25) !important;
}

/* On-screen keyboard: compact grid, collapsed by default */
.ltk.ltk .ltk__kbd {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
	gap: 4px;
	margin-bottom: 8px;
	padding: 8px;
	border: 1px solid var(--ltk-stroke);
	border-radius: 12px;
	background: rgba(13, 27, 50, 0.6);
}

.ltk.ltk .ltk__kbd[hidden] {
	display: none;
}

.ltk.ltk .ltk__kbd .ltk-key {
	min-width: 0;
	min-height: 36px;
	padding: 0;
	font-size: 1.05rem;
}

.ltk.ltk .ltk__kbd.is-shift .ltk-key {
	text-transform: uppercase;
}

.ltk.ltk .ltk__kbd .ltk-key--space {
	grid-column: span 3;
	color: var(--ltk-muted) !important;
}

.ltk.ltk .ltk-key--fn,
.ltk.ltk .ltk-key--mark {
	color: var(--ltk-muted) !important;
}

.ltk.ltk .ltk-key--fn[aria-pressed="true"] {
	color: var(--ltk-ink) !important;
	background-color: var(--ltk-gold-1) !important;
}

/* Voice figures, coloured as on the translator */
.ltk.ltk .ltk-voice {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.ltk.ltk .ltk-voice[data-value="woman"] .ltk-voice__ico {
	color: #ff5fb0;
}

.ltk.ltk .ltk-voice[data-value="man"] .ltk-voice__ico {
	color: #4f9bff;
}

/* Phones: tighter keys so the keyboard stays about five rows high */
@media (max-width: 560px) {
	.ltk.ltk .ltk__kbd {
		grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
		gap: 3px;
		padding: 6px;
	}
	.ltk.ltk .ltk__kbd .ltk-key {
		min-height: 34px;
		border-radius: 8px;
		font-size: 1rem;
	}
	.ltk.ltk .ltk__kbd .ltk-key--space {
		grid-column: span 2;
	}
}

/* Inside the Lektor page cover (class lt-lektor-hero): card on the left of the wide area so the
   video's speaker stays visible on the right, as on the translator page; the hero headline above
   says what the card's own intro line says, so that line is hidden there. */
.lt-lektor-hero .ltk.ltk {
	max-width: 1200px;
}

.lt-lektor-hero .ltk.ltk .ltk__card {
	max-width: 760px;
	margin: 0;
}

.lt-lektor-hero .ltk.ltk .ltk__lead {
	display: none;
}

.lt-lektor-hero .ltk.ltk .ltk__head {
	margin-bottom: 14px;
}

/* ------------------------------------------------------------------------------------------
 * Cover behind Lektor (class lt-video-hero): the same rules as blocks/translator/style.css,
 * which isn't loaded on Lektor pages. Identical selectors, so both loading is harmless.
 * ------------------------------------------------------------------------------------------ */
.wp-block-cover.lt-video-hero {
	isolation: isolate;
	box-sizing: border-box;
	padding: clamp(18px, 3.2vw, 52px) max(clamp(10px, 3vw, 36px), env(safe-area-inset-right)) clamp(18px, 3.2vw, 52px) max(clamp(10px, 3vw, 36px), env(safe-area-inset-left));
	background: radial-gradient(120% 90% at 70% 20%, #1c2f57 0%, #0b1426 55%, #070d1a 100%);
}

.wp-block-cover.lt-video-hero.has-lt-fallback {
	background: var(--lt-fallback) center / cover no-repeat, #0b1426;
}

.wp-block-cover.lt-video-hero .wp-block-cover__video-background {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	user-select: none;
	opacity: 0;
	transition: opacity 0.6s ease;
}

.wp-block-cover.lt-video-hero.is-playing .wp-block-cover__video-background {
	opacity: 1;
}

.wp-block-cover.lt-video-hero .wp-block-cover__inner-container {
	position: relative;
	z-index: 1;
	width: min(1360px, 100%);
	max-width: 100%;
	margin-inline: auto;
}

@media (max-width: 760px) {
	.wp-block-cover.lt-video-hero {
		padding: 14px max(10px, env(safe-area-inset-right)) 18px max(10px, env(safe-area-inset-left));
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-cover.lt-video-hero .wp-block-cover__video-background {
		display: none;
	}
}

/* Lektor cover: the speaker (mirrored clip) on the right, clear of the card; on phones, centred */
.wp-block-cover.lt-lektor-hero .wp-block-cover__video-background {
	object-position: 0% 15% !important;
}

.wp-block-cover.lt-lektor-hero.has-lt-fallback {
	background-position: 0% 15%;
}

@media (max-width: 760px) {
	.wp-block-cover.lt-lektor-hero .wp-block-cover__video-background {
		object-position: 58% 8% !important;
	}
	.wp-block-cover.lt-lektor-hero.has-lt-fallback {
		background-position: 58% 8%;
	}
}

/* "ы" checkbox (ticked by default) */
.ltk.ltk .ltk__try {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin: 6px 0 0;
	font-size: 0.86rem;
	color: var(--ltk-muted);
	cursor: pointer;
}
.ltk.ltk .ltk__try input {
	margin: 3px 0 0;
	accent-color: var(--ltk-gold-1);
	flex: none;
}
