/*
 * County Locations — scoped to co_location single + archive ONLY.
 * Unlocks vertical scrolling that the full-screen homepage map relies on,
 * without touching homepage styles.
 */

/* 1. Scroll unlock (homepage stays locked because it uses page-level rules,
      not body.single-co_location) */
body.single-co_location,
body.post-type-archive-co_location,
html:has(body.single-co_location),
html:has(body.post-type-archive-co_location) {
	overflow-y: auto !important;
	overflow-x: hidden !important;
	height: auto !important;
	min-height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
}

body.single-co_location .bricks-container,
body.post-type-archive-co_location .bricks-container {
	max-width: 1160px !important;
	width: 100% !important;
}

/* 2. Map wrapper */
.salc-county-map-wrap {
	position: relative;
	height: calc(100dvh - var(--salc-header-offset, 145px) - 56px);
	min-height: 460px;
	width: 100%;
	border-radius: 0;
	border-top: 1px solid #e2e8f0;
	border-left: 0;
	border-right: 0;
	border-bottom: 0;
	overflow: hidden;
	box-sizing: border-box;
	margin: 0;
}

.salc-county-map-wrap .wpgmza_map,
.salc-county-map-wrap #wpgmza_map_1,
.salc-county-map-wrap .leaflet-container {
	width: 100% !important;
	height: 100% !important;
	min-height: 0 !important;
}

@media (max-width: 768px) {
	
}

/* 3. Hero */
:root {
	--salc-header-offset: 185px; /* measured logged-out stack: header 120px + sub-brand band + slim title strip */
}

