.apv-vp {
	--apv-vp-icon: #343434;
	--apv-vp-icon-hover: #d20a10;
	--apv-vp-border: #e4e4e4;
	--apv-vp-border-hover: #d20a10;
	--apv-vp-text: #2a2a2a;
	--apv-vp-muted: #6b6b6b;
	font-size: 15px;
	color: var(--apv-vp-text);
	/* Container queries (not viewport media queries) drive the responsive
	   breakpoint below, since this shortcode can end up in a narrow theme
	   column/sidebar even on a wide browser window. */
	container-type: inline-size;
}

.apv-vp [hidden] {
	display: none !important;
}

.apv-vp__filter {
	margin-bottom: 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.apv-vp__select,
.apv-vp__search-input {
	box-sizing: border-box;
	height: 40px;
	padding: 8px 12px;
	border: 1px solid var(--apv-vp-border);
	border-radius: 6px;
	background: #fff;
	font-size: 14px;
	width: 100%;
	min-width: 0;
	max-width: 100%;
}

.apv-vp__select:focus,
.apv-vp__search-input:focus {
	outline: 2px solid var(--apv-vp-border-hover);
	outline-offset: 1px;
}

/* Search grows, country select stays compact; both shrink instead of
   overflowing a narrow column. */
.apv-vp__search {
	position: relative;
	display: flex;
	align-items: center;
	flex: 1 1 260px;
	max-width: 420px;
}

.apv-vp__select {
	flex: 0 1 220px;
	width: auto;
}

.apv-vp__near {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	height: 40px;
	padding: 0 14px;
	border: 1px solid var(--apv-vp-border);
	border-radius: 6px;
	background: #fff;
	color: var(--apv-vp-text);
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
}

.apv-vp__near .apv-vp__icon {
	width: 18px;
	height: 18px;
	margin-top: 0;
}

.apv-vp__near:hover,
.apv-vp__near:focus-visible {
	border-color: var(--apv-vp-border-hover);
}

.apv-vp__near.is-active {
	background: var(--apv-vp-border-hover);
	border-color: var(--apv-vp-border-hover);
	color: #fff;
}

.apv-vp__near.is-active .apv-vp__icon {
	color: #fff;
}

.apv-vp__near:disabled {
	opacity: .6;
	cursor: progress;
}

.apv-vp .apv-vp__near-status {
	margin: -6px 0 12px;
	padding: 0;
	font-size: 13px;
	color: var(--apv-vp-muted);
}

.apv-vp__distance {
	margin-left: auto;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--apv-vp-border-hover);
	white-space: nowrap;
}

.apv-vp__reset {
	background: none;
	border: 0;
	padding: 4px 2px;
	color: var(--apv-vp-border-hover);
	font-size: 13.5px;
	cursor: pointer;
	text-decoration: underline;
}

.apv-vp__count {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--apv-vp-text);
	white-space: nowrap;
}

.apv-vp__search .apv-vp__icon {
	position: absolute;
	left: 10px;
	width: 16px;
	height: 16px;
	color: var(--apv-vp-muted);
	pointer-events: none;
}

.apv-vp__search-input {
	padding-left: 32px;
}

/* Place suggestions below the search field. z-index keeps it above the
   map, which has its own stacking context at z-index 0. */
.apv-vp ul.apv-vp__suggest {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 10;
	margin: 0;
	padding: 4px 0;
	list-style: none;
	max-height: 280px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--apv-vp-border);
	border-radius: 6px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.apv-vp__suggest-item {
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: 8px 12px;
	cursor: pointer;
	line-height: 1.3;
}

.apv-vp__suggest-item:hover,
.apv-vp__suggest-item.is-active {
	background: #f4f4f4;
}

.apv-vp__suggest-item.is-active {
	box-shadow: inset 3px 0 0 var(--apv-vp-border-hover);
}

.apv-vp__suggest-name {
	font-size: 14px;
	font-weight: 600;
	color: var(--apv-vp-text);
}

.apv-vp__suggest-region {
	font-size: 12.5px;
	color: var(--apv-vp-muted);
}

.apv-vp__layout {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
	gap: 20px;
	align-items: start;
}

.apv-vp__layout--no-map {
	grid-template-columns: 1fr;
}

