/* Jero search: header search in the site's own style. Desktop: a black band under the header bar,
   like the mega menus (same width, fixed under the bar, opacity transition); phones: full screen,
   like the mobile menu. Categories and tags read like mega-menu links; products like catalogue
   cards (photo on white, uppercase title, grey SKU); "See all results" is the site's white button
   (style.css a.jero_white_btns). Colours reuse header.css (--jero-muted). !important where
   header.css forces every header link white (against Divi's link colours). */
.jero-search { line-height: normal; }
.jero-search.is-open .jero-search__toggle { color: var(--jero-muted); }
.jero-search__panel[hidden],
.jero-search__results[hidden] { display: none !important; }

/* Open/close: fade and a short slide; visibility switches at the end of the fade-out (so the
   closed panel can't be focused) and at once on opening. search.js toggles .is-open. */
.jero-search__panel {
	visibility: hidden;
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
	pointer-events: none;
}
.jero-search.is-open .jero-search__panel {
	visibility: visible;
	opacity: 1;
	transform: none;
	transition: opacity 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s;
	pointer-events: auto;
}

/* New rows and groups fade up one after the other (--i: their order among the new ones). */
@keyframes jero-search-row {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}
.jero-search__results .is-new {
	animation: jero-search-row 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	animation-delay: calc(var(--i, 0) * 28ms);
}

.jero-search__panel {
	position: fixed;
	top: calc(var(--jero-top) + var(--jero-bar-h));
	right: 0;
	left: 0;
	z-index: 1;
	max-height: calc(100vh - var(--jero-top) - var(--jero-bar-h));
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #000;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
	color: #fff;
	font-family: 'Open Sans', Arial, sans-serif;
	text-align: left;
	scrollbar-color: #444 transparent;
}
.jero-search__inner {
	width: 90%;
	max-width: 1440px;
	margin: 0 auto;
	padding: 24px 0 36px;
}

/* Search field: large, a thin line underneath (as the mobile menu's language divider) */
.jero-search__form {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 0 0 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}
/* A white line draws across the field as the panel opens */
.jero-search__form::after {
	content: '';
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	height: 1px;
	background: #fff;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.2s ease;
}
.jero-search.is-open .jero-search__form::after {
	transform: scaleX(1);
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s;
}
.jero-search__form-icon {
	flex: none;
	color: var(--jero-muted);
	line-height: 0;
}
.jero-search .jero-search__input {
	flex: 1;
	min-width: 0;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: 0;
	background: none;
	box-shadow: none;
	color: #fff;
	font: 300 22px/1.2 'Open Sans', Arial, sans-serif;
	-webkit-appearance: none;
	appearance: none;
}
.jero-search__input::-webkit-search-cancel-button { display: none; }
.jero-search__input::placeholder {
	color: var(--jero-muted);
	opacity: 1;
}
.jero-search__close {
	position: relative;
	flex: none;
	width: 40px;
	height: 40px;
}
.jero-search__close > span::before,
.jero-search__close > span::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 22px;
	height: 1.5px;
	background: #fff;
	transform: translate(-50%, -50%) rotate(45deg);
	transition: background 0.2s;
}
.jero-search__close > span::after { transform: translate(-50%, -50%) rotate(-45deg); }
.jero-search__close > span {
	position: absolute;
	inset: 0;
	transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.jero-search__close:hover > span { transform: rotate(90deg); }
.jero-search__close:hover > span::before,
.jero-search__close:hover > span::after { background: var(--jero-muted); }
.jero-search__close:focus-visible,
.jero-search__toggle:focus-visible { outline: 1px solid #fff; outline-offset: 4px; }

/* Suggestions: categories/tags column, then the products */
.jero-search__results {
	display: grid;
	grid-template-columns: 1fr;
	gap: 40px;
	padding-top: 28px;
}
.jero-search__results.has-terms { grid-template-columns: minmax(180px, 240px) 1fr; }
.jero-search__group + .jero-search__group { margin-top: 24px; }
.jero-search__heading {
	margin-bottom: 14px;
	color: var(--jero-muted);
	font-size: 12px;
	letter-spacing: 1px;
	text-transform: uppercase;
}

/* Categories and tags: like the mega-menu links */
.jero-header .jero-search .jero-search__option--term {
	display: block;
	padding: 6px 0;
	color: #fff !important;
	font-size: 14px;
	line-height: 16.8px;
	text-transform: uppercase;
	transition: color 0.2s;
}
.jero-header .jero-search .jero-search__option--term:hover,
.jero-header .jero-search .jero-search__option--term[aria-selected="true"] { color: var(--jero-muted) !important; }

/* Products: two columns of rows; photo on white like the catalogue */
.jero-search__group--products {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 4px 32px;
}
.jero-search__group--products .jero-search__heading { grid-column: 1 / -1; }
.jero-header .jero-search .jero-search__option--product {
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
	padding: 8px;
	margin: 0 -8px;
	color: #fff !important;
	transition: background 0.2s;
}
.jero-search__option--product:hover,
.jero-search__option--product[aria-selected="true"] { background: rgba(255, 255, 255, 0.08); }
.jero-search__thumb {
	flex: none;
	width: 56px;
	height: 56px;
	overflow: hidden;
	background: #fff;
}
.jero-search__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.jero-search__text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.jero-search__title {
	overflow: hidden;
	font-size: 13px;
	line-height: 1.4;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}
.jero-search__title strong,
.jero-search__option--term strong { font-weight: 700; }
.jero-search__sku {
	color: var(--jero-muted);
	font-size: 12px;
	letter-spacing: 0.5px;
}

/* "See all results": the site's white button */
.jero-header .jero-search .jero-search__option--all {
	display: inline-block;
	margin-top: 24px;
	padding: 15px 25px;
	border: 1px solid #fff;
	background: #fff;
	color: #000 !important;
	font-size: 12px;
	line-height: 1em;
	letter-spacing: 1px;
	text-transform: uppercase;
	transition: background 0.2s, color 0.2s;
}
.jero-header .jero-search .jero-search__option--all:hover,
.jero-header .jero-search .jero-search__option--all[aria-selected="true"] {
	background: transparent;
	color: #fff !important;
}

.jero-search__empty {
	color: var(--jero-muted);
	font-size: 14px;
}

/* No motion for visitors who ask for less: everything appears at once. */
@media (prefers-reduced-motion: reduce) {
	.jero-search__panel,
	.jero-search.is-open .jero-search__panel,
	.jero-search__form::after,
	.jero-search.is-open .jero-search__form::after,
	.jero-search__close > span { transition: none; }
	.jero-search__panel { transform: none; }
	.jero-search__results .is-new { animation: none; }
}

/* Phones and tablets: full screen over the page, like the mobile menu */
@media (max-width: 980px) {
	html.jero-search-open { overflow: hidden; }
	.jero-search__panel {
		top: var(--wp-admin--admin-bar--height, 0px);
		bottom: 0;
		z-index: 100000;
		max-height: none;
		box-shadow: none;
	}
	.jero-search__inner { padding: 16px 0 32px; }
	.jero-search__form { padding-bottom: 8px; }
	.jero-search .jero-search__input { height: 48px; font-size: 18px; } /* 16px+: iOS doesn't zoom in */
	.jero-search__close { width: 44px; height: 44px; }
	.jero-search__results,
	.jero-search__results.has-terms { grid-template-columns: 1fr; gap: 28px; padding-top: 20px; }
	.jero-search__group--products { grid-template-columns: 1fr; }
}