.salc-county-hero {
	padding: 12px 16px 10px;
	text-align: center;
	background: #ffffff;
	border-bottom: 1px solid #e2e8f0;
}
.salc-breadcrumb {
	font-size: 0.85rem;
	color: #475569;
	margin-bottom: 0.75rem;
}
.salc-breadcrumb a { color: #0284c7; text-decoration: none; }
.salc-county-hero h1 {
	font-size: clamp(1.25rem, 2.6vw, 1.7rem);
	line-height: 1.2;
	color: #0f172a;
	margin: 4px 0 0;
	font-weight: 700;
	letter-spacing: -0.02em;
}
.salc-county-intro {
	color: #475569;
	font-size: 1.05rem;
	line-height: 1.65;
	max-width: 68ch;
	margin: 0 0 1rem;
}
.salc-county-notes {
	background: #f8fafc;
	border-left: 3px solid #0284c7;
	padding: 0.9rem 1.1rem;
	border-radius: 0 10px 10px 0;
	color: #334155;
	font-size: 0.95rem;
	margin: 0 0 1.5rem;
}

/* 4. Directory */
.salc-locations-directory h2 {
	font-size: clamp(1.4rem, 3vw, 1.85rem);
	color: #0f172a;
	margin: 0 0 1.25rem;
	letter-spacing: -0.01em;
}
.salc-location-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 1.1rem;
}
.salc-location-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 1.1rem 1.2rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}
.salc-card-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.salc-badge {
	background: #e0f2fe;
	color: #075985;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 0.25rem 0.6rem;
	border-radius: 999px;
	text-transform: uppercase;
}
.salc-location-card h3 {
	margin: 0;
	font-size: 1.02rem;
	color: #0f172a;
	line-height: 1.3;
}
.salc-card-address { color: #475569; font-size: 0.9rem; margin: 0; }
.salc-card-desc { color: #475569; font-size: 0.88rem; line-height: 1.5; margin: 0; }
.salc-card-desc a { color: #0284c7; }
.salc-card-meta {
	margin-top: auto;
	padding-top: 0.6rem;
	border-top: 1px solid #eef2f7;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.6rem;
}
.salc-distance {
	background: #f1f5f9;
	color: #475569;
	font-size: 0.78rem;
	font-weight: 600;
	padding: 0.25rem 0.55rem;
	border-radius: 6px;
}
.salc-directions {
	color: #0284c7;
	font-size: 0.88rem;
	font-weight: 600;
	text-decoration: none;
}
.salc-directions:hover { text-decoration: underline; }
.salc-locations-empty { color: #475569; }

/* 5. Archive grid */
.salc-county-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1rem;
}
.salc-county-card a {
	display: block;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 1.1rem 1.2rem;
	text-decoration: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.salc-county-card a:hover {
	border-color: #0284c7;
	box-shadow: 0 8px 22px -14px rgba(2, 132, 199, 0.45);
}
.salc-county-name {
	font-size: 1.08rem;
	color: #0f172a;
	margin: 0 0 0.35rem;
}
.salc-county-cities {
	color: #475569;
	font-size: 0.87rem;
	line-height: 1.45;
	margin: 0 0 0.6rem;
}
.salc-county-count {
	color: #0284c7;
	font-size: 0.85rem;
	margin: 0 0 0.5rem;
}
.salc-county-cta {
	color: #0f172a;
	font-size: 0.85rem;
	font-weight: 600;
}

/* --------------------------------------------------------------------
 * Category badges + CTA funnel + browse-all (added during QA pass)
 * ------------------------------------------------------------------ */
.salc-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.salc-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.salc-cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 0 0 1.5rem;
}

.salc-cta-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.25);
}

.salc-cta-card a {
  font-size: 17px;
  font-weight: 700;
  color: #0284c7;
  text-decoration: none;
}

.salc-cta-card a:hover,
.salc-cta-card a:focus {
  text-decoration: underline;
}

.salc-cta-card span {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.5;
}

.salc-browse-all {
  margin: 0 0 2rem;
  font-size: 15px;
}

.salc-browse-all a {
  color: #0284c7;
  font-weight: 600;
  text-decoration: none;
}

.salc-browse-all a:hover,
.salc-browse-all a:focus {
  text-decoration: underline;
}

.salc-county-notes {
  margin: 1rem 0 0;
  padding: 12px 16px;
  background: #f8fafc;
  border-left: 4px solid #0284c7;
  border-radius: 8px;
  font-size: 14.5px;
  color: #334155;
}

@media (max-width: 768px) {
  .salc-cta-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------
 * Admin-bar offset preservation (logged-in only).
 * WP core sets html { margin-top: 32px !important } for body.admin-bar;
 * the scoped html override above cancels that on county pages, tucking
 * the header under the admin bar. Restore the offset here only.
 * ------------------------------------------------------------------ */
body.admin-bar.single-co_location,
body.admin-bar.post-type-archive-co_location,
html:has(body.admin-bar.single-co_location),
html:has(body.admin-bar.post-type-archive-co_location) {
	margin-top: var(--wp-admin--admin-bar--height, 32px) !important;
}

/* --------------------------------------------------------------------
 * Directory UX: filter pills, live count line, Show All collapse.
 * ------------------------------------------------------------------ */
.salc-count-line {
	margin: 0 0 1rem;
	font-size: 14.5px;
	line-height: 1.5;
	color: #475569;
}

.salc-filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 1.75rem;
}

.salc-filter-pill {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 8px 16px;
	border-radius: 999px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	color: #0f172a;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.salc-filter-pill:hover {
	background: #f1f5f9;
}

.salc-filter-pill.is-active {
	background: #0284c7;
	border-color: #0284c7;
	color: #ffffff;
}

.salc-hidden {
	display: none !important;
}

.salc-showall {
	display: block;
	margin: 1.75rem auto 2rem;
	min-height: 44px;
	padding: 12px 26px;
	border-radius: 999px;
	border: 1px solid #0f172a;
	background: #0f172a;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.salc-showall:hover {
	background: #1e293b;
}

/* Visible keyboard focus across all interactive county-page controls. */
.salc-filter-pill:focus-visible,
.salc-showall:focus-visible,
.salc-directions:focus-visible,
.salc-cta-card a:focus-visible,
.salc-county-link:focus-visible,
.salc-browse-all a:focus-visible,
.salc-breadcrumb a:focus-visible {
	outline: 3px solid #0284c7;
	outline-offset: 2px;
	border-radius: 4px;
}

.salc-filter-pill:focus-visible,
.salc-showall:focus-visible {
	border-radius: 999px;
}

@media (prefers-reduced-motion: reduce) {
	.salc-filter-pill,
	.salc-showall {
		transition: none;
	}
}

/* --------------------------------------------------------------------
 * Full-bleed map hero: jump strip + smooth anchor + directory block.
 * ------------------------------------------------------------------ */
/* Full-bleed: the map section escapes the Bricks container (scoped to the map section only). */
body.single-co_location .salc-map-section,
body.single-co_location .salc-map-section > .brxe-container,
body.single-co_location .salc-map-section .brxe-container {
	max-width: none !important;
	width: 100% !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.salc-map-jump {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 56px;
	padding: 10px 18px;
	background: #0284c7;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
}

.salc-map-jump:hover {
	background: #0369a1;
	color: #ffffff;
}

.salc-map-jump:focus-visible {
	outline: 3px solid #0f172a;
	outline-offset: -3px;
}

html:has(body.single-co_location) {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html:has(body.single-co_location) {
		scroll-behavior: auto;
	}
}

#list-directory {
	scroll-margin-top: calc(var(--salc-header-offset, 145px) - 40px);
}

.salc-directory-block {
	max-width: 1160px;
	margin: 0 auto;
	padding: 2rem 20px 0;
	box-sizing: border-box;
}

@media (max-width: 768px) {
	.salc-directory-block {
		padding: 1.25rem 16px 0;
	}
}

/* Header stack offsets, measured per viewport x login state — these come after the base :root so they win the cascade. */
:root:has(body.admin-bar) {
	--salc-header-offset: 249px; /* logged-in desktop: stack + 64px admin push */
}

@media (max-width: 768px) {
	:root {
		--salc-header-offset: 182px; /* logged-out mobile stack */
	}
	:root:has(body.admin-bar) {
		--salc-header-offset: 274px; /* logged-in mobile stack */
	}
}

/* --------------------------------------------------------------------
 * Cluster icon fix: the homepage carries this in its Bricks page CSS
 * (post-26.min.css), which county pages never load. Mirror it here,
 * scoped to co_location singles, so cluster pies render as full
 * centered circles like they do on /.
 * ------------------------------------------------------------------ */
body.single-co_location .wpgmza-marker-cluster-icon,
body.post-type-archive-co_location .wpgmza-marker-cluster-icon {
	background-size: contain !important;
	background-position: center center !important;
	background-repeat: no-repeat !important;
	border-radius: 50% !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}

/* --------------------------------------------------------------------
 * MOBILE-ONLY county map cleanup (<=768px, single-co_location only).
 * Desktop, archive, and the homepage are untouched.
 * ------------------------------------------------------------------ */
@media (max-width: 768px) {
	/* 1. Hide the redundant statewide banner on county pages. */
	body.single-co_location .brxe-text.bricks-type-hero {
		display: none !important;
	}

	/* 1b. Tighten the breadcrumb + H1 strip. */
	body.single-co_location .salc-county-hero {
		padding: 8px 12px;
	}

	body.single-co_location .salc-county-hero h1 {
		font-size: 16px;
		line-height: 1.25;
	}

	/* 2. Legend collapsed by default; opens as a scrollable overlay. */
	body.single-co_location .wpgmza-category-legends {
		display: none;
	}

	body.single-co_location .wpgmza-category-legends.is-salc-open {
		display: block;
		position: absolute;
		top: auto !important;
		left: 8px !important;
		right: 8px !important;
		bottom: 64px !important;
		width: auto !important;
		height: auto !important;
		max-height: 55dvh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		z-index: 1003;
		background: #ffffff;
		border-radius: 12px;
		box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.35);
		padding: 10px;
	}

	/* Floating toggle pill (bottom-right, opposite Reset Map). */
	/* Return the plugin's absolutely-positioned list to normal flow. */
	body.single-co_location .wpgmza-category-legends.is-salc-open .wpgmza-category-legend-group {
		position: static !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		bottom: auto !important;
		max-height: none !important;
	}

	body.single-co_location .wpgmza-category-legends.is-salc-open .wpgmza-category-legends-heading {
		position: static !important;
		padding-right: 44px;
	}

	body.single-co_location .salc-legend-toggle {
		position: absolute;
		bottom: 14px;
		right: 12px;
		z-index: 1002;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 9px 16px;
		min-height: 40px;
		background: #0f172a;
		color: #ffffff;
		font-size: 14px;
		font-weight: 600;
		border: 0;
		border-radius: 999px;
		box-shadow: 0 4px 14px -4px rgba(15, 23, 42, 0.5);
		cursor: pointer;
	}

	body.single-co_location .salc-legend-toggle:focus-visible {
		outline: 3px solid #0284c7;
		outline-offset: 2px;
	}

	body.single-co_location .salc-legend-close {
		position: absolute !important;
		top: 6px !important;
		right: 8px !important;
		width: 32px !important;
		height: 32px !important;
		min-height: 32px !important;
		left: auto !important;
		bottom: auto !important;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		background: #0f172a;
		color: #ffffff;
		border: 0;
		border-radius: 999px;
		font-size: 18px;
		font-weight: 700;
		line-height: 1;
		cursor: pointer;
		z-index: 2;
	}

	body.single-co_location .salc-legend-close:focus-visible {
		outline: 3px solid #0284c7;
		outline-offset: 1px;
	}

	/* 3. Reset Map: clean bottom-left clearance. */
	body.single-co_location .leaflet-reset-map-button {
		bottom: 14px !important;
		left: 12px !important;
		z-index: 1002 !important;
	}

	/* 3b. Compact the store-locator search bar. */
	body.single-co_location .wpgmza-store-locator {
		max-width: calc(100% - 24px) !important;
		padding: 6px 8px !important;
		margin-top: 8px !important;
	}

	body.single-co_location .wpgmza-store-locator input[type="text"],
	body.single-co_location .wpgmza-store-locator input[type="search"],
	body.single-co_location .wpgmza-store-locator .wpgmza-text-input {
		height: 34px !important;
		min-height: 34px !important;
		font-size: 13px !important;
		padding: 4px 8px !important;
	}

	body.single-co_location .wpgmza-store-locator select {
		height: 30px !important;
		min-height: 30px !important;
		font-size: 12px !important;
	}

	body.single-co_location .wpgmza-store-locator .wpgmza-search-icon,
	body.single-co_location .wpgmza-store-locator button {
		min-height: 32px !important;
		height: 32px !important;
		width: 32px !important;
		padding: 0 !important;
	}
}

