/*
 * Find Your League map. Brand tokens match abp-style.css: navy buttons
 * with white text (14.5:1), the light blue accent only for marks and
 * borders, never behind text. Fonts are inherited from the theme.
 */

.abp-map-wrap {
	--abp-navy: #000e29;
	--abp-navy-mid: #13294c;
	--abp-accent: #78acd2;
	--abp-border: #e2e6eb;
	--abp-muted: #5a6472;
	--abp-text: #14181f;
	margin: 0 0 1.5rem;
	font-family: inherit;
	color: var(--abp-text);
}

.abp-map {
	scroll-margin-top: 5rem; /* "Back to map" clears a sticky header too */
	position: relative;
	width: 100%;
	height: var(--abp-map-h, 480px);
	border: 1px solid var(--abp-border);
	border-radius: 8px;
	overflow: hidden;
	background: #eef2f6;
	z-index: 0; /* keeps Leaflet's panes under sticky site headers */
}

.abp-map .abp-map-status {
	margin: 0;
	padding: 2rem;
	text-align: center;
	color: var(--abp-muted);
}

.abp-map.leaflet-container {
	font: inherit;
}

/*
 * The brand tint. The street map's beige and orange fight the navy pins, so
 * the tiles are taken to grey and shifted toward the brand's cool blue. Done
 * with a filter on the tile layer rather than a different map, because the
 * plain grey basemaps wash their place names out to near white, and street
 * names are what people use to find a gym. Pins and labels sit in other
 * layers and keep their own colours.
 */
.abp-map--muted .leaflet-tile-pane {
	filter: grayscale(1) sepia(.18) hue-rotate(175deg) saturate(1.4) brightness(1.1) contrast(.82);
}

@media (max-width: 600px) {
	.abp-map {
		/* Short enough that the top of the list shows on the first screen. */
		height: min(var(--abp-map-h, 480px), 52vh);
		min-height: 300px !important; /* beats the inline reserve on phones */
	}
}

/* Popup card. */
.abp-map .leaflet-popup-content-wrapper {
	border-radius: 8px;
	box-shadow: 0 6px 24px rgba(0, 14, 41, .22);
	padding: 0;
}

.abp-map .leaflet-popup-content {
	margin: 0;
	width: auto !important; /* Leaflet sets a pixel width; let the card size itself */
	min-width: 240px;
}

.abp-map-card {
	padding: 1rem 1.1rem 1.1rem;
	border-top: 4px solid var(--abp-accent);
	border-radius: 8px 8px 0 0;
}

.abp-map-card p {
	margin: 0;
}

.abp-map-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: .625rem;
	margin-right: 1.25rem; /* clears the close button */
}

.abp-map .abp-map-card-title {
	margin: 0;
	font-size: 1.1875rem;
	font-weight: 800;
	line-height: 1.2;
	color: var(--abp-navy);
}

.abp-map-card-address {
	margin-top: .375rem !important;
	font-size: .875rem;
	line-height: 1.4;
	color: var(--abp-muted);
	white-space: pre-line;
}

.abp-map-card-count {
	flex: 0 0 auto;
	margin-top: .15rem;
	padding: .2rem .55rem;
	border-radius: 999px;
	background: var(--abp-navy-mid);
	color: #fff;
	font-size: .6875rem;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1.4;
	white-space: nowrap;
}

.abp-map-card-note {
	margin-top: .35rem !important;
	font-size: .8125rem;
	color: var(--abp-muted);
}

.abp-map .abp-map-card-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .4rem;
	margin-top: .85rem;
	padding: .6rem 1rem;
	border-radius: 999px; /* matches Register and the filter pills */
	background: var(--abp-navy-mid);
	color: #fff;
	font-size: .9375rem;
	font-weight: 600;
	text-decoration: none;
	transition: background-color .15s ease;
}

.abp-map .abp-map-card-link:hover {
	background: var(--abp-navy);
	color: #fff;
}

.abp-map .abp-map-card-link:focus-visible,
.abp-map .abp-map-btn:focus-visible,
.abp-map-list summary:focus-visible,
.abp-map-list a:focus-visible,
.abp-map .leaflet-marker-icon:focus-visible {
	outline: 3px solid var(--abp-navy-mid);
	outline-offset: 2px;
}

.abp-map .leaflet-marker-icon:focus-visible {
	outline-color: #fff;
	box-shadow: 0 0 0 5px var(--abp-navy-mid);
	border-radius: 4px;
}

/* Map buttons. */
.abp-map .abp-map-btn-wrap {
	margin-top: 6px;
}

.abp-map .abp-map-btn {
	display: block;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	background-color: #fff;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 18px;
	cursor: pointer;
	border-radius: 2px;
}

