/**
 * Communities Map – layout shell (popup and layer styles later).
 */

.communities-map-shell {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	box-sizing: border-box;
	min-height: min(92vh, 1100px);
	/* Desktop: stable height; mobile overrides min-height below. Never use overflow:clip — hides the desktop category panel past the shell box */
	overflow: visible;
}

.communities-map-shell .communities-map-container {
	box-sizing: border-box;
	flex: 1 1 auto;
}

.communities-map-mobile-bar {
	display: none;
	/* flex: 0 0 auto; */
	/* align-items: stretch;
	justify-content: flex-start; */
	gap: 10px;
	padding: 14px;
	background: #fff;
	border-bottom: 1px solid #d8d8d8;
	box-sizing: border-box;
	position: relative;
	z-index: 2;
}

.communities-map-btn {
	font-family: inherit;
	font-size: 15px;
	font-weight: 900;
	line-height: 1.25;
	padding: 10px 16px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border-radius: 0;
	cursor: pointer;
	/* flex: 1 1 0; */
	min-width: 0;
}

.communities-map-btn--filter {
	background-color: #3d7122;
	color: #fff;
	border: 2px solid #3d7122;
	width: 93px;
	height: 41px;
}

.communities-map-btn--trip {
	background: #fff;
	color: #3d7122;
	border: 2px solid #3d7122;
	height: 41px;
    padding: 8px 20px;
}

.communities-map-container {
	box-sizing: border-box;
	border-radius: 0;
	overflow: hidden;
	background: #e8e8e8;
	height: calc(100vh - 60px) !important;
	min-height: 939px !important;
}

.admin-bar .communities-map-container {
	height: calc(100vh - 96px) !important;
}

.communities-map-toolbar {
	position: absolute;
	top: 150px;
	right: 6%;
	z-index: 5;
	background: transparent;
	width: 336px;
	max-width: calc(100vw - 48px);
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	transition: opacity 0.15s ease;
}

.communities-map-filter-scrim {
	display: none;
}

.communities-map-filter-card {
	box-sizing: border-box;
	background: transparent;
	border-radius: 0;
	overflow: visible;
}

.communities-map-filter-card-header {
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px 12px;
	border-bottom: 1px solid #d8d8d8;
	background: #fff;
	box-sizing: border-box;
}

.communities-map-filter-heading {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 18px;
	font-weight: 900;
	line-height: 1.25;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #252525;
	overflow: visible;
}

.communities-map-filter-close {
	flex-shrink: 0;
	margin: -4px -4px 0 0;
	padding: 4px 8px;
	font-size: 28px;
	line-height: 1;
	color: #3d5229;
	background: transparent;
	border: none;
	cursor: pointer;
	font-family: inherit;
}

.communities-map-nearby {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.communities-map-nearby-title {
	background-color: #3d5229;
	color: #fff;
	font-size: 19px;
	font-weight: 900;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 14px 23px;
	line-height: 1.2;
}

/* Desktop ≥901px: "Nearby" — mobile / filter modal ≤900px: "What's nearby" */
.communities-map-nearby-title--mobile {
	display: none;
}

.communities-map-nearby-list {
	background: #fff;
	border: 1px solid #a8a8a8;
	border-top: 0;
	max-height: min(60vh, 420px);
	overflow-y: auto;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
	padding-left: 20px;
	padding-bottom: 6px;
}

.communities-map-nearby-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 5px 10px 5px 0;
	margin: 0;
	border-bottom: 1px solid #e0e0e0;
	cursor: pointer;
	font-size: 16px;
	font-weight: 900;
	color: #345429;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	line-height: 1.3;
}

.communities-map-nearby-item:last-child {
	border-bottom: 0 !important;
}

.communities-map-nearby-pin {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 30px;
	line-height: 0;
}

