/*
 * Facility map: map and list side by side. The list must stand alone: with no
 * map the script adds .iges-fmap--static and the list is the whole component.
 * #334375 is the site's Primary.
 */

.iges-fmap {
	--iges-fmap-height: 500px;
	--iges-fmap-navy: #334375;
	--iges-fmap-rule: #d5d8de;
	--iges-fmap-quiet: #696969;

	display: grid;
	grid-template-columns: minmax( 0, 2fr ) minmax( 260px, 1fr );
	gap: 16px;
	align-items: stretch;

	/* The Elementor section has no bottom padding above the footer. */
	margin-bottom: 40px;
}

.iges-fmap-stage {
	position: relative;
	min-width: 0;
}

.iges-fmap-canvas {
	height: var( --iges-fmap-height );
	background-color: #eceff3;
}

/* No map: the list takes the full width. */
.iges-fmap--static {
	grid-template-columns: minmax( 0, 1fr );
}

.iges-fmap--static .iges-fmap-stage {
	display: none;
}


/* THE LIST */

.iges-fmap-list {
	height: var( --iges-fmap-height );
	margin: 0;
	padding: 0;
	overflow-y: auto;
	list-style: none;
	border: 1px solid var( --iges-fmap-rule );
}

.iges-fmap--static .iges-fmap-list {
	height: auto;
	overflow-y: visible;
}

.iges-fmap-item + .iges-fmap-item {
	border-top: 1px solid var( --iges-fmap-rule );
}

.iges-fmap-item.is-active {
	background-color: #f4f6fa;
}

.iges-fmap-link {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 12px;
	color: inherit;
	text-decoration: none;
}

.iges-fmap-link:focus-visible {
	outline: 2px solid var( --iges-fmap-navy );
	outline-offset: -2px;
}

/* aspect-ratio with height:auto, not a height: the theme's `height: auto` on
 * images wins over a height declared here, so portrait photos would come out
 * too tall. */
.iges-fmap-thumb {
	flex: 0 0 72px;
	width: 72px;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.iges-fmap-text {
	min-width: 0;
}

.iges-fmap-name {
	display: block;
	font-weight: 700;
	line-height: 1.3;
	color: var( --iges-fmap-navy );
}

.iges-fmap-addr {
	display: -webkit-box;
	margin-top: 4px;
	overflow: hidden;
	font-size: 12px;
	line-height: 1.45;
	color: var( --iges-fmap-quiet );

	/* Two lines in the index; the card shows the full address. */
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}


/* THE MARKERS: advanced markers only (needs a Map ID); classic markers are
 * Google's own pin. */

.iges-fmap-pin {
	display: block;
	padding: 0;
	line-height: 0;
	background: none;
	border: 0;
	cursor: pointer;
	transform-origin: 50% 100%;
	transition: transform 120ms ease-out;
}

.iges-fmap-pin svg {
	overflow: visible;
	fill: #c0392b;
}

.iges-fmap-pin svg circle {
	fill: #ffffff;
}

.iges-fmap-pin:hover,
.iges-fmap-pin:focus-visible,
.iges-fmap-pin.is-active {
	transform: scale( 1.25 );
}

.iges-fmap-pin:hover svg,
.iges-fmap-pin:focus-visible svg,
.iges-fmap-pin.is-active svg {
	fill: var( --iges-fmap-navy );
}

.iges-fmap-pin:focus-visible {
	outline: 2px solid var( --iges-fmap-navy );
	outline-offset: 2px;
}


/* THE CARD: positioned inside .iges-fmap-stage and clamped by facility-map.js;
 * not a Google InfoWindow. */

.iges-fmap-card {
	position: absolute;
	z-index: 5;
	width: 360px;
	max-width: calc( 100% - 20px );
	padding: 14px;
	font-size: 13px;
	line-height: 1.5;
	background-color: #ffffff;
	border: 1px solid var( --iges-fmap-rule );
	box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.16 );
}

.iges-fmap-card[hidden] {
	display: none;
}

.iges-fmap-card-close {
	position: absolute;
	top: 0;
	right: 0;
	width: 32px;
	height: 32px;
	padding: 0;
	font-size: 20px;
	line-height: 1;
	color: var( --iges-fmap-quiet );
	cursor: pointer;
	background: none;
	border: 0;
}

.iges-fmap-card-close:hover,
.iges-fmap-card-close:focus-visible {
	color: var( --iges-fmap-navy );
}

/* Picture beside the title, so the name comes first. */
.iges-fmap-card-head {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding-right: 26px;
}

/* Fixed ratio, automatic height -- see the note on .iges-fmap-thumb. */
.iges-fmap-card-img {
	flex: 0 0 116px;
	width: 116px;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.iges-fmap-card-heading {
	min-width: 0;
}

.iges-fmap-card-title {
	display: block;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	color: var( --iges-fmap-navy );
	text-decoration: none;
}

.iges-fmap-card-title:hover,
.iges-fmap-card-title:focus-visible {
	text-decoration: underline;
}

.iges-fmap-card-addr {
	display: -webkit-box;
	margin: 5px 0 0;
	overflow: hidden;
	font-size: 12px;
	line-height: 1.4;
	color: var( --iges-fmap-quiet );
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.iges-fmap-card-text {
	display: -webkit-box;
	margin: 10px 0 0;
	overflow: hidden;

	/* Clamped so a long excerpt cannot set the card's height. */
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.iges-fmap-card-more {
	display: inline-block;
	margin-top: 10px;
	font-weight: 700;
	color: var( --iges-fmap-navy );
	text-decoration: underline;
}


/* NARROW SCREENS: the map with a horizontal rail of cards under it. */

@media ( max-width: 900px ) {

	.iges-fmap {
		grid-template-columns: minmax( 0, 1fr );
	}

	.iges-fmap-canvas {
		height: min( var( --iges-fmap-height ), 60vh );
	}

	.iges-fmap-list {
		display: flex;
		height: auto;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x proximity;
	}

	.iges-fmap-item {
		flex: 0 0 220px;
		scroll-snap-align: start;
	}

	.iges-fmap-item + .iges-fmap-item {
		border-top: 0;
		border-left: 1px solid var( --iges-fmap-rule );
	}

	.iges-fmap-link {
		flex-direction: column;
		height: 100%;
	}

	.iges-fmap-thumb {
		flex: none;
		width: 100%;
		height: 120px;
	}

	.iges-fmap--static .iges-fmap-list {
		display: block;
		overflow-x: visible;
	}

	.iges-fmap--static .iges-fmap-item {
		flex: none;
	}

	.iges-fmap--static .iges-fmap-item + .iges-fmap-item {
		border-top: 1px solid var( --iges-fmap-rule );
		border-left: 0;
	}

	.iges-fmap--static .iges-fmap-link {
		flex-direction: row;
	}

	.iges-fmap--static .iges-fmap-thumb {
		flex: 0 0 72px;
		width: 72px;
		height: 54px;
	}
}


@media ( prefers-reduced-motion: reduce ) {

	.iges-fmap-pin {
		transition: none;
	}
}
