/* Expanding search field for the "#search" menu item. */

.cwfts-menu-search-item {
	position: relative;
}

/* The toggle inherits the surrounding menu-link styling. */
.cwfts-menu-search-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	color: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.cwfts-menu-search-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.cwfts-menu-search-icon {
	flex: none;
}

/* Fallback in case the active theme doesn't already define this class. */
.cwfts-menu-search-toggle .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	overflow: hidden;
	position: absolute;
	word-wrap: normal !important;
}

.cwfts-menu-search-panel {
	position: absolute;
	top: calc(100% + 0.6em);
	right: 0;
	z-index: 1000;
	min-width: 17rem;
	max-width: min(22rem, 90vw);
	background: #fff;
	color: #23272f;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
	padding: 0.75rem;
}

.cwfts-menu-search-form {
	display: flex;
	gap: 0.5em;
}

.cwfts-menu-search-form input[type='search'] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.45em 0.65em;
	font-size: 1rem;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 4px;
	background: #fff;
	color: inherit;
}

.cwfts-menu-search-submit {
	flex: none;
	padding: 0.45em 0.9em;
	font-size: 0.95rem;
	border: 0;
	border-radius: 4px;
	background: #23272f;
	color: #fff;
	cursor: pointer;
}

.cwfts-menu-search-submit:hover,
.cwfts-menu-search-submit:focus-visible {
	background: #3d5a80;
}

/* On small screens (menu likely in a drawer) render inline instead of floating. */
@media (max-width: 767px) {
	.cwfts-menu-search-panel {
		position: static;
		min-width: 0;
		max-width: none;
		box-shadow: none;
		border: 0;
		padding: 0.5rem 0;
		background: transparent;
		color: inherit;
	}
}
