/**
 * Walker Locator — front-end styles.
 * Scoped under .walker-locator so nothing leaks into the Bricks theme.
 */

.walker-locator {
	display: block;
	width: 100%;
	align-self: stretch;

	--wl-accent: #c8102e;
	--wl-border: #e2ded6;
	--wl-bg: #ffffff;
	--wl-muted: #6b675f;
	--wl-text: #23201c;
	--wl-radius: 6px;
	--wl-map-height: 600px;

	container-type: inline-size;
	color: var(--wl-text);
	font-size: 15px;
	line-height: 1.45;
}

.walker-locator__layout {
	display: grid;
	grid-template-columns: minmax(280px, 360px) 1fr;
	gap: 0;
	height: var(--wl-map-height);
	border: 1px solid var(--wl-border);
	border-radius: var(--wl-radius);
	overflow: hidden;
	background: var(--wl-bg);
}

.walker-locator__sidebar {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	border-right: 1px solid var(--wl-border);
	background: var(--wl-bg);
}

/* ---- Search ---------------------------------------------------------- */

.walker-locator__search {
	padding: 16px;
	border-bottom: 1px solid var(--wl-border);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.walker-locator__input,
.walker-locator__radius,
.walker-locator__retailer {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--wl-border);
	border-radius: var(--wl-radius);
	background: #fff;
	color: inherit;
	font: inherit;
	box-sizing: border-box;
}

.walker-locator__input:focus-visible,
.walker-locator__radius:focus-visible,
.walker-locator__retailer:focus-visible,
.walker-locator__button:focus-visible,
.walker-locator__result:focus-visible {
	outline: 2px solid var(--wl-accent);
	outline-offset: 2px;
}

.walker-locator__search-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.walker-locator__radius-label {
	color: var(--wl-muted);
	font-size: 13px;
	white-space: nowrap;
}

.walker-locator__radius {
	width: auto;
	flex: 1 1 auto;
	min-width: 0;
}

.walker-locator__button {
	flex: 0 0 auto;
	padding: 10px 18px;
	border: 0;
	border-radius: var(--wl-radius);
	background: var(--wl-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.walker-locator__button:hover {
	opacity: 0.88;
}

.walker-locator__search.is-loading .walker-locator__button {
	opacity: 0.5;
	pointer-events: none;
}

.walker-locator__message {
	margin: 0;
	font-size: 13px;
	color: var(--wl-muted);
}

.walker-locator__message:empty {
	display: none;
}

.walker-locator__message.is-error {
	color: var(--wl-accent);
}

/* ---- Results --------------------------------------------------------- */

.walker-locator__count {
	margin: 0;
	padding: 10px 16px;
	font-size: 13px;
	color: var(--wl-muted);
	border-bottom: 1px solid var(--wl-border);
	background: #faf8f4;
}

.walker-locator__results {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.walker-locator__result {
	display: grid;
	gap: 2px;
	width: 100%;
	padding: 12px 16px;
	border: 0;
	border-bottom: 1px solid var(--wl-border);
	background: transparent;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.walker-locator__result:hover {
	background: #faf8f4;
}

.walker-locator__result-title {
	font-weight: 600;
}

.walker-locator__result-address,
.walker-locator__popup-address {
	color: var(--wl-muted);
	font-size: 13px;
}

.walker-locator__result-distance {
	font-size: 12px;
	font-weight: 600;
	color: var(--wl-accent);
}

.walker-locator__badge {
	justify-self: start;
	margin: 2px 0;
	padding: 1px 7px;
	border-radius: 999px;
	background: #f0ece4;
	color: var(--wl-muted);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* ---- Map ------------------------------------------------------------- */

.walker-locator__map {
	height: 100%;
	min-height: 320px;
	width: 100%;
}

.walker-locator__origin {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #2b6cb0;
	border: 3px solid #fff;
	box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.35);
}

/* ---- Popup ----------------------------------------------------------- */

.walker-locator__popup {
	display: grid;
	gap: 3px;
}

.walker-locator__popup-title {
	font-size: 15px;
}

.walker-locator__popup-hours {
	font-size: 13px;
	white-space: pre-line;
}

.walker-locator__popup-actions {
	display: flex;
	gap: 12px;
	margin-top: 6px;
}

.walker-locator__popup-link {
	color: var(--wl-accent);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.walker-locator__popup-link:hover {
	text-decoration: underline;
}

/* ---- Single-location map --------------------------------------------- */

.walker-map {
	--wl-map-height: 400px;

	/* Bricks drops this into flex contexts where a shrink-to-fit item would
	   collapse to zero width, which leaves Mapbox with a 400px fallback canvas. */
	display: block;
	width: 100%;
	align-self: stretch;
}

.walker-map__canvas {
	height: var(--wl-map-height);
	min-height: 240px;
	width: 100%;
	min-width: 100%;
}

.walker-map__marker {
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	cursor: pointer;
}

.walker-map__marker:focus-visible {
	outline: 2px solid var(--action, #7fb3b5);
	outline-offset: 3px;
}

/* Follow the site's action colour here rather than the locator's red. */
.walker-map .walker-locator__popup-link {
	color: var(--action, #7fb3b5);
}

.walker-map .walker-locator__popup-title {
	font-size: 18px;
	line-height: 1.25;
}

.walker-map .walker-locator__popup {
	gap: 6px;
	padding: 2px;
}

.walker-locator-error {
	padding: 12px 16px;
	border-left: 3px solid var(--wl-accent, #c8102e);
	background: #fdf3f4;
	font-size: 14px;
}

/* ---- Responsive ------------------------------------------------------ */

@container (max-width: 780px) {
	.walker-locator__layout {
		grid-template-columns: 1fr;
		height: auto;
	}

	.walker-locator__sidebar {
		order: 2;
		border-right: 0;
		border-top: 1px solid var(--wl-border);
		border-bottom: 0;
	}

	.walker-locator__map {
		order: 1;
		height: var(--wl-map-height-mobile, 420px);
	}

	.walker-locator__results {
		max-height: 260px;
	}
}

/* Fallback for browsers without container queries. */
@media (max-width: 780px) {
	.walker-locator__layout {
		grid-template-columns: 1fr;
		height: auto;
	}

	.walker-locator__sidebar {
		order: 2;
		border-right: 0;
		border-top: 1px solid var(--wl-border);
		border-bottom: 0;
	}

	.walker-locator__map {
		order: 1;
		height: var(--wl-map-height-mobile, 420px);
	}

	.walker-locator__results {
		max-height: 260px;
	}
}
