/**
 * Motovante homepage styles — hero search banner, stats bar, browse-by
 * grids, CTA banner. Loaded only on pages containing a homepage
 * shortcode (see Motovante\Public_Site\Public_Site::needs_home_styles()).
 * Depends on the CSS variables defined in public.css.
 */

/* ---------- Hero ---------- */
.motovante-hero {
	position: relative;
	background-color: var(--motovante-hero-bg, var(--motovante-ink));
	background-size: cover;
	background-position: center;
	padding: var(--motovante-hero-padding-top, 90px) 0 var(--motovante-hero-padding-bottom, 50px);
	color: #fff;
	overflow: hidden;
}

.motovante-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background: var(--motovante-hero-overlay, radial-gradient(circle at 30% 20%, rgba(109, 47, 167, 0.55), rgba(20, 20, 20, 0.85)));
	z-index: 0;
}

.motovante-hero__overlay {
	display: none; /* gradient handled by ::before for a single paint layer */
}

.motovante-hero__inner {
	position: relative;
	z-index: 1;
	text-align: center;
	max-width: 900px;
}

.motovante-hero__title {
	font-size: clamp(28px, 4vw, 44px);
	font-weight: 700;
	color: var(--motovante-hero-title-color, #fff);
	margin: 0 0 12px;
	letter-spacing: -0.01em;
}

.motovante-hero__subtitle {
	font-size: 16px;
	color: var(--motovante-hero-subtitle-color, rgba(255, 255, 255, 0.85));
	margin: 0 0 32px;
}

.motovante-hero-search {
	background: var(--motovante-hero-search-bg, #fff);
	border: 1px solid transparent;
	border-radius: var(--motovante-hero-search-radius, 14px);
	color: var(--motovante-hero-search-text, var(--motovante-ink));
	padding: 18px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
	text-align: left;
	transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.motovante-hero-search__tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 14px;
}

.motovante-hero-search__tab {
	position: relative;
	cursor: pointer;
}

.motovante-hero-search__tab input {
	position: absolute;
	opacity: 0;
}

.motovante-hero-search__tab span {
	display: inline-block;
	padding: 8px 18px;
	border: 1px solid transparent;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	color: var(--motovante-muted);
	background: var(--motovante-bg);
	transition: all 0.15s ease;
}

.motovante-hero-search__tab input:checked + span {
	background: var(--motovante-crimson);
	color: #fff;
}

.motovante-hero-search__fields {
	display: grid;
	/* v2.1.40: each configurable desktop row declares its own field count.
	   A sensible minimum keeps native select arrows from sitting on text. */
	grid-template-columns: repeat(var(--motovante-hero-row-count, 4), minmax(110px, 1fr));
	column-gap: var(--motovante-hero-column-gap, 10px);
	row-gap: 10px;
	align-items: stretch;
}

.motovante-hero-search__fields + .motovante-hero-search__fields {
	margin-top: var(--motovante-hero-row-gap, 10px);
}

/* v2.1.44: Row 2 can be conditionally collapsed for New inventory.
   It is a fieldset so disabled state excludes every hidden Row 2 control
   from the submitted GET request without interfering with dependent selects. */
fieldset.motovante-hero-search__fields {
	min-inline-size: 0;
	margin-inline: 0;
	padding: 0;
	border: 0;
}

.motovante-hero-search__fields[hidden] {
	display: none !important;
}

.motovante-hero-search__fields > * {
	min-width: 0;
	box-sizing: border-box;
}

.motovante-hero-search__fields input,
.motovante-hero-search__fields select {
	width: 100%;
	height: auto;
	min-height: 42px;
	box-sizing: border-box;
	padding: 10px 14px;
	border: 1px solid var(--motovante-border);
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.35;
	vertical-align: middle;
	color: var(--motovante-hero-search-text, var(--motovante-ink));
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.motovante-hero-search__fields select {
	/* Extra room protects the selected text from the browser's native arrow. */
	padding-right: 34px;
	line-height: normal;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* Switch before the desktop row becomes cramped. This keeps every select
   readable instead of squeezing its selected option beneath the native arrow. */
@media (max-width: 1024px) {
	.motovante-hero-search__fields {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.motovante-hero-search__keyword {
		grid-column: 1 / -1;
	}

	.motovante-hero-search__filters-btn,
	.motovante-hero-search__submit {
		width: 100%;
		justify-content: center;
	}
}

@media (max-width: 640px) {
	.motovante-hero-search__fields {
		grid-template-columns: 1fr;
	}

	.motovante-hero-search__keyword {
		grid-column: auto;
	}
}

.motovante-hero-search__filters-btn {
	position: relative;
	display: inline-flex;
	min-height: 42px;
	box-sizing: border-box;
	align-items: center;
	gap: 6px;
	background: var(--motovante-bg);
	border: 1px solid var(--motovante-border);
	border-radius: 8px;
	padding: 12px 18px;
	font-size: 14px;
	font-weight: 600;
	color: var(--motovante-hero-search-text, var(--motovante-ink));
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.motovante-hero-search__filters-btn:hover {
	border-color: var(--motovante-crimson);
	color: var(--motovante-crimson);
}

.motovante-hero-search__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	box-sizing: border-box;
	background: var(--motovante-crimson);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 12px 28px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.motovante-hero-search__submit:hover {
	background: var(--motovante-crimson-dark);
}

/* ---------- Stats bar ---------- */
.motovante-stats-bar {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 40px;
	margin-top: 32px;
}

.motovante-stats-bar__item {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.motovante-stats-bar__value {
	font-size: 26px;
	font-weight: 700;
	color: var(--motovante-gold);
}

.motovante-stats-bar__label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.75);
	margin-top: 2px;
}

/* Stats bar rendered outside the dark hero (e.g. standalone shortcode)
   gets dark text automatically via this contextual override. */
body:not(:has(.motovante-hero)) .motovante-stats-bar__label {
	color: var(--motovante-muted);
}

body:not(:has(.motovante-hero)) .motovante-stats-bar {
	background: var(--motovante-bg);
	border-radius: var(--motovante-radius);
	padding: 24px;
}

/* ---------- Section wrappers ---------- */
.motovante-home-section {
	padding: 56px 0;
}

.motovante-home-section--locations {
	background: var(--motovante-bg);
}

.motovante-home-section__title {
	text-align: center;
	font-size: 26px;
	margin: 0 0 32px;
	color: var(--motovante-ink);
}

/* ---------- Featured vehicle card consistency ----------
   Featured inventory can be rendered through either the full Home Featured
   Elementor widget or the standalone Featured Vehicles widget. Mark featured
   grids explicitly and lock the actual image canvas — not only the outer card
   — so every thumbnail occupies the exact same frame regardless of the source
   image dimensions or WordPress thumbnail attributes. */
.motovante-home-section--featured .motovante-card__media,
.motovante-grid--featured .motovante-card__media {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
}

.motovante-home-section--featured .motovante-card__media > a,
.motovante-grid--featured .motovante-card__media > a {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.motovante-home-section--featured .motovante-card__media img,
.motovante-grid--featured .motovante-card__media img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	min-width: 100%;
	min-height: 100%;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	object-fit: cover !important;
	object-position: 50% 50% !important;
}

.motovante-home-section--featured .motovante-card__placeholder,
.motovante-grid--featured .motovante-card__placeholder {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

/* Condition and featured badge geometry is shared in public.css. */

/* Keep the monetary overlay badge at one height too; its width remains
   content-aware so long currencies/prices are never clipped. */
.motovante-home-section--featured .motovante-card__price-badge,
.motovante-grid--featured .motovante-card__price-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 120px;
	min-height: 28px;
	box-sizing: border-box;
	line-height: 1;
	white-space: nowrap;
}

/* ---------- Browse by Location ---------- */
.motovante-browse-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 20px;
}

.motovante-browse-card {
	display: block;
	border-radius: var(--motovante-radius);
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	background: #fff;
	border: 1px solid var(--motovante-border);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.motovante-browse-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.motovante-browse-card__media {
	height: 130px;
	background: linear-gradient(135deg, var(--motovante-crimson), var(--motovante-crimson-dark));
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
}

.motovante-browse-card__initial {
	font-size: 40px;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.85);
}

.motovante-browse-card__body {
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.motovante-browse-card__name {
	font-weight: 600;
	font-size: 15px;
	color: var(--motovante-ink);
}

.motovante-browse-card__count {
	font-size: 12px;
	color: var(--motovante-muted);
}

/* ---------- Browse by Type ---------- */
.motovante-browse-grid--types {
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.motovante-type-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	text-align: center;
	padding: 24px 12px;
	border-radius: var(--motovante-radius);
	border: 1px solid var(--motovante-border);
	background: #fff;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.motovante-type-card:hover {
	border-color: var(--motovante-crimson);
	transform: translateY(-3px);
}

.motovante-type-card__icon {
	width: 40px;
	height: 40px;
	color: var(--motovante-crimson);
}

.motovante-type-card__icon svg {
	width: 100%;
	height: 100%;
}

.motovante-type-card__name {
	font-weight: 600;
	font-size: 14px;
	color: var(--motovante-ink);
}

.motovante-type-card__count {
	font-size: 12px;
	color: var(--motovante-muted);
}

/* ---------- CTA banner ---------- */
.motovante-cta-banner {
	background: linear-gradient(120deg, var(--motovante-ink), var(--motovante-crimson-dark));
	color: #fff;
	padding: 48px 0;
}

.motovante-cta-banner__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 20px;
}

.motovante-cta-banner__title {
	margin: 0 0 6px;
	font-size: 24px;
}

.motovante-cta-banner__subtitle {
	margin: 0;
	color: rgba(255, 255, 255, 0.8);
	font-size: 14px;
}

.motovante-cta-banner__button {
	background: var(--motovante-crimson);
	color: #fff;
	border: none;
	white-space: nowrap;
	font-weight: 600;
}

.motovante-cta-banner__button:hover,
.motovante-cta-banner__button:active,
.motovante-cta-banner__button:focus-visible {
	background: var(--motovante-crimson-dark);
	color: #fff;
}


/* Elementor live-preview safety: keep hero search child controls visually isolated.
   Low-specificity defaults preserve visibility without overriding Elementor instance controls. */
:where(.motovante-hero-search__fields input, .motovante-hero-search__fields select) {
	color: var(--motovante-hero-search-text, var(--motovante-ink));
	background-color: #fff;
}

:where(.motovante-hero-search__filters-btn) {
	color: var(--motovante-hero-search-text, var(--motovante-ink));
	background-color: var(--motovante-bg);
}

:where(.motovante-hero-search__submit) {
	color: #fff;
	background-color: var(--motovante-crimson);
}

:where(.motovante-hero-search__fields input, .motovante-hero-search__fields select, .motovante-hero-search__filters-btn, .motovante-hero-search__submit):focus,
:where(.motovante-hero-search__fields input, .motovante-hero-search__fields select, .motovante-hero-search__filters-btn, .motovante-hero-search__submit):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---------- Elementor native homepage composition ----------
 * The generated Elementor Home intentionally keeps Stats as its own native
 * Motovante widget. Do not infer its context from the presence of a Hero
 * elsewhere on the page; make the standalone widget readable explicitly.
 */
.elementor-widget-motovante_stats_bar .motovante-stats-bar,
.elementor-element.elementor-widget-motovante_stats_bar .motovante-stats-bar {
	margin-top: 0;
	background: var(--motovante-bg);
	padding: 24px;
}

.elementor-widget-motovante_stats_bar .motovante-stats-bar__label,
.elementor-element.elementor-widget-motovante_stats_bar .motovante-stats-bar__label {
	color: var(--motovante-muted);
}
