/* The Waymorphic Map block in the editor. Each map block has its own layers, and the selected block is
   above the other blocks: the suggestions of its search are above the shield of the next map block. */
.waymorphic-map-editor {
	position: relative;
	isolation: isolate;
}

/* A new block with its first-step card (the card can be higher than the block) is above the blocks
   around it. The selected block is above that, and above the parts of a next block that have a
   layer of their own (a spacer, a cover). These are the levels that the card (4) and the
   suggestions of the search (6) had in the page before each block had its own layers. A block
   that stays at the top of the window (10) is above them. */
.waymorphic-map-editor.has-setup {
	z-index: 4;
}

.waymorphic-map-editor.is-selected {
	z-index: 6;
}

/* The first click on a block that is not selected selects it: the shield is above all parts of the map, also its popups. */
.waymorphic-map-editor__shield {
	position: absolute;
	inset: 0;
	z-index: 7;
}

.waymorphic-map-editor__search {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 4;
	width: 320px;
	max-width: calc(100% - 70px);
}

/* The search field with its suggestions. */
.waymorphic-search {
	position: relative;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	color: #1e1e1e;
	text-align: left;
}

.waymorphic-search .waymorphic-search__input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid #949494;
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	font: inherit;
	color: inherit;
}

.waymorphic-search .waymorphic-search__input:focus {
	border-color: #3858e9;
	outline: 1px solid #3858e9;
}

.waymorphic-search.is-busy .waymorphic-search__input {
	border-color: #3858e9;
}

.waymorphic-search__list {
	position: absolute;
	top: 44px;
	left: 0;
	right: 0;
	z-index: 5;
	max-height: 260px;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	list-style: none;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.waymorphic-search__item {
	margin: 0;
	padding: 8px 10px;
	border-radius: 3px;
	cursor: pointer;
}

.waymorphic-search__item.is-active {
	background: #3858e9;
	color: #fff;
}

.waymorphic-search__item strong,
.waymorphic-search__item span {
	display: block;
}

.waymorphic-search__item span {
	font-size: 12px;
	opacity: 0.75;
}

.waymorphic-search__message {
	margin: 0;
	padding: 8px 10px;
	color: #757575;
}

.waymorphic-map-editor__add {
	display: block;
	box-sizing: border-box;
	max-width: 100%;
	margin: 6px 0 0;
	padding: 8px 12px;
	border: 0;
	border-radius: 4px;
	background: #3858e9;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	font: 600 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #fff;
	text-align: left;
	cursor: pointer;
}

/* The first step of a new block. */
.waymorphic-setup {
	position: absolute;
	inset: 0;
	z-index: 4;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 24px 16px;
	background: rgba(255, 255, 255, 0.55);
	overflow: visible;
}

.waymorphic-setup__card {
	box-sizing: border-box;
	width: 420px;
	max-width: 100%;
	padding: 20px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
	font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	color: #1e1e1e;
	text-align: left;
}

.waymorphic-setup__card .waymorphic-setup__title {
	margin: 0 0 4px;
	font-size: 18px;
	font-weight: 600;
}

.waymorphic-setup__card .waymorphic-setup__text {
	margin: 0 0 12px;
	font-size: 13px;
	color: #50575e;
}

.waymorphic-setup__card .waymorphic-search__input {
	box-shadow: none;
}

.waymorphic-setup__skip {
	margin: 12px 0 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: 13px;
	color: #3858e9;
	text-decoration: underline;
	cursor: pointer;
}

/* A popup shows above the search field, not below it. For that, the layers of the map are not apart from the layers of the block. */
.waymorphic-map-editor .waymorphic-map {
	isolation: auto;
}

/* Three class names: this rule must be stronger than the rule of the page styles, which come after this file when the editor has no iframe. */
.waymorphic-map-editor .waymorphic-map .maplibregl-popup {
	z-index: 5;
}

/* While the suggestions of the search show, they are above the form of a marker. */
.waymorphic-map-editor__search:has(.waymorphic-search__list) {
	z-index: 6;
}

/* A browser that does not know :has(): while the search field is in use. */
@supports not selector(:has(a)) {
	.waymorphic-map-editor__search:focus-within {
		z-index: 6;
	}
}

/* The form in the popup of a marker. */
.waymorphic-marker-form {
	/* Not wider than a narrow map (a map in one of three columns). */
	width: 200px;
	max-width: 100%;
	font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #1e1e1e;
}

.waymorphic-marker-form label {
	display: block;
	font-weight: 600;
}

.waymorphic-marker-form input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: 34px;
	margin: 4px 0 8px;
	padding: 0 8px;
	border: 1px solid #949494;
	border-radius: 3px;
	font: inherit;
	font-weight: 400;
}

