/* =========================================================================
   APEX STORE LOCATOR v2 — frontend styles
   Every surface is a token. Light and dark ship as presets; a custom palette
   overrides the tokens inline from PHP, so nothing here has to know about it.
   ========================================================================= */

.apex-locator,
.apex-locator *,
.apex-locator *::before,
.apex-locator *::after {
	box-sizing: border-box;
}

/* ---------- Tokens (light is the base) ---------- */
.apex-locator {
	--ax-accent: #FF8A00;
	--ax-accent-2: #FFB54D;
	--ax-accent-text: #FFFFFF;
	--ax-accent-soft: rgba(255, 138, 0, .12);
	--ax-accent-ring: rgba(255, 138, 0, .30);
	--ax-pin: var(--ax-accent);

	--ax-bg: #F4F6F9;
	--ax-panel: #FFFFFF;
	--ax-panel-2: #F7F9FC;
	--ax-card: #FFFFFF;
	--ax-card-hover: #F5F8FC;
	--ax-line: #E3E8EF;
	--ax-line-soft: #ECEFF4;
	--ax-text: #131A22;
	--ax-text-dim: #5A6675;
	--ax-text-faint: #8B97A6;

	--ax-scale: 1;
	--ax-radius: 16px;
	--ax-radius-sm: 11px;
	--ax-shadow: 0 18px 44px -24px rgba(16, 24, 40, .28);
	--ax-h: 640px;
	--ax-peek: 128px;

	--ax-fs-xs: calc(11px * var(--ax-scale));
	--ax-fs-sm: calc(12.5px * var(--ax-scale));
	--ax-fs-md: calc(14px * var(--ax-scale));
	--ax-fs-lg: calc(16px * var(--ax-scale));
	--ax-fs-xl: calc(19px * var(--ax-scale));

	--ax-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
	--ax-sans: var(--ax-font, "Montserrat"), -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;

	position: relative;
	display: block;
	font-family: var(--ax-sans);
	font-size: var(--ax-fs-md);
	line-height: 1.45;
	color: var(--ax-text);
	-webkit-font-smoothing: antialiased;
	isolation: isolate;
}

/* ---------- Dark preset ---------- */
.apex-locator.apex-theme-dark {
	--ax-bg: #11161D;
	--ax-panel: #161D26;
	--ax-panel-2: #1C2530;
	--ax-card: #1A222C;
	--ax-card-hover: #212B37;
	--ax-line: #2A3543;
	--ax-line-soft: #222C39;
	--ax-text: #EAF0F6;
	--ax-text-dim: #97A4B4;
	--ax-text-faint: #6A7889;
	--ax-shadow: 0 26px 64px -28px rgba(0, 0, 0, .68);
}

/* ---------- Auto: follow the visitor's system setting ---------- */
@media (prefers-color-scheme: dark) {
	.apex-locator.apex-theme-auto {
		--ax-bg: #11161D;
		--ax-panel: #161D26;
		--ax-panel-2: #1C2530;
		--ax-card: #1A222C;
		--ax-card-hover: #212B37;
		--ax-line: #2A3543;
		--ax-line-soft: #222C39;
		--ax-text: #EAF0F6;
		--ax-text-dim: #97A4B4;
		--ax-text-faint: #6A7889;
		--ax-shadow: 0 26px 64px -28px rgba(0, 0, 0, .68);
	}
}

/* ---------- Theme bleed guards ---------- */
.apex-locator a,
.apex-locator a:hover,
.apex-locator a:focus,
.apex-locator a:visited {
	text-decoration: none !important;
	box-shadow: none;
	border-bottom: none;
}
.apex-locator button {
	font-family: inherit;
	font-size: inherit;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	margin: 0;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}
.apex-locator input {
	font-family: inherit;
	margin: 0;
}
.apex-locator p,
.apex-locator h3,
.apex-locator h4 {
	margin: 0;
}
.apex-locator img {
	max-width: 100%;
	height: auto;
	display: block;
}
.apex-locator [hidden] { display: none !important; }

/* =========================================================================
   Shell + layout
   ========================================================================= */
.apex-shell {
	position: relative;
	display: grid;
	grid-template-columns: minmax(318px, 392px) 1fr;
	height: var(--ax-h);
	background: var(--ax-bg);
	border: 1px solid var(--ax-line);
	border-radius: var(--ax-radius);
	box-shadow: var(--ax-shadow);
	overflow: hidden;
}

