/* ============================================================
   Website Search — frontend modal
   Mirrors the Poppy & Lotus search overlay (.sov) design.

   Every rule is scoped under .wsp-modal and, where a theme is
   likely to compete (inputs, buttons, links), the selector is
   element-qualified so it outranks generic theme rules such as
   input[type="search"] (0,1,1) or .site button (0,2,0).
   ============================================================ */

.wsp-modal {
	--wsp-paper: #FFFEF7;
	--wsp-paper-2: #F2EFDE;
	--wsp-card: #FFFFFF;
	--wsp-ink: #0A2916;
	--wsp-ink-soft: #3E5748;
	--wsp-line: rgba(10, 41, 22, .14);
	--wsp-accent: #CBED74;
	--wsp-radius: 16px;
	--wsp-ease: cubic-bezier(.16, 1, .3, 1);
	--wsp-sage: #F5C36A;
	--wsp-clay: #EE9E68;
	--wsp-lotus: #9AC4C3;
	--wsp-shroom: #E48784;
	--wsp-danger: #B3402E;
	--wsp-cols-desktop: 3;
	--wsp-cols-tablet: 2;
	--wsp-cols-mobile: 1;

	position: fixed;
	inset: 0;
	z-index: 999990;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 10vh 20px 20px;
	margin: 0;
	font-family: inherit;
	line-height: 1.55;
	color: var(--wsp-ink);
	opacity: 0;
	visibility: hidden;
	transition: opacity .35s var(--wsp-ease), visibility 0s .35s;
	box-sizing: border-box;
}

.wsp-modal *,
.wsp-modal *::before,
.wsp-modal *::after {
	box-sizing: border-box;
}

.wsp-modal[hidden] {
	display: none;
}

/*
   The browser hides [hidden] elements with `[hidden] { display: none }`, which
   scores only (0,1,0). Scoped rules below such as `.wsp-modal .wsp-loading`
   score (0,2,0) and would silently defeat it, leaving the spinner, suggestions
   and "View all" button on screen forever. Restore the intended behaviour once,
   here, so every display-setting rule in this file stays safe to write.
*/
.wsp-modal [hidden] {
	display: none !important;
}

.wsp-modal.is-open {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

.wsp-modal .wsp-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .45);
	margin: 0;
	padding: 0;
}

.wsp-modal .wsp-box {
	position: relative;
	background: var(--wsp-paper);
	border: 0;
	border-radius: var(--wsp-radius);
	max-width: 620px;
	width: 100%;
	padding: 24px;
	margin: 0;
	max-height: 76vh;
	overflow: auto;
	transform: translateY(14px);
	transition: transform .35s var(--wsp-ease);
	box-shadow: 0 24px 60px rgba(10, 41, 22, .18);
}

.wsp-modal.is-open .wsp-box {
	transform: none;
}

.wsp-modal .wsp-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- input row ---------- */

.wsp-modal .wsp-field {
	display: flex;
	gap: 10px;
	align-items: center;
	border: 1.5px solid var(--wsp-line);
	border-radius: 999px;
	padding: 4px 6px 4px 20px;
	margin: 0;
	background: var(--wsp-card);
	box-shadow: none;
	transition: border-color .2s var(--wsp-ease);
}

.wsp-modal .wsp-field:focus-within {
	border-color: var(--wsp-ink);
}

.wsp-modal .wsp-field .wsp-icon {
	width: 19px;
	height: 19px;
	flex: none;
	stroke: var(--wsp-ink-soft);
	stroke-width: 1.8;
	fill: none;
	stroke-linecap: round;
	display: block;
}

/*
   Element-qualified and triple-classed so it beats theme rules
   targeting input[type="search"] / input[type="text"].
*/
.wsp-modal .wsp-field input.wsp-input,
.wsp-modal .wsp-field input[type="search"].wsp-input,
.wsp-modal .wsp-field input[type="text"].wsp-input {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	max-width: none;
	height: auto;
	min-height: 0;
	border: 0;
	border-radius: 0;
	background: none;
	background-color: transparent;
	background-image: none;
	box-shadow: none;
	outline: none;
	padding: 11px 0;
	margin: 0;
	font: inherit;
	font-size: 16px;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	color: var(--wsp-ink);
}

.wsp-modal .wsp-field input.wsp-input:focus,
.wsp-modal .wsp-field input.wsp-input:focus-visible,
.wsp-modal .wsp-field input[type="search"].wsp-input:focus,
.wsp-modal .wsp-field input[type="text"].wsp-input:focus {
	border: 0;
	background: none;
	background-color: transparent;
	box-shadow: none;
	outline: none;
	color: var(--wsp-ink);
}

.wsp-modal .wsp-field input.wsp-input::-webkit-search-cancel-button,
.wsp-modal .wsp-field input.wsp-input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.wsp-modal .wsp-field input.wsp-input::placeholder {
	color: var(--wsp-ink-soft);
	opacity: .75;
	font: inherit;
	font-size: 16px;
}

