/* Homepage map. Accent inherits the theme's primary preset; neutral fallback. */
.asm-map-section {
	--asm-accent: var(--wp--preset--color--primary, #1f2937);
	margin: 0 auto;
	max-width: var(--wp--style--global--wide-size, 1200px);
}

.asm-map-heading {
	margin: 0 0 0.75rem;
	font-size: clamp(1.4rem, 2.5vw, 2rem);
	font-weight: 600;
	letter-spacing: -0.01em;
}

.asm-map {
	width: 100%;
	min-height: 240px;
	border-radius: 16px;
	overflow: hidden;
	background: #eef0f3;
	isolation: isolate;
}

.asm-map:not(.asm-map--ready) noscript a,
.asm-map--failed a,
.asm-map-placeholder {
	display: block;
	padding: 2rem;
	text-align: center;
	color: #4b5563;
}

.asm-map-footer {
	margin: 0.75rem 0 0;
	font-size: 0.95rem;
}

.asm-map-footer a {
	color: var(--asm-accent);
	text-decoration: none;
	font-weight: 500;
}

.asm-map-footer a:hover {
	text-decoration: underline;
}

/* Pin: a green house (markup in sold-map.js). */
.asm-map-section,
.asm-map {
	--asm-pin-color: #16a34a;
	--asm-pin-glow: rgba(22, 163, 74, 0.55);
}

.asm-pin {
	background: none;
	border: 0;
	line-height: 0;
}

.asm-pin svg {
	display: block;
	overflow: visible;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
	transform-origin: 50% 100%;
	transition: transform 0.15s ease;
}

.asm-pin .asm-pin-house {
	fill: var(--asm-pin-color);
	stroke: #fff;
	stroke-width: 2;
	stroke-linejoin: round;
}

.asm-pin .asm-pin-door {
	fill: #fff;
}

.asm-pin:hover svg {
	transform: scale(1.2);
}

/* Story-page map: the other sales recede, this home stands out. */
.asm-pin--minor {
	opacity: 0.8;
}

.asm-pin--minor:hover {
	opacity: 1;
}

.asm-pin--focus {
	position: relative;
	isolation: isolate;
}

.asm-pin--focus svg {
	position: relative;
	z-index: 1;
	filter: drop-shadow(0 0 6px var(--asm-pin-glow)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* The selected home: a soft halo that pulses outward behind the house. */
.asm-pin--focus::before,
.asm-pin--focus::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 55%;
	width: 60px;
	height: 60px;
	margin: -30px 0 0 -30px;
	border-radius: 50%;
	background: var(--asm-pin-glow);
	pointer-events: none;
	z-index: 0;
}

.asm-pin--focus::before {
	opacity: 0.35;
}

.asm-pin--focus::after {
	animation: asm-pin-pulse 1.8s ease-out infinite;
}

@keyframes asm-pin-pulse {
	from {
		transform: scale(0.5);
		opacity: 0.6;
	}
	to {
		transform: scale(1.6);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.asm-pin--focus::after {
		animation: none;
		opacity: 0;
	}
}

/* Story-page map is shorter than the archive map; Google caps the info window
   to what fits, so the popup photo is shorter here to keep the buttons visible. */
.asm-where .asm-map .asm-popup img,
.asm-where .asm-map .asm-popup-nophoto {
	height: 120px;
}

/* Popup — scoped under .asm-map so these win over leaflet.css, which the
   lazy loader appends after this file. */
.asm-map .leaflet-popup-content-wrapper {
	border-radius: 14px;
	padding: 0;
	overflow: hidden;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.asm-map .leaflet-popup-content {
	margin: 0;
	width: 280px !important;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #111827;
}

.asm-map .asm-popup img,
.asm-map .asm-popup-nophoto {
	display: block;
	width: 100%;
	height: 168px;
	object-fit: cover;
	background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
}

.asm-map .asm-popup-body {
	padding: 12px 14px 14px;
}

.asm-map .asm-popup-body p {
	margin: 0;
}

.asm-map .asm-popup-top {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 2px 8px;
}

.asm-map .asm-popup-price {
	font-size: 19px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.asm-map .asm-popup-result {
	font-size: 12px;
	font-weight: 600;
	color: var(--asm-accent, #1f2937);
	white-space: nowrap;
}

.asm-map .asm-popup-address {
	margin-top: 4px !important;
	font-weight: 600;
}

.asm-map .asm-popup-address span {
	display: block;
	font-weight: 400;
	color: #6b7280;
}

.asm-map .asm-popup-glance {
	margin-top: 6px !important;
	color: #374151;
}

.asm-map .asm-popup-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 12px !important;
}

.asm-map .asm-popup-maps {
	color: #374151 !important;
	font-size: 13px;
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.asm-map .asm-popup-link {
	display: inline-block;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--asm-accent, #1f2937);
	color: #fff !important;
	text-decoration: none;
	font-weight: 500;
}

.asm-map.leaflet-container a.asm-popup-link:hover {
	opacity: 0.9;
}

.asm-map.leaflet-container a.leaflet-popup-close-button {
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	font-size: 22px;
	top: 6px;
	right: 8px;
}

/* Google Maps: the info window carries the same popup; strip Google's chrome
   and centre the dot on the point (Advanced Markers anchor at bottom-centre). */
.asm-map--google .asm-pin {
	cursor: pointer;
}

.asm-map.asm-map--google .gm-style-iw-c {
	padding: 0 !important;
	max-width: min(280px, calc(100vw - 64px)) !important; /* Google caps it near 217px on phone-width maps */
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.asm-map.asm-map--google .gm-style-iw-d {
	overflow: hidden !important;
	max-height: none !important;
}

.asm-map.asm-map--google .asm-popup {
	position: relative;
	width: 280px;
	max-width: 100%;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #111827;
}

.asm-map .asm-popup-close {
	position: absolute;
	top: 6px;
	right: 8px;
	padding: 0 4px;
	border: 0;
	background: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

@media (max-width: 600px) {
	.asm-map {
		border-radius: 10px;
	}
}
