/* Header search pill and the predictive search dialog. */

.njf-search {
	display: flex;
	align-items: center;
	color: var(--njf-fg, currentcolor);
}

.njf-search .njf-search__form {
	width: 100%;
	margin: 0;
}

.njf-search .njf-search__pill {
	position: relative;
	display: flex;
	align-items: center;
	width: 220px;
	max-width: 100%;
	height: 36px;
	margin: 0;
	padding-inline: 14px;
	overflow: hidden;
	border-radius: 9999px;
	background: color-mix(in srgb, currentcolor 10%, transparent);
	color: inherit;
	cursor: text;
}

.njf-search .njf-search__pill:hover {
	background: color-mix(in srgb, currentcolor 16%, transparent);
}

.njf-search--full .njf-search__pill {
	width: 100%;
}

.njf-search .njf-search__icon,
.njf-drawer .njf-search__icon {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
}

.njf-search .njf-search__pill .njf-search__input[type] {
	flex: 1;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 6px;
	border: 0;
	border-radius: 0;
	outline: 0;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font-size: 12px;
	appearance: none;
}

.njf-search .njf-search__pill .njf-search__input[type]:focus,
.njf-search .njf-search__pill .njf-search__input[type]:hover {
	border: 0;
	background: transparent;
	box-shadow: none;
}

.njf-search .njf-search__pill:focus-within {
	outline: 2px solid var(--njf-accent, currentcolor);
	outline-offset: 2px;
}

.njf-search .njf-search__input::-webkit-search-cancel-button {
	display: none;
}

.njf-search .njf-search__placeholder {
	position: absolute;
	inset: 0 14px 0 calc(14px + 18px + 6px);
	display: flex;
	align-items: center;
	gap: 0.35em;
	color: color-mix(in srgb, currentcolor 55%, transparent);
	font-size: 12px;
	line-height: 18px;
	white-space: nowrap;
	pointer-events: none;
}

.njf-search .njf-search__input:not(:placeholder-shown) + input + .njf-search__placeholder {
	display: none;
}

.njf-search .njf-search__terms {
	display: block;
	height: 18px;
	overflow: hidden;
}

.njf-search .njf-search__track {
	display: block;
	transition: transform 2s ease;
}

.njf-search .njf-search__term {
	display: block;
	height: 18px;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
	.njf-search .njf-search__track {
		transition: none;
	}
}

/* ---- Dialog ---- */
dialog.njf-drawer--search {
	inset: 0 0 auto;
	width: 100vw;
	height: auto;
	max-height: min(85dvh, 760px);
	transform: translateY(-100%);
}

dialog.njf-drawer--search[open] {
	transform: translateY(0);
}

dialog.njf-drawer--search.is-closing {
	transform: translateY(-100%);
}

@starting-style {
	dialog.njf-drawer--search[open] {
		transform: translateY(-100%);
	}
}

.njf-drawer--search .njf-drawer__inner {
	width: min(100%, 1100px);
	height: auto;
	max-height: inherit;
	margin: 0 auto;
}

.njf-drawer .njf-sd__form {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 16px 20px;
	border-bottom: 1px solid var(--njf-d-line);
}

.njf-drawer .njf-sd__form .njf-sd__input[type] {
	flex: 1;
	min-width: 0;
	height: 44px;
	margin: 0;
	padding: 0 4px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font-size: 18px;
}

.njf-drawer .njf-sd__form .njf-sd__input[type]:focus {
	border: 0;
	outline: 0;
	background: transparent;
	box-shadow: none;
}

.njf-drawer .njf-sd__input::-webkit-search-cancel-button {
	display: none;
}

.njf-drawer .njf-sd__form:focus-within {
	box-shadow: inset 0 -2px 0 var(--njf-accent, currentcolor);
}

.njf-drawer--search.is-loading .njf-sd__form {
	box-shadow: inset 0 -2px 0 var(--njf-d-muted);
}

.njf-drawer .njf-sd__body {
	padding: 20px;
}

.njf-drawer .njf-sd__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.njf-drawer .njf-sd__chips .njf-sd__chip {
	margin: 0;
	padding: 8px 14px;
	border: 1px solid var(--njf-d-line);
	border-radius: 9999px;
	background: transparent;
	color: inherit;
	font-size: 13px;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

.njf-drawer .njf-sd__chips .njf-sd__chip:hover,
.njf-drawer .njf-sd__chips .njf-sd__chip:focus {
	border-color: currentcolor;
	background: transparent;
	color: inherit;
}

.njf-drawer .njf-sd__results {
	display: grid;
	gap: 24px;
}

.njf-drawer .njf-sd__results[hidden],
.njf-drawer .njf-sd__suggestions[hidden] {
	display: none;
}

@media (min-width: 990px) {
	.njf-drawer .njf-sd__results {
		grid-template-columns: 2fr 1fr;
		align-items: start;
	}

	.njf-drawer .njf-sd__results > .njf-sr__group:first-child {
		grid-row: span 2;
	}

	.njf-drawer .njf-sd__results > .njf-sr__all {
		grid-column: 1 / -1;
	}
}

.njf-drawer .njf-sr__heading {
	margin: 0 0 12px;
	color: var(--njf-d-muted);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.njf-drawer .njf-sr__products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.njf-drawer .njf-sr__product {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 12px;
	align-items: center;
	color: inherit;
	text-decoration: none;
}

.njf-drawer .njf-sr__product:hover,
.njf-drawer .njf-sr__product:focus {
	color: inherit;
}

.njf-drawer .njf-sr__product:hover .njf-sr__name {
	text-decoration: underline;
}

.njf-drawer .njf-sr__img {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--njf-surface, #f5f5f5);
}

.njf-drawer .njf-sr__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.njf-drawer .njf-sr__info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.njf-drawer .njf-sr__name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

.njf-drawer .njf-sr__price {
	font-size: 13px;
}

.njf-drawer .njf-sr__links {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.njf-drawer .njf-sr__links a {
	color: inherit;
	font-size: 14px;
	text-decoration: none;
}

.njf-drawer .njf-sr__links a:hover {
	color: var(--njf-accent-light, inherit);
	text-decoration: underline;
}

.njf-drawer .njf-sr__empty {
	margin: 0;
	font-size: 14px;
}