.apex-side-right .apex-shell {
	grid-template-columns: 1fr minmax(318px, 392px);
}
.apex-side-right .apex-panel {
	order: 2;
	border-right: none;
	border-left: 1px solid var(--ax-line);
}

/* ---------- Panel ---------- */
.apex-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--ax-panel);
	border-right: 1px solid var(--ax-line);
}

.apex-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px 12px;
	flex: none;
}

.apex-brand {
	display: flex;
	align-items: center;
	gap: 9px;
	min-width: 0;
}
.apex-brand-logo {
	height: 26px;
	width: auto;
	max-width: 130px;
	object-fit: contain;
}
.apex-brand-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--ax-accent);
	box-shadow: 0 0 0 4px var(--ax-accent-soft);
	flex: none;
}
.apex-brand-name {
	font-size: var(--ax-fs-md);
	font-weight: 700;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.apex-head-right {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: none;
}

.apex-icon-btn {
	width: 34px;
	height: 34px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--ax-radius-sm);
	border: 1px solid var(--ax-line);
	background: var(--ax-panel-2);
	color: var(--ax-text-dim);
	transition: color .18s, border-color .18s, background .18s;
}
.apex-icon-btn:hover {
	color: var(--ax-accent);
	border-color: var(--ax-accent);
}
.apex-i-moon { display: none; }
.apex-theme-dark .apex-i-sun { display: none; }
.apex-theme-dark .apex-i-moon { display: block; }

.apex-count {
	display: flex;
	align-items: baseline;
	gap: 5px;
	font-family: var(--ax-mono);
}
.apex-count-num {
	font-size: var(--ax-fs-lg);
	font-weight: 700;
	color: var(--ax-accent);
	font-variant-numeric: tabular-nums;
}
.apex-count-label {
	font-size: var(--ax-fs-xs);
	color: var(--ax-text-faint);
	text-transform: uppercase;
	letter-spacing: .08em;
}

/* ---------- Search ---------- */
.apex-search {
	display: flex;
	gap: 8px;
	padding: 0 18px 12px;
	flex: none;
}

.apex-search-field {
	position: relative;
	flex: 1;
	min-width: 0;
}
.apex-search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--ax-text-faint);
	pointer-events: none;
}
.apex-search-input {
	width: 100%;
	height: 44px;
	padding: 0 36px 0 38px;
	border-radius: var(--ax-radius-sm);
	border: 1px solid var(--ax-line);
	background: var(--ax-panel-2);
	color: var(--ax-text);
	font-size: var(--ax-fs-md);
	outline: none;
	transition: border-color .18s, box-shadow .18s;
	-webkit-appearance: none;
	appearance: none;
}
.apex-search-input::placeholder { color: var(--ax-text-faint); }
.apex-search-input::-webkit-search-cancel-button { display: none; }
.apex-search-input:focus {
	border-color: var(--ax-accent);
	box-shadow: 0 0 0 3px var(--ax-accent-ring);
}

.apex-search-clear {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 26px;
	height: 26px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--ax-text-faint);
}
.apex-search-clear:hover { color: var(--ax-text); background: var(--ax-card-hover); }

.apex-geo-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	height: 44px;
	padding: 0 14px;
	border-radius: var(--ax-radius-sm);
	border: 1px solid var(--ax-line);
	background: var(--ax-panel-2);
	color: var(--ax-text);
	font-size: var(--ax-fs-sm);
	font-weight: 600;
	white-space: nowrap;
	flex: none;
	transition: border-color .18s, color .18s, background .18s;
}
.apex-geo-btn:hover {
	border-color: var(--ax-accent);
	color: var(--ax-accent);
}
.apex-geo-btn.is-active svg { animation: apex-spin 1.1s linear infinite; }
@keyframes apex-spin { to { transform: rotate(360deg); } }

