/*
 * Elektronics Voice Search v1.6.8
 *
 * UI-only layout.
 * No DOM movement, no dependency on Journal Typeahead initialisation.
 * Functional SpeechRecognition JS remains unchanged from v1.6.2.
 */

.header-search {
	position: relative;
}

/* Shared microphone control */
.header-search > .evs-v16-control,
.header-search .evs-v16-control {
	z-index: 30;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	cursor: pointer;
	outline: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.header-search .evs-v16-control .fa {
	line-height: 1;
	pointer-events: none;
}

.header-search .evs-v16-control:hover,
.header-search .evs-v16-control:focus {
	opacity: 0.72;
}

.header-search .evs-v16-control.is-listening .fa {
	animation: evs-v16-pulse 0.9s ease-in-out infinite;
}

.header-search .evs-v16-control.is-error,
.header-search .evs-v16-control.is-unsupported {
	opacity: 0.5;
}

@keyframes evs-v16-pulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.22); }
	100% { transform: scale(1); }
}

/*
 * DESKTOP
 *
 * Use Journal's own html.desktop-header-active state.
 * The search row is always flex from the initial render.
 * The input/typeahead wrapper permanently occupies all space except
 * the 48px native search button.
 *
 * The microphone remains a sibling in the DOM but is absolutely
 * positioned over the right side of the grey input.
 */
html.desktop-header-active .header-search {
	display: flex !important;
	align-items: center !important;
	position: relative !important;
}

html.desktop-header-active .header-search > #search-input-el,
html.desktop-header-active .header-search > .twitter-typeahead {
	flex: 1 1 0 !important;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
}

html.desktop-header-active .header-search > #search-input-el {
	display: block !important;
}

html.desktop-header-active .header-search > .twitter-typeahead {
	display: block !important;
	position: relative !important;
}

html.desktop-header-active .header-search > .twitter-typeahead > #search-input-el,
html.desktop-header-active .header-search > .twitter-typeahead > .search-input {
	width: 100% !important;
	min-width: 0 !important;
	max-width: none !important;
}

html.desktop-header-active .header-search > .search-button {
	flex: 0 0 48px !important;
	width: 48px !important;
	min-width: 48px !important;
}

html.desktop-header-active .header-search > .evs-v16-control {
	position: absolute !important;
	top: 50% !important;
	right: 56px !important;
	width: 30px !important;
	height: 30px !important;
	transform: translateY(-50%) !important;
}

html.desktop-header-active .header-search > .evs-v16-control .fa {
	font-size: 15px;
}

/*
 * If Journal has already wrapped the input with Typeahead but some old
 * cached DOM placement leaves the control inside that wrapper, keep the
 * same visual result rather than breaking the row.
 */
html.desktop-header-active .header-search > .twitter-typeahead > .evs-v16-control {
	position: absolute !important;
	top: 50% !important;
	right: 8px !important;
	width: 30px !important;
	height: 30px !important;
	transform: translateY(-50%) !important;
}

html.desktop-header-active .header-search > .twitter-typeahead > .evs-v16-control .fa {
	font-size: 15px;
}

/*
 * MOBILE
 *
 * Keep the microphone as a normal sibling immediately before Journal's
 * native search button. No absolute positioning and no input-width change.
 */
html.mobile-header-active .header-search {
	display: flex !important;
	align-items: center !important;
}

html.mobile-header-active .header-search > #search-input-el,
html.mobile-header-active .header-search > .twitter-typeahead {
	flex: 1 1 auto !important;
	min-width: 0 !important;
}

html.mobile-header-active .header-search > .evs-v16-control {
	position: relative !important;
	top: auto !important;
	right: auto !important;
	flex: 0 0 38px !important;
	width: 38px !important;
	height: 40px !important;
	transform: none !important;
}

html.mobile-header-active .header-search > .evs-v16-control .fa {
	font-size: 21px;
}

html.mobile-header-active .header-search > .search-button {
	flex: 0 0 auto !important;
}
