/**
 * RV search form ([fireside_rv_search]).
 *
 * Desktop widths: fourth / sixth / sixth / fourth, then a sixth for the button.
 * Layout responds to the width the form gets (container queries), so it works
 * in both Kadence header slots.
 */

.rv-search {
	--rv-search-text: #1f2933;
	--rv-search-label: #f3f4f7;
	--rv-search-muted: #7b8794;
	--rv-search-bg: #ffffff;
	--rv-search-accent: #e47b02;
	--rv-search-accent-hover: #c96a00;
	--rv-search-focus: rgba(228, 123, 2, 0.45);
	--rv-search-height: 46px;
	--rv-search-radius: 999px;

	container-type: inline-size;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	font-size: 16px;
	color: var(--rv-search-text);
}

.rv-search *,
.rv-search *::before,
.rv-search *::after {
	box-sizing: border-box;
}

/* Phones: Camper Type full width, then pairs. */
.rv-search__fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	align-items: end;
}

.rv-search__field {
	min-width: 0;
}

.rv-search__field:first-child {
	grid-column: 1 / -1;
}

.rv-search__label {
	display: block;
	margin: 0 0 6px 18px;
	font-family: Rubik, sans-serif;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rv-search-label);
}

.rv-search__control {
	position: relative;
	display: flex;
	align-items: center;
	height: var(--rv-search-height);
	background: var(--rv-search-bg);
	border-radius: var(--rv-search-radius);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
	transition: box-shadow 0.15s ease;
}

.rv-search__control:focus-within {
	box-shadow: 0 0 0 3px var(--rv-search-focus);
}

.rv-search__icon {
	position: absolute;
	top: 50%;
	left: 16px;
	width: 18px;
	height: 18px;
	transform: translateY(-50%);
	pointer-events: none;
	fill: none;
	stroke: var(--rv-search-muted);
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Reset Kadence's global form field styles inside the pill. */
.rv-search .rv-search__input {
	width: 100%;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0 16px 0 44px;
	font-family: inherit;
	font-size: 16px; /* 16px stops iOS zooming in on focus. */
	line-height: normal;
	color: var(--rv-search-text);
	background: transparent;
	border: 0;
	border-radius: var(--rv-search-radius);
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.rv-search .rv-search__input::placeholder {
	color: var(--rv-search-muted);
	opacity: 1;
}

.rv-search .rv-search__input--select {
	padding-right: 40px;
	cursor: pointer;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237b8794' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 18px center;
}

.rv-search .rv-search__input--date {
	padding: 0 14px 0 20px;
	cursor: pointer;
}

/* iOS Safari centres date values and collapses empty date inputs. */
.rv-search .rv-search__input--date::-webkit-date-and-time-value {
	text-align: left;
}

.rv-search .rv-search__input--date::-webkit-calendar-picker-indicator {
	cursor: pointer;
	opacity: 0.45;
}

.rv-search .rv-search__input:invalid {
	color: #d64545;
}

.rv-search__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: var(--rv-search-height);
	margin: 0;
	padding: 0 24px;
	font-family: Rubik, sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #ffffff;
	background: var(--rv-search-accent);
	border: 0;
	border-radius: var(--rv-search-radius);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.rv-search__submit:hover {
	color: #ffffff;
	background: var(--rv-search-accent-hover);
}

.rv-search__submit:active {
	transform: translateY(1px);
}

.rv-search__submit:focus-visible {
	outline: 3px solid var(--rv-search-label);
	outline-offset: 2px;
}

.rv-search__submit-icon {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
}

/* Very narrow: one column. */
@container (max-width: 339px) {
	.rv-search__fields {
		grid-template-columns: 1fr;
	}
}

/* Tablets: two rows. */
@container (min-width: 560px) {
	.rv-search__fields {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: 14px 16px;
	}

	.rv-search__field,
	.rv-search__field:first-child {
		grid-column: span 2;
	}

	.rv-search__field--fourth:nth-child(4),
	.rv-search__field--actions {
		grid-column: span 3;
	}
}

/* Desktop: one row. */
@container (min-width: 1040px) {
	.rv-search__fields {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		gap: 0 16px;
	}

	.rv-search__field--fourth,
	.rv-search__field--fourth:nth-child(4),
	.rv-search__field:first-child {
		grid-column: span 3;
	}

	.rv-search__field--sixth,
	.rv-search__field--actions {
		grid-column: span 2;
	}
}

/*
 * Kadence header integration: the top row holding the form becomes a
 * full-width band, with the form aligned to the site content width.
 */
.header-html-inner > p,
.mobile-html-inner > p {
	margin: 0;
}

.site-header-item:has(.rv-search),
.site-header-item:has(.rv-search) .header-html,
.site-header-item:has(.rv-search) .header-html-inner,
.site-header-item:has(.rv-search) .mobile-html,
.site-header-item:has(.rv-search) .mobile-html-inner {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
}

.site-top-header-wrap:has(.rv-search) {
	max-width: none;
	margin-right: 0;
	margin-left: 0;
	padding-right: 0;
	padding-left: 0;
}

/*
 * Kadence paints stuck sticky rows #fff with an ID selector (1,4,0); this needs
 * to win in both desktop and mobile headers, hence the repeated class (1,5,0).
 */
#masthead .site-top-header-wrap.site-top-header-wrap.site-header-focus-item:has(.rv-search) > .site-header-row-container-inner {
	background: #1f2933;
	border-bottom: 3px solid var(--rv-search-accent, #e47b02);
}

.site-top-header-wrap:has(.rv-search) .site-header-row-container-inner > .site-container {
	max-width: var(--global-content-width, 1290px);
	margin-right: auto;
	margin-left: auto;
	padding: 18px var(--global-content-edge-padding, 1.5rem) 20px;
}

.site-top-header-wrap:has(.rv-search) .site-top-header-inner-wrap {
	min-height: 0;
}

/*
 * Compact band while Kadence's sticky header has it pinned, so it covers less
 * of the page on scroll-up (full size again once the page is back at the top).
 */
#masthead .site-top-header-wrap.item-is-fixed:has(.rv-search) .site-header-row-container-inner > .site-container {
	padding-top: 8px;
	padding-bottom: 10px;
}

#masthead .site-top-header-wrap.item-is-fixed .rv-search {
	--rv-search-height: 38px;
}

#masthead .site-top-header-wrap.item-is-fixed .rv-search__label {
	margin-bottom: 4px;
	font-size: 11px;
}
