.pm-portfolio {
	/* Geometry — set inline via shortcode attr */
	--pm-map-height: 520px;

	/* Color fallbacks — overridden at runtime by style_block() from Settings > Appearance */
	--pm-btn-bg:           #0F2744;
	--pm-input-focus:      #0F2744;
	--pm-popup-title:      #0F2744;
	--pm-popup-link:       #0F2744;
	--pm-card-title-color: #0F2744;
	--pm-card-addr-color:  #5c6470;
	--pm-tag-bg:           #f7f8fa;
	--pm-tag-color:        #E8A91E;
	--pm-border:           #e3e5e8;
	--pm-text:             #1c1f24;
	--pm-muted:            #5c6470;
	--pm-bg:               #ffffff;
	--pm-bg-alt:           #f7f8fa;
	--pm-radius:           10px;

	/* Card list divider — separate from UI border so they can differ */
	--pm-card-border:             #e3e5e8;

	/* Filter pill border radius */
	--pm-filter-radius:           999px;

	/* Clear All button */
	--pm-clearall-color:          #5c6470;
	--pm-clearall-font-size:      13px;

	/* Popup title */
	--pm-iw-title-font-size:      15px;

	/* Popup "View details" link divider */
	--pm-iw-link-border-color:    #e3e5e8;
	--pm-iw-link-border-width:    1px;

	/* Card hover */
	--pm-card-hover-border-color: var(--pm-border);
	--pm-card-hover-shadow:       none;

	/* Typography */
	--pm-font-search:     14px;
	--pm-font-card-title: 15px;
	--pm-font-addr:       13px;
	--pm-font-filter:     13px;
	--pm-font-tag:        12px;
	--pm-font-popup:      13px;
	--pm-font-popup-addr: 12px;

	/* Info-window — --pm-iw-img-size controls the full-width image height */
	--pm-iw-max-width: 280px;
	--pm-iw-img-size:  160px;
	--pm-input-ph:     10px;

	color: var(--pm-text);
	font-family: inherit;
	font-size: 14px;
	/* Whole-embed background, inner padding, corner radius and shadow (Settings → Appearance). */
	background: var(--pm-embed-bg, transparent);
	padding: var(--pm-embed-pad, 0);
	border-radius: var(--pm-embed-radius, 0);
	box-shadow: var(--pm-embed-shadow, none);
	/* Never let the embed exceed its container and trigger page-level
	   horizontal scrolling on mobile. */
	max-width: 100%;
}

/* Phones: the embed's inner padding stays small, so the search, map and lists keep their width. */
@media (max-width: 600px) {
	.pm-portfolio {
		padding: min(var(--pm-embed-pad, 0px), 12px);
	}
}

.pm-portfolio,
.pm-portfolio * {
	box-sizing: border-box;
}

.pm-portfolio [hidden] {
	display: none !important;
}

/* ---- Branded header bar ---- */

.pm-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	padding: 12px 20px;
	background: var(--pm-header-bg, var(--pm-bg));
	border-bottom: 1px solid var(--pm-border);
	border-radius: var(--pm-header-radius, 0);
	flex-wrap: wrap;
}

/* No logo, company name or tabs: the rating and button sit in the middle. */
.pm-header--center {
	justify-content: center;
}

/* Brand + nav grouped on the left side */
.pm-header-left {
	display: flex;
	align-items: center;
	gap: 4px 20px;
	flex-wrap: wrap;
}

.pm-header-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
	text-decoration: none;
}

.pm-header-initials {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-family: inherit;
}

.pm-header-logo {
	height: 36px;
	width: auto;
	object-fit: contain;
	display: block;
}

.pm-header-logo-link {
	display: inline-flex;
	line-height: 0;
	text-decoration: none;
}

.pm-header-company {
	font-weight: 700;
	font-size: 16px;
	color: var(--pm-text);
	white-space: nowrap;
}

