/*
 * WildMagic Search: the dropdown panel, the phone overlay and the small search field (0.6.0; dark focus ring 0.6.1).
 *
 * Light only. Every block that has a background also sets its text colour, so a browser that forces a dark page still
 * shows readable text. Palette: white #fff, ink #1d2327, muted #50575e, line #dcdcde, hover #f0f0f1, soft #f6f7f7,
 * focus #2271b1 (all text pairs above 4.5:1 on white).
 */

/* ---------- Shared ---------- */

.twm-sr-panel[hidden],
.twm-sr-overlay[hidden] {
	display: none;
}

.twm-sr-panel,
.twm-sr-overlay {
	box-sizing: border-box;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	background: #fff;
	color: #1d2327;
}

.twm-sr-panel *,
.twm-sr-overlay * {
	box-sizing: border-box;
}

.twm-sr-live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface {
	background: #fff;
	color: #1d2327;
}

.twm-sr-list {
	background: #fff;
	color: #1d2327;
	overscroll-behavior: contain;
}

.twm-sr-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	background: #fff;
	color: #1d2327;
}

.twm-sr-slot {
	min-width: 0;
	background: #fff;
	color: #1d2327;
}

.twm-sr-section {
	padding: 8px 0 4px;
	background: #fff;
	color: #1d2327;
}

.twm-sr-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0;
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	background: #fff;
	color: #50575e;
}