.abp-map .abp-map-btn:hover {
	background-color: #f1f5f9;
}

.abp-map .abp-map-btn--reset {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313294c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E");
}

.abp-map .abp-map-btn--near {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313294c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v4M12 18v4M2 12h4M18 12h4'/%3E%3C/svg%3E");
}

/* Stand-in pin if the image fails. */
.abp-map-fallback-pin span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	background: var(--abp-navy-mid, #13294c);
	color: #fff;
	font-weight: 700;
}

.abp-map-fallback-pin span::first-line {
	display: inline-block;
}

/* Tile failure notice. */
.abp-map-tiles-down {
	position: absolute;
	left: 8px;
	right: 8px;
	bottom: 24px;
	z-index: 1000;
	margin: 0;
	padding: .5rem .75rem;
	border-radius: 6px;
	background: #fff;
	color: var(--abp-text);
	font-size: .8125rem;
	box-shadow: 0 2px 8px rgba(0, 14, 41, .2);
}

/* List fallback under the map: slim rows, two columns. */
.abp-map-list {
	margin-top: .75rem;
	font-size: .9375rem;
}

.abp-map-list summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--abp-navy-mid);
	padding: .35rem 0;
}

.abp-map-list ul {
	list-style: none;
	margin: .5rem 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 24px;
	row-gap: 0;
}

.abp-map-list li {
	margin: 0;
	padding: 0;
	min-width: 0;
	border-top: 1px solid #dfe4ec;
	background: none;
}

.abp-map-list-row {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	box-sizing: border-box;
	min-height: 44px;
	padding: 10px;
	color: inherit;
	text-decoration: none;
}

/* Beaver Builder sets every link in Poppins bold (.fl-builder-content a). */
.abp-map-wrap .abp-map-list a.abp-map-list-row {
	font-family: inherit;
	font-weight: 400;
}

.abp-map-list a.abp-map-list-row:hover,
.abp-map-list a.abp-map-list-row:focus-visible {
	background: #eaf0f8;
	text-decoration: none;
}

.abp-map-list-city {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: #1b2a4a;
}

.abp-map-list-address {
	font-size: 13px;
	line-height: 1.35;
	color: #4f5f7a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.abp-map-list-soon {
	font-size: 13px;
	font-weight: 400;
	line-height: 1.35;
	color: #4f5f7a;
}

@media (max-width: 899.98px) {
	.abp-map-list ul {
		grid-template-columns: 1fr;
	}

	/* Mobile wraps long addresses instead of cutting them off. */
	.abp-map-list-address {
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
	}
}

.abp-map-admin-note {
	margin: .75rem 0 0;
	padding: .6rem .8rem;
	border-left: 4px solid #c27a00;
	background: #fff8e8;
	font-size: .875rem;
}

.abp-map-wrap .abp-sr,
.abp-map .abp-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.abp-map .abp-map-card-link {
		transition: none;
	}
}

/* League list under the map. */
.abp-map-programs {
	margin-top: 1.5rem;
	scroll-margin-top: 5rem; /* clears a sticky header when a pin jumps here */
}

/* Skip link: hidden until a keyboard user lands on it. */
.abp-skip {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 1001;
	padding: .6rem 1rem;
	background: var(--abp-navy-mid);
	color: #fff;
	font-weight: 600;
	border-radius: 0 0 6px 0;
}

.abp-skip:focus {
	left: 0;
	position: static;
	display: inline-block;
	margin-bottom: .5rem;
	border-radius: 6px;
	outline: 3px solid var(--abp-navy-mid);
	outline-offset: 2px;
}

/* Touch screens: bigger targets for the map controls and the card's close
   button. Leaflet's defaults are 30px and 24px. */
@media (pointer: coarse) {
	.abp-map .leaflet-bar a,
	.abp-map .abp-map-btn {
		width: 44px;
		height: 44px;
		line-height: 44px;
		background-size: 22px;
	}

	.abp-map.leaflet-container a.leaflet-popup-close-button {
		width: 44px;
		height: 44px;
		font-size: 24px;
		line-height: 44px;
		right: 0;
		top: 0;
	}

	.abp-map .abp-map-card-head {
		margin-right: 2rem;
	}
}

.abp-map-pick-note {
	margin: 0 0 1rem;
	padding: .75rem 1rem;
	border-left: 4px solid var(--abp-navy-mid);
	background: #f3f5f9;
	border-radius: 0 6px 6px 0;
	font-weight: 600;
}

.abp-map-programs:focus {
	outline: none; /* focus is moved here programmatically, not a control */
}

