/*
 * Design System - AELITA
 * components/home-car-picker.css - homepage "Підбір автомобіля" filter block.
 *
 * Consumes tokens.css / layout.css only; no hex values, no Bootstrap grid.
 * Native <select> controls are kept for accessibility and to avoid the legacy
 * jQuery custom-select plugin. The model list is narrowed by brand through
 * js/design-system/home-car-picker.js; without JS the GET form still submits
 * the default condition.
 *
 * Loaded on the front page only (see inc/enqueue.php).
 */

/* -------------------------------------------------------------------- */
/* Section                                                              */
/* -------------------------------------------------------------------- */
.a-home-car-picker {
	padding-block: var(--home-section-space);
	/* Same light-grey band as the feedback form buttons (--bg-muted). */
	background-color: var(--bg-muted);
}

.a-home-car-picker__header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-2) var(--space-5);
	margin-block-end: var(--space-5);
}

.a-home-car-picker__title {
	margin: 0;
	font-family: var(--font-display-strong);
	font-size: var(--fs-h2);
	font-weight: var(--fw-bold);
	line-height: var(--lh-heading);
	color: var(--text-primary);
	text-transform: uppercase;
}

.a-home-car-picker__count {
	margin: 0;
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	color: var(--text-secondary);
}

/* Only the number is emphasised: brand red, semibold. */
.a-home-car-picker__count-num {
	color: var(--c-red-600);
	font-weight: var(--fw-semibold);
}

/* -------------------------------------------------------------------- */
/* Form                                                                 */
/* -------------------------------------------------------------------- */
.a-car-picker {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.a-car-picker__filters {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-3);
}

.a-car-picker__field {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	min-width: 0;
}

/* -------------------------------------------------------------------- */
/* Native select                                                        */
/* -------------------------------------------------------------------- */
.a-car-picker__select {
	display: block;
	width: 100%;
	/* 44px minimum touch target, composed from tokens. */
	min-height: calc(var(--space-6) + var(--space-3));
	padding: var(--space-2) var(--space-3);
	border: var(--border-w) solid var(--border);
	border-radius: var(--radius);
	background-color: var(--bg);
	color: var(--text-primary);
	font-family: var(--font-body);
	font-size: var(--fs-body);
	line-height: var(--lh-heading);
	cursor: pointer;
	transition:
		border-color var(--dur-press) var(--ease-out),
		box-shadow var(--dur-press) var(--ease-out);
}

/* Legacy theme ships `*:focus{outline:none!important}`, so keep the ring local. */
.a-car-picker__select:focus-visible {
	outline: 2px solid var(--focus-ring) !important;
	outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	.a-car-picker__select:hover {
		border-color: var(--text-secondary);
	}
}

/* -------------------------------------------------------------------- */
/* Submit                                                               */
/* -------------------------------------------------------------------- */
.a-car-picker__field--submit {
	justify-content: flex-end;
}

.a-car-picker__submit {
	width: 100%;
}

/* -------------------------------------------------------------------- */
/* Condition switch (Нові / З пробігом)                                 */
/* -------------------------------------------------------------------- */
.a-car-picker__condition {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-5);
}

.a-car-picker__radio {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	/* 44px minimum touch target. */
	min-height: calc(var(--space-6) + var(--space-3));
	font-size: var(--fs-body);
	line-height: var(--lh-heading);
	color: var(--text-primary);
	cursor: pointer;
}

.a-car-picker__radio input {
	width: calc(var(--space-4) + var(--space-1));
	height: calc(var(--space-4) + var(--space-1));
	margin: 0;
	accent-color: var(--c-red-600);
	cursor: pointer;
}

.a-car-picker__radio input:focus-visible {
	outline: 2px solid var(--focus-ring) !important;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------- */
/* Responsive                                                           */
/* -------------------------------------------------------------------- */
@media (min-width: 768px) {
	.a-car-picker__filters {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 992px) {
	.a-car-picker__filters {
		grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
		align-items: end;
	}

	.a-car-picker__submit {
		width: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.a-car-picker__select {
		transition-duration: 0.01ms;
	}
}
