/**
 * Wise Line Dealer Locator — form styles.
 *
 * Scoped under .wlm-form so nothing leaks into the theme. The accent is
 * injected inline from the Primary colour setting, so re-theming is one field.
 */

.wlm-form {
	--wlm-accent: #007e25;
	--wlm-accent-dark: #00631d;
	--wlm-border: #d5dad7;
	--wlm-text: #1f2522;
	--wlm-muted: #5d6b63;
	--wlm-bg: #ffffff;
	--wlm-radius: 6px;

	max-width: 720px;
	color: var(--wlm-text);
	font-size: 16px;
	line-height: 1.5;
}

/* ---- Rows ------------------------------------------------------------- */

.wlm-form__row {
	display: block;
	margin: 0 0 20px;
}

.wlm-form__row--split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

@media (max-width: 600px) {
	.wlm-form__row--split {
		grid-template-columns: 1fr;
		gap: 20px;
	}
}

/* ---- Fields ----------------------------------------------------------- */

.wlm-form label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wlm-muted);
}

.wlm-form input[type="text"],
.wlm-form input[type="email"],
.wlm-form input[type="tel"] {
	width: 100%;
	padding: 13px 15px;
	border: 1px solid var(--wlm-border);
	border-radius: var(--wlm-radius);
	background: var(--wlm-bg);
	color: inherit;
	font: inherit;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wlm-form input[type="text"]:hover,
.wlm-form input[type="email"]:hover,
.wlm-form input[type="tel"]:hover {
	border-color: var(--wlm-muted);
}

.wlm-form input[type="text"]:focus,
.wlm-form input[type="email"]:focus,
.wlm-form input[type="tel"]:focus {
	outline: none;
	border-color: var(--wlm-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wlm-accent) 20%, transparent);
}

/* Browsers without color-mix still get a visible focus ring. */
@supports not (color: color-mix(in srgb, red 50%, transparent)) {
	.wlm-form input:focus {
		box-shadow: 0 0 0 3px rgba(0, 126, 37, 0.2);
	}
}

.wlm-form__hint {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--wlm-muted);
}

/* ---- Button ----------------------------------------------------------- */

.wlm-form__button {
	display: inline-block;
	padding: 15px 34px;
	border: 0;
	border-radius: var(--wlm-radius);
	background: var(--wlm-accent);
	color: #fff;
	font: inherit;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.wlm-form__button:hover,
.wlm-form__button:focus {
	background: var(--wlm-accent-dark);
	color: #fff;
}

.wlm-form__button:active {
	transform: translateY(1px);
}

.wlm-form__button:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--wlm-accent) 45%, transparent);
	outline-offset: 2px;
}

.wlm-form__button[disabled] {
	opacity: 0.6;
	cursor: default;
}

/* ---- Messages --------------------------------------------------------- */

.wlm-form__error {
	margin: 0 0 22px;
	padding: 13px 16px;
	border-left: 4px solid #b32d2e;
	border-radius: 0 var(--wlm-radius) var(--wlm-radius) 0;
	background: #fdf3f4;
	color: #7d1f1c;
	font-size: 15px;
}

/* ---- Honeypot ---------------------------------------------------------
 * Hidden from people, left in the DOM for bots. Never display: none, which
 * some bots check for.
 * ---------------------------------------------------------------------- */

.wlm-form__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---- Postal code suggestions ------------------------------------------
 * The field is a combobox: type three characters and Mapbox postal codes
 * are offered. Suggestions are fetched through this site, never from the
 * browser directly, so the Mapbox token is not exposed.
 * ---------------------------------------------------------------------- */

.wlm-form__combo {
	position: relative;
}

.wlm-form__postal {
	text-transform: uppercase;
}

.wlm-form__postal::placeholder {
	text-transform: none;
	color: #9aa5a0;
}

.wlm-form__suggestions {
	position: absolute;
	z-index: 20;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: 260px;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	list-style: none;
	border: 1px solid var(--wlm-border);
	border-radius: var(--wlm-radius);
	background: var(--wlm-bg);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.wlm-form__suggestion {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin: 0;
	padding: 10px 12px;
	border-radius: 4px;
	cursor: pointer;
	line-height: 1.3;
}

.wlm-form__suggestion strong {
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.wlm-form__suggestion span {
	font-size: 13px;
	color: var(--wlm-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wlm-form__suggestion:hover,
.wlm-form__suggestion.is-active {
	background: var(--wlm-accent);
	color: #fff;
}

.wlm-form__suggestion:hover span,
.wlm-form__suggestion.is-active span {
	color: rgba(255, 255, 255, 0.85);
}

/* The split row lays fields out in a grid, so the combobox must not stretch
 * the postal row to the full form width. */
.wlm-form__row .wlm-form__combo {
	max-width: 260px;
}
