/* The AVA map above the directory. Colours follow the theme's listing palette
   (bridge-child/assets/listings.css), repeated here so the plugin stands alone. */

.owb-map {
	position: relative;
	height: 460px;
	margin: 0 0 32px;
	background: var(--owb-tint);
	border: 1px solid var(--owb-line);
	overflow: hidden;
}

.owb-map.is-failed {
	display: none;
}

.owb-map-canvas {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity .5s ease;
}

.owb-map.is-ready .owb-map-canvas {
	opacity: 1;
}

.owb-map-status {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	color: var(--owb-muted);
	font-size: 14px;
}

/* The display above would otherwise outrank the attribute map.js sets. */
.owb-map-status[hidden] {
	display: none;
}

.owb-map .leaflet-container {
	background: var(--owb-tint);
	font: inherit;
}

@media (max-width: 768px) {
	.owb-map {
		height: 340px;
	}
}

/* AVA hover card. */
/* A set width: Leaflet positions the card absolutely, so left to itself it
   shrinks to its narrowest word and wraps every line. */
.owb-map-tip {
	width: min(360px, 80vw);
	padding: 10px 12px;
	border: 1px solid var(--owb-line);
	border-radius: 4px;
	box-shadow: 0 2px 10px rgba(0, 4, 41, .12);
	color: #3f3b37;
	font-size: 12px;
	line-height: 1.45;
	white-space: normal;
}

.owb-map-tip span {
	display: block;
}

.owb-map-tip em {
	color: var(--owb-muted);
	font-style: normal;
}

.owb-map-tip-name {
	display: block;
	margin-bottom: 2px;
	color: var(--owb-main);
	font-size: 14px;
}

.owb-map-tip-count {
	margin-bottom: 4px;
	color: var(--owb-accent);
	font-weight: 600;
}

/* Listing pin: a teardrop in its AVA's colour (grey out of focus) with the
   type's icon drawn inside the same SVG, both set by map-core.js, and the
   listing's name beside it. */
.owb-map-pin {
	overflow: visible;
}

.owb-map-pin-drop {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 28px;
	height: 38px;
	overflow: visible;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3));
	transition: transform .15s ease;
	transform-origin: 50% 100%;
}

.owb-map-pin:hover .owb-map-pin-drop {
	transform: scale(1.15);
}

.owb-map-pin-label {
	position: absolute;
	top: 7px;
	left: 30px;
	max-width: 180px;
	overflow: hidden;
	color: var(--owb-main);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
	pointer-events: none;
}

.owb-map-pin.is-muted .owb-map-pin-label {
	color: var(--owb-muted);
}

/* An AVA's count bubble, centred on its largest piece. Colours set by map-core.js. */
.owb-map-ava-count span {
	display: flex;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	align-items: center;
	justify-content: center;
	border: 1.5px solid var(--owb-main);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	font-size: 11px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .15s ease;
}

/* With events in it too: "12 · ▦3", a pill rather than a disc. */
.owb-map-ava-count--wide span {
	gap: 2px;
	padding: 0 7px;
	border-radius: 13px;
	white-space: nowrap;
}

.owb-map-ava-count-cal {
	width: 11px;
	height: 11px;
	flex: 0 0 11px;
}

/* An AVA's card, opened from the AVA once it is in focus: a speech bubble, as
   the planner's tutorial is, hanging beside the point clicked with its arrow
   at the point (map-core.js placeCard). On the page, over the map's panels,
   under the header and the listing popup. */
.owb-map-card {
	position: fixed;
	z-index: 1500;
	box-sizing: border-box;
	width: min(320px, calc(100vw - 24px));
	padding: 16px 18px 16px;
	border-radius: 0;
	background: var(--owb-main);
	box-shadow: 0 12px 32px rgba(0, 4, 41, .3);
	color: var(--owb-secondary);
	font-size: 13px;
	line-height: 1.5;
}

/* The arrow: on the card's left edge, or its right when it hangs left. */
.owb-map-card::before {
	position: absolute;
	top: calc(var(--owb-card-arrow, 30px) - 9px);
	right: 100%;
	border: 9px solid transparent;
	border-right-color: var(--owb-main);
	content: "";
}

.owb-map-card.is-left::before {
	right: auto;
	left: 100%;
	border-right-color: transparent;
	border-left-color: var(--owb-main);
}

@media (prefers-reduced-motion: no-preference) {
	.owb-map-card {
		animation: owb-map-card-in .2s ease-out;
	}
}

@keyframes owb-map-card-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
}

.owb-map-card-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 26px;
	height: 26px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(242, 237, 233, .35);
	border-radius: 0;
	background: transparent;
	color: var(--owb-secondary);
	font: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.owb-map-card-close:hover,
.owb-map-card-close:focus-visible {
	border-color: #fff;
	color: #fff;
}

