/*
 * Site header is position:fixed (see header.php). Margin-top clears the bar; overlay
 * sidebar uses top: 1rem relative to this box (not padding, so it stays over the map).
 */
/* Full viewport width when inside a constrained .entry-content / container */
.csek-job-site-map {
	/* Matches theme.json palette: slug "red" / "blue" */
	--csek-site-red: #930f0f;
	--csek-site-blue: #095b8e;
	/* Search row stays pill-shaped; panel uses a modest radius so it hugs the bar, not a giant capsule */
	--csek-pill-radius: 9999px;
	--csek-well-radius: 14px;
	--csek-map-header-clearance: 6rem;
	position: relative;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	margin-top: calc(1rem + var(--csek-map-header-clearance));
	margin-bottom: 1.5rem;
	padding-top: 0;
	min-height: min(70vh, 820px);
}

body.admin-bar .csek-job-site-map {
	margin-top: calc(1rem + var(--csek-map-header-clearance) + 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar .csek-job-site-map {
		margin-top: calc(1rem + var(--csek-map-header-clearance) + 46px);
	}
}

.csek-job-site-map__payload {
	display: none;
}

.csek-job-site-map__map {
	width: 100%;
	height: min(70vh, 820px);
	min-height: 420px;
	/* Prevent Leaflet panes/controls from overlaying the fixed site header. */
	position: relative;
	z-index: 0;
	isolation: isolate;
	border-radius: 0;
	overflow: hidden;
	border: none;
	background-color: #f1f5f9;
}

.csek-job-site-map__map--error {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	text-align: center;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: #475569;
	background-color: #f8fafc;
}

/* Google-maps style hint: “Hold Ctrl/Option + scroll to zoom” */
.csek-job-site-map__zoom-hint {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 450; /* above overlay + tiles, below header */
	pointer-events: none;
	opacity: 0;
	transition: opacity 180ms ease;
}

.csek-job-site-map__zoom-hint.is-visible {
	opacity: 1;
}

.csek-job-site-map__zoom-hint-inner {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.6rem 0.85rem;
	border-radius: 9999px;
	background: rgba(15, 23, 42, 0.82);
	color: #fff;
	font-size: 0.875rem;
	line-height: 1.2;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.csek-job-site-map__zoom-hint kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5em;
	padding: 0.08rem 0.4rem;
	border-radius: 0.45rem;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.22);
	font: inherit;
	font-weight: 700;
	letter-spacing: 0.01em;
}

/* Leaflet calibration panel (URL-enabled) */
.csek-job-site-map__calibrate.leaflet-bar {
	border: none;
	border-radius: 10px;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}

.csek-job-site-map__calibrate-inner {
	padding: 0.75rem;
	width: min(22rem, 78vw);
	box-sizing: border-box;
}

.csek-job-site-map__calibrate-title {
	font-weight: 700;
	font-size: 0.875rem;
	color: #0f172a;
	margin: 0 0 0.5rem;
}

.csek-job-site-map__calibrate-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0.35rem 0;
}

.csek-job-site-map__calibrate-label {
	font-size: 0.8125rem;
	color: #334155;
	user-select: none;
}

.csek-job-site-map__calibrate-slider {
	flex: 1;
	min-width: 0;
}

.csek-job-site-map__calibrate-output {
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.5rem 0.6rem;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	font-size: 0.75rem;
	line-height: 1.25;
	color: #0f172a;
	background: #fff;
	resize: vertical;
}

.csek-job-site-map__calibrate-copy {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 0.5rem;
	padding: 0.45rem 0.65rem;
	border: 1px solid rgba(9, 91, 142, 0.35);
	border-radius: 8px;
	background: #fff;
	color: var(--csek-site-blue);
	font-weight: 700;
	font-size: 0.8125rem;
	cursor: pointer;
}

.csek-job-site-map__calibrate-copy:hover {
	border-color: rgba(9, 91, 142, 0.6);
	background: rgba(9, 91, 142, 0.06);
}

.csek-job-site-map__calibrate-copy:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgba(9, 91, 142, 0.35);
}

/* Search + directory over the map (right; bottom on narrow screens) */
.csek-job-site-map__sidebar {
	--csek-sidebar-bg: rgba(15, 39, 68, 0.78);
	--csek-sidebar-card: #ffffff;
	--csek-sidebar-accent: var(--csek-site-blue);
	position: absolute;
	/* Header is Tailwind z-30; keep this below it */
	z-index: 20;
	top: 1rem;
	right: 1rem;
	bottom: 1rem;
	width: min(24rem, calc(100% - 2rem));
	max-height: calc(100% - 2rem);
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	min-height: 0;
	padding: 0.75rem;
	background: var(--csek-sidebar-bg);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border-radius: var(--csek-well-radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28);
	border: 1px solid rgba(255, 255, 255, 0.1);
	pointer-events: auto;
	overflow: visible;
}

