/*
 * Map (contact page, showroom-list featured card): an OpenStreetMap (Leaflet) or Google map with markers.
 * The saved markup is the root and its marker list; map.js adds the canvas ([data-rt-map-canvas]) near the viewport.
 * The list is for screen readers; on the map each marker opens its title and text in a popup.
 * The canvas inside belongs to Leaflet or Google; their classes are styled here under .rt-map.
 * The original theme: rtthemes/map (static block; min height from the block's dimensions support).
 */
:where(.rt-map) {
	background-color: var(--rt-color-surface);
}

.rt-map {
	position: relative;
	/* Leaflet panes use z-index 400–1000: keep them inside the map */
	isolation: isolate;
	min-height: 20rem;
	overflow: hidden;
}

.rt-map > [data-rt-map-canvas] {
	position: absolute;
	inset: 0;
	font: inherit;
}

/* Screen reader text: the markers' titles and texts */
.rt-map .rt-map__markers {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Greyscale on OpenStreetMap: only the tiles (Google greys its own map through map styles) */
.rt-map--grayscale .leaflet-tile-pane {
	filter: grayscale(1);
}

.rt-map [data-rt-map-pin] {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--rt-color-accent);
	cursor: pointer;
	filter: drop-shadow(0 2px 2px rgb(0 0 0 / 35%));
}

.rt-map [data-rt-map-pin] svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

/* Icon library icon: in an accent badge with a tip pointing at the place */
.rt-map [data-rt-map-pin="icon"] {
	display: grid;
	position: relative;
	height: calc(100% - 0.5rem);
	place-items: center;
	border-radius: 50%;
	background-color: var(--rt-color-accent);
	color: var(--rt-color-on-accent);
}

.rt-map [data-rt-map-pin="icon"]::after {
	content: "";
	position: absolute;
	top: calc(100% - 1px);
	left: 50%;
	border-top: 0.5rem solid var(--rt-color-accent);
	border-right: 0.375rem solid transparent;
	border-left: 0.375rem solid transparent;
	translate: -50% 0;
}

.rt-map [data-rt-map-pin="icon"] svg {
	width: 62%;
	height: 62%;
}

.rt-map .leaflet-marker-icon:focus-visible,
.rt-map button[data-rt-map-pin]:focus-visible {
	outline: 2px solid var(--rt-color-contrast);
	outline-offset: 2px;
}

/* Popup (Leaflet and Google): title and text in the theme's type */
.rt-map [data-rt-map-popup] {
	color: var(--rt-color-body);
	font-family: var(--rt-font-family-body);
	font-size: var(--rt-font-size-small);
	line-height: 1.5;
}

.rt-map [data-rt-map-popup] strong {
	display: block;
	color: var(--rt-color-contrast);
	font-size: var(--rt-font-size-base);
	font-weight: var(--rt-font-weight-medium);
}

.rt-map [data-rt-map-popup] p {
	margin: 0.25rem 0 0;
}

.rt-map .leaflet-popup-content {
	margin: 0.75rem var(--rt-spacing-30);
}

/* Leaflet paints the popup white; the palette's base keeps it readable in dark palettes */
.rt-map .leaflet-popup-content-wrapper,
.rt-map .leaflet-popup-tip {
	background-color: var(--rt-color-base);
}

.rt-map .leaflet-popup-content-wrapper {
	border-radius: var(--rt-radius-card);
}