.owb-map-card .owb-map-tip-name {
	margin: 0 28px 4px 0;
	color: #fff;
	font-family: var(--owb-font-headline, Georgia, serif);
	font-size: 18px;
	line-height: 1.25;
}

.owb-map-card .owb-map-tip-count {
	margin: 4px 0 6px;
	color: var(--owb-sky, #c0d8dd);
	font-weight: 700;
}

.owb-map-card span {
	display: block;
}

.owb-map-card em {
	color: rgba(242, 237, 233, .7);
	font-style: normal;
}

.owb-map-card-text {
	margin: 4px 0 6px;
	color: var(--owb-secondary);
	font-size: 13px;
}

.owb-map-card-text p {
	margin: 0 0 6px;
	color: inherit;
}

.owb-map-card .owb-map-card-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin-top: 12px;
}

.owb-map-card-links a {
	color: #fff;
	font-weight: 700;
	text-decoration: underline;
}

.owb-map-card-links .owb-map-button {
	padding: 8px 14px;
	border: 2px solid #fff;
	border-radius: 0;
	background: transparent;
	color: #fff;
	font-family: var(--owb-font-secondary, Arial, sans-serif) !important;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.owb-map-card-links .owb-map-button:hover,
.owb-map-card-links .owb-map-button:focus-visible {
	background: #fff;
	color: var(--owb-main);
}

.owb-map-ava-count:hover span {
	transform: scale(1.12);
}

.owb-map-ava-count.is-muted span {
	border-color: var(--owb-muted);
}

/* Zoomed out, a count of the listings in no AVA. */
.owb-map-badge span {
	display: flex;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--owb-main);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	cursor: pointer;
}

.owb-map-badge.is-muted span {
	background: #a9a8a3;
}

/* Stack: the icons of the types in it, overlapping, and the total. */
.owb-map-stack {
	display: flex;
	align-items: center;
	cursor: pointer;
}

.owb-map-stack-chips {
	display: flex;
}

.owb-map-stack-chip {
	position: relative;
	display: flex;
	box-sizing: border-box;
	width: 26px;
	height: 26px;
	align-items: center;
	justify-content: center;
	border: 1.5px solid var(--owb-main);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.owb-map-stack-chip + .owb-map-stack-chip {
	margin-left: -12px;
}

.owb-map-stack-chip svg {
	width: 14px;
	height: 14px;
}

.owb-map-stack-count {
	margin-left: 3px;
	padding: 1px 6px;
	border-radius: 9px;
	background: var(--owb-main);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 16px;
}

.owb-map-stack.is-muted .owb-map-stack-count {
	background: #a9a8a3;
}

.owb-map-stack:hover .owb-map-stack-chips {
	transform: scale(1.08);
}

/* The radius: its centre and the handle on its edge, in the circle's gold. */
.owb-map-here span,
.owb-map-handle span {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
	cursor: grab;
}

.owb-map-here span {
	border: 3px solid #fff;
	background: var(--owb-gold);
}

.owb-map-handle span {
	border: 2px solid var(--owb-gold);
	background: #fff;
	cursor: ew-resize;
}

/* Waiting for the click that places the marker. */
.owb-map.is-placing .leaflet-container,
.owb-map.is-placing .leaflet-interactive {
	cursor: crosshair !important;
}

/* The toolbar under the map. */
.owb-map-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 20px;
	margin: -20px 0 32px;
	font-size: 14px;
}

.owb-map-tools[hidden] {
	display: none;
}

.owb-map-tool {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.owb-map-tool--check {
	cursor: pointer;
}

.owb-map-button {
	padding: 6px 14px;
	border: 1px solid var(--owb-accent);
	border-radius: 999px;
	background: #fff;
	color: var(--owb-accent);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.owb-map-button[aria-pressed="true"] {
	background: var(--owb-accent);
	color: #fff;
}

.owb-map-button--quiet {
	border-color: var(--owb-line);
	color: var(--owb-muted);
}

.owb-map-address {
	min-width: 240px;
	padding: 6px 10px;
	border: 1px solid var(--owb-line);
	border-radius: 4px;
	font: inherit;
}

.owb-map-miles {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--owb-muted);
}

.owb-map-miles input {
	width: 64px;
	padding: 6px 8px;
	border: 1px solid var(--owb-line);
	border-radius: 4px;
	font: inherit;
}

.owb-map-tool-status {
	color: var(--owb-muted);
	font-size: 13px;
}

@media (max-width: 768px) {
	.owb-map-address {
		min-width: 0;
		flex: 1 1 100%;
	}
}

/* How much ground the view covers, top right. */
.owb-map-span {
	padding: 4px 9px;
	border: 1px solid var(--owb-line);
	border-radius: 4px;
	background: rgba(255, 255, 255, .92);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
	color: var(--owb-main);
	font-size: 12px;
	font-weight: 600;
	white-space: pre;
}
