/* TypeTester
   The chrome (controls / labels / pills) inherits the Lay Theme frontend
   typography and renders in black in light mode. Only the specimen shows the
   tested webfont — and it is driven entirely through CSS variables applied with
   !important + high specificity, so the theme's text-format typography (applied
   to content inside .lay-textformat-parent) cannot override the uploaded font. */

.lay-typetester {
	--tt-ink: #000;
	--tt-line: rgba(0, 0, 0, 0.25);
	--tt-bg: transparent;
	width: 100%;
	box-sizing: border-box;
	font-family: inherit; /* adopt the Lay Theme interface font */
	color: var(--tt-ink);
}

.lay-typetester *,
.lay-typetester *::before,
.lay-typetester *::after {
	box-sizing: border-box;
}

/* ---- specimen (on top) ---- */

.lay-typetester-stage {
	background: var(--tt-bg);
	transition: background 0.2s;
}

.lay-typetester .lay-typetester-stage .lay-typetester-input {
	font-family: var(--tt-family), sans-serif !important;
	font-size: var(--tt-size, 80px) !important;
	line-height: var(--tt-lh, 1.1) !important;
	letter-spacing: var(--tt-ls, 0) !important;
	text-align: var(--tt-align, left) !important;
	font-feature-settings: var(--tt-feat, "liga" 1) !important;
	-webkit-font-feature-settings: var(--tt-feat, "liga" 1) !important;
	color: var(--tt-ink) !important;
	margin: 0 !important;
	padding: 8px 0;
	min-height: 1em;
	outline: none;
	word-break: break-word;
	overflow-wrap: break-word;
}
.lay-typetester .lay-typetester-stage .lay-typetester-input:focus {
	outline: none;
}

/* ---- controls (below the specimen) ---- */

.lay-typetester-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 18px 28px;
	margin-top: 26px;
	padding-top: 18px;
	border-top: 1px solid var(--tt-line);
	font-family: inherit;
	color: var(--tt-ink);
}

.lay-tt-control {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.lay-tt-label {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 12px;
	line-height: 1.2;
	color: var(--tt-ink);
	white-space: nowrap;
}

.lay-tt-val {
	color: var(--tt-ink);
	font-variant-numeric: tabular-nums;
	opacity: 0.6;
}

/* range sliders */
.lay-tt-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 160px;
	height: 1px;
	background: var(--tt-ink);
	outline: none;
	margin: 9px 0;
	cursor: pointer;
}
.lay-tt-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--tt-ink);
	border: none;
	cursor: pointer;
}
.lay-tt-slider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--tt-ink);
	border: none;
	cursor: pointer;
}

/* icon + text buttons */
.lay-tt-btn,
.lay-tt-font-btn {
	font-family: inherit;
	font-size: 13px;
	line-height: 1;
	color: var(--tt-ink);
	background: transparent;
	border: 1px solid var(--tt-line);
	border-radius: 2px;
	padding: 7px 10px;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lay-tt-btn:hover,
.lay-tt-font-btn:hover {
	border-color: var(--tt-ink);
}
.lay-tt-btn.is-active,
.lay-tt-font-btn.is-active {
	background: var(--tt-ink);
	color: #fff;
	border-color: var(--tt-ink);
}

.lay-tt-fonts,
.lay-tt-align {
	flex-direction: row;
	gap: 6px;
}

/* ---- OpenType feature toggles (pills, below the controls) ---- */

.lay-typetester-features {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
	font-family: inherit;
}
.lay-tt-feature {
	display: inline-flex;
	cursor: pointer;
	user-select: none;
}
.lay-tt-feature input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}
.lay-tt-feature span {
	display: inline-block;
	font-size: 12px;
	line-height: 1;
	padding: 7px 11px;
	border: 1px solid var(--tt-line);
	border-radius: 999px;
	color: var(--tt-ink);
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lay-tt-feature:hover span {
	border-color: var(--tt-ink);
}
.lay-tt-feature input:checked + span {
	background: var(--tt-ink);
	border-color: var(--tt-ink);
	color: #fff;
}
.lay-tt-feature input:focus-visible + span {
	outline: 2px solid var(--tt-ink);
	outline-offset: 2px;
}

/* ---- inverted mode: flips only the specimen box; the controls below stay
   readable on the normal (light) page background ---- */

.lay-typetester.is-inverted .lay-typetester-stage {
	--tt-ink: #fff;
	background: #111;
	padding: 24px 20px;
}

/* ---- small screens ---- */

@media (max-width: 600px) {
	.lay-tt-slider {
		width: 130px;
	}
	.lay-typetester-controls {
		gap: 14px 20px;
	}
}