.waymorphic-marker-form__remove {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: #cc1818;
	text-decoration: underline;
	cursor: pointer;
}

.waymorphic-setup__locate {
	display: block;
	box-sizing: border-box;
	width: 100%;
	/* The text can have two lines in a narrow block. */
	min-height: 40px;
	margin: 10px 0 0;
	padding: 6px 12px;
	border: 1px solid #3858e9;
	border-radius: 4px;
	background: #fff;
	font: inherit;
	font-weight: 600;
	color: #3858e9;
	cursor: pointer;
}

.waymorphic-setup__locate:disabled {
	border-color: #949494;
	color: #757575;
	cursor: default;
}

.waymorphic-setup__card .waymorphic-setup__error {
	margin: 8px 0 0;
	font-size: 13px;
	color: #cc1818;
}

/* The offer of a marker at the point of a click. */
.waymorphic-map-editor__here {
	margin: 0 14px 0 0;
	padding: 6px 10px;
	border: 0;
	border-radius: 3px;
	background: #3858e9;
	font: 600 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #fff;
	cursor: pointer;
}

/* The style swatches in the sidebar, as in the Waymorphic map browser. */
.waymorphic-styles {
	display: flex;
	gap: 2px;
	margin: 0 -4px;
}

.waymorphic-styles__item {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	min-width: 0;
	margin: 0;
	padding: 5px 4px 6px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	font-size: 11.5px;
	line-height: 1;
	color: #757575;
	white-space: nowrap;
	cursor: pointer;
}

.waymorphic-styles__item:hover {
	background: #f0f0f0;
	color: #1e1e1e;
}

.waymorphic-styles__item:focus-visible {
	outline: 2px solid #3858e9;
	outline-offset: 1px;
}

.waymorphic-styles__item[aria-checked="true"] {
	color: #1e1e1e;
	font-weight: 600;
}

.waymorphic-styles__swatch {
	position: relative;
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 7px;
	background: var(--land);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* A bay of water. */
.waymorphic-styles__swatch::before {
	content: "";
	position: absolute;
	inset: 55% -20% -20% 40%;
	border-radius: 50%;
	background: var(--water);
}

/* A road. */
.waymorphic-styles__swatch::after {
	content: "";
	position: absolute;
	top: 46%;
	right: -10%;
	left: -10%;
	height: 12%;
	background: var(--road);
	transform: rotate(-32deg);
	transform-origin: center;
}

.waymorphic-styles__item[aria-checked="true"] .waymorphic-styles__swatch {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3858e9;
}

/* The bar on the map while the user draws a shape. */
.waymorphic-map-editor__draw {
	position: absolute;
	left: 10px;
	bottom: 34px;
	z-index: 4;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	max-width: calc(100% - 20px);
	box-sizing: border-box;
	padding: 8px 12px;
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #1e1e1e;
}

.waymorphic-map-editor__draw .waymorphic-map-editor__add {
	margin: 0;
	box-shadow: none;
}

.waymorphic-map-editor__draw .waymorphic-map-editor__add:disabled {
	background: #a7aaad;
	cursor: default;
}

.waymorphic-map-editor__cancel {
	margin: 0;
	padding: 8px 12px;
	border: 1px solid #949494;
	border-radius: 4px;
	background: #fff;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

/* The browser cannot show the map in the editor. The first-step card is in the flow of the block: the
   block is as high as the card at each width, and the message is below the card. The message has no
   layer of its own: the suggestions of a search show above it. The bar of a new shape is at the top
   of the grey box, not on the message. */
.waymorphic-map-editor.has-no-map .waymorphic-setup {
	position: relative;
	inset: auto;
}

.waymorphic-map-editor.has-no-map .waymorphic-map-editor__draw {
	top: 10px;
	bottom: auto;
}

.waymorphic-map-editor__error {
	margin: 0;
	padding: 12px 16px;
	background: #fcf9e8;
	color: #1e1e1e;
	font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