.twm-sr-message {
	margin: 0;
	padding: 14px 12px 4px;
	font-size: 15px;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface strong {
	font-weight: 700;
}

.twm-sr-surface a,
.twm-sr-surface a:hover,
.twm-sr-surface a:focus {
	text-decoration: none;
}

/* ---------- Rows and chips ---------- */

.twm-sr-line {
	display: flex;
	align-items: center;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface a.twm-sr-row {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 8px 12px;
	font-size: 14px;
	font-weight: 400;
	background: #fff;
	color: #1d2327;
	cursor: pointer;
}

.twm-sr-row-text {
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Scoped to the dropdown and overlay: the results page prints its own `.twm-sr-notice` (twm-sr-results_v2.css) where this file also loads. */
.twm-sr-surface .twm-sr-notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	column-gap: 6px;
	padding: 4px 12px;
	font-size: 14px;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface .twm-sr-notice-text {
	min-width: 0;
	overflow-wrap: anywhere;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface a.twm-sr-notice-link,
.twm-sr-surface a.twm-sr-notice-link:hover,
.twm-sr-surface a.twm-sr-notice-link:focus {
	flex: 0 1 auto;
	padding: 8px 0;
	font-weight: 700;
	text-decoration: underline;
}

.twm-sr-row-tag {
	flex: none;
	padding: 2px 8px;
	font-size: 12px;
	border-radius: 10px;
	background: #f0f0f1;
	color: #50575e;
}

.twm-sr-items-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 4px 12px 8px;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface a.twm-sr-chip {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	margin: 0;
	padding: 6px 14px;
	font-size: 14px;
	border: 1px solid #dcdcde;
	border-radius: 18px;
	background: #f6f7f7;
	color: #1d2327;
}

.twm-sr-overlay a.twm-sr-chip {
	min-height: 44px;
}

button.twm-sr-clear {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-weight: 400;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	border: 0;
	border-radius: 4px;
	box-shadow: none;
	background: #fff;
	color: #50575e;
	cursor: pointer;
}

/* The cross is a pointer shortcut (hidden from assistive technology); Delete on the active option is the keyboard way. */
.twm-sr-remove {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font-size: 20px;
	line-height: 1;
	border-radius: 4px;
	background: #fff;
	color: #50575e;
	cursor: pointer;
}

.twm-sr-overlay .twm-sr-remove {
	width: 44px;
	height: 44px;
}

.twm-sr-tools {
	padding: 0 12px 8px;
	background: #fff;
	color: #1d2327;
}

.twm-sr-tools[hidden],
.twm-sr-message[hidden] {
	display: none;
}

button.twm-sr-clear {
	min-height: 36px;
	padding: 0 8px;
	font-size: 13px;
	text-decoration: underline;
}

.twm-sr-overlay button.twm-sr-clear {
	min-height: 44px;
	padding: 0 12px;
}

/* ---------- Cards ---------- */

.twm-sr-items-product-cards,
.twm-sr-items-guide-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 4px;
	padding: 0 8px;
	background: #fff;
	color: #1d2327;
}

.twm-sr-surface a.twm-sr-card {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 6px;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	cursor: pointer;
}

.twm-sr-card-pic {
	flex: none;
	display: block;
	width: 56px;
	height: 56px;
	border-radius: 4px;
	overflow: hidden;
	background: #f6f7f7;
	color: #1d2327;
}

.twm-sr-card-pic img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: contain;
	background: #f6f7f7;
}

.twm-sr-card.is-out .twm-sr-card-pic img {
	filter: grayscale(1);
}

.twm-sr-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.twm-sr-card-name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.twm-sr-card-price {
	font-size: 13px;
	font-weight: 600;
	color: #1d2327;
}

.twm-sr-card-was {
	font-weight: 400;
	color: #646970;
}

.twm-sr-card-stock {
	font-size: 12px;
	font-weight: 600;
	color: #8a2424;
}

.twm-sr-card-meta {
	font-size: 12px;
	color: #50575e;
}

.twm-sr-surface a.twm-sr-card-guide .twm-sr-card-pic {
	width: 64px;
	height: 48px;
}

/* ---------- Hover, active, focus ---------- */

.twm-sr-surface a.twm-sr-row:hover,
.twm-sr-surface a.twm-sr-card:hover,
.twm-sr-surface a.twm-sr-chip:hover,
.twm-sr-surface a.is-active {
	background: #f0f0f1;
	color: #1d2327;
}

.twm-sr-surface a.is-active {
	outline: 2px solid #2271b1;
	outline-offset: -2px;
}

.twm-sr-surface a:focus-visible,
.twm-sr-surface button:focus-visible,
.twm-sr-overlay button:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

/* ---------- Panel (the open box on a wide screen) ---------- */

.twm-sr-panel {
	position: fixed;
	z-index: 9995;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

@media (min-width: 700px) {
	.twm-sr-grid {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
		column-gap: 8px;
	}

	.twm-sr-slot-side {
		grid-column: 1;
		grid-row: 1;
	}

	.twm-sr-slot-more {
		grid-column: 1;
		grid-row: 2;
	}

	.twm-sr-slot-main {
		grid-column: 2;
		grid-row: 1 / span 2;
	}

	.twm-sr-slot-foot {
		grid-column: 2;
		grid-row: 3;
	}

	.twm-sr-no-main,
	.twm-sr-no-side {
		grid-template-columns: minmax(0, 1fr);
	}

	.twm-sr-no-main .twm-sr-slot,
	.twm-sr-no-side .twm-sr-slot {
		grid-column: 1;
		grid-row: auto;
	}

	.twm-sr-items-product-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- Overlay (a phone, or an icon-type search) ---------- */

.twm-sr-overlay {
	position: fixed;
	/* Above the WordPress admin bar (99999), so the bar never covers the box. */
	z-index: 100000;
	top: 0;
	right: 0;
	left: 0;
	height: 100vh;
	height: 100dvh;
	padding: 0;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	overscroll-behavior: contain;
	background: #fff;
	color: #1d2327;
}

/* Set by the script when the phone's keyboard changes the visible height. */
.twm-sr-overlay.has-vv {
	top: var(--twm-sr-vt, 0px);
	height: var(--twm-sr-vh, 100dvh);
}

.twm-sr-bar {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px 12px;
	border-bottom: 1px solid #dcdcde;
	background: #fff;
	color: #1d2327;
}

.twm-sr-overlay input.twm-sr-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 44px;
	margin: 0;
	padding: 0 14px;
	font-family: inherit;
	/* 16px or more: below it iOS zooms the page when the box gets focus. */
	font-size: 16px;
	line-height: 44px;
	border: 1px solid #8c8f94;
	border-radius: 22px;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	background: #fff;
	color: #1d2327;
}

.twm-sr-overlay input.twm-sr-input:focus {
	border-color: #2271b1;
	outline: 2px solid #2271b1;
	outline-offset: 0;
	box-shadow: none;
	background: #fff;
	color: #1d2327;
}

.twm-sr-overlay input.twm-sr-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.twm-sr-overlay button.twm-sr-go,
.twm-sr-overlay button.twm-sr-cancel {
	flex: none;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0 14px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	border-radius: 22px;
	box-shadow: none;
	cursor: pointer;
}

.twm-sr-overlay button.twm-sr-go {
	border: 1px solid #1d2327;
	background: #1d2327;
	color: #fff;
}

.twm-sr-overlay button.twm-sr-cancel {
	border: 1px solid #fff;
	background: #fff;
	color: #1d2327;
}

.twm-sr-overlay .twm-sr-surface {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding-bottom: 16px;
}

/* A phone: one column; the products slide sideways. */
@media (max-width: 699px) {
	.twm-sr-overlay .twm-sr-items-product-cards {
		display: flex;
		gap: 8px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		padding: 0 12px 8px;
	}

	.twm-sr-overlay .twm-sr-items-product-cards::-webkit-scrollbar {
		display: none;
	}

	.twm-sr-overlay a.twm-sr-card-product {
		flex: 0 0 150px;
		flex-direction: column;
		align-items: stretch;
		scroll-snap-align: start;
		border: 1px solid #dcdcde;
	}

	.twm-sr-overlay a.twm-sr-card-product .twm-sr-card-pic {
		width: 100%;
		height: 120px;
	}

	.twm-sr-overlay .twm-sr-slot-foot .twm-sr-row {
		font-weight: 600;
	}
}

/* A wide screen opens the overlay in the middle, 960px at most, over a dim page. */
@media (min-width: 850px) {
	.twm-sr-overlay {
		align-items: center;
		padding-top: 8vh;
		padding-bottom: 4vh;
		background: rgba(0, 0, 0, 0.45);
		color: #1d2327;
	}

	.twm-sr-overlay .twm-sr-bar,
	.twm-sr-overlay .twm-sr-surface {
		width: 100%;
		max-width: 960px;
	}

	.twm-sr-overlay .twm-sr-bar {
		border-radius: 10px 10px 0 0;
	}

	.twm-sr-overlay .twm-sr-surface {
		flex: 0 1 auto;
		border-radius: 0 0 10px 10px;
	}
}

html.twm-sr-locked {
	overflow: hidden;
}

/* ---------- The small search field (0.6.0) ---------- */

/*
 * One look on any header colour: a white box with dark text. Flatsome's `.nav-dark` and `.dark` are not followed (light only).
 * The width is a custom property, so a store changes it in its custom CSS: `.twm-sr-form-wrap { --twm-sr-form-width: 240px; }`.
 * The selectors carry the input's class and element, so they beat Flatsome's base `input[type=search]` rule.
 */
.twm-sr-form-wrap {
	box-sizing: border-box;
	width: var(--twm-sr-form-width, 200px);
	max-width: 100%;
	margin: 0;
	padding: 0;
}

.twm-sr-form-wrap .twm-sr-form {
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
}

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

.twm-sr-form input.twm-sr-form-field {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	height: 36px;
	min-height: 0;
	margin: 0;
	padding: 0 14px 0 36px;
	border: 1px solid #8c8f94;
	border-radius: 999px;
	background: #fff;
	color: #1d2327;
	box-shadow: none;
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: normal;
	letter-spacing: normal;
	text-transform: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	transition: border-color 0.15s;
}

.twm-sr-form input.twm-sr-form-field::placeholder {
	color: #50575e;
	opacity: 1;
}

.twm-sr-form input.twm-sr-form-field::-webkit-search-decoration {
	-webkit-appearance: none;
}

.twm-sr-form input.twm-sr-form-field:hover {
	border-color: #50575e;
}

/* A dark ring (0.6.1): it reads on a white header and on any coloured bar (blue on a green bar did not). */
.twm-sr-form input.twm-sr-form-field:focus {
	border-color: #1d2327;
	outline: 2px solid #1d2327;
	outline-offset: 1px;
	box-shadow: none;
	background: #fff;
	color: #1d2327;
}

/* The magnifier sits over the box's left padding and lets every click through to the box. */
.twm-sr-form .twm-sr-form-icon {
	position: absolute;
	top: 50%;
	left: 13px;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	color: #50575e;
	pointer-events: none;
}

/*
 * Flatsome's own live search, which runs when the dropdown is off: its list opens in the form's `.live-search-results`. The
 * theme styles that box only inside its own search elements, so it is placed and coloured here.
 */
.twm-sr-form .live-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 9990;
	margin-top: 4px;
	background: transparent;
	color: #1d2327;
	text-align: left;
}

.twm-sr-form .autocomplete-suggestions {
	box-sizing: border-box;
	max-height: 50vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	background: #fff;
	color: #1d2327;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.twm-sr-form .autocomplete-suggestion {
	background: #fff;
	color: #1d2327;
}

.twm-sr-form .autocomplete-suggestion.autocomplete-selected {
	background: #f0f0f1;
	color: #1d2327;
}

/* Flatsome's header rows: the list item may shrink in a crowded row. */
.nav > li.header-twm-sr-search {
	min-width: 0;
	margin-top: 0;
	margin-bottom: 0;
}

/* The top bar is low: a lower box. */
.header-top .twm-sr-form input.twm-sr-form-field {
	height: 28px;
	padding-left: 32px;
	font-size: 13px;
}

.header-top .twm-sr-form .twm-sr-form-icon {
	left: 11px;
	width: 14px;
	height: 14px;
	margin-top: -7px;
}

/* The off-canvas menu: the full width. */
.nav-sidebar .twm-sr-form-wrap {
	width: 100%;
}

/* Phones: 16px text, or iOS zooms the page when the box takes the focus; in the mobile top and bottom bars, the full width. */
@media (max-width: 849px) {
	.twm-sr-form input.twm-sr-form-field,
	.header-top .twm-sr-form input.twm-sr-form-field {
		font-size: 16px;
	}

	.header-top .mobile-nav > li.header-twm-sr-search,
	.header-bottom .mobile-nav > li.header-twm-sr-search {
		flex: 1 1 auto;
	}

	.header-top .mobile-nav > li.header-twm-sr-search .twm-sr-form-wrap,
	.header-bottom .mobile-nav > li.header-twm-sr-search .twm-sr-form-wrap {
		width: 100%;
	}
}