/* Only wrap search tools; avoid a tall empty panel when the list is collapsed */
.csek-job-site-map__sidebar--results-collapsed {
	bottom: auto;
	max-height: none;
}

.csek-job-site-map__sidebar--results-collapsed .csek-job-site-map__sidebar-tools {
	margin-bottom: 0;
}

.csek-job-site-map__sidebar-tools {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	flex-shrink: 0;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin-bottom: 0.625rem;
}

.csek-job-site-map__search-cluster {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin-bottom: 0;
}

.csek-job-site-map__search-wrap {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 0.2rem 0.35rem 0.2rem 0.85rem;
	border-radius: var(--csek-pill-radius);
	background: #fff;
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
	border: 1px solid rgba(226, 232, 240, 0.95);
	gap: 0.25rem;
}

.csek-job-site-map__search {
	flex: 1;
	min-width: 0;
	width: auto;
	padding: 0.35rem 0.35rem 0.35rem 0;
	border: none;
	border-radius: 0;
	background: transparent;
	color: #0f172a;
	font-size: 0.9375rem;
	line-height: 1.35;
	-webkit-appearance: none;
	appearance: none;
}

.csek-job-site-map__search:focus {
	outline: none;
}

.csek-job-site-map__search-wrap:focus-within {
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12), 0 0 0 2px rgba(9, 91, 142, 0.35);
	border-color: rgba(9, 91, 142, 0.45);
}

.csek-job-site-map__search-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	margin: 0.05rem 0.05rem 0.05rem 0;
	border: none;
	border-radius: 50%;
	background: var(--csek-sidebar-accent);
	color: #fff;
	cursor: pointer;
	box-shadow: inset 0 0 0 2px #fff;
	transition: background 0.15s ease, transform 0.1s ease;
}

.csek-job-site-map__search-submit:hover {
	background: #074a73;
}

.csek-job-site-map__search-submit:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.csek-job-site-map__search-icon {
	display: block;
}

/* Site-red tab: anchored to sidebar bottom (well), not the search row; rounded bottom, hangs below panel */
.csek-job-site-map__browse-directory {
	position: absolute;
	left: 50%;
	bottom: 0;
	z-index: 2;
	transform: translate(-50%, 100%);
	margin: 0;
	padding: 0.35rem 0.85rem 0.45rem;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-top: none;
	border-radius: 0 0 10px 10px;
	background: var(--csek-site-red);
	font: inherit;
	font-size: 0.625rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	text-align: center;
	white-space: nowrap;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
	line-height: 1.2;
}

.csek-job-site-map__browse-directory:hover {
	filter: brightness(1.08);
}

.csek-job-site-map__browse-directory:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Tab only when the directory is collapsed; hide after browse, search, or marker opens the list */
.csek-job-site-map__sidebar:not(.csek-job-site-map__sidebar--results-collapsed) .csek-job-site-map__browse-directory {
	display: none;
}

/* Where supported, overlay scrollbars so they don’t narrow cards vs. the search row */
@supports (overflow: overlay) {
	.csek-job-site-map__list {
		overflow-x: hidden;
		overflow-y: overlay;
	}
}

.csek-job-site-map__search::placeholder {
	color: #64748b;
}

.csek-job-site-map__list {
	list-style: none;
	margin: 0;
	padding: 0.25rem 0 1.25rem;
	padding-inline: 0;
	overflow: auto;
	flex: 1;
	min-height: 0;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	align-self: stretch;
	margin:0px !important;
	border: none;
	border-radius: 0;
	background: transparent;
	-webkit-overflow-scrolling: touch;
	transition: max-height 0.35s ease, opacity 0.28s ease, flex 0.35s ease, padding 0.28s ease;
	/* Subtle “more below” cue at bottom of scroll area */
	-webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
	mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
}

