/**
 * Key-free raster basemap.
 *
 * Styles the map pdt-map-tiles.js builds: tile grid, shape overlay, corner
 * handles and controls. Loaded on every screen that shows a map without a
 * vendor SDK, so it has to stand on its own - no Mapbox stylesheet here.
 */

.pdt-tilemap {
	position: relative;
	overflow: hidden;
	background-color: #e8e4dd;
	/* A faint graticule so an offline or blocked tile server still reads as a
	   map surface rather than a broken box - drawing keeps working. */
	background-image:
		linear-gradient( to right, rgba( 0, 0, 0, 0.06 ) 1px, transparent 1px ),
		linear-gradient( to bottom, rgba( 0, 0, 0, 0.06 ) 1px, transparent 1px );
	background-size: 32px 32px;
	cursor: grab;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

.pdt-tilemap.is-grabbing {
	cursor: grabbing;
}

.pdt-tilemap:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.pdt-tilemap__tiles,
.pdt-tilemap__markers,
.pdt-tilemap__handles,
.pdt-tilemap__vectors {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.pdt-tilemap__markers,
.pdt-tilemap__handles,
.pdt-tilemap__vectors {
	/* Clicks belong to the map: the editor turns them into corners. */
	pointer-events: none;
}

.pdt-tilemap__tile {
	position: absolute;
	top: 0;
	left: 0;
	width: 256px;
	height: 256px;
	max-width: none;
	pointer-events: none;
	-webkit-user-drag: none;
}

.pdt-tilemap__tile.is-failed {
	visibility: hidden;
}

.pdt-tilemap__marker {
	position: absolute;
	top: 0;
	left: 0;
	margin: -14px 0 0 -14px;
	pointer-events: auto;
}

.pdt-tilemap__handles .pdt-map-handle {
	position: absolute;
	top: 0;
	left: 0;
	margin: -11px 0 0 -11px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var( --pdt-handle-color, #b4532a );
	color: #fff;
	font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.4 );
	cursor: grab;
	pointer-events: auto;
	touch-action: none;
}

.pdt-tilemap__handles .pdt-map-handle:hover,
.pdt-tilemap__handles .pdt-map-handle:focus-visible {
	transform-origin: center;
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.pdt-tilemap__handles .pdt-map-handle:active {
	cursor: grabbing;
}

.pdt-tilemap__controls {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	flex-direction: column;
	gap: 1px;
	z-index: 3;
}

.pdt-tilemap__btn {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid rgba( 0, 0, 0, 0.18 );
	background: #fff;
	color: #1d2327;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.pdt-tilemap__btn:first-child {
	border-radius: 4px 4px 0 0;
}

.pdt-tilemap__btn:last-child {
	border-radius: 0 0 4px 4px;
}

.pdt-tilemap__btn:hover {
	background: #f6f7f7;
}

.pdt-tilemap__btn:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
	z-index: 1;
}

.pdt-tilemap__attribution {
	position: absolute;
	right: 0;
	bottom: 0;
	padding: 2px 6px;
	background: rgba( 255, 255, 255, 0.82 );
	border-radius: 3px 0 0 0;
	color: #3c434a;
	font-size: 10px;
	line-height: 1.6;
	pointer-events: none;
	z-index: 3;
}

.pdt-tilemap__notice {
	position: absolute;
	inset: auto 12px 12px 12px;
	margin: 0;
	padding: 8px 12px;
	border-radius: 6px;
	background: rgba( 29, 35, 39, 0.88 );
	color: #fff;
	font-size: 12px;
	text-align: center;
	pointer-events: none;
	z-index: 4;
}

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

	.pdt-tilemap__tile {
		transition: none;
	}
}
