/* PX search panel (includes/search.php, assets/search.js). Under the header; full screen below it on phones. */
.kps {
	--kps-ink: #1b1b1b;
	--kps-muted: #8b8381;
	--kps-line: #efeae8;
	--kps-red: var(--px-sale, #d31130);
	position: fixed;
	inset: var(--kps-top, 0px) 0 0;
	z-index: 400;
	--kps-font: var(--wd-text-font, "Jost", system-ui, sans-serif);
	font-family: var(--kps-font);
	color: var(--kps-ink);
}
.kps[hidden] { display: none; }
.kps *, .kps *::before, .kps *::after { box-sizing: border-box; }
.kps-veil { position: absolute; inset: 0; background: rgba(22, 18, 18, .42); opacity: 0; transition: opacity .2s; }
.kps-box {
	position: relative;
	display: flex;
	flex-direction: column;
	max-height: 100%;
	background: #fff;
	box-shadow: 0 18px 30px rgba(0, 0, 0, .12);
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity .18s, transform .22s ease;
}
.kps.is-in .kps-veil { opacity: 1; }
.kps.is-in .kps-box { opacity: 1; transform: none; }
.kps-form { display: flex; flex-direction: column; min-height: 0; margin: 0; }
html.kps-open { overflow: hidden; }

/* field */
.kps-field { flex: none; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 max(28px, calc((100% - 1320px) / 2)); border-bottom: 1px solid var(--kps-line); }
.kps-field > svg { flex: none; width: 20px; height: 20px; color: #7a7371; }
.kps .kps-field input[type=search] {
	flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; outline: 0; box-shadow: none; background: none;
	color: var(--kps-ink); font: 400 16px/1.2 var(--kps-font); -webkit-appearance: none; appearance: none;
}
.kps .kps-field input::placeholder { color: #a39c9a; opacity: 1; }
.kps .kps-field input::-webkit-search-cancel-button { display: none; }
.kps .kps-erase { flex: none; height: auto; min-height: 0; padding: 6px 4px; border: 0; background: none; color: #7a7371; font: 500 13px var(--kps-font); text-transform: none; letter-spacing: 0; cursor: pointer; }
.kps .kps-erase[hidden] { display: none; }

/* body */
.kps-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px max(28px, calc((100% - 1320px) / 2)) 26px; }
.kps-cols { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; align-items: start; }
.kps-cols--one { grid-template-columns: minmax(0, 1fr); }
.kps-side { display: grid; gap: 22px; align-content: start; }
.kps .kps-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 11px; color: var(--kps-muted); font: 600 11px/1.3 var(--kps-font); letter-spacing: .09em; text-transform: uppercase; }
.kps .kps-h .kps-n { letter-spacing: 0; font-weight: 500; }
.kps .kps-link { padding: 0; min-height: 0; height: auto; border: 0; background: none; color: var(--kps-muted); font: 500 12px var(--kps-font); letter-spacing: 0; text-transform: none; text-decoration: underline; cursor: pointer; }
.kps-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kps .kps-chip {
	display: inline-flex; align-items: center; gap: 6px; height: auto; min-height: 0; padding: 6px 13px; margin: 0;
	border: 1px solid #e6e0dd; border-radius: 999px; background: #fff; color: var(--kps-ink);
	font: 400 13.5px/1.3 var(--kps-font); letter-spacing: 0; text-transform: none; text-decoration: none; cursor: pointer;
	transition: border-color .15s;
}
.kps .kps-chip:hover { border-color: var(--kps-ink); color: var(--kps-ink); }
.kps-chip svg { width: 14px; height: 14px; flex: none; color: #9a9391; }
.kps-chip .kps-n { color: #9a9391; font-size: 12px; }
/* desktop: categories and suggestions as a plain list in the side column */
@media (min-width: 768px) {
	.kps-side .kps-links { flex-direction: column; align-items: flex-start; gap: 2px; }
	.kps-side .kps-links .kps-chip { padding: 4px 0; border: 0; border-radius: 0; font-size: 14px; }
	.kps-side .kps-links .kps-chip:hover { text-decoration: underline; }
}

/* product cards */
.kps-grid { display: grid; grid-template-columns: repeat(var(--kps-n, 5), minmax(0, 1fr)); gap: 18px 16px; }
.kps .kps-card { position: relative; display: grid; gap: 7px; align-content: start; min-width: 0; color: var(--kps-ink); }
.kps-im { position: relative; display: block; }
.kps .kps-im img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 0; background: #f2f0ee; }
/* badges: the drawer carousel's labels (.px-mini-card__labels in px.css), same size */
.kps-row { display: flex; align-items: flex-start; gap: 6px; }
.kps .kps-bag { flex: none; display: grid; place-items: center; width: 30px; height: 30px; min-height: 0; margin: -5px -5px 0 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--kps-ink); cursor: pointer; }
.kps .kps-bag:hover { background: none; color: var(--wd-primary-color, #ff8873); }
.kps .kps-bag svg { width: 20px; height: 20px; }
.kps-card px-quick-add { display: contents; }
.kps .kps-nm { flex: 1; min-width: 0; display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--kps-ink); font-size: 13px; line-height: 1.35; text-decoration: none; }
.kps-nm mark { padding: 0; background: none; color: inherit; font-weight: 600; }
.kps-pr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; color: var(--kps-red); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.kps-pr s { color: #a29b99; font-size: 12.5px; font-weight: 400; }
.kps .kps-card a, .kps .kps-card a:hover { text-decoration: none; }

/* all results + empty + loading */
.kps-allwrap { display: flex; justify-content: center; margin-top: 22px; }
.kps .kps-all {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: auto; min-height: 48px; padding: 0 28px;
	border: 0; border-radius: 999px; background: var(--kps-ink); color: #fff; font: 500 14px var(--kps-font); letter-spacing: 0; text-transform: none; cursor: pointer;
}
.kps .kps-all:hover { background: #000; color: #fff; }
.kps-all svg { width: 16px; height: 16px; }
.kps-empty { display: grid; gap: 18px; max-width: 640px; }
.kps-empty > p { margin: 0; color: #5f5856; font-size: 14.5px; }
.kps-wait { height: 120px; border-radius: 10px; background: linear-gradient(90deg, #f4f1ef 25%, #faf8f7 50%, #f4f1ef 75%) 0 0 / 200% 100%; animation: kps-wait 1.2s linear infinite; }
@keyframes kps-wait { to { background-position: -200% 0; } }

/* close button in the field: always visible, even when the panel opens under the theme's sticky header */
.kps .kps-x { flex: none; display: grid; place-items: center; width: 36px; height: 36px; min-height: 0; margin: 0 -8px 0 4px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--kps-ink); cursor: pointer; }
.kps .kps-x svg { width: 20px; height: 20px; }
.kps .kps-x:hover { background: none; color: var(--kps-ink); opacity: .7; }

/* phones: full screen below the header, 2 columns, button kept at the bottom */
@media (max-width: 767px) {
	.kps-box { height: 100%; }
	.kps-field { height: 60px; padding: 0 16px; }
	.kps-body { flex: 1; padding: 18px 16px 0; }
	.kps-cols { grid-template-columns: minmax(0, 1fr); gap: 20px; }
	.kps-side { gap: 18px; }
	.kps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 16px 12px; }
	.kps-allwrap { position: sticky; bottom: 0; margin: 14px -16px 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(rgba(255, 255, 255, 0), #fff 32%); }
	.kps .kps-all { width: 100%; }
	.kps-body::after { content: ""; display: block; height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .kps-veil, .kps-box { transition: none; } .kps-wait { animation: none; } }