/* ---------- Status line ---------- */
.apex-status {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 18px 10px;
	padding: 9px 12px;
	border-radius: var(--ax-radius-sm);
	background: var(--ax-accent-soft);
	color: var(--ax-text);
	font-size: var(--ax-fs-sm);
	font-weight: 500;
	flex: none;
}
.apex-status.is-error {
	background: rgba(220, 38, 38, .10);
	color: #B91C1C;
}
.apex-theme-dark .apex-status.is-error { color: #FCA5A5; }
.apex-pulse {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ax-accent);
	flex: none;
	animation: apex-pulse 1.3s ease-in-out infinite;
}
@keyframes apex-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: .35; transform: scale(.7); }
}

/* ---------- Results ---------- */
.apex-results {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0 18px 18px;
	display: flex;
	flex-direction: column;
	gap: 9px;
	scrollbar-width: thin;
	scrollbar-color: var(--ax-line) transparent;
}
.apex-results::-webkit-scrollbar { width: 8px; }
.apex-results::-webkit-scrollbar-thumb {
	background: var(--ax-line);
	border-radius: 4px;
}
.apex-results:focus { outline: none; }

.apex-card {
	position: relative;
	padding: 14px 14px 13px 40px;
	border-radius: var(--ax-radius-sm);
	border: 1px solid var(--ax-line);
	background: var(--ax-card);
	cursor: pointer;
	transition: border-color .18s, background .18s, transform .18s;
	animation: apex-rise .34s both cubic-bezier(.22, 1, .36, 1);
}
@keyframes apex-rise {
	from { opacity: 0; transform: translateY(9px); }
	to { opacity: 1; transform: none; }
}
.apex-card:hover {
	background: var(--ax-card-hover);
	border-color: var(--ax-accent);
}
.apex-card.is-active {
	border-color: var(--ax-accent);
	background: var(--ax-card-hover);
	box-shadow: inset 3px 0 0 var(--ax-accent);
}

.apex-card-rank {
	position: absolute;
	left: 13px;
	top: 15px;
	width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: calc(var(--ax-radius-sm) * .55);
	background: var(--ax-panel-2);
	border: 1px solid var(--ax-line);
	color: var(--ax-text-faint);
	font-family: var(--ax-mono);
	font-size: var(--ax-fs-xs);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}
.apex-card.is-active .apex-card-rank,
.apex-card:hover .apex-card-rank {
	background: var(--ax-accent);
	border-color: var(--ax-accent);
	color: var(--ax-accent-text);
}

.apex-card-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}
.apex-card-name {
	font-size: var(--ax-fs-md);
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.3;
	color: var(--ax-text);
}
.apex-card-city {
	display: block;
	margin-top: 2px;
	font-size: var(--ax-fs-xs);
	color: var(--ax-text-faint);
	text-transform: uppercase;
	letter-spacing: .07em;
	font-weight: 600;
}
.apex-badge-featured {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 4px;
	background: var(--ax-accent-soft);
	color: var(--ax-accent);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	vertical-align: middle;
}

.apex-distance {
	flex: none;
	text-align: right;
	font-family: var(--ax-mono);
	line-height: 1.15;
}
.apex-distance-val {
	display: block;
	font-size: var(--ax-fs-lg);
	font-weight: 700;
	color: var(--ax-accent);
	font-variant-numeric: tabular-nums;
}
.apex-distance-unit {
	display: block;
	font-size: 9.5px;
	color: var(--ax-text-faint);
	text-transform: uppercase;
	letter-spacing: .07em;
}

.apex-card-addr {
	margin-top: 8px;
	font-size: var(--ax-fs-sm);
	color: var(--ax-text-dim);
	line-height: 1.5;
}

.apex-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin-top: 9px;
}
.apex-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: var(--ax-fs-xs);
	color: var(--ax-text-faint);
	font-weight: 500;
}
.apex-meta-item svg { flex: none; opacity: .8; }

.apex-card-actions {
	display: flex;
	gap: 7px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--ax-line-soft);
}

.apex-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 36px;
	padding: 0 13px;
	border-radius: calc(var(--ax-radius-sm) * .8);
	border: 1px solid transparent;
	font-size: var(--ax-fs-sm);
	font-weight: 600;
	white-space: nowrap;
	transition: filter .18s, border-color .18s, color .18s, background .18s;
}
.apex-btn-primary {
	flex: 1;
	background: var(--ax-accent);
	color: var(--ax-accent-text) !important;
}
.apex-btn-primary:hover { filter: brightness(1.08); }
.apex-btn-ghost {
	background: transparent;
	border-color: var(--ax-line);
	color: var(--ax-text-dim) !important;
	padding: 0 11px;
}
.apex-btn-ghost:hover {
	border-color: var(--ax-accent);
	color: var(--ax-accent) !important;
}
.apex-btn-icon { padding: 0; width: 36px; }