.wsp-modal .wsp-field button.wsp-clear,
.wsp-modal .wsp-field button.wsp-close {
	-webkit-appearance: none;
	appearance: none;
	width: 36px;
	height: 36px;
	min-width: 0;
	min-height: 0;
	flex: none;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: none;
	background-color: transparent;
	box-shadow: none;
	padding: 0;
	margin: 0;
	font: inherit;
	font-size: 15px;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	color: var(--wsp-ink-soft);
	cursor: pointer;
	transition: background-color .2s var(--wsp-ease), color .2s var(--wsp-ease);
}

.wsp-modal .wsp-field button.wsp-close svg {
	width: 16px;
	height: 16px;
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
}

.wsp-modal .wsp-field button.wsp-clear:hover,
.wsp-modal .wsp-field button.wsp-close:hover,
.wsp-modal .wsp-field button.wsp-clear:focus-visible,
.wsp-modal .wsp-field button.wsp-close:focus-visible {
	background-color: var(--wsp-paper-2);
	color: var(--wsp-ink);
}

/* ---------- headings ---------- */

.wsp-modal .wsp-heading {
	font-family: inherit;
	font-size: 11px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--wsp-ink-soft);
	margin: 20px 0 10px;
	padding: 0;
	font-weight: 600;
	line-height: 1.4;
}

/* ---------- trending ---------- */

.wsp-modal .wsp-trending {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wsp-modal button.wsp-pill {
	-webkit-appearance: none;
	appearance: none;
	padding: 9px 18px;
	margin: 0;
	min-height: 0;
	border: 1.5px solid var(--wsp-line);
	border-radius: 999px;
	background: transparent;
	background-color: transparent;
	box-shadow: none;
	color: var(--wsp-ink);
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
	transition: background-color .25s var(--wsp-ease), color .25s var(--wsp-ease), border-color .25s var(--wsp-ease), transform .25s var(--wsp-ease);
}

.wsp-modal button.wsp-pill:hover,
.wsp-modal button.wsp-pill:focus-visible {
	background-color: var(--wsp-ink);
	color: var(--wsp-paper);
	border-color: var(--wsp-ink);
	transform: translateY(-2px);
}

.wsp-modal .wsp-trending--text {
	display: block;
}

.wsp-modal .wsp-trending--text button.wsp-pill {
	display: block;
	width: 100%;
	text-align: left;
	padding: 7px 0;
	border: 0;
	border-bottom: 1px solid var(--wsp-line);
	border-radius: 0;
	font-weight: 500;
}

.wsp-modal .wsp-trending--text button.wsp-pill:hover,
.wsp-modal .wsp-trending--text button.wsp-pill:focus-visible {
	background: none;
	color: var(--wsp-ink);
	transform: none;
	text-decoration: underline;
}

/* ---------- results ---------- */

.wsp-modal .wsp-results {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 0;
}

.wsp-modal a.wsp-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 9px 10px;
	margin: 0;
	border: 0;
	border-radius: 8px;
	background: none;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	transition: background-color .2s var(--wsp-ease);
}

.wsp-modal a.wsp-row:hover,
.wsp-modal a.wsp-row:focus-visible,
.wsp-modal a.wsp-row.is-active {
	background-color: var(--wsp-paper-2);
	color: inherit;
	text-decoration: none;
	outline: none;
}

.wsp-modal .wsp-thumb {
	width: 46px;
	height: 46px;
	flex: none;
	border-radius: 6px;
	overflow: hidden;
	display: grid;
	place-items: center;
	background-color: var(--wsp-paper-2);
}

.wsp-modal .wsp-thumb img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
	border-radius: 0;
	margin: 0;
}

