/* CCRC ARN Search — search bars (header bar + bars on the search page). Loaded site-wide. */

:root {
	--ccrc-arn-blue: #0065a4;
	--ccrc-arn-teal: #31a2b6;
	--ccrc-arn-bar-border: #d9d9d9;     /* Spec #F3F3F3 is nearly invisible on white; matches the mockups instead. */
	--ccrc-arn-placeholder: #757575;    /* Spec #F3F3F3 fails contrast; matches the mockups instead. */
	--ccrc-arn-muted: #757575;
}

/* ---- Bar ---------------------------------------------------------------- */

.ccrc-arn-bar {
	display: flex;
	align-items: center;
	box-sizing: border-box;
	width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 6px 0 18px;
	background: #fff;
	border: 1px solid var(--ccrc-arn-bar-border);
	border-radius: 999px;
	transition: border-color .15s, box-shadow .15s;
}

.ccrc-arn-bar:focus-within {
	border-color: var(--ccrc-arn-blue);
	box-shadow: 0 0 0 3px rgba(0, 101, 164, .15);
}

.ccrc-arn-bar .ccrc-arn-bar__input,
.ccrc-arn-bar .ccrc-arn-bar__input:focus {
	all: unset;
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	box-sizing: border-box;
	font-family: Lato, sans-serif;
	font-size: 14px;
	font-weight: 400;
	color: #000;
	-webkit-appearance: none;
	appearance: none;
}

.ccrc-arn-bar .ccrc-arn-bar__input::placeholder {
	color: var(--ccrc-arn-placeholder);
	opacity: 1;
}

.ccrc-arn-bar .ccrc-arn-bar__input::-webkit-search-cancel-button {
	display: none;
}

.ccrc-arn-bar .ccrc-arn-bar__btn,
.ccrc-arn-bar .ccrc-arn-bar__btn:hover,
.ccrc-arn-bar .ccrc-arn-bar__btn:focus {
	all: unset;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	color: var(--ccrc-arn-blue);
	cursor: pointer;
}

.ccrc-arn-bar .ccrc-arn-bar__btn:focus-visible {
	outline: 2px solid var(--ccrc-arn-blue);
	outline-offset: 1px;
}

.ccrc-arn-icon {
	width: 20px;
	height: 20px;
}

/* Search icon becomes an arrow once something is typed. */
.ccrc-arn-icon--arrow,
.ccrc-arn-bar.has-text .ccrc-arn-icon--search {
	display: none;
}

.ccrc-arn-bar.has-text .ccrc-arn-icon--arrow {
	display: block;
}

.ccrc-arn-terms {
	display: block;
	margin-top: 6px;
	text-align: right;
	font-family: Lato, sans-serif;
	font-size: 12px;
	line-height: 1.2;
	color: var(--ccrc-arn-muted) !important;
	text-decoration: none !important;
}

.ccrc-arn-terms:hover,
.ccrc-arn-terms:focus {
	text-decoration: underline !important;
}

/* ---- Header placement ----------------------------------------------------
   The Elementor shortcode widget holding [ccrc_arn_searchbar] gets the CSS class
   "ccrc-arn-header-search". On desktop the bar is always visible and the old
   magnifier toggle (.slidedclick) is hidden; below 1025px the magnifier opens it. */

.elementor-widget.ccrc-arn-header-search {
	flex: 1 1 260px;
	min-width: 220px;
	max-width: 420px;
	margin-left: 24px;
}

/* The bar is vertically centred with the menu; the terms link hangs below it without
   taking up layout space, so alignment is the same whether or not the link is shown. */
.ccrc-arn-header-search .ccrc-arn-sb {
	position: relative;
}

.ccrc-arn-header-search .ccrc-arn-terms {
	position: absolute;
	top: 100%;
	right: 4px;
	white-space: nowrap;
}

/* Only when the ARN bar is in the header, so a reverted header keeps its magnifier. */
@media (min-width: 1025px) {
	body:has(.ccrc-arn-header-search) .slidedclick {
		display: none !important;
	}

	/* Keep the top menu on one line; the search bar gives up width instead. */
	.e-con:has(> .ccrc-arn-header-search) .e-n-menu-heading {
		flex-wrap: nowrap;
	}

	.e-con:has(> .ccrc-arn-header-search) .e-n-menu-title,
	.e-con:has(> .ccrc-arn-header-search) .e-n-menu-title-text {
		white-space: nowrap;
	}

	.e-con:has(> .ccrc-arn-header-search) .elementor-widget-n-menu {
		flex-shrink: 0;
	}
}

@media (min-width: 1025px) and (max-width: 1199px) {
	.elementor-widget.ccrc-arn-header-search {
		min-width: 180px;
		margin-left: 16px;
	}
}

@media (max-width: 1024px) {
	.elementor-widget.ccrc-arn-header-search {
		display: none;
		position: fixed;
		left: 0;
		right: 0;
		top: var(--ccrc-arn-panel-top, 140px);
		z-index: 9999;
		min-width: 0;
		max-width: none;
		margin: 0;
		padding: 14px 16px 12px;
		background: #fff;
		box-shadow: 0 8px 16px rgba(0, 0, 0, .12);
	}

	.elementor-widget.ccrc-arn-header-search.is-open {
		display: block;
	}

	.ccrc-arn-header-search .ccrc-arn-terms {
		position: static; /* Mobile panel: normal flow under the bar. */
	}

	.ccrc-arn-header-search .ccrc-arn-bar .ccrc-arn-bar__input {
		font-size: 16px; /* Prevents iOS zoom on focus. */
	}
}
