/* Midrex — map marker popups (loaded with the Mapbox Map widget). */

.mdxmap-popup .mapboxgl-popup-content {
	padding: 0;
	border: 1px solid #DFE4EA;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 18px 46px rgba(0, 31, 62, .3), 0 2px 8px rgba(0, 31, 62, .16);
}

/* Fade in + settle down, on our own element — Mapbox owns the popup's
   transform for positioning, so animating that would fight it. */
.mdxmap-pop {
	position: relative;
	font-family: "Open Sans", sans-serif;
	color: #181818;
	animation: mdxmap-pop-in .3s cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes mdxmap-pop-in {
	from { opacity: 0; transform: translateY(-12px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.mdxmap-pop { animation-duration: .01ms; }
	.mdxmap-pop__track { transition: none !important; }
}

/* ------------------------------------------------------------------ chrome */

.mdxmap-pop__close,
.mdxmap-pop__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.mdxmap-pop__close {
	position: absolute;
	inset-block-start: 10px;
	inset-inline-end: 10px;
	z-index: 3;
	width: 30px;
	height: 30px;
	color: #fff;
	background: rgba(0, 31, 62, .55);
	border-radius: 50%;
	transition: background .2s ease;
}

.mdxmap-pop__close:hover {
	background: rgba(0, 31, 62, .82);
}

.mdxmap-pop__close svg,
.mdxmap-pop__btn svg {
	display: block;
	width: 17px;
	height: 17px;
}

.mdxmap-pop__count {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-start: 12px;
	z-index: 3;
	margin: 0;
	padding: 3px 10px;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: rgba(0, 31, 62, .62);
	border-radius: 20px;
}

.mdxmap-pop__nav {
	position: absolute;
	inset-block-start: 62px;
	inset-inline: 8px;
	z-index: 3;
	display: flex;
	justify-content: space-between;
	pointer-events: none;
}

.mdxmap-pop__btn {
	pointer-events: auto;
	width: 32px;
	height: 32px;
	color: #1D4F91;
	background: rgba(255, 255, 255, .94);
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 31, 62, .28);
	transition: background .2s ease, transform .2s ease;
}

.mdxmap-pop__btn:hover {
	background: #fff;
	transform: scale(1.06);
}

/* ------------------------------------------------------------------ track */

.mdxmap-pop__viewport {
	overflow: hidden;
	width: 100%;
}

.mdxmap-pop__track {
	display: flex;
	will-change: transform;
}

/* A definite width is essential: without it the slide sizes to its CONTENT,
   so a long link title stretches the card (never wrapping, then clipped) and
   the image no longer spans the full width. The carousel overrides this
   inline with 100 / (slides + 2 clones). */
.mdxmap-pop__slide {
	flex: 0 0 auto;
	width: 100%;
	min-width: 0;
	display: flex;
	flex-direction: column;
	max-height: 540px;
}

/* ------------------------------------------------------------------ media */

/* No fixed height: the image keeps its own aspect ratio up to the cap, so a
   landscape shot is shown whole instead of being cropped to a letterbox. Only
   when it would exceed the cap does it get clamped — and then object-fit
   crops it from the centre rather than squashing it. */
.mdxmap-pop__figure {
	flex: 0 0 auto;
	max-height: 260px;
	overflow: hidden;
	background: #EDF1F5 center / cover no-repeat;
}

.mdxmap-pop__img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 260px;
	object-fit: cover;
	object-position: center center;
	margin-inline: auto;
}

/* Long entries scroll inside the card rather than stretching the popup. */
.mdxmap-pop__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 14px 16px 16px;
}

/* ------------------------------------------------------------------- text */

.mdxmap-pop,
.mdxmap-pop__name,
.mdxmap-pop__loc,
.mdxmap-pop__note,
.mdxmap-pop__media a,
.mdxmap-pop__more a,
.mdxmap-pop__row dd {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.mdxmap-pop__name {
	margin: 0 0 2px;
	font: 600 16px/1.3 "Titillium Web", sans-serif;
	color: #1D4F91;
}

.mdxmap-pop__loc {
	margin: 0 0 10px;
	font-size: 13px;
	color: #5A6472;
}

.mdxmap-pop__meta {
	margin: 0 0 10px;
	padding: 10px 0 0;
	border-top: 1px solid #E4E8EE;
	font-size: 13px;
}

.mdxmap-pop__row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 2px 0;
}

.mdxmap-pop__row dt {
	color: #5A6472;
}

.mdxmap-pop__row dd {
	margin: 0;
	font-weight: 600;
	text-align: right;
}

.mdxmap-pop__note {
	margin: 8px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: #3D4652;
}

.mdxmap-pop__more,
.mdxmap-pop__media {
	margin: 10px 0 0;
	padding: 0;
	font-size: 12.5px;
}

.mdxmap-pop__media {
	list-style: none;
	border-top: 1px solid #E4E8EE;
	padding-top: 8px;
}

.mdxmap-pop__media li + li {
	margin-top: 5px;
}

.mdxmap-pop__media a,
.mdxmap-pop__more a {
	color: #1D4F91;
	text-decoration: underline;
}

/* ------------------------------------------------------------------ legend */

.mdxmap-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
	font: 400 14px/1.4 "Open Sans", sans-serif;
}

.mdxmap-legend li {
	display: flex;
	align-items: center;
	gap: 8px;
}

.mdxmap-legend i {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}

/* ---------------------------------------------------------------------------
 * Sizing — the height comes from the widget's responsive Height control, which
 * writes it onto .midrex-map. The Mapbox canvas is 100% of that, so it always
 * has a definite box to inherit (a percentage height against an auto-height
 * parent resolves to 0 and the map disappears).
 * ------------------------------------------------------------------------- */

.elementor-widget-midrex_mapbox_map .midrex-map__canvas,
.elementor-widget-midrex_mapbox_map .mapboxgl-map {
	height: 100%;
}

/* ---------------------------------------------------------------------------
 * Edge fade — softens the hard crop at the top/bottom when zooming.
 * Masks the WebGL canvas ONLY: popups, markers and the zoom controls are
 * siblings of it, so they stay fully opaque.
 * ------------------------------------------------------------------------- */

.midrex-map--fade .mapboxgl-canvas {
	--mdxmap-fade-stop: var(--mdxmap-fade, 90px);
	-webkit-mask-image: linear-gradient(
		to bottom,
		transparent 0,
		#000 var(--mdxmap-fade-stop),
		#000 calc(100% - var(--mdxmap-fade-stop)),
		transparent 100%
	);
	mask-image: linear-gradient(
		to bottom,
		transparent 0,
		#000 var(--mdxmap-fade-stop),
		#000 calc(100% - var(--mdxmap-fade-stop)),
		transparent 100%
	);
}

/* ---------------------------------------------------------------------------
 * Popups must escape the map box. Mapbox sets overflow:hidden on .mapboxgl-map
 * and the shell is rounded, so a popup near an edge gets clipped. Unclip the
 * whole chain and round the CANVAS itself instead — it is a single element, so
 * border-radius alone crops it without needing an overflow clip.
 * ------------------------------------------------------------------------- */

.elementor-widget-midrex_mapbox_map,
.elementor-widget-midrex_mapbox_map > .elementor-widget-container,
.midrex-map,
.midrex-map .mapboxgl-map,
.midrex-map .mapboxgl-canvas-container {
	overflow: visible;
}

.midrex-map .mapboxgl-canvas {
	border-radius: 8px;
}

.midrex-map .mapboxgl-popup {
	z-index: 6;
}

.midrex-map .mapboxgl-control-container {
	z-index: 4;
}