.communities-map-nearby-pin-svg {
	display: block;
	flex-shrink: 0;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.communities-map-nearby-label {
	flex: 1;
	min-width: 0;
}

.communities-map-nearby-radio {
	flex-shrink: 0;
	width: 19px;
	height: 19px;
	margin: 0;
	accent-color: #3d5229;
}

body.communities-map-filter-open {
	overflow: hidden;
}

@media (max-width: 900px) {
	body.communities-map-filter-open .communities-map-mobile-bar {
		z-index: 10002;
	}

	.communities-map-shell {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
		min-height: 0;
		padding-top: calc(
			env(safe-area-inset-top, 0px) + var(--communities-map-header-clearance, 80px)
		);
	}

	body.admin-bar .communities-map-shell {
		padding-top: calc(env(safe-area-inset-top, 0px) + var(--communities-map-header-clearance, 80px) + var(--wp-admin--admin-bar--height, 0px));
	}

	.communities-map-nearby-title--desktop {
		display: none !important;
	}

	.communities-map-nearby-title--mobile {
		display: block !important;
		font-size: 20px;
		font-weight: 500;
		letter-spacing: normal;

	}

	.communities-map-mobile-bar {
		display: flex;
	}

	.communities-map-container {
		flex: 0 0 auto;
		height: min(68dvh, 560px) !important;
		min-height: 260px !important;
	}

	.communities-map-toolbar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		top: 0;
		z-index: 99999;
		width: auto;
		max-width: none;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.18s ease, visibility 0.18s ease;
	}

	.communities-map-shell.communities-map-filter-open .communities-map-toolbar {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.communities-map-filter-scrim {
		display: block;
		position: absolute;
		inset: 0;
		background: rgba(0, 0, 0, 0.45);
		z-index: 0;
		cursor: pointer;
	}

	.communities-map-filter-card {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		width: 100%;
		max-height: min(88dvh, 620px);
		padding: 30px;
		display: flex;
		flex-direction: column;
		background: #fff;
		box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
		z-index: 1;
		overflow: hidden;
		border-top-left-radius: 5px;
		border-top-right-radius: 5px;
	}

	.communities-map-filter-card-header {
		display: flex !important;
		flex: 0 0 auto;
		align-items: center;
		justify-content: space-between;
		flex-wrap: nowrap;
		width: 100%;
		min-height: 48px;
		visibility: visible !important;
		opacity: 1 !important;
		border-bottom: 1px solid #63666a;
		padding: 0 0 20px;
		margin-bottom: 20px;
	}

	.communities-map-shell.communities-map-filter-open .communities-map-filter-heading {
		display: block !important;
		visibility: visible !important;
		opacity: 1 !important;
		color: #252525 !important;
		flex: 1 1 auto;
		min-width: 0;
	}

	.communities-map-shell.communities-map-filter-open .communities-map-filter-close {
		display: inline-block !important;
		visibility: visible !important;
		opacity: 1 !important;
		flex-shrink: 0;
	}

	.communities-map-nearby {
		display: flex;
		flex-direction: column;
		min-height: 0;
		flex: 1 1 auto;
		overflow: hidden;
		margin-left: -15px;
		margin-right: -15px;
	}

	.communities-map-nearby-list {
		max-height: min(52dvh, 380px);
		flex: 1 1 auto;
		border: none;
		padding: 0 15px;
	}

	.communities-map-nearby-item {
		border-bottom: 2px solid #35532c73 !important;
		gap: 5px;
		padding: 10px 0;
	}

	.communities-map-nearby-title {
		padding: 10px !important;
	}
	.communities-map-nearby-pin-svg{
		max-width: 20px;
	}
}

/* Desktop/tablet: same visual stack as legacy shortcode — filter-card no extra box — stay above Maps canvas */
@media (min-width: 901px) {
	.communities-map-toolbar {
		pointer-events: auto;
		z-index: 3100;
	}

	.communities-map-toolbar .communities-map-filter-card {
		display: contents;
	}

	.communities-map-toolbar .communities-map-nearby {
		width: 100%;
	}
}

.communities-map-container .gm-style-iw.gm-style-iw-c {
	border-radius: 0;
}

/*
 * NEARBY toolbar uses z-index 3100 on desktop so it stays above the map canvas.
 * Google InfoWindows render inside the map and default below that, so the close
 * control can sit under the category box — lift the whole InfoWindow stack above it.
 */
.communities-map-shell .communities-map-container .gm-style .gm-style-iw-t,
.communities-map-shell .communities-map-container .gm-style .gm-style-iw-c,
.communities-map-shell .communities-map-container .gm-style .gm-style-iw-a,
.communities-map-shell .communities-map-container .gm-style .gm-style-iw-chr {
	z-index: 4000 !important;
}

.communities-map-shell .communities-map-container .gm-style .gm-style-iw-tc,
.communities-map-shell .communities-map-container .gm-style .gm-style-iw-ch {
	z-index: 4001 !important;
	position: relative;
}

.communities-map-popup {
	max-width: 260px;
	padding-bottom: 15px;
}

.gm-style .gm-style-iw-c {
	padding: 0;
}

.communities-map-popup-image {
	display: block;
	width: 100%;
	height: auto;
	margin-bottom: 15px;
	border-radius: 0px;
	height: 140px;
	object-fit: cover;
}

.communities-map-popup-title {
	font-family: 'Geograph';
	font-size: 18px !important;
	line-height: 1.5;
	letter-spacing: normal;
	color: #335525;
	font-weight: normal;
	text-align: left;
	padding: 0 15px;
	text-transform: unset;
	font-weight: 500;
}

.communities-map-popup-text,
.communities-map-popup-address {
	margin: 15px 0 0px;
	color: #335525;
	font-size: 14px;
	font-style: normal;
	font-family: 'Geograph';
	font-weight: normal;
	font-stretch: normal;
	line-height: 1.5;
	letter-spacing: normal;
	margin-top: 15px;
	text-align: left;
	padding: 0 15px;
}

.communities-map-popup-text--html p:first-child {
	margin-top: 0;
}

.communities-map-popup-text--html p:last-child {
	margin-bottom: 0;
}

.communities-map-popup-text--html ul,
.communities-map-popup-text--html ol {
	margin: 0.5em 0;
	padding-left: 1.25em;
}

.communities-map-popup-text--html a {
	color: #3d7122;
	text-decoration: underline;
}

p.communities-map-popup-address {
	display: flex;
	gap: 5px;
	align-items: center;
}

p.communities-map-popup-address svg {
	width: 20px;
	height: 19px;
}

p.communities-map-popup-address svg path {
	fill: #3d7122;
}

.communities-map-region-label {
	color: rgba(255, 255, 255, 0.48);
	font-size: 54px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	transform: rotate(-33deg);
	transform-origin: center;
	white-space: nowrap;
}

/* Keep Google controls below overlapping sticky header click area. */
.communities-map-container .gm-style .gm-style-mtc {
	margin-top: 88px;
}

.communities-map-container .gm-style .gm-bundled-control {
	margin-top: 56px;
}

.communities-map-container .gm-style-iw-d {
	overflow: unset !important;
}

.communities-map-popup a {
	padding: 0 15px;
	text-decoration: underline;
	font-family: 'Geograph';
	font-size: 16px;
	font-weight: bold;
	font-stretch: normal;
	font-style: normal;
	line-height: 1.5;
	letter-spacing: normal;
	color: #3d7122;
	display: block;
}

/* Keep map page navbar background stable during Oxygen sticky/non-sticky class churn. */
body.has-communities-map #component-main-navigation,
body.has-communities-map #component-main-navigation.oxy-header-wrapper,
body.has-communities-map #component-main-navigation.oxy-header,
body.has-communities-map #component-main-navigation.oxy-header.oxy-overlay-header,
body.has-communities-map #component-main-navigation.oxy-header.oxy-overlay-header.oxy-header:not(.oxy-sticky-header-active),
body.has-communities-map #component-main-navigation #navigation-menu,
body.has-communities-map #component-main-navigation.oxy-header.oxy-overlay-header #navigation-menu,
body.has-communities-map #component-main-navigation.oxy-header.oxy-overlay-header.oxy-header:not(.oxy-sticky-header-active) #navigation-menu,
body.has-communities-map #component-main-navigation.oxy-header.oxy-overlay-header.oxy-header.oxy-sticky-header-active #navigation-menu {
	background-color: #3d5229 !important;
}