.wsp-modal .wsp-tint-sage   { background-image: linear-gradient(140deg, var(--wsp-sage), #fff); }
.wsp-modal .wsp-tint-clay   { background-image: linear-gradient(140deg, var(--wsp-clay), #fff); }
.wsp-modal .wsp-tint-lotus  { background-image: linear-gradient(140deg, var(--wsp-lotus), #fff); }
.wsp-modal .wsp-tint-shroom { background-image: linear-gradient(140deg, var(--wsp-shroom), #fff); }

.wsp-modal .wsp-meta {
	min-width: 0;
	display: block;
}

.wsp-modal .wsp-title {
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	display: block;
	line-height: 1.3;
	color: var(--wsp-ink);
}

.wsp-modal .wsp-sub {
	font-size: 12px;
	color: var(--wsp-ink-soft);
	display: block;
	line-height: 1.4;
}

.wsp-modal .wsp-tags {
	display: flex;
	gap: 5px;
	flex-wrap: wrap;
	margin-top: 4px;
}

.wsp-modal .wsp-tag {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 999px;
	background-color: var(--wsp-paper-2);
	color: var(--wsp-ink-soft);
	line-height: 1.4;
}

.wsp-modal .wsp-price {
	margin-left: auto;
	font-size: 14px;
	white-space: nowrap;
	display: flex;
	gap: 6px;
	align-items: baseline;
	color: var(--wsp-ink);
}

.wsp-modal .wsp-price del {
	color: var(--wsp-ink-soft);
	font-size: 12.5px;
	opacity: .8;
	background: none;
}

.wsp-modal .wsp-price ins {
	text-decoration: none;
	font-weight: 600;
	background: none;
	color: inherit;
}

.wsp-modal .wsp-stock {
	font-size: 11px;
	color: var(--wsp-ink-soft);
	display: block;
	margin-top: 2px;
}

.wsp-modal .wsp-stock.is-out {
	color: var(--wsp-danger);
}

/* grid layout */

.wsp-modal .wsp-results--grid {
	display: grid;
	grid-template-columns: repeat(var(--wsp-cols-desktop), minmax(0, 1fr));
	gap: 10px;
}

.wsp-modal .wsp-results--grid a.wsp-row {
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	padding: 10px;
	border: 1px solid var(--wsp-line);
}

.wsp-modal .wsp-results--grid .wsp-thumb {
	width: 100%;
	height: 110px;
	border-radius: 8px;
}

.wsp-modal .wsp-results--grid .wsp-price {
	margin-left: 0;
}

/* ---------- states ---------- */

.wsp-modal .wsp-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 2px;
	font-size: 13.5px;
	color: var(--wsp-ink-soft);
}

.wsp-modal .wsp-spinner {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid var(--wsp-line);
	border-top-color: var(--wsp-ink);
	animation: wsp-spin .7s linear infinite;
	flex: none;
}

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

@media (prefers-reduced-motion: reduce) {
	.wsp-modal,
	.wsp-modal .wsp-box,
	.wsp-modal button.wsp-pill,
	.wsp-modal a.wsp-row {
		transition: none;
	}

	.wsp-modal .wsp-spinner {
		animation: none;
	}
}

.wsp-modal .wsp-empty,
.wsp-modal .wsp-error {
	font-size: 14px;
	color: var(--wsp-ink-soft);
	padding: 14px 2px 4px;
	margin: 0;
	line-height: 1.5;
}

.wsp-modal .wsp-error {
	color: var(--wsp-danger);
}

.wsp-modal .wsp-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding-bottom: 4px;
	margin: 0;
}

.wsp-modal .wsp-suggestion,
.wsp-modal button.wsp-suggestion,
.wsp-modal a.wsp-suggestion {
	-webkit-appearance: none;
	appearance: none;
	border: 1px solid var(--wsp-line);
	background-color: var(--wsp-card);
	border-radius: 999px;
	padding: 6px 14px;
	margin: 0;
	min-height: 0;
	box-shadow: none;
	font: inherit;
	font-size: 12.5px;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	color: var(--wsp-ink);
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.wsp-modal button.wsp-suggestion:hover,
.wsp-modal a.wsp-suggestion:hover,
.wsp-modal button.wsp-suggestion:focus-visible,
.wsp-modal a.wsp-suggestion:focus-visible {
	background-color: var(--wsp-paper-2);
	color: var(--wsp-ink);
	text-decoration: none;
}

.wsp-modal .wsp-suggestion .wsp-suggestion-type {
	font-size: 10px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--wsp-ink-soft);
}

.wsp-modal a.wsp-viewall {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 16px;
	padding: 11px 22px;
	border: 0;
	border-radius: 999px;
	background-color: var(--wsp-accent);
	color: var(--wsp-ink);
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	box-shadow: none;
	transition: transform .25s var(--wsp-ease);
}

.wsp-modal a.wsp-viewall:hover,
.wsp-modal a.wsp-viewall:focus-visible {
	transform: translateY(-2px);
	color: var(--wsp-ink);
	text-decoration: none;
}

/* ---------- scroll lock ---------- */

html.wsp-locked,
html.wsp-locked body {
	overflow: hidden !important;
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
	.wsp-modal .wsp-results--grid {
		grid-template-columns: repeat(var(--wsp-cols-tablet), minmax(0, 1fr));
	}
}

@media (max-width: 820px) {
	.wsp-modal {
		padding: 0;
		align-items: stretch;
	}

	.wsp-modal .wsp-backdrop {
		background: var(--wsp-paper);
	}

	.wsp-modal .wsp-box {
		max-width: none;
		width: 100%;
		height: 100%;
		max-height: none;
		border-radius: 0;
		padding: 18px 20px calc(28px + env(safe-area-inset-bottom));
		box-shadow: none;
	}

	.wsp-modal .wsp-field {
		padding: 2px 4px 2px 16px;
	}

	/* Stay at 16px: anything smaller makes iOS Safari zoom on focus. */
	.wsp-modal .wsp-field input.wsp-input,
	.wsp-modal .wsp-field input[type="search"].wsp-input {
		padding: 9px 0;
		font-size: 16px;
	}

	.wsp-modal .wsp-field button.wsp-clear,
	.wsp-modal .wsp-field button.wsp-close {
		width: 32px;
		height: 32px;
	}

	.wsp-modal .wsp-results--grid {
		grid-template-columns: repeat(var(--wsp-cols-mobile), minmax(0, 1fr));
	}
}
