/*
 * 8am Map — layout and every fallback.
 *
 * The block is a list of places first. The stage that holds the map is hidden
 * until the runtime is about to draw into it (or holds a picture that stands in
 * for the map), so a reader without JavaScript never sees an empty frame.
 *
 * Colours are read from custom properties and never declared here, so a
 * theme sets them once — on :root or on .eightam-map — and the drawn map reads
 * the same values: --eightam-map-land, -water, -river, -label, -label-muted,
 * -paper, -accent, and one per group: -red, -ink, -ochre, -green, -blue,
 * -olive. The fallbacks below are the plugin's own parchment palette.
 */

.eightam-map {
	--_land: var(--eightam-map-land, #ece2c4);
	--_label: var(--eightam-map-label, #34312a);
	--_muted: var(--eightam-map-label-muted, #877c64);
	--_paper: var(--eightam-map-paper, #fffdf6);
	--_rule: var(--eightam-map-rule, rgba(52, 49, 42, 0.14));
	--_place: var(--eightam-map-accent, #8a3b1f);
	--_gap: var(--eightam-map-gap, clamp(1.25rem, 3vw, 2.5rem));
	--_top: var(--eightam-map-sticky-top, 1rem);

	display: grid;
	gap: var(--_gap);
	margin-block: var(--eightam-map-margin, clamp(2rem, 5vw, 4rem));
}

/* Group colours for the list, the panel and the menus, the same values the map is drawn with. */
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-group-red { --_place: var(--eightam-map-red, #b73a2c); }
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-group-ink { --_place: var(--eightam-map-ink, #2b2a26); }
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-group-ochre { --_place: var(--eightam-map-ochre, #8c5a1c); }
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-group-green { --_place: var(--eightam-map-green, #3d7a3a); }
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-group-blue { --_place: var(--eightam-map-blue, #2e79ab); }
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-group-olive { --_place: var(--eightam-map-olive, #6d8752); }

/* A land without a colour of its own is named quietly, as on the map. */
:is(.eightam-map__place, .eightam-map__panel, .eightam-map__menu-entry).is-kind-area:not([class*='is-group-']) { --_place: var(--_muted); }

/* The stage ----------------------------------------------------------------- */

.eightam-map__stage {
	position: relative;
	aspect-ratio: var(--eightam-map-ratio, 4 / 3);
	overflow: hidden;
	background: var(--_land);
	border-radius: var(--eightam-map-radius, 0);
}

.eightam-map__stage[hidden] {
	display: none;
}

/* Two classes, so MapLibre's own `.maplibregl-map { position: relative }`,
   which arrives later, does not collapse the canvas to nothing. */
.eightam-map .eightam-map__picture,
.eightam-map .eightam-map__canvas {
	position: absolute;
	inset: 0;
}

.eightam-map__picture img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.eightam-map.is-live .eightam-map__picture {
	display: none;
}

/* While the map is on its way: the paper, a degree grid, and a word. */
.eightam-map.is-enhanced:not(.has-picture) .eightam-map__stage {
	background-color: var(--_land);
	background-image:
		linear-gradient(to right, rgba(92, 80, 56, 0.12) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(92, 80, 56, 0.12) 1px, transparent 1px);
	background-size: 25% 25%;
	background-position: -1px -1px;
}

.eightam-map.is-loading .eightam-map__stage::after {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 1.75rem;
	height: 1.75rem;
	margin: -0.875rem 0 0 -0.875rem;
	border: 2px solid var(--_muted);
	border-right-color: transparent;
	border-radius: 50%;
	animation: eightam-map-turn 0.9s linear infinite;
}

@keyframes eightam-map-turn {
	to { transform: rotate(1turn); }
}

@media (prefers-reduced-motion: reduce) {
	.eightam-map.is-loading .eightam-map__stage::after {
		animation: none;
		border-right-color: var(--_muted);
		opacity: 0.5;
	}
}

/* Asked for rather than drawn: a button, and what it costs. */
.eightam-map__offer {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 0.5rem;
	padding: 1rem;
	text-align: center;
}

.eightam-map__load {
	font: inherit;
	font-weight: 600;
	padding: 0.7rem 1.3rem;
	border: 0;
	border-radius: 999px;
	color: var(--_paper);
	background: var(--_label);
	cursor: pointer;
}

.eightam-map__offer-note {
	margin: 0;
	font-size: 0.8rem;
	color: var(--_muted);
}

/* The list ------------------------------------------------------------------ */

.eightam-map__places {
	list-style: none;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.eightam-map__place {
	display: grid;
	grid-template-columns: 2rem minmax(0, 1fr);
	gap: 0 0.9rem;
	padding: 1.1rem 0.9rem 1.2rem;
	border-top: 1px solid var(--_rule);
	scroll-margin-top: calc(var(--_top) + 1rem);
	transition: background-color 0.3s ease;
}

.eightam-map__place:last-child {
	border-bottom: 1px solid var(--_rule);
}

/* A heading between the places opens a part of the list. */
.eightam-map__part {
	padding: clamp(1.75rem, 4vw, 2.75rem) 0.9rem 0.9rem;
}

.eightam-map__part:first-child {
	padding-top: 0;
}

.eightam-map__part > * {
	margin: 0;
}

/* The place being shown: a wash of its colour, and its mark filled in —
   the same thing the map does to the marker. */
.eightam-map__place.is-active {
	background: color-mix(in srgb, var(--_place) 7%, transparent);
}

.eightam-map__mark {
	display: grid;
	place-items: center;
	width: 1.75rem;
	height: 1.75rem;
	margin-top: 0.1rem;
	border-radius: 50%;
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: lining-nums tabular-nums;
	color: var(--_paper);
	background: var(--_place);
}

/* A place's mark is drawn the same in the list and in a menu of places. */
:is(.eightam-map__place, .eightam-map__menu-entry).is-kind-site .eightam-map__mark {
	width: 0.9rem;
	height: 0.9rem;
	margin: 0.35rem auto 0;
	background: var(--_paper);
	border: 2px solid var(--_place);
}

:is(.eightam-map__place, .eightam-map__menu-entry).has-icon .eightam-map__mark {
	width: 2rem;
	height: 2rem;
	margin: 0;
	color: var(--_place);
	background: var(--_paper);
	border: 0;
	box-shadow: inset 0 0 0 2px var(--_place);
	transition: color 0.3s ease, background-color 0.3s ease;
}

.eightam-map__icon {
	width: 1.05rem;
	height: 1.05rem;
}

.eightam-map__place.is-active.has-icon .eightam-map__mark {
	color: var(--_paper);
	background: var(--_place);
}

.eightam-map__place.is-active:not(.has-icon) .eightam-map__mark {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--_place) 25%, transparent);
}

.eightam-map__place.is-kind-area .eightam-map__mark {
	width: 1.1rem;
	height: 2px;
	margin: 0.7rem auto 0;
	border-radius: 0;
	background: var(--_place);
}

/* In a menu and in the legend an area's sign is a polygon in its colour, in
   a cell as wide as an icon's. */
:is(.eightam-map__menu-entry, .eightam-map__signs li).is-kind-area .eightam-map__mark {
	display: grid;
	place-items: center;
	flex: none;
	width: 1.75rem;
	height: 1.75rem;
	margin: 0;
	border-radius: 0;
	background: none;
}

:is(.eightam-map__menu-entry, .eightam-map__signs li).is-kind-area .eightam-map__mark::before {
	content: "";
	width: 1.1rem;
	height: 1.1rem;
	background: var(--_place);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M5 8.5 11.5 3.5 20 7.5 18.5 17 8 20.5 3.5 14Z' fill='black' fill-opacity='.18'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M5 8.5 11.5 3.5 20 7.5 18.5 17 8 20.5 3.5 14Z' fill='black' fill-opacity='.18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.eightam-map__name {
	margin: 0;
	font-size: 1.1rem;
	line-height: 1.25;
}

.eightam-map__place.is-kind-area .eightam-map__name {
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 0.95rem;
}

.eightam-map__date {
	margin: 0.2rem 0 0;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--_place);
}

.eightam-map__text {
	margin-top: 0.45rem;
}

.eightam-map__text > * {
	margin-block: 0.5rem 0;
}

.eightam-map__text > :first-child {
	margin-top: 0;
}

/* The coordinates are a link to openstreetmap.org, and look it: a pin in the
   place's colour, the degrees underlined. */
.eightam-map__where {
	margin: 0.55rem 0 0;
	font-size: 0.8rem;
	font-variant-numeric: tabular-nums;
}

.eightam-map__where .eightam-map__coordinates {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	color: var(--_muted);
	text-decoration: none;
}

.eightam-map__coordinates > svg {
	flex: none;
	width: 1.2em;
	height: 1.2em;
	color: var(--_place);
}

.eightam-map__coordinates-text {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.eightam-map__where .eightam-map__coordinates:hover {
	color: var(--_place);
}

.eightam-map__where .eightam-map__coordinates:hover .eightam-map__coordinates-text {
	text-decoration-thickness: 2px;
}

/* A place's picture, above its name. */
.eightam-map__photo {
	margin: 0 0 0.75rem;
}

.eightam-map__photo-image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	border-radius: var(--eightam-map-radius, 0);
	background: var(--_land);
}

.eightam-map__photo-credit {
	margin-top: 0.3rem;
	font-size: 0.7rem;
	color: var(--_muted);
}

/* Links to more, as lines of the entry. The explore layout makes them
   buttons; see below. */
.eightam-map__links {
	margin: 0.55rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.85rem;
	font-weight: 600;
}

.eightam-map__links li + li {
	margin-top: 0.3rem;
}

/* Two classes: core's own link colour, `:root :where(a…)`, weighs as much
   as one and is printed later. */
.eightam-map__links .eightam-map__link {
	color: var(--_place);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.eightam-map__links .eightam-map__link::after {
	content: " →";
}

.eightam-map__link > svg {
	display: none;
}

.eightam-map__show {
	margin: 0.7rem 0.5rem 0 0;
	padding: 0.35rem 0.85rem;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--_place);
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 999px;
	cursor: pointer;
}

.eightam-map__show:hover {
	color: var(--_paper);
	background: var(--_place);
	border-color: var(--_place);
}

.eightam-map__show:focus-visible,
.eightam-map__load:focus-visible,
.eightam-map__coordinates:focus-visible {
	outline: 2px solid var(--_place);
	outline-offset: 2px;
}

/* The caption --------------------------------------------------------------- */

.eightam-map__caption {
	display: grid;
	gap: 0.25rem;
	font-size: 0.85rem;
	color: var(--_muted);
}

.eightam-map__credit {
	font-size: 0.7rem;
}

.eightam-map__credit a {
	color: inherit;
}

/*
 * The key to a forest archive: a swatch per class, each the wash the map
 * draws laid on the land colour, as it shows on the map. Like the credit, it
 * belongs to a drawn map.
 */
.eightam-map__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.75rem;
}

.eightam-map__legend li {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.eightam-map__legend li::before {
	content: "";
	width: 0.9rem;
	height: 0.9rem;
	border-radius: 2px;
	background: linear-gradient(var(--_swatch), var(--_swatch)), var(--_land);
	box-shadow: inset 0 0 0 1px var(--_rule);
}

.eightam-map__legend :is(.is-intact, .is-forest) { --_swatch: var(--eightam-map-forest, rgba(34, 104, 48, 0.24)); }
.eightam-map__legend .is-degraded { --_swatch: var(--eightam-map-forest-degraded, rgba(34, 104, 48, 0.13)); }
.eightam-map__legend .is-regrowth { --_swatch: var(--eightam-map-forest-regrowth, rgba(70, 160, 70, 0.14)); }
.eightam-map__legend .is-cleared { --_swatch: var(--eightam-map-forest-cleared, rgba(170, 60, 30, 0.45)); }

/* Nothing to credit when nothing is drawn: no JavaScript and no picture. */
.eightam-map:not(.is-enhanced):not(.has-picture) :is(.eightam-map__credit, .eightam-map__legend) {
	display: none;
}

/* Layouts ------------------------------------------------------------------- */

/*
 * Side by side on a wide screen: the map holds still beside the places while
 * they are read, and follows them. On a phone the map holds the top of the
 * screen instead — the same arrangement as the painting in a story — but only
 * once it is live; a picture standing in for it stays in the flow.
 */
@media (min-width: 900px) {
	.eightam-map.is-layout-side {
		grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
		align-items: start;
	}

	.eightam-map.is-layout-side .eightam-map__stage {
		position: sticky;
		top: var(--_top);
		max-height: calc(100svh - var(--_top) - 1.5rem);
	}

	.eightam-map.is-layout-side .eightam-map__stage[hidden] + .eightam-map__places {
		grid-column: 1 / -1;
		max-width: 48rem;
	}

	.eightam-map.is-layout-side :is(.eightam-map__intro, .eightam-map__caption) {
		grid-column: 1 / -1;
	}

	.eightam-map.is-layout-stack .eightam-map__places {
		columns: 2 22rem;
		column-gap: var(--_gap);
	}

	.eightam-map.is-layout-stack .eightam-map__place {
		break-inside: avoid;
	}
}

@media (max-width: 899.98px) {
	.eightam-map.is-layout-side.is-live .eightam-map__stage {
		position: sticky;
		top: var(--_top);
		z-index: 2;
		aspect-ratio: auto;
		height: min(46svh, 28rem);
		box-shadow: 0 1px 0 var(--_rule);
	}

	.eightam-map.is-layout-side.is-live .eightam-map__place {
		scroll-margin-top: calc(var(--_top) + min(46svh, 28rem) + 1rem);
	}
}

/*
 * Explore: the map is the page. It is as large as the screen allows, a place
 * clicked opens in a panel over it — at the side on a wide screen, across the
 * bottom half on a phone — and the list underneath becomes an index of names.
 * Without the map the list is printed in full, in two columns.
 */
.eightam-map.is-layout-explore {
	--_inset: var(--eightam-map-panel-inset, clamp(0.75rem, 1.4vw, 1.25rem));
}

.eightam-map.is-layout-explore .eightam-map__stage {
	aspect-ratio: auto;
	height: clamp(24rem, calc(100svh - var(--_top) - 2rem), 60rem);
	scroll-margin-top: var(--_top);
}

/* Offered rather than drawn, on a connection that asked to save data: a
   button does not need the whole screen. */
.eightam-map.is-layout-explore.is-offered .eightam-map__stage {
	height: 14rem;
	min-height: 0;
}

.eightam-map.is-layout-explore .eightam-map__caption {
	order: 1;
}

.eightam-map.is-layout-explore .eightam-map__places {
	order: 2;
}

@media (min-width: 900px) {
	.eightam-map.is-layout-explore .eightam-map__places {
		columns: 2 22rem;
		column-gap: var(--_gap);
	}

	.eightam-map.is-layout-explore .eightam-map__place {
		break-inside: avoid;
	}

	.eightam-map.is-layout-explore .eightam-map__part {
		column-span: all;
	}
}

@media (max-width: 899.98px) {
	.eightam-map.is-layout-explore .eightam-map__stage {
		height: calc(100svh - var(--_top) - 0.75rem);
		min-height: 22rem;
	}
}

/* The panel: as large as the place needs and no larger. */
.eightam-map__panel {
	position: absolute;
	z-index: 3;
	top: var(--_inset);
	left: var(--_inset);
	display: flex;
	flex-direction: column;
	width: min(var(--eightam-map-panel-width, 23rem), calc(100% - 2 * var(--_inset)));
	max-height: calc(100% - 2 * var(--_inset));
	overflow: hidden;
	color: var(--_label);
	background: var(--_paper);
	border-radius: var(--eightam-map-panel-radius, 12px);
	box-shadow: 0 14px 38px -12px rgba(0, 0, 0, 0.42), 0 0 0 1px var(--_rule);
}

.eightam-map__panel[hidden] {
	display: none;
}

.eightam-map__panel:focus {
	outline: none;
}

.eightam-map__panel:focus-visible {
	outline: 2px solid var(--_place);
	outline-offset: 2px;
}

.eightam-map__panel-body {
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1.15rem 1.25rem 1.3rem;
}

/* The picture runs to the panel's edges, under the close button. */
.eightam-map__panel .eightam-map__photo {
	margin: -1.15rem -1.25rem 1rem;
}

.eightam-map__panel .eightam-map__photo-image {
	border-radius: 0;
}

.eightam-map__panel .eightam-map__photo-credit {
	padding-inline: 1.25rem;
}

.eightam-map__panel:not(.has-photo) .eightam-map__name {
	padding-right: 5.25rem;
}

/* Close in the corner, share beside it. */
.eightam-map__close,
.eightam-map__share {
	position: absolute;
	z-index: 1;
	top: 0.55rem;
	right: 0.55rem;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	color: var(--_label);
	background: var(--_paper);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.22);
	cursor: pointer;
}

.eightam-map__share {
	right: 3.45rem;
}

.eightam-map__close svg,
.eightam-map__share svg {
	width: 1.1rem;
	height: 1.1rem;
}

.eightam-map__close:hover,
.eightam-map__share:hover {
	color: var(--_paper);
	background: var(--_label);
}

.eightam-map__close:focus-visible,
.eightam-map__share:focus-visible,
.eightam-map__pick:focus-visible,
.eightam-map.is-layout-explore .eightam-map__link:focus-visible {
	outline: 2px solid var(--_place);
	outline-offset: 2px;
}

.eightam-map__panel .eightam-map__name {
	font-size: 1.35rem;
}

/* A word over the map for a moment: a link copied, a position off the map.
   Empty, it draws nothing, and stays a live region. */
.eightam-map__note {
	position: absolute;
	z-index: 5;
	top: calc(var(--eightam-map-menus-top, var(--_inset)) + var(--eightam-map-menus-h, 0px) + 0.6rem);
	left: 50%;
	max-width: calc(100% - 2rem);
	margin: 0;
	padding: 0.5rem 0.95rem;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	color: var(--_paper);
	background: var(--_label);
	border-radius: 999px;
	box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.45);
	transform: translateX(-50%);
	pointer-events: none;
}

.eightam-map__note:empty {
	padding: 0;
	background: none;
	box-shadow: none;
}

/* On a phone, the bottom half of the map; the place stands in the top half. */
@media (max-width: 899.98px) {
	.eightam-map__panel {
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		height: 50%;
		max-height: none;
		border-radius: var(--eightam-map-panel-radius, 12px) var(--eightam-map-panel-radius, 12px) 0 0;
		box-shadow: 0 -10px 30px -14px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--_rule);
	}

	.eightam-map__panel-body {
		flex: 1;
	}

	/* A strip of the picture, so the name and the first lines show above
	   the fold of a half-screen sheet. */
	.eightam-map__panel .eightam-map__photo-image {
		aspect-ratio: auto;
		height: clamp(6.5rem, 17svh, 9.5rem);
	}
}

/* Links as buttons: what each opens told apart by its colour and its sign.
   A theme colours a kind of link with --eightam-map-link and
   --eightam-map-link-ink on .eightam-map__link.is-type-<post type>. */
.eightam-map.is-layout-explore .eightam-map__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1rem;
	font-size: 0.875rem;
}

.eightam-map.is-layout-explore .eightam-map__links li + li {
	margin-top: 0;
}

.eightam-map.is-layout-explore .eightam-map__link {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	min-height: 2.5rem;
	padding: 0.45rem 1rem 0.45rem 0.85rem;
	line-height: 1.2;
	color: var(--eightam-map-link-ink, var(--_paper));
	background: var(--eightam-map-link, var(--_place));
	border-radius: 999px;
	text-decoration: none;
	transition: filter 0.15s ease;
}

.eightam-map.is-layout-explore .eightam-map__link:hover {
	filter: brightness(0.92);
}

.eightam-map.is-layout-explore .eightam-map__link::after {
	content: none;
}

.eightam-map.is-layout-explore .eightam-map__link > svg {
	display: block;
	flex: none;
	width: 1.15em;
	height: 1.15em;
}

/* An address typed by hand is drawn in outline: it leaves the site. */
.eightam-map.is-layout-explore .eightam-map__link.is-type-link {
	color: var(--eightam-map-link-ink, var(--_label));
	background: var(--eightam-map-link, transparent);
	box-shadow: inset 0 0 0 1.5px currentColor;
}

/* The index: once the map is drawn, the list is the places' names, and each
   opens its place on the map. */
.eightam-map.is-layout-explore.is-live .eightam-map__places {
	columns: 3 14rem;
	column-gap: var(--_gap);
}

.eightam-map.is-layout-explore.is-live .eightam-map__part {
	column-span: all;
	padding: 1.25rem 0.5rem 0.5rem;
}

.eightam-map.is-layout-explore.is-live .eightam-map__part:first-child {
	padding-top: 0;
}

.eightam-map.is-layout-explore.is-live .eightam-map__place {
	break-inside: avoid;
	grid-template-columns: 1.75rem minmax(0, 1fr);
	align-items: center;
	gap: 0 0.65rem;
	padding: 0.3rem 0.5rem;
	border: 0;
	border-radius: 6px;
}

.eightam-map.is-layout-explore.is-live .eightam-map__place-body > :not(.eightam-map__name) {
	display: none;
}

.eightam-map.is-layout-explore.is-live .eightam-map__places .eightam-map__name {
	font-size: 1rem;
	line-height: 1.3;
}

.eightam-map.is-layout-explore.is-live .eightam-map__place.has-icon .eightam-map__mark {
	width: 1.75rem;
	height: 1.75rem;
}

.eightam-map.is-layout-explore.is-live .eightam-map__icon {
	width: 0.95rem;
	height: 0.95rem;
}

.eightam-map__pick {
	display: inline;
	padding: 0;
	font: inherit;
	letter-spacing: inherit;
	text-align: start;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

.eightam-map__pick:hover {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

/*
 * Fill the screen: once the map is to be drawn (`is-filling`, and
 * `eightam-map-screen` on <html>) the block is the window below whatever the
 * theme keeps above it — --eightam-map-screen-top, 0 by default — and the page
 * does not scroll. A theme that lays the window out itself can place the block
 * in a box of its own instead. The index under the map gives way to menus over
 * its corner, and the caption to the foot of the map; both come back, with
 * the page, if the map cannot be drawn.
 */
html.eightam-map-screen {
	overflow: hidden;
	overscroll-behavior: none;
}

/* With <html> no longer visible, a body's own overflow stops passing to the
   window and makes the body a scroll box of its own (a theme's `overflow-x:
   hidden` is enough), and a sticky header then keeps its offset from the
   body instead of the window: logged in, the admin bar's 32px twice over. */
html.eightam-map-screen body {
	overflow: visible;
}

/* The window, not the theme's column: a wide block is capped at the wide
   size by the theme's layout (`.is-layout-constrained > .alignwide`). */
.eightam-map.is-screen.is-filling {
	position: fixed;
	inset: var(--eightam-map-screen-top, 0px) 0 0;
	z-index: var(--eightam-map-screen-z, 1);
	display: block;
	width: auto;
	max-width: none;
	margin: 0;
}

.eightam-map.is-screen.is-filling .eightam-map__stage {
	height: 100%;
	min-height: 0;
	border-radius: 0;
}

.eightam-map.is-screen.is-filling :is(.eightam-map__places, .eightam-map__caption) {
	display: none;
}

/* The menus: one per part of the list, over the top left corner, clear of
   the zoom buttons. */
.eightam-map__menus {
	position: absolute;
	z-index: 4;
	top: var(--eightam-map-menus-top, var(--_inset));
	right: calc(var(--_inset) + 2.75rem);
	left: var(--_inset);
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	pointer-events: none;
}

.eightam-map__menu {
	position: relative;
	pointer-events: auto;
}

.eightam-map__menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	min-height: 2.5rem;
	padding: 0.45rem 0.75rem 0.45rem 1rem;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--_label);
	background: var(--_paper);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--_rule);
	cursor: pointer;
}

.eightam-map__menu-toggle:hover,
.eightam-map__menu-toggle[aria-expanded="true"] {
	color: var(--_paper);
	background: var(--_label);
}

.eightam-map__menu-count {
	min-width: 1.6em;
	padding: 0.15em 0.4em;
	font-size: 0.75em;
	font-variant-numeric: lining-nums tabular-nums;
	line-height: 1;
	text-align: center;
	background: color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 999px;
}

.eightam-map__menu-caret {
	flex: none;
	width: 0.85em;
	height: 0.85em;
	transition: transform 0.2s ease;
}

.eightam-map__menu-toggle[aria-expanded="true"] .eightam-map__menu-caret {
	transform: rotate(180deg);
}

.eightam-map__menu-list {
	position: absolute;
	top: calc(100% + 0.4rem);
	left: 0;
	width: max-content;
	min-width: 100%;
	max-width: min(22rem, calc(100vw - 2 * var(--_inset)));
	max-height: min(30rem, 62vh);
	max-height: min(30rem, 62svh);
	margin: 0;
	padding: 0.35rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
	color: var(--_label);
	background: var(--_paper);
	border-radius: var(--eightam-map-panel-radius, 12px);
	box-shadow: 0 14px 38px -12px rgba(0, 0, 0, 0.42), 0 0 0 1px var(--_rule);
}

.eightam-map__menu-item {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	min-height: 2.5rem;
	padding: 0.25rem 0.75rem 0.25rem 0.35rem;
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1.25;
	text-align: start;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}

.eightam-map__menu-item:hover {
	background: color-mix(in srgb, var(--_place) 9%, transparent);
}

.eightam-map__menu-item[aria-current] {
	font-weight: 600;
	background: color-mix(in srgb, var(--_place) 13%, transparent);
}

.eightam-map__menu-entry .eightam-map__mark {
	flex: none;
	margin: 0;
}

.eightam-map__menu-entry.has-icon .eightam-map__mark {
	width: 1.75rem;
	height: 1.75rem;
}

.eightam-map__menu-entry .eightam-map__icon {
	width: 0.95rem;
	height: 0.95rem;
}

.eightam-map__menu-entry.has-icon .eightam-map__menu-item[aria-current] .eightam-map__mark {
	color: var(--_paper);
	background: var(--_place);
}

.eightam-map__menu-toggle:focus-visible,
.eightam-map__menu-item:focus-visible {
	outline: 2px solid var(--_label);
	outline-offset: 2px;
}

/* On a phone the menus take the whole row, smaller, the zoom buttons move
   below them, and the lists drop from the row, across it. */
@media (max-width: 599.98px) {
	.eightam-map__menus {
		right: var(--_inset);
		gap: 0.4rem;
	}

	.eightam-map__menu {
		position: static;
	}

	.eightam-map__menu-toggle {
		gap: 0.4em;
		min-height: 2.25rem;
		padding: 0.35rem 0.6rem 0.35rem 0.85rem;
		font-size: 0.8125rem;
	}

	.eightam-map.is-screen .maplibregl-ctrl-top-right {
		top: calc(var(--eightam-map-menus-top, var(--_inset)) + var(--eightam-map-menus-h, 0px));
	}

	.eightam-map__menu-list {
		right: 0;
		width: auto;
		max-width: none;
	}
}

/* On a wide screen the panel stands below the menus. */
@media (min-width: 900px) {
	.eightam-map.is-screen .eightam-map__panel {
		--_below: calc(var(--eightam-map-menus-top, var(--_inset)) + var(--eightam-map-menus-h, 0px) + 0.6rem);
		top: var(--_below);
		max-height: calc(100% - var(--_below) - var(--_inset));
	}
}

/* The foot: one row in the corner — the scale, then tabs that open their
   popovers above them, in the look of the menus over the other corner. */
.eightam-map.is-screen .maplibregl-ctrl-bottom-right {
	right: var(--_inset);
	bottom: var(--_inset);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.eightam-map.is-screen .maplibregl-ctrl-bottom-right > .maplibregl-ctrl {
	float: none;
	clear: none;
	margin: 0;
}

.eightam-map .maplibregl-ctrl.eightam-map__foot {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--_label);
}

.eightam-map__tab-wrap {
	position: relative;
}

.eightam-map__tab {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	min-height: 2.25rem;
	padding: 0.35rem 0.75rem 0.35rem 0.9rem;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--_label);
	background: var(--_paper);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--_rule);
	cursor: pointer;
}

.eightam-map__tab.is-about {
	padding-inline: 0.9rem;
}

/* Over MapLibre's own button hover. */
.eightam-map .maplibregl-ctrl .eightam-map__tab:hover,
.eightam-map .maplibregl-ctrl .eightam-map__tab[aria-expanded="true"] {
	color: var(--_paper);
	background: var(--_label);
}

/* The caret points up: the popover opens above. */
.eightam-map__tab .eightam-map__menu-caret {
	transform: rotate(180deg);
}

.eightam-map__tab[aria-expanded="true"] .eightam-map__menu-caret {
	transform: none;
}

.eightam-map__tab:focus-visible {
	outline: 2px solid var(--_label);
	outline-offset: 2px;
}

.eightam-map__pop {
	box-sizing: border-box;
	position: absolute;
	right: 0;
	bottom: calc(100% + 0.5rem);
	width: max-content;
	max-width: min(20rem, calc(100vw - 2 * var(--_inset)));
	max-height: min(32rem, 60vh);
	max-height: min(32rem, 60svh);
	padding: 1rem 1.1rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	font-size: 0.8125rem;
	line-height: 1.45;
	text-align: start;
	text-wrap: pretty;
	color: var(--_label);
	background: var(--_paper);
	border-radius: var(--eightam-map-panel-radius, 12px);
	box-shadow: 0 14px 38px -12px rgba(0, 0, 0, 0.42), 0 0 0 1px var(--_rule);
}

.eightam-map__pop.is-legend {
	width: min(20rem, calc(100vw - 2 * var(--_inset)));
}

.eightam-map__pop-note {
	margin: 0;
	color: var(--_muted);
}

.eightam-map__pop-section + .eightam-map__pop-section,
.eightam-map__pop-note + .eightam-map__pop-section {
	margin-top: 0.9rem;
	padding-top: 0.9rem;
	border-top: 1px solid var(--_rule);
}

.eightam-map__pop-title {
	margin: 0 0 0.6rem;
	font: inherit;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--_muted);
}

.eightam-map__pop .eightam-map__legend {
	display: grid;
	gap: 0.5rem;
	font-size: inherit;
}

.eightam-map__pop .eightam-map__legend li::before {
	width: 1.5rem;
	height: 1rem;
	flex: none;
}

.eightam-map__signs {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.eightam-map__signs li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.eightam-map__signs .eightam-map__mark {
	flex: none;
	margin: 0;
}

.eightam-map__signs li.has-icon .eightam-map__mark {
	width: 1.5rem;
	height: 1.5rem;
}

/* The legend's cells are smaller than a menu's. */
.eightam-map__signs li.is-kind-area .eightam-map__mark {
	width: 1.5rem;
	height: 1.5rem;
}

.eightam-map__signs .eightam-map__icon {
	width: 0.85rem;
	height: 0.85rem;
}

.eightam-map__foot a {
	color: inherit;
}

/* On a phone the tabs say less: the scale gives way, and the popovers take
   the width of the screen. */
@media (max-width: 599.98px) {
	.eightam-map.is-screen .maplibregl-ctrl-scale {
		display: none;
	}

	.eightam-map__tab-wrap {
		position: static;
	}

	.eightam-map__foot {
		position: relative;
	}

	.eightam-map__pop,
	.eightam-map__pop.is-legend {
		width: calc(100vw - 2 * var(--_inset));
	}
}

/*
 * The intro: above the list as the page's lead, and on a map that fills the
 * screen the message it opens with, in a dialog over the map.
 */
.eightam-map__intro > :first-child {
	margin-top: 0;
}

.eightam-map.is-screen.is-filling > .eightam-map__intro {
	display: none;
}

.eightam-map__dialog {
	box-sizing: border-box;
	width: min(34rem, calc(100vw - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: clamp(1.5rem, 4vw, 2.25rem);
	overflow-y: auto;
	color: var(--_label);
	background: var(--_paper);
	border: 0;
	border-radius: var(--eightam-map-panel-radius, 12px);
	box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--_rule);
}

.eightam-map__dialog::backdrop {
	background: color-mix(in srgb, var(--_label) 35%, transparent);
}

.eightam-map__dialog .eightam-map__intro-title {
	margin: 0 0 0.75rem;
}

.eightam-map__dialog p {
	margin: 0 0 0.9rem;
}

.eightam-map__dialog-go {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	margin-top: 0.5rem;
	padding: 0.6rem 1.25rem;
	font: inherit;
	font-weight: 600;
	color: var(--_paper);
	background: var(--_place);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.eightam-map__dialog-go:focus-visible {
	outline: 2px solid var(--_label);
	outline-offset: 3px;
}

/* MapLibre's controls, in the map's own colours ------------------------------ */

.eightam-map .maplibregl-ctrl-group {
	background: var(--_paper);
	border-radius: 4px;
	box-shadow: 0 0 0 1px var(--_rule);
}

.eightam-map .maplibregl-ctrl-scale {
	color: var(--_label);
	background: color-mix(in srgb, var(--_paper) 75%, transparent);
	border-color: var(--_label);
	font-size: 10px;
}

.eightam-map .maplibregl-ctrl-attrib {
	font-size: 10px;
	background: color-mix(in srgb, var(--_paper) 80%, transparent);
}


/* Print: the list, and the picture if there is one. A WebGL canvas does not
   survive the printer, and the list says everything it would. */
@media print {
	.eightam-map {
		display: block;
	}

	.eightam-map__canvas,
	.eightam-map__offer,
	.eightam-map__show,
	.eightam-map__panel,
	.eightam-map__menus,
	.eightam-map__dialog,
	.eightam-map__note {
		display: none !important;
	}

	/* A map that fills the screen prints as the list it is. */
	html.eightam-map-screen {
		overflow: visible;
	}

	.eightam-map.is-screen.is-filling {
		position: static;
	}

	.eightam-map.is-screen.is-filling :is(.eightam-map__places, .eightam-map__caption, .eightam-map__intro) {
		display: revert;
	}

	/* The index goes back to being the list. */
	.eightam-map.is-layout-explore.is-live .eightam-map__place-body > :not(.eightam-map__name) {
		display: revert;
	}

	.eightam-map:not(.has-picture) .eightam-map__stage {
		display: none;
	}

	.eightam-map.is-live .eightam-map__picture {
		display: block;
	}

	.eightam-map__stage {
		position: static;
		max-height: none;
		margin-bottom: 1rem;
	}

	.eightam-map__place {
		break-inside: avoid;
		background: none;
		box-shadow: none;
	}
}