/* ---------- Show more ---------- */
.apex-more {
	flex: none;
	margin: 0 18px 18px;
	height: 40px;
	border-radius: var(--ax-radius-sm);
	border: 1px dashed var(--ax-line);
	background: transparent;
	color: var(--ax-text-dim);
	font-size: var(--ax-fs-sm);
	font-weight: 600;
	transition: border-color .18s, color .18s;
}
.apex-more:hover { border-color: var(--ax-accent); color: var(--ax-accent); }

/* ---------- Empty state ---------- */
.apex-empty {
	padding: 40px 20px;
	text-align: center;
	color: var(--ax-text-faint);
}
.apex-empty svg { opacity: .4; margin-bottom: 10px; }
.apex-empty h4 {
	font-size: var(--ax-fs-md);
	font-weight: 700;
	color: var(--ax-text);
	margin-bottom: 4px;
}
.apex-empty p { font-size: var(--ax-fs-sm); }

/* ---------- Skeleton ---------- */
.apex-skeleton-wrap { display: flex; flex-direction: column; gap: 9px; }
.apex-skeleton {
	padding: 16px 14px;
	border-radius: var(--ax-radius-sm);
	border: 1px solid var(--ax-line-soft);
	background: var(--ax-card);
}
.apex-sk-line {
	height: 9px;
	border-radius: 5px;
	margin-bottom: 9px;
	background: linear-gradient(90deg, var(--ax-line-soft) 25%, var(--ax-line) 50%, var(--ax-line-soft) 75%);
	background-size: 200% 100%;
	animation: apex-shimmer 1.4s linear infinite;
}
.apex-sk-line:last-child { margin-bottom: 0; }
.w70 { width: 70%; }
.w90 { width: 90%; }
.w50 { width: 50%; }
@keyframes apex-shimmer {
	from { background-position: 200% 0; }
	to { background-position: -200% 0; }
}

/* =========================================================================
   Map
   ========================================================================= */
.apex-map-wrap {
	position: relative;
	min-height: 0;
	background: var(--ax-panel-2);
}
.apex-map {
	position: absolute;
	inset: 0;
	z-index: 1;
}

.apex-map-tools {
	position: absolute;
	right: 12px;
	top: 12px;
	z-index: 420;
	display: flex;
	flex-direction: column;
	gap: 7px;
}
.apex-tool {
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: calc(var(--ax-radius-sm) * .9);
	border: 1px solid var(--ax-line);
	background: var(--ax-panel);
	color: var(--ax-text-dim);
	box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .35);
	transition: color .18s, border-color .18s;
}
.apex-tool:hover { color: var(--ax-accent); border-color: var(--ax-accent); }
.apex-i-collapse { display: none; }
.apex-locator.is-fullscreen .apex-i-expand { display: none; }
.apex-locator.is-fullscreen .apex-i-collapse { display: block; }

/* Leaflet chrome */
.apex-locator .leaflet-container {
	background: var(--ax-panel-2);
	font-family: var(--ax-sans);
}
.apex-locator .leaflet-control-zoom {
	border: 1px solid var(--ax-line) !important;
	border-radius: 10px !important;
	overflow: hidden;
	box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .35) !important;
}
.apex-locator .leaflet-control-zoom a {
	background: var(--ax-panel) !important;
	color: var(--ax-text-dim) !important;
	border-bottom-color: var(--ax-line) !important;
	width: 34px;
	line-height: 34px;
	height: 34px;
	font-size: 17px;
}
.apex-locator .leaflet-control-zoom a:hover { color: var(--ax-accent) !important; }
/* Attribution follows the palette tokens, so a dark custom palette gets a dark
   credit line without needing the dark theme class. */
.apex-locator .leaflet-control-attribution {
	background: var(--ax-panel) !important;
	color: var(--ax-text-faint) !important;
	font-size: 10px;
	padding: 2px 6px;
	border-radius: 6px 0 0 0;
}
.apex-locator .leaflet-control-attribution a { color: var(--ax-text-dim) !important; }

