.tlab-search-popup {
	position: fixed;
	inset: 0;
	z-index: 9998;
	display: none;
	padding: clamp(20px, 4vw, 48px);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--body);
	line-height: inherit;
}

.tlab-search-popup,
.tlab-search-popup * {
	box-sizing: border-box;
}

.tlab-search-popup.is-open {
	display: grid;
	place-items: start center;
}

.tlab-search-popup-open {
	overflow: hidden;
}

.tlab-search-popup__backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--wp--preset--color--dark-surface) 36%, transparent);
	backdrop-filter: blur(8px);
}

.tlab-search-popup__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 18px;
	width: min(640px, calc(100vw - 32px));
	max-height: min(780px, calc(100vh - 40px));
	margin-top: clamp(8px, 2vh, 24px);
	padding: 24px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--overlay);
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--overlay);
}

.tlab-search-popup__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 18px;
	padding-right: 48px;
}

.tlab-search-popup__eyebrow {
	margin: 0 0 12px;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 750;
	letter-spacing: 0.11em;
	line-height: 1.2;
	text-transform: uppercase;
}

.tlab-search-popup__title {
	margin: 0;
	color: var(--wp--preset--color--contrast);
	font-size: clamp(2rem, 4vw, 2.625rem);
	font-weight: 650;
	letter-spacing: -0.025em;
	line-height: 1.05;
}

.tlab-search-popup__close {
	position: absolute;
	top: 24px;
	right: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	background: color-mix(in srgb, var(--wp--preset--color--surface) 76%, var(--wp--preset--color--base));
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	transition:
		background var(--wp--custom--motion--fast) ease,
		color var(--wp--custom--motion--fast) ease,
		border-color var(--wp--custom--motion--fast) ease,
		transform var(--wp--custom--motion--fast) ease;
}

.tlab-search-popup__close:hover {
	background: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	transform: translateY(-1px);
}

.tlab-search-popup__close svg {
	width: 24px;
	height: 24px;
}

.tlab-search-popup__field {
	display: grid;
	gap: 8px;
}

.tlab-search-popup__field span {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 800;
	letter-spacing: 0.06em;
	line-height: 1.2;
	text-transform: uppercase;
}

.tlab-search-popup__input {
	width: 100%;
	height: 54px;
	padding: 0 16px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	outline: none;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-size: var(--wp--preset--font-size--body);
}

.tlab-search-popup__input:focus {
	border-color: var(--wp--preset--color--primary);
	box-shadow:
		0 0 0 4px
		color-mix(in srgb, var(--wp--preset--color--primary) 25%, transparent);
}

.tlab-search-popup__results {
	height: min(420px, 46vh);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 2px 4px 2px 0;
}

.tlab-search-popup__results-inner {
	display: grid;
	gap: 10px;
}

.tlab-search-placeholder {
	width: 100%;
	height: 94px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background: linear-gradient(90deg, var(--wp--preset--color--surface-muted) 0%, var(--wp--preset--color--surface) 50%, var(--wp--preset--color--surface-muted) 100%);
	background-size: 200% 100%;
	animation: tlab-search-placeholder-pulse 1.4s ease-in-out infinite;
}

.tlab-search-result {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr) max-content;
	gap: 14px;
	align-items: center;
	padding: 10px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	transition:
		transform var(--wp--custom--motion--fast) ease,
		border-color var(--wp--custom--motion--fast) ease,
		background var(--wp--custom--motion--fast) ease;
}

.tlab-search-result:hover {
	border-color: color-mix(in srgb, var(--wp--preset--color--contrast) 22%, var(--wp--preset--color--border));
	background: color-mix(in srgb, var(--wp--preset--color--surface) 62%, var(--wp--preset--color--base));
	transform: translateY(-1px);
}

.tlab-search-result img {
	display: block;
	width: 72px;
	height: 72px;
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--surface-muted);
	object-fit: cover;
}

.tlab-search-result span {
	display: grid;
	gap: 4px;
	min-width: 0;
	overflow: hidden;
}

.tlab-search-result strong {
	overflow: hidden;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 700;
	letter-spacing: -0.015em;
	line-height: 1.15;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tlab-search-result small {
	overflow: hidden;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--body-small);
	line-height: 1.25;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tlab-search-result em {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--body-small);
	font-style: normal;
	font-weight: 850;
	justify-self: end;
	min-width: max-content;
	text-align: right;
	white-space: nowrap;
}

.tlab-search-message {
	margin: 0;
	padding: 18px;
	border: 1px dashed var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	color: var(--wp--preset--color--muted);
	text-align: center;
}

@keyframes tlab-search-placeholder-pulse {

	0% {
		opacity: 0.55;
		background-position: 100% 0;
	}

	50% {
		opacity: 1;
	}

	100% {
		opacity: 0.55;
		background-position: -100% 0;
	}
}

@media (max-width: 640px) {

	.tlab-search-popup {
		padding: 12px;
	}

	.tlab-search-popup__dialog {
		width: 100%;
		max-height: calc(100vh - 24px);
		margin-top: 12px;
		padding: 18px;
		border-radius: 18px;
	}

	.tlab-search-popup__results {
		height: min(360px, 44vh);
	}

	.tlab-search-result {
		grid-template-columns: 60px 1fr;
	}

	.tlab-search-result img {
		width: 60px;
		height: 60px;
	}

	.tlab-search-result em {
		grid-column: 2;
	}
}