.csek-job-site-map__sidebar--results-collapsed .csek-job-site-map__list {
	flex: 0 0 auto;
	max-height: 0 !important;
	min-height: 0;
	padding: 0;
	margin: 0;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

.csek-job-site-map__list-item {
	display: flex;
	justify-content: center;
	margin: 0 0 0.625rem;
	padding: 0;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.csek-job-site-map__list-item:last-child {
	margin-bottom: 0;
}

/* Location cards */
.csek-job-site-map__card {
	flex: 0 1 100%;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
	background: var(--csek-sidebar-card);
	border-radius: 10px;
	box-shadow: 0 2px 12px rgba(15, 23, 42, 0.12);
	overflow: hidden;
	border: 1px solid rgba(226, 232, 240, 0.95);
}

.csek-job-site-map__card-head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.25rem;
	min-height: 2.75rem;
	padding: 0.5rem 0.75rem;
	background: var(--csek-site-red);
}

.csek-job-site-map__card-title {
	margin: 0;
	padding:0px;

	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
	letter-spacing: -0.01em;
}

.csek-job-site-map__card-building {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.875rem;
	line-height: 1.25;
	color: rgba(255, 255, 255, 0.9);
}

.csek-job-site-map__card-building-icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1rem;
	height: 1rem;
	color: rgba(255, 255, 255, 0.9);
}

.csek-job-site-map__card-building-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.csek-job-site-map__card-body {
	padding: 0 1rem 0.75rem;
	border-top: 1px solid #e2e8f0;
}

.csek-job-site-map__card-section-label {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #94a3b8;
	margin: 0.75rem 0 0.5rem;
}

.csek-job-site-map__card-body .csek-job-site-map__card-section-label:first-child {
	margin-top: 0.5rem;
}

.csek-job-site-map__person {
	padding: 0.5rem 0;
}

.csek-job-site-map__person--border {
	border-top: 1px solid #f1f5f9;
	margin-top: 0.25rem;
	padding-top: 0.75rem;
}

.csek-job-site-map__person-heading {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.5rem;
	margin-bottom: 0.375rem;
}

.csek-job-site-map__person-name {
	font-weight: 700;
	font-size: 1.0625rem;
	line-height: 1.25;
	color: var(--csek-site-red);
}

.csek-job-site-map__person-role {
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.3;
	color: var(--csek-site-blue);
}

.csek-job-site-map__person-name + .csek-job-site-map__person-role::before {
	content: "·";
	margin-right: 0.4em;
	color: #94a3b8;
	font-weight: 400;
}

.csek-job-site-map__person-line {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin-top: 0.35rem;
	font-size: 0.8125rem;
	line-height: 1.45;
}

.csek-job-site-map__person > .csek-job-site-map__person-line:first-child,
.csek-job-site-map__person-heading + .csek-job-site-map__person-line {
	margin-top: 0;
}

.csek-job-site-map__person-line-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1rem;
	height: 1rem;
	margin-top: 0.1em;
	color: #64748b;
}

.csek-job-site-map__person-line-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.csek-job-site-map__person-line-value {
	flex: 1;
	min-width: 0;
	color: #334155;
	word-break: break-word;
}

.csek-job-site-map__person-notes {
	margin-top: 0.5rem;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: #475569;
}

.csek-job-site-map__meta {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.2rem 0.75rem;
	font-size: 0.8125rem;
	line-height: 1.45;
	align-items: baseline;
}

.csek-job-site-map__meta dt {
	margin: 0;
	font-weight: 600;
	color: #475569;
}

.csek-job-site-map__meta dd {
	margin: 0;
	color: #334155;
	word-break: break-word;
}

