/* Exact match switch shown beside site search buttons. */

.mtb-exact-match {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	position: relative;
	margin: 0 0 0 20px;
	vertical-align: middle;
	white-space: nowrap;
	font-size: 15px;
	line-height: 1.2;
	color: #161528;
	cursor: pointer;
	user-select: none;
}

/* Visually hidden but still focusable and announced as a switch. */
.mtb-exact-match-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.mtb-exact-match-switch {
	position: relative;
	flex: none;
	width: 36px;
	height: 20px;
	border-radius: 10px;
	background-color: #b4b4b4;
	transition: background-color 0.15s ease-in-out;
}

.mtb-exact-match-switch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background-color: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease-in-out;
}

.mtb-exact-match-input:checked + .mtb-exact-match-switch {
	background-color: #26a68b;
}

.mtb-exact-match-input:checked + .mtb-exact-match-switch::after {
	transform: translateX(16px);
}

.mtb-exact-match-input:focus-visible + .mtb-exact-match-switch {
	outline: 2px solid #7a47bf;
	outline-offset: 2px;
}

/*
 * Search forms in page content wrap on narrow screens. Spacing them with a flex gap instead of margins keeps
 * whatever wraps onto a new line flush with the input.
 */
.content .search-form,
.content .searchwp-search-form form > div {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 20px;
}

.content .search-form .mtb-exact-match + input.search-form-submit,
.content .searchwp-search-form #searchsubmit,
.content .mtb-exact-match {
	margin: 0;
}

/* The header search input already has a 25px right margin, so space the switch from the button instead. */
.header-search-wrap .mtb-exact-match {
	margin-left: 0;
	margin-right: 25px;
}

/* Sidebar forms are too narrow for the switch, so keep the input and button together and wrap the switch below. */
.sidebar-primary .searchwp-search-form form > div {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.sidebar-primary .searchwp-search-form #searchsubmit {
	order: 1;
	margin-left: auto;
}

.sidebar-primary .searchwp-search-form .mtb-exact-match {
	order: 2;
	margin: 10px 0 0;
}
