/* Ground: where the biome layer has nothing (loading, or zoomed out past it).
   Roughly the average of the faded biome palette, so it reads as land rather
   than a hole. */
.emerland-map {
	--emerland-map-ground: #626b6e;
	container-type: inline-size;
	position: relative;
	width: 100%;
	height: var(--emerland-map-height, 600px);
	background: var(--emerland-map-ground);
	border-radius: 4px;
	overflow: hidden;
	font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.emerland-map.em-in-nether {
	--emerland-map-ground: #5e4846;
}

.emerland-map.em-in-end {
	--emerland-map-ground: #4f4c5e;
}

.emerland-map .leaflet-container,
.emerland-map.leaflet-container {
	background: var(--emerland-map-ground);
}

/* Minecraft is blocks: never blur them when magnifying. */
.emerland-map .em-terrain img,
.emerland-map img.em-chunks,
.emerland-map canvas.leaflet-tile {
	image-rendering: pixelated;
}

.emerland-map .em-info {
	padding: 4px 8px;
	background: rgba(16, 32, 44, 0.85);
	color: #eef3f6;
	border-radius: 4px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Leave the bottom-right corner (Chunkbase link, credits) clear on narrow maps. */
.emerland-map .leaflet-bottom.leaflet-left {
	width: calc(100% - 170px); /* Leaflet corners pass clicks through, so the width is harmless */
}

.emerland-map .leaflet-bottom.leaflet-left .em-info {
	white-space: normal;
}

.emerland-map .em-chunkbase {
	display: block;
	padding: 2px 6px;
	background: rgba(255, 255, 255, 0.7);
	color: #333;
	border-radius: 3px;
	font-size: 11px;
	text-decoration: none;
}

.emerland-map .em-chunkbase:hover {
	background: #fff;
	text-decoration: underline;
}

.emerland-map .em-popup-coords {
	font-weight: 600;
	margin-bottom: 4px;
	font-variant-numeric: tabular-nums;
}

.emerland-map-error {
	padding: 1em;
	border: 1px dashed #c33;
	color: #c33;
}

@media (max-width: 600px) {
	.emerland-map .em-info {
		white-space: normal;
		max-width: 70vw;
	}
}

/* The seed's biomes are a backdrop: faded, so explored terrain stands out. */
.emerland-map .em-biomes {
	filter: saturate(0.45) brightness(1.12) contrast(0.8);
}

/* Top left, in one row: zoom, dimensions, go to spawn. */
.emerland-map .leaflet-top.leaflet-left {
	display: flex;
	align-items: flex-start;
	flex-wrap: wrap;
	max-width: calc(100% - 60px); /* clear of the layers button */
}

.emerland-map .leaflet-top.leaflet-left .leaflet-control {
	margin-right: 0;
}

.emerland-map .em-dims {
	display: flex;
	background: #fff;
}

.emerland-map .em-go-spawn {
	display: block;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 2px;
	background: #fff;
	color: #c99a00;
	font-size: 18px;
	line-height: 30px;
	text-align: center;
	cursor: pointer;
	padding: 0;
}

.emerland-map .em-go-spawn:hover {
	background: #f4f4f4;
}

/* The layers menu: opened by its button, closed by its own ×, the map, or leaving it. */
.emerland-map .em-layers-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 4px;
	font-weight: 600;
}

.emerland-map .em-layers-close {
	border: 0;
	background: none;
	padding: 0 2px;
	font-size: 18px;
	line-height: 1;
	color: #555;
	cursor: pointer;
}

.emerland-map .em-layers-close:hover {
	color: #000;
}

.emerland-map .em-dim {
	border: 0;
	border-right: 1px solid #ccc;
	background: #fff;
	color: #333;
	font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	padding: 7px 9px;
	cursor: pointer;
}

.emerland-map .em-dim:last-child {
	border-right: 0;
}

.emerland-map .em-dim:hover {
	background: #f1f6f2;
}

.emerland-map .em-dim.is-active {
	background: #1b4d2c;
	color: #fff;
}

/* Narrow maps: the info box takes the full width above the credits, and the
   corner Chunkbase link goes (clicking unexplored land still offers it). */
@container (max-width: 480px) {
	.emerland-map .leaflet-bottom.leaflet-left {
		width: calc(100% - 10px);
		bottom: 18px;
	}

	.emerland-map .em-chunkbase {
		display: none;
	}

	/* Zoom, dimensions and spawn still in one row on a phone. */
	.emerland-map .em-dim {
		padding: 7px 6px;
	}
}

/* Markers: the world spawn, and players (logged-in visitors only). */
.emerland-map .em-spawn {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
	color: #ffd54a;
	text-shadow: 0 0 2px #000, 0 0 4px #000;
}
/* Marker icons stay position: absolute (Leaflet's). Anything else puts them in the
   page flow, each pushed down by the ones before it: a fixed pixel error that is a
   few blocks close up and hundreds far out. Their labels are placed against them. */
.emerland-map .em-player-dot {
	display: block;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	border-radius: 50%;
	background: #3ec7ff;
	border: 2px solid #fff;
	box-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}
.emerland-map .em-player-unknown .em-player-dot {
	background: #9aa3a6;
	border-width: 1px;
}
.emerland-map .em-player-name {
	position: absolute;
	left: 15px;
	top: 50%;
	transform: translateY(-50%);
	white-space: nowrap;
	font: 600 11px/1.2 system-ui, sans-serif;
	color: #fff;
	text-shadow: 0 0 2px #000, 0 0 3px #000;
	pointer-events: none;
}
.emerland-map.em-far .em-player-name {
	display: none;
}
.emerland-map .em-player-when {
	opacity: 0.75;
	font-size: 0.9em;
}
.emerland-map .em-locked {
	opacity: 0.55;
	cursor: default;
}
.emerland-map .em-locked .em-login {
	opacity: 1;
	text-decoration: underline;
}

/* align="full" (the default): the whole width of the page's content area, inside the site's
   side padding, rather than the theme's text column. Beats the constrained layout's
   max-width and auto margins. */
.is-layout-constrained > .emerland-map.em-fill,
.emerland-map.em-fill {
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

/* The Nether's height picker, beside the dimension buttons. */
.emerland-map .em-heights {
	background: #fff;
}

.emerland-map .em-height {
	display: block;
	height: 30px;
	border: 0;
	border-radius: 2px;
	background: #fff;
	color: #333;
	font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	padding: 0 4px;
	cursor: pointer;
}