.csek-job-site-map__meta-link {
	color: var(--csek-sidebar-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.csek-job-site-map__meta-link:hover {
	color: #074a73;
}

.csek-job-site-map__card-legacy {
	font-size: 0.875rem;
	line-height: 1.5;
	color: #334155;
}

.csek-job-site-map__card-legacy p {
	margin: 0 0 0.5rem;
}

.csek-job-site-map__card-legacy p:last-child {
	margin-bottom: 0;
}

.csek-job-site-map__card-footer {
	padding: 0.5rem 1rem 0.875rem;
	border-top: 1px solid #e2e8f0;
	background: #f8fafc;
}

.csek-job-site-map__card-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0.5rem 0.75rem;
	border: 1px solid rgba(9, 91, 142, 0.35);
	border-radius: 8px;
	background: #fff;
	color: var(--csek-sidebar-accent);
	font-weight: 600;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.csek-job-site-map__card-action:hover,
.csek-job-site-map__card-action:focus-visible {
	background: rgba(9, 91, 142, 0.08);
	border-color: rgba(9, 91, 142, 0.55);
	outline: none;
}

/* Legacy list patterns (no longer emitted; kept for any cached HTML) */
.csek-job-site-map__item {
	display: block;
	width: 100%;
	text-align: left;
	padding: 0.5rem 0.75rem;
	border: none;
	border-bottom: 1px solid #f3f4f6;
	background: #fff;
	cursor: pointer;
}

.csek-job-site-map__item:hover,
.csek-job-site-map__item:focus-visible {
	background: #eff6ff;
	outline: none;
}

.csek-job-site-map__group {
	list-style: none;
	margin: 0;
	padding: 0;
	border-bottom: 1px solid #e5e7eb;
}

.csek-job-site-map__group:last-child {
	border-bottom: none;
}

.csek-job-site-map__location {
	display: block;
	width: 100%;
	text-align: left;
	padding: 0.625rem 0.75rem;
	border: none;
	background: #f8fafc;
	font-weight: 600;
	font-size: 0.9375rem;
	color: #0f172a;
	cursor: pointer;
}

.csek-job-site-map__location:hover,
.csek-job-site-map__location:focus-visible {
	background: #e0f2fe;
	outline: none;
}

.csek-job-site-map__contacts {
	list-style: none;
	margin: 0;
	padding: 0 0 0.25rem 0;
	background: #fff;
}

.csek-job-site-map__contacts li {
	margin: 0;
	padding: 0;
}

.csek-job-site-map__contact {
	display: block;
	width: 100%;
	text-align: left;
	padding: 0.4rem 0.75rem 0.4rem 1.25rem;
	border: none;
	border-top: 1px solid #f1f5f9;
	background: #fff;
	font-size: 0.875rem;
	color: #334155;
	cursor: pointer;
}

.csek-job-site-map__contact:hover,
.csek-job-site-map__contact:focus-visible {
	background: #eff6ff;
	outline: none;
}

.csek-job-site-map__empty {
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 1rem;
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.75);
	text-align: center;
	list-style: none;
}

/* Leaflet popup */
.leaflet-popup-content .csek-popup__title {
	display: block;
	margin-bottom: 0.5rem;
	font-size: 1.0625rem;
	font-weight: 800;
	line-height: 1.2;
	color: var(--csek-site-red);
}

.leaflet-popup-content .csek-popup__contact {
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top: 1px solid #e5e7eb;
	font-size: 0.875rem;
	line-height: 1.45;
}

.leaflet-popup-content .csek-popup__contact:first-of-type {
	margin-top: 0.5rem;
	padding-top: 0;
	border-top: none;
}

.leaflet-popup-content .csek-popup__role {
	color: #64748b;
	font-size: 0.8125rem;
	margin-top: 0.125rem;
}

.leaflet-popup-content .csek-popup__line {
	margin-top: 0.25rem;
}

.leaflet-popup-content .csek-popup__line--icon {
	display: flex;
	align-items: flex-start;
	gap: 0.4rem;
}

.leaflet-popup-content .csek-popup__icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1rem;
	height: 1rem;
	margin-top: 0.12em;
	color: #64748b;
}

.leaflet-popup-content .csek-popup__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.leaflet-popup-content .csek-popup__value {
	min-width: 0;
}

.leaflet-popup-content .csek-popup__name {
	display: inline-flex;
	align-items: flex-start;
	gap: 0.4rem;
}

.leaflet-popup-content .csek-popup__nameIcon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1rem;
	height: 1rem;
	margin-top: 0.12em;
	color: #64748b;
}

.leaflet-popup-content .csek-popup__nameIcon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.leaflet-popup-content .csek-popup__notes {
	margin-top: 0.35rem;
	color: #475569;
	white-space: pre-wrap;
}

.leaflet-popup-content .csek-popup__legacy {
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top: 1px solid #e5e7eb;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

/* Narrow screens: search / directory first, map below (in flow — no overlay) */
@media (max-width: 640px) {
	.csek-job-site-map {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		min-height: 0;
	}

	.csek-job-site-map__sidebar {
		position: relative;
		top: auto;
		right: auto;
		bottom: auto;
		left: auto;
		z-index: 1;
		width: 100%;
		max-width: none;
		max-height: none;
		margin: 0 0 0.75rem;
		flex: 0 0 auto;
		min-height: 0;
	}

	.csek-job-site-map__sidebar--results-collapsed {
		bottom: auto;
		max-height: none;
	}

	.csek-job-site-map__map {
		position: relative;
		flex: 1 1 auto;
		width: 100%;
		/* Fill the viewport below the fixed header on mobile. */
		min-height: calc(100vh - var(--csek-mobile-header-h, 0px));
		height: calc(100vh - var(--csek-mobile-header-h, 0px));
		margin: 0;
		z-index: 0;
	}

	.csek-job-site-map__list {
		/* Long lists: scroll inside panel so the map stays reachable */
		max-height: min(62vh, 480px);
	}
}