.pm-header-nav {
	display: flex;
	align-items: center;
	gap: 2px;
}

.pm-header-tab {
	display: inline-block;
	padding: 8px 14px;
	font-size: 14px;
	font-weight: 500;
	color: var(--pm-text);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	white-space: nowrap;
	transition: color 0.15s, border-color 0.15s;
	font-family: inherit;
}

.pm-header-tab:hover {
	color: var(--pm-tag-color);
}

.pm-header-tab.is-active {
	color: var(--pm-tag-color);
	border-bottom-color: var(--pm-tag-color);
	font-weight: 600;
}

.pm-header-right {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
}

.pm-header-rating {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	color: var(--pm-text);
	text-decoration: none;
	white-space: nowrap;
}

.pm-header-provider-icon {
	display: block;
	flex-shrink: 0;
	vertical-align: middle;
}

.pm-header-rating-value {
	font-weight: 700;
}

.pm-header-stars {
	color: #f59e0b;
	letter-spacing: -0.5px;
	font-size: 14px;
}

.pm-header-rating-count {
	color: var(--pm-muted);
}

.pm-header-cta {
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 18px;
	background: var(--pm-btn-bg);
	color: #fff;
	border-radius: var(--pm-radius);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity 0.15s;
	font-family: inherit;
	/* Reset so a <button> CTA (no URL) matches the <a> CTA exactly. */
	border: none;
	cursor: pointer;
	box-sizing: border-box;
	line-height: 1;
	appearance: none;
	-webkit-appearance: none;
}

.pm-header-cta:hover {
	opacity: 0.88;
	color: #fff;
}

/* ---- Search row (search + nearby side by side) ---- */

.pm-search-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 16px 24px;
	padding: 16px 0 0;
	align-items: start;
}

.pm-search-row > *:only-child {
	grid-column: 1 / -1;
}

.pm-search-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--pm-muted);
	margin-bottom: 7px;
}

/* ---- Fused input group (icon + input + button as one unit) ---- */

.pm-input-group {
	display: flex;
	align-items: center;
	border: 1px solid var(--pm-border);
	border-radius: var(--pm-radius);
	background: var(--pm-bg);
	overflow: hidden;
	transition: border-color 0.15s;
	/* Allow the group to shrink below its content's intrinsic width so the
	   fused input + button never push past a narrow (mobile) container. */
	min-width: 0;
	max-width: 100%;
}

/* Grid items wrapping each search bar must also be allowed to shrink. */
.pm-search-col,
.pm-nearby-col {
	min-width: 0;
}

.pm-input-group:focus-within {
	border-color: var(--pm-input-focus);
}

/* Per-bar decoupled input-group styling (Search vs Nearby) */
.pm-search-col .pm-input-group {
	background: var(--pm-search-group-bg, var(--pm-bg));
	border: var(--pm-search-group-border-w, 1px) solid var(--pm-search-group-border, var(--pm-border));
	border-radius: var(--pm-search-group-radius, var(--pm-radius));
}
.pm-search-col .pm-input-group:focus-within {
	border-color: var(--pm-search-group-focus, var(--pm-input-focus));
	box-shadow: var(--pm-search-focus-glow, 0 0 0 3px rgba(15, 39, 68, 0.18));
}
.pm-nearby-col .pm-input-group {
	background: var(--pm-nearby-group-bg, var(--pm-bg));
	border: var(--pm-nearby-group-border-w, 1px) solid var(--pm-nearby-group-border, var(--pm-border));
	border-radius: var(--pm-nearby-group-radius, var(--pm-radius));
}
.pm-nearby-col .pm-input-group:focus-within {
	border-color: var(--pm-nearby-group-focus, var(--pm-input-focus));
	box-shadow: var(--pm-nearby-focus-glow, 0 0 0 3px rgba(15, 39, 68, 0.18));
}