/* Providers with only a light cartography get filtered for dark palettes.
   The hue rotation keeps water blue and parks green after the invert. */
.apex-locator.apex-tiles-dark .leaflet-tile-pane {
	filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.55);
}

/* ---------- Pins ---------- */
.apex-pin {
	position: relative;
	width: 30px;
	height: 38px;
	cursor: pointer;
}
.apex-pin-shape {
	position: absolute;
	left: 50%;
	top: 0;
	width: 26px;
	height: 26px;
	margin-left: -13px;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	background: var(--ax-pin);
	border: 2px solid var(--ax-panel);
	box-shadow: 0 4px 10px -3px rgba(0, 0, 0, .5);
	transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}
.apex-pin-shape::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 8px;
	height: 8px;
	margin: -4px 0 0 -4px;
	border-radius: 50%;
	background: var(--ax-panel);
}
.apex-pin:hover .apex-pin-shape { transform: rotate(-45deg) scale(1.12); }
.apex-pin.is-active .apex-pin-shape {
	transform: rotate(-45deg) scale(1.28);
	box-shadow: 0 0 0 7px var(--ax-accent-ring), 0 4px 10px -3px rgba(0, 0, 0, .5);
}

.apex-pin.is-user { width: 30px; height: 30px; }
.apex-pin.is-user .apex-pin-shape {
	top: 3px;
	width: 18px;
	height: 18px;
	margin-left: -9px;
	border-radius: 50%;
	transform: none;
	background: #2E7CF6;
	box-shadow: 0 0 0 6px rgba(46, 124, 246, .25);
	animation: apex-ping 2.2s ease-out infinite;
}
.apex-pin.is-user .apex-pin-shape::after { width: 6px; height: 6px; margin: -3px 0 0 -3px; }
@keyframes apex-ping {
	0%, 100% { box-shadow: 0 0 0 5px rgba(46, 124, 246, .28); }
	50% { box-shadow: 0 0 0 12px rgba(46, 124, 246, .07); }
}

.apex-locator .marker-cluster {
	background: var(--ax-accent-ring);
	border-radius: 50%;
}
.apex-locator .marker-cluster div {
	background: var(--ax-accent);
	color: var(--ax-accent-text);
	font-family: var(--ax-mono);
	font-weight: 700;
	font-size: 12px;
	border-radius: 50%;
	margin: 5px;
	width: 30px;
	height: 30px;
	line-height: 30px;
}

/* ---------- Popups ---------- */
.apex-locator .leaflet-popup-content-wrapper {
	background: var(--ax-panel);
	color: var(--ax-text);
	border-radius: var(--ax-radius-sm);
	border: 1px solid var(--ax-line);
	box-shadow: 0 18px 44px -20px rgba(0, 0, 0, .55);
	padding: 0;
}
.apex-locator .leaflet-popup-content {
	margin: 0;
	width: auto !important;
	font-family: var(--ax-sans);
}
.apex-locator .leaflet-popup-tip {
	background: var(--ax-panel);
	border: 1px solid var(--ax-line);
}
.apex-locator .leaflet-popup-close-button {
	color: var(--ax-text-faint) !important;
	width: 26px !important;
	height: 26px !important;
	font-size: 19px !important;
	padding: 3px 0 0 !important;
}

.apex-popup { padding: 14px; }
.apex-popup-img {
	width: calc(100% + 28px);
	margin: -14px -14px 11px;
	height: 108px;
	object-fit: cover;
	border-radius: var(--ax-radius-sm) var(--ax-radius-sm) 0 0;
}
.apex-popup-name {
	font-size: var(--ax-fs-md);
	font-weight: 700;
	letter-spacing: -0.01em;
	margin-bottom: 3px;
}
.apex-popup-addr {
	font-size: var(--ax-fs-sm);
	color: var(--ax-text-dim);
	line-height: 1.45;
}
.apex-popup-meta {
	margin-top: 9px;
	display: flex;
	flex-direction: column;
	gap: 5px;
}
.apex-popup-row {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: var(--ax-fs-xs);
	color: var(--ax-text-faint);
	font-weight: 500;
}
.apex-popup-row.is-dist {
	color: var(--ax-accent);
	font-family: var(--ax-mono);
	font-weight: 700;
}
.apex-popup-actions {
	display: flex;
	gap: 6px;
	margin-top: 12px;
}
.apex-popup-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	height: 34px;
	border-radius: calc(var(--ax-radius-sm) * .72);
	border: 1px solid transparent;
	font-size: var(--ax-fs-sm);
	font-weight: 600;
}
.apex-popup-btn-primary {
	background: var(--ax-accent);
	color: var(--ax-accent-text) !important;
}
.apex-popup-btn-primary:hover { filter: brightness(1.08); }
.apex-popup-btn-ghost {
	background: transparent;
	border-color: var(--ax-line);
	color: var(--ax-text-dim) !important;
}
.apex-popup-btn-ghost:hover { border-color: var(--ax-accent); color: var(--ax-accent) !important; }

