/*
 * RacerPacer Maps: the map box, the marks on it, and the list and buttons of the
 * Map block.
 *
 * Colours come from four variables, each with a fallback, so a theme or another
 * plugin sets the look by setting them on any element around the map:
 *   --rpmap-accent     marks and buttons          --rpmap-on-accent  text on the accent
 *   --rpmap-line       a GPX line                 --rpmap-radius     corners
 * Everything else takes the colour of the text around it.
 */

/* ---- The map itself: also used alone by other plugins ---- */
.rpmap-box {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	min-height: 160px;
	border-radius: var(--rpmap-radius, 14px);
	overflow: hidden;
	background: rgba(127, 127, 127, 0.12);
}
.rpmap-box .rpmap-note {
	margin: 0;
	padding: 16px;
	font-size: 0.875em;
	opacity: 0.75;
	text-align: center;
}

/* A place's mark: on the map, and beside its name in the list. */
.rpmap-mark {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	flex: none;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid var(--rpmap-accent, #0EA5E9);
	background: var(--rpmap-accent, #0EA5E9);
	color: var(--rpmap-on-accent, #fff);
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
}
.rpmap-box .rpmap-mark {
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
	cursor: pointer;
}
/* A place between the first and the last, for a caller that tells them apart. */
.rpmap-mark-checkpoint {
	background: var(--rpmap-mark-bg, #fff);
	color: var(--rpmap-mark-text, #0f172a);
}
.rpmap-popup {
	display: flex;
	flex-direction: column;
	gap: 2px;
	color: #0f172a;
	font-size: 14px;
	line-height: 1.35;
}

/* ---- Buttons ---- */
.rpmap-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	width: auto;
	margin: 0;
	padding: 8px 16px;
	border: 1px solid var(--rpmap-accent, #0EA5E9);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.875em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}
.rpmap-btn:hover,
.rpmap-btn:focus-visible {
	background: var(--rpmap-accent, #0EA5E9);
	color: var(--rpmap-on-accent, #fff);
}

/* ---- The Map block ---- */
.rpmap .rpmap-title {
	margin: 0 0 12px;
}
.rpmap .rpmap-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}
.rpmap .rpmap-list {
	list-style: none;
	margin: 14px 0 0;
	padding: 0;
}
.rpmap .rpmap-place {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 10px 0;
	border-top: 1px solid rgba(127, 127, 127, 0.25);
}
.rpmap .rpmap-place:first-child {
	border-top: 0;
}
.rpmap .rpmap-place-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1 1 auto;
	min-width: 0;
}
.rpmap .rpmap-place-note {
	font-size: 0.875em;
	opacity: 0.8;
}
.rpmap .rpmap-place-link {
	flex: none;
}
.rpmap .rpmap-credit {
	margin: 10px 0 0;
	font-size: 0.8125em;
	opacity: 0.85;
}
.rpmap .rpmap-empty {
	margin: 0;
	padding: 16px;
	border: 1px dashed currentColor;
	border-radius: var(--rpmap-radius, 14px);
	opacity: 0.8;
}

/* The popup. Its colours are its own: a dialog sits above the page, not in it. */
.rpmap .rpmap-dialog {
	width: min(760px, calc(100vw - 32px));
	max-width: none;
	padding: 24px;
	border: 0;
	border-radius: 24px;
	background: #fff;
	color: #0f172a;
}
.rpmap .rpmap-dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
}
.rpmap .rpmap-dialog .rpmap-box {
	max-height: 52vh;
}
.rpmap .rpmap-dialog .rpmap-actions {
	margin-top: 16px;
}
