/*
 * Shop example search (docs/shop-examples.md), Casetti's look (the live JetSearch popup): the header's search button
 * opens a full-screen dark veil with the form in the middle (white field, gold square button) and a gold close square at
 * the top right (the same <summary>). Esc, the close square or a click on the veil close it (search.js, header.js).
 */
.myco-header-search > summary {
	list-style: none;
}

.myco-header-search > summary::-webkit-details-marker {
	display: none;
}

.myco-header-search__panel {
	position: fixed;
	z-index: 5;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.78);
}

html:has(.myco-header-search[open]) {
	overflow: hidden;
}

/* Open: the summary becomes the gold close square. */
.site-header .myco-header-search[open] > summary {
	position: fixed;
	z-index: 6;
	inset-block-start: var(--casetti-topbar-h, 0px); /* Under the announcement bar, which stays above the veil (as live). */
	inset-inline-end: 30px;
	width: 74px;
	height: 38px;
	border-radius: 0;
	background: var(--myco-color-accent);
	color: var(--myco-color-white);
}

.site-header .myco-header-search[open] > summary:hover,
.site-header .myco-header-search[open] > summary:focus-visible {
	background: var(--casetti-gold-hover);
}

.myco-header-search[open] > summary svg {
	display: none;
}

.myco-header-search[open] > summary::before {
	content: "";
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.myco-header-search__panel .search-form {
	position: relative;
	display: flex;
	gap: 11px;
	width: min(500px, 100%);
	margin: 0;
}

.myco-header-search__panel .search-form__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.myco-header-search__panel .search-form__field {
	flex: 1 1 auto;
	min-width: 0;
	height: 36px;
	margin: 0;
	padding: 0 10px;
	border: 0;
	border-radius: 0;
	background: var(--myco-color-white);
	color: var(--casetti-ink);
	font: 400 14px/1.3 var(--myco-font-sans);
}

.myco-header-search__panel .search-form__submit {
	display: inline-flex;
	flex: 0 0 74px;
	align-items: center;
	justify-content: center;
	height: 38px;
	margin: -1px 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--myco-color-accent);
	color: var(--myco-color-white);
	font-size: 0; /* The word "Ara" stays the button's name; a magnifier shows. */
	cursor: pointer;
}

.myco-header-search__panel .search-form__submit:hover {
	background: var(--casetti-gold-hover);
}

.myco-header-search__panel .search-form__submit::before {
	content: "";
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m20 20-4.8-4.8'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m20 20-4.8-4.8'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Suggestions (search.js) under the field. */
.myco-product-search__list {
	position: absolute;
	z-index: 1;
	inset-inline: 0;
	inset-block-start: 100%;
	max-block-size: min(60vh, 420px);
	margin: 6px 0 0;
	padding: 4px;
	overflow: auto;
	background: var(--myco-color-white);
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
	list-style: none;
}

.myco-product-search__list [role="option"] {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 6px 8px;
	color: var(--casetti-ink);
	font-size: 14px;
	cursor: pointer;
}

.myco-product-search__list [aria-selected="true"],
.myco-product-search__list [role="option"]:hover {
	background: var(--casetti-cream);
}

.myco-product-search__list img {
	width: 48px;
	height: 48px;
	object-fit: cover;
}

.myco-product-search__price {
	margin-inline-start: auto;
	color: var(--myco-color-muted);
	font-size: var(--myco-font-size-sm);
	white-space: nowrap;
}

@media (max-width: 767px) {
	.site-header .myco-header-search[open] > summary {
		inset-inline-end: 14px;
		width: 36px;
		height: 36px;
		border-radius: 0 0 4px 4px;
	}

	.myco-header-search__panel .search-form {
		gap: 10px;
		width: 100%;
		padding-inline: 14px;
	}

	.myco-header-search__panel .search-form__field {
		height: 56px;
		border-radius: 4px;
		font-size: 16px; /* No zoom on focus in iOS. */
	}

	.myco-header-search__panel .search-form__submit {
		flex-basis: 60px;
		height: 56px;
		margin: 0;
		border-radius: 4px;
	}

	.myco-header-search__panel .search-form__submit::before {
		width: 18px;
		height: 18px;
	}
}