/* --- Mobile refinement: single-row search bar + spec'd map height ------- */
@media (max-width: 768px) {
	/* Compact single-row locator: address input + radius select share a row. */
	body.single-co_location .wpgmza-store-locator {
		display: flex !important;
		flex-wrap: nowrap !important;
		flex-direction: row !important;
		align-items: center !important;
		gap: 6px !important;
		max-width: calc(100% - 24px) !important;
		padding: 6px 10px !important;
		margin-top: 8px !important;
	}

	body.single-co_location .wpgmza-store-locator .wpgmza-address-container {
		flex: 1 1 auto;
		display: flex;
	}

	body.single-co_location .wpgmza-store-locator input.wpgmza-address {
		width: 100% !important;
		height: 34px !important;
		min-height: 34px !important;
		font-size: 13px !important;
		padding: 4px 10px !important;
	}

	body.single-co_location .wpgmza-store-locator .wpgmza-radius-container {
		flex: 0 0 auto;
	}

	body.single-co_location .wpgmza-store-locator .wpgmza-radius {
		height: 30px !important;
		min-height: 30px !important;
		font-size: 12px !important;
		padding: 2px 4px !important;
	}

	body.single-co_location .wpgmza-store-locator svg:not([class*="loading"]) {
		width: 18px;
		height: 18px;
		flex: 0 0 auto;
	}

	/* Map height per spec: dvh-based with 62dvh ceiling. */
	body.single-co_location .salc-county-map-wrap {
		height: calc(100dvh - var(--salc-mobile-header-h, 128px) - 52px);
		min-height: 360px;
		max-height: 62dvh;
	}

	:root {
		--salc-mobile-header-h: 125px; /* measured logged-out mobile stack */
	}

	:root:has(body.admin-bar) {
		--salc-mobile-header-h: 217px; /* measured logged-in mobile stack */
	}
}