/* =========================================================================
   Overlay layout — panel floats above the map
   ========================================================================= */
.apex-layout-overlay .apex-shell { grid-template-columns: 1fr; }
.apex-layout-overlay .apex-map-wrap { grid-column: 1 / -1; grid-row: 1; }
.apex-layout-overlay .apex-panel {
	position: absolute;
	left: 16px;
	top: 16px;
	bottom: 16px;
	width: 360px;
	max-width: calc(100% - 32px);
	z-index: 430;
	grid-column: 1 / -1;
	grid-row: 1;
	border: 1px solid var(--ax-line);
	border-radius: var(--ax-radius);
	box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .6);
	overflow: hidden;
}
.apex-side-right.apex-layout-overlay .apex-panel {
	left: auto;
	right: 16px;
	border-left: none;
}
/* Move the tools out from under a right-hand floating panel, and let the
   zoom control drop below them so the two don't stack on the same spot. */
.apex-side-right.apex-layout-overlay .apex-map-tools {
	right: auto;
	left: 12px;
}
.apex-side-right.apex-layout-overlay .leaflet-top.leaflet-left {
	top: 100px;
}

/* =========================================================================
   Fullscreen
   ========================================================================= */
.apex-locator.is-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 99999;
	padding: 0;
	margin: 0;
	background: var(--ax-bg);
}
.apex-locator.is-fullscreen .apex-shell {
	height: 100vh;
	height: 100dvh;
	border: none;
	border-radius: 0;
	box-shadow: none;
}
.apex-locator.is-fullscreen.apex-layout-overlay .apex-panel { border-radius: var(--ax-radius); }
html.apex-fs-lock,
body.apex-fs-lock {
	overflow: hidden !important;
	touch-action: none;
}

/* =========================================================================
   Mobile view switch + bottom sheet
   ========================================================================= */
.apex-switch {
	display: none;
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	z-index: 440;
	padding: 4px;
	gap: 3px;
	border-radius: 999px;
	border: 1px solid var(--ax-line);
	background: var(--ax-panel);
	box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .45);
}
.apex-switch-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 34px;
	padding: 0 18px;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var(--ax-text-dim);
	font-size: var(--ax-fs-sm);
	font-weight: 600;
	transition: background .18s, color .18s;
}
.apex-switch-btn.is-on {
	background: var(--ax-accent);
	color: var(--ax-accent-text);
}
.apex-switch-count {
	font-family: var(--ax-mono);
	font-size: var(--ax-fs-xs);
	opacity: .8;
	font-variant-numeric: tabular-nums;
}

.apex-sheet-grip { display: none; }