/* Location names under the pins. Pills rather than bare text so they read on
   any tile colour, and clickable, because a name looks like a target. */
.abp-map .abp-map-label {
	padding: 2px 9px;
	border: 1px solid var(--abp-border);
	border-radius: 999px;
	background: #fff;
	color: var(--abp-navy);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
	box-shadow: 0 1px 4px rgba(0, 14, 41, .18);
	cursor: pointer;
	transition: opacity .15s ease, background-color .15s ease;
}

.abp-map .abp-map-label::before {
	display: none; /* no arrow; the pin already points at the spot */
}

/* The location the list is filtered to stays strong, the others step back. */
.abp-map .abp-map-label.is-active {
	background: var(--abp-navy-mid);
	border-color: var(--abp-navy-mid);
	color: #fff;
}

.abp-map.has-active .leaflet-marker-icon:not(.is-active),
.abp-map.has-active .abp-map-label:not(.is-active) {
	opacity: .5 !important; /* Leaflet writes opacity inline */
}

.abp-map.has-active .leaflet-marker-icon:not(.is-active):hover,
.abp-map.has-active .leaflet-marker-icon:not(.is-active):focus-visible {
	opacity: 1 !important;
}

.abp-map .leaflet-marker-icon.is-active {
	filter: drop-shadow(0 3px 6px rgba(0, 14, 41, .45));
}

.abp-map .leaflet-marker-icon {
	transition: opacity .15s ease;
}

/* "Back to map" beside the result count. */
.abp-map-programs .abp-map-back {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	margin-left: auto;
	padding: .25rem 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: .8125rem;
	font-weight: 600;
	color: var(--abp-navy-mid);
	cursor: pointer;
}

.abp-map-programs .abp-map-back[hidden] {
	display: none;
}

.abp-map-programs .abp-map-back:hover {
	text-decoration: underline;
}

.abp-map-programs .abp-map-back:focus-visible {
	outline: 3px solid var(--abp-navy-mid);
	outline-offset: 2px;
	border-radius: 4px;
}

/* On a phone the count and Clear all fill the line, so the link wraps. It
   sits under them on the left rather than floating alone at the right. */
@media (max-width: 600px) {
	.abp-map-programs .abp-map-back {
		margin-left: 0;
		padding: .375rem 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.abp-map .abp-map-label,
	.abp-map .leaflet-marker-icon {
		transition: none;
	}
}

/* Map and filter bar as one card: the map on top, the filters along its
   bottom edge, sharing the map's border as their divider. */
.abp-map-wrap--joined .abp-map {
	border-radius: 12px 12px 0 0;
}

.abp-map-wrap--joined .abp-map-programs {
	margin-top: 0;
}

.abp-map-wrap--joined .abp-map-programs .abp-toolbar {
	border-top: 0;
	border-radius: 0 0 14px 14px;
}

.abp-map-wrap--joined .abp-map-programs .abp-toolbar-toggle {
	border-top: 0;
	border-radius: 0 0 12px 12px;
}

@media (max-width: 640px) {
	/* On a phone the bar opens below the Filters button as its own card. */
	.abp-map-wrap--joined .abp-map-programs .abp-toolbar {
		border-top: 1px solid var(--abp-border);
		border-radius: 14px;
	}

	/* The count, Clear all and Back to map stay in view while scrolling a
	   long list. Themes with a sticky header can set --abp-sticky-top to its
	   height so this line sits under it. */
	.abp-map-programs .abp-countline {
		position: sticky;
		top: var(--abp-sticky-top, 0px);
		z-index: 5;
		margin-bottom: var(--abp-space-sm);
		padding: .5rem 0;
		background: #fff;
		border-bottom: 1px solid var(--abp-border);
	}
}


/* The skip link is an <a> inside builder content, and Beaver Builder's
   `.fl-builder-content a:not(.fl-builder-submenu-link)` sets the global accent
   on it at a higher specificity than `.abp-skip`. That made the link navy on
   its own navy background: invisible to the keyboard user it exists for.
   Same colours as above, at a specificity that holds. */
.abp-map-wrap .abp-skip,
.abp-map-wrap .abp-skip:focus,
.abp-map-wrap .abp-skip:hover {
	background: var(--abp-navy-mid) !important;
	color: #fff !important;
}

/* 1.12.1: the BB global link colour (.fl-builder-content a) outranked the white label, so the
   popup button read navy on navy. Same values, higher specificity. */
.fl-builder-content .abp-map a.abp-map-card-link,
.fl-builder-content .abp-map a.abp-map-card-link:hover,
.fl-builder-content .abp-map a.abp-map-card-link:focus { color: #fff; }