.apv-vp__layout--no-map .apv-vp__list {
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

@container (max-width: 700px) {
	.apv-vp__layout {
		grid-template-columns: 1fr;
	}
}

/* The map gets its own stacking context (isolation + z-index), so
   Leaflet's internal panes/controls (z-index 400-1000) can never paint
   over the filter, the theme header or its dropdown menus. It also never
   grows taller than the viewport, whatever height the shortcode asks for -
   otherwise the sticky map could cover everything around it when the
   browser window is short or zoomed. */
.apv-vp__map {
	width: 100%;
	max-height: calc(100vh - 32px - var(--wp-admin--admin-bar--height, 0px));
	border-radius: 8px;
	background: #f2f2f2;
	position: sticky;
	top: calc(16px + var(--wp-admin--admin-bar--height, 0px));
	z-index: 0;
	isolation: isolate;
}

.apv-vp__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
	max-height: min(640px, calc(100vh - 32px - var(--wp-admin--admin-bar--height, 0px)));
	overflow-y: auto;
	padding-right: 4px;
}

@container (max-width: 700px) {
	.apv-vp__map {
		position: relative;
		top: auto;
		height: min(360px, 55vh) !important;
	}
	.apv-vp__list {
		max-height: none;
		overflow: visible;
		padding-right: 0;
	}
	.apv-vp__search,
	.apv-vp__select,
	.apv-vp__near {
		flex: 1 1 100%;
		max-width: none;
	}
	.apv-vp__near {
		justify-content: center;
		height: 44px;
		font-size: 16px;
	}
	/* Bigger touch targets for the place suggestions. */
	.apv-vp__suggest-item {
		padding: 11px 14px;
	}
	/* 16px stops iOS Safari from zooming the page when a field gets focus. */
	.apv-vp__select,
	.apv-vp__search-input {
		font-size: 16px;
		height: 44px;
	}
}

.apv-vp__empty {
	grid-column: 1 / -1;
	margin: 0;
	padding: 24px 16px;
	text-align: center;
	color: var(--apv-vp-muted);
	border: 1px dashed var(--apv-vp-border);
	border-radius: 4px;
}

.apv-vp__more {
	grid-column: 1 / -1;
	justify-self: center;
	margin-top: 4px;
	padding: 10px 20px;
	min-height: 44px;
	border: 1px solid var(--apv-vp-border-hover);
	border-radius: 6px;
	background: #fff;
	color: var(--apv-vp-border-hover);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.apv-vp__more:hover,
.apv-vp__more:focus-visible {
	background: var(--apv-vp-border-hover);
	color: #fff;
}

.apv-vp__card {
	border: 1px solid var(--apv-vp-border);
	border-radius: 4px;
	padding: 14px 16px;
	background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.apv-vp__card.is-clickable {
	cursor: pointer;
}

.apv-vp__card:focus-visible {
	outline: 2px solid var(--apv-vp-border-hover);
	outline-offset: 2px;
}

.apv-vp__card.is-active,
.apv-vp__card:hover {
	border-color: var(--apv-vp-border-hover);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.apv-vp__card.is-active .apv-vp__icon,
.apv-vp__card:hover .apv-vp__icon {
	color: var(--apv-vp-icon-hover);
}

.apv-vp__card.is-hidden {
	display: none;
}

.apv-vp__title {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.apv-vp__badge {
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--apv-vp-badge-color);
	border: 1px solid var(--apv-vp-badge-color);
	border-radius: 999px;
	padding: 1px 8px;
	line-height: 1.6;
}

.apv-vp__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
	margin: 0 0 16px;
}

/* Extra specificity: themes (e.g. Divi) give content lists their own
   padding/margin, which indented the legend and pushed the counter down. */
.apv-vp ul.apv-vp__legend {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	font-size: 12.5px;
	color: var(--apv-vp-muted);
}

.apv-vp__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.apv-vp__legend-flag {
	width: 26px;
	height: 19px;
	flex: none;
}

.apv-vp ul.apv-vp__fields {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.apv-vp__field {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--apv-vp-muted);
}

.apv-vp__field a {
	color: var(--apv-vp-text);
	text-decoration: none;
}

.apv-vp__field a:hover {
	text-decoration: underline;
}

.apv-vp__icon {
	flex: none;
	width: 18px;
	height: 18px;
	color: var(--apv-vp-icon);
	margin-top: 1px;
	transition: color .15s ease;
}

.apv-vp__icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.apv-vp__marker span {
	display: block;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.apv-vp__cluster span {
	display: block;
	border-radius: 50%;
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	text-align: center;
}

.apv-vp .leaflet-popup-content {
	font-size: 13.5px;
	line-height: 1.5;
}

.apv-vp .leaflet-popup-content strong {
	display: block;
	margin-bottom: 4px;
}

.apv-vp .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