.apex-toast {
	position: absolute;
	left: 50%;
	bottom: 22px;
	transform: translate(-50%, 12px);
	z-index: 460;
	padding: 9px 16px;
	border-radius: 999px;
	background: var(--ax-text);
	color: var(--ax-panel);
	font-size: var(--ax-fs-sm);
	font-weight: 600;
	opacity: 0;
	pointer-events: none;
	transition: opacity .22s, transform .22s;
}
.apex-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Breakpoint: stack or sheet ---------- */
@media (max-width: 880px) {
	.apex-shell,
	.apex-side-right .apex-shell,
	.apex-layout-overlay .apex-shell {
		grid-template-columns: 1fr;
	}

	/* -- Stacked mode: list above map -- */
	.apex-mobile-stack .apex-shell {
		grid-template-rows: auto minmax(320px, 1fr);
		height: auto;
	}
	.apex-mobile-stack .apex-panel,
	.apex-mobile-stack.apex-side-right .apex-panel,
	.apex-mobile-stack.apex-layout-overlay .apex-panel {
		position: static;
		order: 1;
		width: auto;
		max-width: none;
		border: none;
		border-bottom: 1px solid var(--ax-line);
		border-radius: 0;
		box-shadow: none;
	}
	.apex-mobile-stack .apex-results { max-height: 46vh; }
	.apex-mobile-stack .apex-map-wrap { order: 2; min-height: 340px; }

	/* -- Sheet mode: map fills, list slides up over it -- */
	.apex-mobile-sheet .apex-shell {
		position: relative;
		display: block;
		height: var(--ax-h);
		min-height: 460px;
	}
	.apex-mobile-sheet .apex-map-wrap {
		position: absolute;
		inset: 0;
	}
	.apex-mobile-sheet .apex-panel,
	.apex-mobile-sheet.apex-side-right .apex-panel,
	.apex-mobile-sheet.apex-layout-overlay .apex-panel {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		width: auto;
		max-width: none;
		height: 92%;
		z-index: 450;
		border: 1px solid var(--ax-line);
		border-bottom: none;
		border-radius: var(--ax-radius) var(--ax-radius) 0 0;
		box-shadow: 0 -14px 40px -18px rgba(0, 0, 0, .45);
		transform: translateY(calc(100% - var(--ax-peek)));
		transition: transform .32s cubic-bezier(.22, 1, .36, 1);
		will-change: transform;
	}
	.apex-mobile-sheet .apex-panel.is-dragging { transition: none; }
	.apex-mobile-sheet .apex-panel.is-half { transform: translateY(45%); }
	.apex-mobile-sheet .apex-panel.is-full { transform: translateY(0); }

	.apex-mobile-sheet .apex-sheet-grip {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 20px;
		padding-top: 8px;
		flex: none;
		cursor: grab;
		touch-action: none;
	}
	.apex-mobile-sheet .apex-sheet-grip span {
		width: 38px;
		height: 4px;
		border-radius: 2px;
		background: var(--ax-line);
	}
	.apex-mobile-sheet .apex-panel-head { padding-top: 8px; }
	.apex-mobile-sheet .apex-switch {
		display: flex;
		bottom: calc(var(--ax-peek) + 14px);
	}
	.apex-mobile-sheet .apex-panel.is-full ~ * .apex-switch { opacity: 0; pointer-events: none; }
	.apex-mobile-sheet .apex-map-tools { top: 12px; right: 12px; }

	.apex-locator.is-fullscreen.apex-mobile-sheet .apex-shell {
		height: 100dvh;
	}
}

@media (max-width: 520px) {
	/* Give the search field the room; the crosshair reads on its own. */
	.apex-geo-btn {
		width: 44px;
		padding: 0;
		justify-content: center;
		flex: none;
	}
	.apex-geo-btn span { display: none; }
	.apex-card-actions { flex-wrap: wrap; }
	.apex-btn-primary { flex: 1 0 100%; }
	.apex-btn-ghost { flex: 1; }
	.apex-btn-icon { flex: none; }
	.apex-panel-head,
	.apex-search { padding-left: 14px; padding-right: 14px; }
	.apex-results { padding-left: 14px; padding-right: 14px; }
	.apex-status { margin-left: 14px; margin-right: 14px; }
	.apex-switch-btn { padding: 0 15px; }
}

/* Safe area for notched phones in fullscreen */
@supports (padding: max(0px)) {
	.apex-locator.is-fullscreen .apex-results {
		padding-bottom: max(18px, env(safe-area-inset-bottom));
	}
	.apex-locator.is-fullscreen .apex-switch {
		bottom: max(16px, env(safe-area-inset-bottom));
	}
	.apex-locator.is-fullscreen.apex-mobile-sheet .apex-switch {
		bottom: calc(var(--ax-peek) + max(14px, env(safe-area-inset-bottom)));
	}
}

/* ---------- Accessibility ---------- */
.apex-locator a:focus-visible,
.apex-locator button:focus-visible,
.apex-locator input:focus-visible,
.apex-locator .apex-card:focus-visible {
	outline: 2px solid var(--ax-accent);
	outline-offset: 2px;
}
.apex-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.apex-locator *,
	.apex-locator *::before,
	.apex-locator *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
