/*
 * The World Map page (/map), in the Blades and Banners theme: an ipsBox card with the theme's gold accent and
 * display font; controls and popups in the box colours. Unexplored land is the theme's dusk sky. Every colour
 * comes from the theme's variables, so it follows the light and dark schemes; the fallbacks are the dark ones.
 */
.cWmp {
	--wmp-gold: var(--bb-gold, hsl(42 85% 66%));
	--wmp-box: var(--i-box--ba-co, #1f1d29);
	--wmp-line: var(--i-box--bo-co, hsl(250 12% 26%));
	--wmp-text: var(--i-color_hard, #ece7dc);
	--wmp-soft: var(--i-color_soft, #a9a3b5);
	--wmp-panel: color-mix(in srgb, var(--wmp-box) 88%, transparent);
	--wmp-radius: var(--i-design-radius, 8px);
	/* The fog over unexplored land: its lit and shaded tones, and the far fog beyond it */
	--wmp-fog-light: #b8b3c8;
	--wmp-fog-dark: #77728a;
	--wmp-fog-far: #918ca3;
	overflow: hidden;
}

[data-ips-scheme="light"] .cWmp {
	--wmp-fog-light: #f1eef6;
	--wmp-fog-dark: #bdb7cc;
	--wmp-fog-far: #d8d3e2;
}

/* ---------------------------------------------------------------- header */

.cWmp__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 20px;
	border-bottom: 1px solid color-mix(in srgb, var(--wmp-gold) 22%, var(--wmp-line));
}

.cWmp__heading {
	min-width: 0;
}

.cWmp__title {
	margin: 0;
	font-family: var(--bb-font-display, inherit);
	font-weight: 700;
	font-size: 1.45rem;
	letter-spacing: .02em;
	color: var(--wmp-text);
}

.cWmp__title i {
	color: var(--wmp-gold);
	margin-inline-end: 8px;
}

.cWmp__intro {
	margin: 4px 0 0;
	color: var(--wmp-soft);
	font-size: .95rem;
}

/* When the map was last drawn */
.cWmp__updated {
	margin: 0;
	color: var(--wmp-soft);
	font-size: .9rem;
	font-variant: small-caps;
	letter-spacing: .04em;
	white-space: nowrap;
}

.cWmp__updated[hidden] {
	display: none;
}

/* ---------------------------------------------------------------- the map */

.cWmp__frame {
	position: relative;
	height: min(76vh, 900px);
	min-height: 420px;
	box-shadow: inset 0 1px 0 color-mix(in srgb, var(--wmp-gold) 14%, transparent);
}

.cWmp__frame:fullscreen {
	height: 100vh;
}

/* Unexplored land: fog. The fog layer (worldmap.js) covers far past the world; this is its colour beyond that. */
.cWmp__map,
.cWmp__map.leaflet-container {
	position: absolute;
	inset: 0;
	font: inherit;
	background: var(--wmp-fog-far);
}

.cWmp__map .cWmp__fog {
	image-rendering: auto;
}

.cWmp__map.leaflet-container {
	cursor: grab;
}

.cWmp__map.leaflet-dragging {
	cursor: grabbing;
}

.cWmp__map.is-pixelated .leaflet-tile {
	image-rendering: pixelated;
}

/* Controls: the forum's box colours, gold on hover */
.cWmp__map .leaflet-bar,
.cWmp__map .leaflet-control-layers,
.cWmp__panel,
.cWmp__btn {
	background: var(--wmp-panel);
	color: var(--wmp-text);
	border: 1px solid var(--wmp-line);
	border-radius: var(--wmp-radius);
	box-shadow: 0 6px 18px rgb(0 0 0 / .28);
	backdrop-filter: blur(4px);
}

.cWmp__map .leaflet-bar a {
	background: transparent;
	color: var(--wmp-text);
	border-bottom-color: var(--wmp-line);
}

.cWmp__map .leaflet-bar a:hover,
.cWmp__btn:hover {
	color: var(--wmp-gold);
	background: color-mix(in srgb, var(--wmp-gold) 10%, var(--wmp-box));
}

.cWmp__map .leaflet-bar a.leaflet-disabled {
	color: var(--wmp-soft);
	background: transparent;
	opacity: .5;
}

.cWmp__panel,
.cWmp__btn {
	position: absolute;
	z-index: 500;
	font-size: .85rem;
}

.cWmp__panel--coords {
	right: 10px;
	bottom: 10px;
	padding: 5px 10px;
	font-variant-numeric: tabular-nums;
	white-space: pre;
	pointer-events: none;
}

.cWmp__panel--coords:empty {
	display: none;
}

.cWmp__btn {
	top: 10px;
	width: 34px;
	height: 34px;
	padding: 0;
	cursor: pointer;
	display: grid;
	place-items: center;
}

.cWmp__btn--full {
	right: 10px;
}

.cWmp__btn--link {
	right: 52px;
}

.cWmp__btn--link.is-done {
	color: var(--i-color_green, #7fd17f);
}

.cWmp__state {
	position: absolute;
	inset: 0;
	z-index: 600;
	display: grid;
	place-items: center;
	padding: 24px;
	text-align: center;
	color: var(--wmp-text);
	font-family: var(--bb-font-display, inherit);
	font-size: 1.1rem;
	text-shadow: 0 2px 10px rgb(0 0 0 / .5);
	pointer-events: none;
}

.cWmp__state[hidden] {
	display: none;
}

/* ---------------------------------------------------------------- region tiles: layers, names, popups */

.cWmp__map .leaflet-top.leaflet-right {
	top: 52px;
}

.cWmp__map .leaflet-control-layers {
	font-size: .85rem;
}

.cWmp__map .leaflet-control-layers-expanded {
	padding: 6px 12px 6px 10px;
}

.cWmp__map .leaflet-control-layers label {
	display: flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
}

.cWmp__map .leaflet-control-layers input {
	accent-color: var(--wmp-gold);
}

.cWmp__map .leaflet-control-layers-separator {
	display: none;
}

.cWmp__map .cWmp__tip {
	background: var(--wmp-box);
	color: var(--wmp-text);
	border: 1px solid var(--wmp-line);
	border-radius: var(--wmp-radius);
	box-shadow: 0 4px 12px rgb(0 0 0 / .3);
	font-size: .85rem;
}

.cWmp__map .cWmp__tip::before {
	display: none;
}

.cWmp__map .cWmp__popup .leaflet-popup-content-wrapper {
	background: var(--wmp-box);
	color: var(--wmp-text);
	border: 1px solid color-mix(in srgb, var(--wmp-gold) 35%, var(--wmp-line));
	border-radius: var(--wmp-radius);
	box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}

.cWmp__map .cWmp__popup .leaflet-popup-tip {
	background: var(--wmp-box);
	border: 1px solid color-mix(in srgb, var(--wmp-gold) 35%, var(--wmp-line));
}

.cWmp__map .cWmp__popup a.leaflet-popup-close-button {
	color: var(--wmp-soft);
}

.cWmp__map .cWmp__popup a.leaflet-popup-close-button:hover {
	color: var(--wmp-gold);
}

.cWmp__map .cWmp__popup .leaflet-popup-content {
	margin: 10px 14px;
	line-height: 1.5;
	font-size: .9rem;
	min-width: 170px;
}

.cWmp__popName {
	font-family: var(--bb-font-display, inherit);
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--wmp-gold);
	margin-bottom: 2px;
}

.cWmp__popMuted {
	color: var(--wmp-soft);
}

@media (max-width: 600px) {
	.cWmp__frame {
		height: 70vh;
		min-height: 320px;
	}

}