.pm-input-icon {
	/* Block so SVG renders its own paths correctly; flex-item centering
	   is handled by the parent .pm-input-group (align-items: center).
	   margin keeps the SVG's own viewBox intact (unlike padding on SVG). */
	display: block;
	margin: 0 6px 0 14px;
	color: var(--pm-muted, #5c6470);
	flex-shrink: 0;
	pointer-events: none;
}

/* Icons inside buttons — strip the input-group padding; button gap handles spacing */
.pm-search-btn .pm-input-icon,
.pm-nearby-btn .pm-input-icon {
	display: block;
	padding: 0;
	color: currentColor;
	flex-shrink: 0;
}

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

.pm-search {
	/* no extra layout — .pm-input-group handles it */
}

.pm-portfolio .pm-search-input {
	flex: 1;
	height: 44px;
	padding: 0 8px;
	border: none;
	background: transparent;
	font-size: var(--pm-search-input-font, var(--pm-font-search));
	font-family: inherit;
	color: var(--pm-search-input-color, var(--pm-text));
	outline: none;
	min-width: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.pm-search-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 44px;
	padding: 0 18px 0 0;
	background: var(--pm-search-btn-bg, var(--pm-btn-bg));
	color: var(--pm-search-btn-color, #fff);
	border: none;
	border-left: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 0;
	font-size: var(--pm-search-btn-font, var(--pm-font-search));
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: opacity 0.15s;
}

.pm-search-btn:hover {
	opacity: 0.88;
}

/* ---- Nearby search ---- */

.pm-nearby-col .pm-nearby-inner {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.pm-portfolio .pm-nearby-input {
	flex: 1;
	height: 44px;
	padding: 0 8px;
	border: none;
	background: transparent;
	font-size: var(--pm-nearby-input-font, var(--pm-font-search));
	font-family: inherit;
	color: var(--pm-nearby-input-color, var(--pm-text));
	outline: none;
	min-width: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.pm-nearby-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 44px;
	padding: 0 18px 0 0;
	background: var(--pm-nearby-btn-bg, var(--pm-btn-bg));
	color: var(--pm-nearby-btn-color, #fff);
	border: none;
	border-left: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 0;
	font-size: var(--pm-nearby-btn-font, var(--pm-font-search));
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: opacity 0.15s;
}

.pm-nearby-btn:hover {
	opacity: 0.88;
}

.pm-nearby-clear {
	align-self: flex-start;
	height: 34px;
	padding: 0 14px;
	background: none;
	border: 1px solid var(--pm-border);
	color: var(--pm-muted);
	border-radius: var(--pm-radius);
	font-size: var(--pm-font-search);
	font-family: inherit;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}

.pm-nearby-clear:hover {
	border-color: var(--pm-btn-bg);
	color: var(--pm-text);
}

.pm-nearby-status {
	font-size: var(--pm-font-popup-addr);
	color: var(--pm-muted);
	display: block;
}

/* ---- Filter pills ---- */

.pm-filters {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 0 10px;
}

/* Inner wrapper — pills wrap here; the outer row stays a single flex line
   so the Clear-all button is always pinned to the far right */
.pm-filter-pills {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	flex: 1;
}

.pm-filter-prefix {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--pm-muted);
	flex-shrink: 0;
	margin-right: 2px;
}

.pm-filter-pill {
	position: relative;
}

.pm-filter-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 34px;
	padding: 0 12px;
	border: var(--pm-filter-border-w, 1px) solid var(--pm-filter-border, var(--pm-border));
	border-radius: var(--pm-filter-radius);
	background: var(--pm-filter-bg, var(--pm-bg));
	font-size: var(--pm-font-filter);
	font-family: inherit;
	color: var(--pm-filter-text, var(--pm-text));
	cursor: pointer;
	white-space: nowrap;
	transition: border-color 0.15s, color 0.15s;
	line-height: 1;
}

.pm-filter-btn:hover {
	border-color: var(--pm-muted);
}

.pm-filter-pill-active .pm-filter-btn {
	border-color: var(--pm-filter-active, var(--pm-tag-color));
	color: var(--pm-filter-active, var(--pm-tag-color));
}

.pm-filter-pill-open .pm-filter-btn {
	border-color: var(--pm-muted);
}

.pm-chevron {
	flex-shrink: 0;
	opacity: 0.65;
	transition: transform 0.15s;
}

.pm-filter-pill-open .pm-chevron {
	transform: rotate(180deg);
}

.pm-filter-drop {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	min-width: 225px;
	background: var(--pm-bg);
	border: 1px solid var(--pm-border);
	border-radius: var(--pm-radius);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
	z-index: 200;
	/* Cap the height so long term lists scroll instead of overflowing the embed. */
	max-height: min(320px, 50vh);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 4px 0;
	scrollbar-width: thin;
}

.pm-filter-drop::-webkit-scrollbar {
	width: 8px;
}

.pm-filter-drop::-webkit-scrollbar-thumb {
	background: var(--pm-border, #d7dbe0);
	border-radius: 8px;
}

.pm-filter-drop::-webkit-scrollbar-track {
	background: transparent;
}

.pm-filter-option {
	padding: 0px 14px;
	font-size: var(--pm-font-filter);
	cursor: pointer;
	transition: background 0.1s;
	color: var(--pm-text);
}

.pm-filter-option:hover {
	background: var(--pm-bg-alt);
}

.pm-filter-option-active {
	font-weight: 600;
	color: var(--pm-tag-color);
}

.pm-clear-all {
	background: none;
	border: none;
	color: var(--pm-clearall-color);
	font-size: var(--pm-clearall-font-size);
	font-family: inherit;
	cursor: pointer;
	padding: 0 4px;
	flex-shrink: 0;
	white-space: nowrap;
	text-decoration: none;
	transition: color 0.15s, opacity 0.15s;
}

.pm-clear-all:hover {
	color: var(--pm-text);
	opacity: 0.8;
}

/* ---- Layout ---- */

.pm-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
	gap: 20px;
	min-height: var(--pm-map-height);
	margin-top: 12px;
}

.pm-map-wrap {
	height: var(--pm-map-height);
	border-radius: var(--pm-radius);
	overflow: hidden;
	background: var(--pm-bg-alt);
	position: sticky;
	top: 16px;
}

.pm-map {
	width: 100%;
	height: 100%;
}

/* ---- Location landing intro (dynamic heading + "View All Projects") ---- */
.pm-location-intro {
	margin: 0 0 var(--pm-loc-gap-head, 18px);
}

.pm-location-heading {
	margin: 0;
	font-size: clamp(1.35rem, 2.4vw, 2rem);
	line-height: 1.2;
	color: var(--pm-text, #1c1f24);
}

/* Icon + subheading on one line (icon to the left), respecting alignment. */
.pm-location-subhead-row {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 var(--pm-loc-gap-sub, 6px);
}

.pm-location-logo {
	display: block;
	max-height: 44px;
	width: auto;
	margin: 0;
	flex: 0 0 auto;
}

.pm-location-subheading {
	margin: 0;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--pm-muted, #5c6470);
}

/* "View All Projects" — centered below the whole embed. */
.pm-location-footer {
	margin: var(--pm-loc-gap-btn, 18px) 0 0;
	text-align: center;
}

.pm-location-viewall {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 18px;
	background: var(--pm-va-bg, var(--pm-btn-bg, #0F2744));
	color: #fff;
	border-radius: var(--pm-radius, 8px);
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	transition: background 0.15s, opacity 0.15s;
}

.pm-location-viewall:hover {
	background: var(--pm-va-hover, var(--pm-va-bg, var(--pm-btn-bg, #0F2744)));
	opacity: 0.92;
	color: #fff;
}

/* ---- Custom map controls (zoom in / out + reset) ---- */
.pm-map-controls {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 10px;
}

.pm-map-ctrl {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: var(--pm-bg, #ffffff);
	color: var(--pm-text, #1c1f24);
	border: 1px solid var(--pm-border, #e2e5ea);
	border-radius: var(--pm-radius, 8px);
	font-family: inherit;
	font-size: 22px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
	transition: background 0.12s, color 0.12s;
}

.pm-map-ctrl:hover {
	background: var(--pm-btn-bg, #0F2744);
	color: #fff;
	border-color: var(--pm-btn-bg, #0F2744);
}

.pm-map-reset svg {
	display: block;
}

/*
 * Google Maps InfoWindow overrides.
 *
 * Container chain (outer → inner):
 *   .gm-style-iw-c   – Google's outer box (padding, border-radius, overflow)
 *   .gm-style-iw-d   – Google's scrollable content div (sets max-height inline)
 *   .pm-iw           – Our popup root (border-radius + overflow:hidden for corners)
 *
 * The CSS rules below are the baseline. Google re-applies max-height via JS
 * after domready (typically 121px on Safari). The MutationObserver in
 * frontend.js catches every inline-style write on .gm-style-iw-d and
 * immediately re-applies the 600px override with setProperty 'important'
 * so it always wins, even against Google's own JS.
 */
.pm-map .gm-style .gm-style-iw-c {
	padding: 0 !important;
	overflow: hidden !important;
	background: var(--pm-popup-bg, #ffffff) !important;
	max-width: var(--pm-iw-max-width, 280px) !important;
}

/* Recolor the InfoWindow pointer (tail) to match the popup background */
.pm-map .gm-style .gm-style-iw-tc::after,
.pm-map .gm-style .gm-style-iw-t::after {
	background: var(--pm-popup-bg, #ffffff) !important;
}

.pm-map .gm-style .gm-style-iw-d {
	overflow: hidden !important;
	padding: 0 !important;
	max-height: 600px !important;
	max-width: var(--pm-iw-max-width, 280px) !important;
}

/*
 * .gm-style-iw-chr is the close-button container in current Maps API builds.
 * We also target .gm-style-iw-ch for older builds.
 * position:absolute removes it from the flex column (eliminates the white gap);
 * right:0 + z-index:999 floats it over the top-right of the image.
 */
.pm-map .gm-style .gm-style-iw-chr,
.pm-map .gm-style .gm-style-iw-ch {
	position: absolute !important;
	top: 0 !important;
	right: 0 !important;
	z-index: 999 !important;
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	display: flex !important;
	justify-content: flex-end !important;
	pointer-events: none !important;
}

/* White circle — flex-centred so the icon sits exactly in the middle */
.pm-map .gm-style .gm-style-iw-chr > button,
.pm-map .gm-style .gm-style-iw-ch > button {
	pointer-events: auto !important;
	margin: 6px 6px 0 0 !important;
	background: #ffffff !important;
	border-radius: 50% !important;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
	opacity: 1 !important;
	width: 28px !important;
	height: 28px !important;
	padding: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}

/* Google sets margin:7px + width/height on the inner <span> via inline styles.
   Reset margin (flex centering handles position), constrain to 15px, and tell
   the browser to scale any background-image sprite down rather than tile it
   (tiling is what causes the "multiple duplicates" when the box shrinks). */
.pm-map .gm-style .gm-style-iw-chr > button > span,
.pm-map .gm-style .gm-style-iw-ch > button > span {
	margin: 0 !important;
	width: 15px !important;
	height: 15px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	overflow: hidden !important;
	background-size: contain !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
}

/* Newer builds render the icon as an inline SVG or img inside the span */
.pm-map .gm-style .gm-style-iw-chr > button > span > svg,
.pm-map .gm-style .gm-style-iw-chr > button > span > img,
.pm-map .gm-style .gm-style-iw-ch > button > span > svg,
.pm-map .gm-style .gm-style-iw-ch > button > span > img {
	width: 15px !important;
	height: 15px !important;
	display: block !important;
	filter: none !important;
}

.pm-list-wrap {
	display: flex;
	flex-direction: column;
	max-height: var(--pm-map-height);
}

/* ---- List header (count + sort) ---- */

.pm-list-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 0 2px 10px;
	flex-shrink: 0;
}

.pm-count {
	font-size: 13px;
	font-weight: 600;
	color: var(--pm-text);
}

.pm-portfolio .pm-sort {
	font-size: var(--pm-sort-font, 13px);
	font-family: inherit;
	color: var(--pm-sort-text, var(--pm-text));
	background-color: var(--pm-sort-bg, var(--pm-bg));
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%235c6470' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
	border: var(--pm-sort-border-w, 1px) solid var(--pm-sort-border, var(--pm-border));
	border-radius: var(--pm-sort-radius, var(--pm-radius));
	padding: 5px 28px 5px 10px;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
	outline: none;
	transition: border-color 0.15s;
}

.pm-portfolio .pm-sort:focus {
	border-color: var(--pm-input-focus);
}

/* ---- Card list ---- */

.pm-list {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding-right: 4px;
	overflow-y: auto;
	flex: 1;
	/* Slim, theme-colored scrollbar (Firefox) */
	scrollbar-width: thin;
	scrollbar-color: var(--pm-muted) transparent;
}

/* Slim, theme-colored scrollbar (WebKit/Chromium/Safari) — no arrow buttons */
.pm-list::-webkit-scrollbar {
	width: 8px;
}
.pm-list::-webkit-scrollbar-track {
	background: transparent;
}
.pm-list::-webkit-scrollbar-thumb {
	background: var(--pm-muted);
	border-radius: 999px;
	border: 2px solid transparent;
	background-clip: padding-box;
}
.pm-list::-webkit-scrollbar-thumb:hover {
	background: var(--pm-text);
	background-clip: padding-box;
}
.pm-list::-webkit-scrollbar-button {
	display: none;
	width: 0;
	height: 0;
}

.pm-loading,
.pm-empty {
	color: var(--pm-muted);
	font-size: 14px;
	padding: 16px 0;
	margin: 0;
}

/* ---- Cards ---- */

.pm-card {
	display: grid;
	grid-template-columns: 100px 1fr;
	align-items: center;
	gap: 10px;
	padding: 10px 4px 10px 10px;
	background: var(--pm-card-bg, var(--pm-bg));
	border: none;
	border-bottom: 1px solid var(--pm-card-border);
	border-left: 3px solid transparent; /* reserved space — active border changes colour only */
	border-radius: 0;
	color: inherit;
	cursor: pointer;
	transition: background 0.15s, border-left-color 0.15s, box-shadow 0.15s;
}

.pm-card:last-child {
	border-bottom: none;
}

.pm-card:hover {
	background: var(--pm-bg-alt);
	box-shadow: var(--pm-card-hover-shadow);
}

.pm-card-active {
	background: var(--pm-bg-alt) !important;
	border-left-color: var(--pm-card-active-color, var(--pm-tag-color)) !important;
	box-shadow: var(--pm-card-hover-shadow);
}

.pm-card-img-wrap {
	width: 100px;
	height: 84px;
	border-radius: 6px;
	overflow: hidden;
	background: var(--pm-bg-alt);
	flex-shrink: 0;
}

.pm-card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pm-card-img-placeholder {
	background: linear-gradient(135deg, #e7eaef 0%, #d4dae3 100%);
}

.pm-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.pm-card-service {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--pm-card-service-color, var(--pm-tag-color));
	line-height: 1.2;
}

.pm-card-title {
	margin: 0;
	font-size: var(--pm-font-card-title);
	font-weight: 600;
	line-height: 1.3;
	color: var(--pm-card-title-color);
}

.pm-card-addr {
	font-size: var(--pm-font-addr);
	color: var(--pm-card-addr-color);
}

.pm-card-meta {
	font-size: var(--pm-font-tag);
	color: var(--pm-card-meta-color, var(--pm-muted));
}

.pm-card-link {
	display: inline-block;
	width: 50%;
	margin-top: 5px;
	font-size: var(--pm-font-tag);
	font-weight: 600;
	color: var(--pm-popup-link);
	text-decoration: none;
}

.pm-card-link:hover {
	text-decoration: none;
	opacity: 0.75;
}

.pm-card-title-link {
	color: var(--pm-card-title-color);
	text-decoration: none;
}

.pm-card-title-link:hover {
	text-decoration: none;
	opacity: 0.75;
}

.pm-card-dist {
	font-size: var(--pm-font-tag);
	color: var(--pm-card-meta-color, var(--pm-muted));
	font-weight: 600;
}

.pm-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 4px;
}

.pm-tag {
	background: var(--pm-tag-bg);
	color: var(--pm-tag-color);
	font-size: var(--pm-font-tag);
	padding: 2px 8px;
	border-radius: var(--pm-tag-radius, 999px);
	border: var(--pm-tag-border-w, 1px) solid var(--pm-tag-border, var(--pm-border));
}

/* ---- Info window (popup) ---- */

.pm-iw {
	display: flex;
	flex-direction: column;
	width: var(--pm-iw-max-width, 280px);
	max-width: 100%;
	font-family: inherit;
	background: var(--pm-popup-bg, #ffffff);
	border-radius: var(--pm-popup-radius, 8px);
	overflow: hidden;
}

/* Image wrapper — position: relative so service label can overlay it */
.pm-iw-img-wrap {
	position: relative;
	flex-shrink: 0;
	overflow: hidden;
}

.pm-iw-img {
	width: 100%;
	height: var(--pm-iw-img-size);
	object-fit: cover;
	display: block;
}

/* Service label overlaid on top-left of the image */
.pm-iw-service {
	position: absolute;
	top: 8px;
	left: 10px;
	font-size: var(--pm-iw-service-font-size, 10px);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--pm-iw-service-color, #000000);
	background: #ffffff;
	padding: 2px 8px;
	border-radius: 999px;
	line-height: 1.6;
	pointer-events: none;
}

.pm-iw-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: var(--pm-font-popup);
	color: var(--pm-popup-body-color, var(--pm-text));
	line-height: 1.4;
	padding: 10px 12px 8px;
	/* Prevent child text from overflowing the popup width */
	min-width: 0;
	overflow-wrap: break-word;
	word-break: break-word;
}

.pm-iw-title {
	font-weight: 600;
	font-size: var(--pm-iw-title-font-size, 15px);
	color: var(--pm-popup-title);
	display: block;
	text-decoration: none;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: break-word;
}

.pm-iw-title:hover {
	text-decoration: none;
	opacity: 0.8;
}

/* Address row — flex so pin icon + text align properly */
.pm-iw-addr {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	color: var(--pm-popup-addr-color, var(--pm-muted));
	font-size: var(--pm-font-popup-addr);
	min-width: 0;
}

/* Address text sits next to the pin icon and wraps freely */
.pm-iw-addr-text {
	overflow-wrap: break-word;
	word-break: break-word;
	min-width: 0;
}

.pm-iw-pin-icon {
	flex-shrink: 0;
	margin-top: 1px;
	color: var(--pm-muted);
}

.pm-iw-meta {
	font-size: var(--pm-font-popup-addr);
	color: var(--pm-popup-addr-color, var(--pm-muted));
}

/* Standalone divider above the "View project" link — uses the same settings
   vars as the old border-top so Settings → Appearance → Map Popup still works */
.pm-iw-divider {
	width: 100%;
	height: var(--pm-iw-link-border-width, 1px);
	background: var(--pm-iw-link-border-color, #e3e5e8);
	margin-top: 8px;
	flex-shrink: 0;
}

.pm-iw-link {
	display: block;
	width: 50%;
	color: var(--pm-popup-link);
	font-weight: 600;
	font-size: var(--pm-font-popup-link, 13px);
	text-decoration: none;
	margin-top: 6px;
}

.pm-iw-link:hover {
	text-decoration: none;
	opacity: 0.8;
}

/* ---- Notice (admin) ---- */

.pm-notice {
	background: #fff7e6;
	border: 1px solid #f0c674;
	color: #5b3d00;
	padding: 14px 16px;
	border-radius: 8px;
	font-size: 14px;
}

/* ---- Archive wrapper ---- */

.pm-archive {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 20px;
}

.pm-archive-header {
	margin-bottom: 24px;
}

.pm-archive-title {
	margin: 0 0 8px 0;
	font-size: clamp(1.8rem, 3.5vw, 2.6rem);
}

.pm-archive-desc {
	color: var(--pm-muted);
	font-size: 16px;
	max-width: 680px;
}

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

@media (max-width: 900px) {
	.pm-layout {
		grid-template-columns: 1fr;
		margin-top: 8px;
	}
	.pm-map-wrap {
		height: 55vh;
		min-height: 300px;
		position: relative;
		top: auto;
	}
	/* Keep .pm-list-wrap and .pm-list at desktop defaults so the list
	   stays height-limited with internal scroll instead of expanding fully */
}

/* Safari/iOS reports a different vh than Chrome/Firefox due to the collapsing
   address bar. -webkit-touch-callout is supported by Safari but not Chrome or
   Firefox, making it a reliable Safari-only @supports guard. */
@supports (-webkit-touch-callout: none) {
	@media (max-width: 900px) {
		.pm-map-wrap {
			height: 75vh;
		}
	}
}

@media (max-width: 995px) {
	.pm-search-row {
		grid-template-columns: minmax(0, 1fr);
	}
	.pm-search-row > *:only-child {
		grid-column: auto;
	}
	.pm-header {
		justify-content: center;
		gap: 10px;
	}
	.pm-header-left {
		justify-content: center;
		width: 100%;
	}
	.pm-header-nav {
		width: 100%;
		flex-wrap: wrap;
		justify-content: center;
	}
	.pm-header-right {
		justify-content: center;
		width: 100%;
		flex-wrap: wrap;
	}
	.pm-header-rating {
		flex-wrap: wrap;
		justify-content: center;
		white-space: normal;
	}
}

@media (max-width: 600px) {
	/* Smaller search controls so they fit comfortably on phones */
	.pm-search-btn,
	.pm-nearby-btn {
		height: 40px;
		padding: 0 12px 0 0;
		font-size: 13px;
		gap: 3px;
	}
	.pm-portfolio .pm-search-input,
	.pm-portfolio .pm-nearby-input {
		height: 40px;
		font-size: 14px;
	}
	.pm-search-label {
		font-size: 10px;
	}
	/* Header text + buttons scale down on phones */
	.pm-header-company {
		font-size: 14px;
		white-space: normal;
	}
	.pm-header-tab {
		padding: 6px 10px;
		font-size: 13px;
	}
	.pm-header-cta {
		height: 32px;
		padding: 0 14px;
		font-size: 12px;
	}
	.pm-header-rating {
		font-size: 12px;
	}
	.pm-filter-btn {
		height: 32px;
		padding: 0 10px;
	}
}

@media (max-width: 480px) {
	.pm-card {
		grid-template-columns: 80px 1fr;
	}
	.pm-card-img-wrap {
		width: 80px;
		height: 80px;
	}

	/* ---- Popup on small phones ---- */
	.pm-iw-img {
		height: 120px; /* shorter image so body content fits comfortably */
	}

	/* Tighter close button margin on narrow screens */
	.pm-map .gm-style .gm-style-iw-chr > button,
	.pm-map .gm-style .gm-style-iw-ch > button {
		margin: 4px 4px 0 0 !important;
	}
}
