/**
 * Live Application Map (page-templates/live-map.php).
 *
 * Figma file Tw5TKCmoQyCrrGnkEDwfLS, pulled 2026-09-15:
 *   desktop/livemap/1 1637:23066 — toolbar 1637:23565 32px below the nav
 *     (header/2XL title + body/M subtitle, 480x44 search, 44px pill row, 24px
 *     apart); full-width maparea 619 tall 32px below; controls 32px squares,
 *     8px apart, 24px from the right and bottom.
 *   mobile/livemap/1 1426:35407 — 16px below the nav: header/L + body/XS,
 *     350 search, pills, 16px apart; maparea 519 tall; controls 20px in.
 *   card/mapprojects 1647:25597 (480x171; mobile 350x140 per REF/13).
 *   filters 1646:23911 (level 1) and 1646:24681 (level 2), 720 wide; mobile
 *     bottom sheet 1432:39152. Backdrop background blur 1646:23910.
 *   project modal 1697:28307 (720 wide), mobile 1697:29607 (350 wide).
 *
 * Not in the design, so provisional: selected pill and checkbox states, the
 * status message over the map, the search suggestions list, the mobile card's
 * inner positions, dialog heights on short screens.
 *
 * Mobile first. Desktop from 64rem.
 */

/* ==================================================================
 * Toolbar
 * ================================================================ */

.live-map__toolbar {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding-top: 1rem;
	padding-bottom: 1rem;
}

.live-map__header {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.live-map__title {
	font: var(--type-header-l);
	color: var(--color-text-dark);
}

.live-map__subtitle {
	font: var(--type-body-xs);
	color: var(--color-text-grey);
}

/* Search: searchbox 1224:27684 over a light pill. */
.live-map__search,
.map-filters__search {
	position: relative;
	display: flex;
	gap: 0.5rem;
	align-items: center;
	height: 2.75rem; /* 44 */
	padding-inline: 1rem;
	background-color: var(--color-background-grey);
	border: 1px solid var(--color-border-light);
	border-radius: 6.25rem;
}

.live-map__search:focus-within,
.map-filters__search:focus-within {
	border-color: var(--color-primary);
}

.live-map__search-icon {
	display: inline-flex;
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	color: var(--color-text-grey);
}

.live-map__search-icon svg {
	width: 100%;
	height: 100%;
}

.live-map__search-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	padding: 0;
	font: var(--type-subtitle-l);
	color: var(--color-text-dark);
	background: none;
	border: 0;
	outline: none;
	appearance: none;
}

.live-map__search-input::placeholder {
	color: var(--color-text-grey);
	opacity: 1;
}

.live-map__search-input::-webkit-search-cancel-button {
	appearance: none;
}

.live-map__search-clear {
	display: inline-grid;
	flex-shrink: 0;
	place-items: center;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	color: var(--color-text-grey);
	cursor: pointer;
	background: none;
	border: 0;
}

.live-map__search-clear svg {
	width: 1rem;
	height: 1rem;
}

.live-map__suggestions {
	position: absolute;
	inset: calc(100% + 0.5rem) 0 auto;
	z-index: 1100;
	max-height: 18rem;
	padding: 0.5rem 0;
	margin: 0;
	overflow-y: auto;
	list-style: none;
	background-color: var(--color-background-white);
	border: 1px solid var(--color-border-light);
	border-radius: var(--radius-16);
	box-shadow: 0 8px 24px rgba(9, 3, 19, 0.08);
}

.live-map__suggestion {
	padding: 0.625rem 1rem;
	font: var(--type-subtitle-m);
	color: var(--color-text-dark);
	cursor: pointer;
}

.live-map__suggestion[aria-selected="true"],
.live-map__suggestion:hover {
	background-color: var(--color-background-purple);
}

/* Pills: tag/medium, 44 tall, 8px apart; one scrolling row. */
.live-map__pills {
	display: flex;
	gap: 0.5rem;
	margin-inline: calc(-1 * var(--gutter-mobile));
	padding-inline: var(--gutter-mobile);
	overflow-x: auto;
	scrollbar-width: none;
}

.live-map__pills::-webkit-scrollbar {
	display: none;
}

.live-map__type-pills {
	display: contents;
}

.live-map__pill {
	display: inline-flex;
	flex-shrink: 0;
	gap: 0.25rem;
	align-items: center;
	justify-content: center;
	height: 2.75rem; /* 44 */
	padding: 0.4375rem 1rem 0.5rem; /* 7 16 8 */
	font: var(--type-subtitle-m);
	color: var(--color-primary);
	white-space: nowrap;
	cursor: pointer;
	background-color: rgba(255, 255, 255, 0.3);
	border: 1px solid #c0aaf3; /* raw hex in the design, not a variable */
	border-radius: 6.25rem;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.live-map__pill:hover {
	background-color: var(--color-background-purple);
}

/* Selected type pill: not designed; shown like the Filters pill. */
.live-map__pill[aria-pressed="true"],
.live-map__pill--filters {
	color: var(--color-text-white);
	background-color: var(--color-primary);
	border-color: var(--color-primary);
}

.live-map__pill[aria-pressed="true"]:hover,
.live-map__pill--filters:hover {
	background-color: var(--color-primary-hover);
}

.live-map__pill-icon {
	display: inline-flex;
	width: 1rem;
	height: 1rem;
}

.live-map__pill-icon svg {
	width: 100%;
	height: 100%;
}

/* ==================================================================
 * Map area
 * ================================================================ */

/* 16px below the pills on mobile: the toolbar's bottom padding. */
.live-map__area {
	position: relative;
	height: 32.4375rem; /* 519 */
	overflow: hidden;
}

.live-map__map {
	position: absolute;
	inset: 0;
	z-index: 0;
	font-family: var(--font-family);
	background-color: #e5e5e3; /* tile ground while loading */
}

.live-map__map:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: -2px;
}

/* OpenStreetMap's colourful tiles, turned pale grey to approach the design's
 * map (grey sea, near-white land). Tuned against assets/images/map-preview-wide.jpg.
 * Only the tile layer: pins, card and controls keep their colours. Remove this
 * if a provider with a grey style is set (inc/live-map.php). */
.live-map__map .leaflet-tile-pane {
	filter: grayscale(1) brightness(0.86) contrast(1.6);
}

.live-map__map .leaflet-control-attribution {
	font: 400 0.625rem/1.4 var(--font-family);
	background-color: rgba(255, 255, 255, 0.8);
}

.live-map__controls {
	position: absolute;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 500;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.live-map__control {
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	color: var(--color-text-dark);
	cursor: pointer;
	background-color: var(--color-background-white);
	border: 1px solid var(--color-border-light);
	border-radius: 0.5rem;
}

.live-map__control:hover {
	border-color: var(--color-border-dark);
}

.live-map__control svg {
	width: 1rem;
	height: 1rem;
}

.live-map__status {
	position: absolute;
	top: 1.25rem;
	left: 50%;
	z-index: 500;
	max-width: calc(100% - 2.5rem);
	padding: 0.5rem 1rem;
	font: var(--type-subtitle-m);
	color: var(--color-text-dark);
	text-align: center;
	background-color: var(--color-background-white);
	border: 1px solid var(--color-border-light);
	border-radius: 6.25rem;
	transform: translateX(-50%);
}

/* ------------------------------------------------------------------
 * Pins: pin/location 1429:37709 (single 32x35, selected 36x40, grouped 44x38).
 * Single and selected carry a white circle in the middle of the head (12px and
 * 16px across); grouped carries the count instead.
 * ---------------------------------------------------------------- */

.live-map .homz-pin,
.live-map .homz-cluster {
	background: none;
	border: 0;
}

.homz-pin img,
.homz-cluster img {
	display: block;
	width: 100%;
	height: 100%;
	/* Figma dx 2, dy 4, stdDeviation 4; CSS takes twice the deviation. */
	filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.15));
}

.homz-cluster {
	position: relative;
}

.homz-cluster__count {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	height: 2rem; /* the round body, above the tail */
	font: var(--type-subtitle-m);
	line-height: 2rem;
	color: var(--color-text-white);
	text-align: center;
}

/* ------------------------------------------------------------------
 * Card: card/mapprojects
 * ---------------------------------------------------------------- */

.map-card {
	position: absolute;
	bottom: 1.25rem;
	left: 50%;
	z-index: 600;
	display: flex;
	gap: 1rem;
	align-items: center;
	width: min(21.875rem, calc(100% - 2.5rem)); /* 350 */
	min-height: 8.75rem; /* 140 */
	padding: 0.75rem 3rem 0.75rem 1rem;
	background-color: var(--color-background-white);
	border: 1px solid var(--color-border-light);
	border-radius: var(--radius-16);
	transform: translateX(-50%);
}

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

.map-card__side {
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	gap: 0.75rem;
	align-items: center;
}

.map-card__icon {
	width: 4.25rem; /* 68 */
	height: 4.25rem;
}

.map-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-items: flex-start;
	min-width: 0;
}

.map-card__title {
	font: var(--type-subtitle-m);
	color: var(--color-text-dark);
}

.map-card__meta {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.map-card__application,
.map-card__row {
	font: var(--type-subtitle-s);
	color: var(--color-text-grey);
}

.map-card__application:empty {
	display: none;
}

.map-card__row {
	display: flex;
	gap: 0.25rem;
	align-items: center;
}

.map-card__row-icon {
	display: inline-flex;
	flex-shrink: 0;
	width: 0.875rem; /* 14 */
	height: 0.875rem;
	color: var(--color-primary);
}

.map-card__row-icon svg {
	width: 100%;
	height: 100%;
}

.map-card__details {
	display: inline-flex;
	gap: 0.125rem;
	align-items: center;
	padding: 0;
	font: var(--type-header-3xs);
	color: var(--color-primary);
	cursor: pointer;
	background: none;
	border: 0;
}

.map-card__details-icon {
	display: inline-flex;
	width: 0.75rem;
	height: 0.75rem;
}

.map-card__details-icon svg {
	width: 100%;
	height: 100%;
}

.map-card__close {
	position: absolute;
	top: 0.9375rem; /* 15 */
	right: 1rem;
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	color: var(--color-text-dark);
	cursor: pointer;
	background-color: var(--color-background-white);
	border: 1px solid var(--color-border-light);
	border-radius: 0.5rem;
}

.map-card__close svg {
	width: 1rem;
	height: 1rem;
}

/* ==================================================================
 * Dialogs: filters (bottom sheet on mobile) and project details
 * ================================================================ */

.map-sheet {
	max-width: 100%;
	max-height: 100%;
	padding: 0;
	overflow: hidden;
	color: var(--color-text-dark);
	border: 0;
}

.map-sheet[open] {
	display: flex;
	flex-direction: column;
}

.map-sheet::backdrop {
	background-color: rgba(9, 3, 19, 0.5);
	backdrop-filter: blur(1px);
}

.map-sheet__close {
	position: absolute;
	top: 1.25rem;
	right: 1.25rem;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 1.5rem; /* 24 */
	height: 1.5rem;
	padding: 0;
	color: var(--color-text-dark);
	cursor: pointer;
	background: none;
	border: 0;
}

.map-sheet__close svg {
	width: 100%;
	height: 100%;
}

.map-sheet__actions {
	display: flex;
	flex-shrink: 0;
	gap: 0.625rem; /* 10 */
	padding: 1rem 1.25rem;
	background-color: var(--color-background-grey);
	border-top: 1px solid var(--color-border-light);
}

.map-sheet__actions .button {
	flex: 1 1 0;
	min-width: 0;
}

/* ---- Filters ---- */

.map-filters {
	position: fixed;
	inset: auto 0 0;
	width: 100%;
	height: calc(100% - 3.5rem); /* 788 of 844: below the mobile head */
	margin: 0;
	background-color: var(--color-background-white);
	border-radius: var(--radius-20) var(--radius-20) 0 0;
}

.map-sheet__grabber {
	position: absolute;
	top: 0.375rem;
	left: 50%;
	width: 2.25rem; /* 36 */
	height: 0.3125rem; /* 5 */
	background-color: var(--color-border-light);
	border-radius: 6.25rem;
	transform: translateX(-50%);
}

.map-filters__content {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 1rem;
	min-height: 0;
	padding: 3.25rem 1.25rem 0; /* text at 52 */
}

.map-filters__text {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-right: 2rem;
}

.map-filters__title {
	font: var(--type-header-s);
}

.map-filters__description {
	font: var(--type-subtitle-m);
	color: var(--color-text-grey);
}

.map-filters__level {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.5rem;
	min-height: 0;
}

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

.map-filters__rows,
.map-filters__list {
	padding: 0;
	margin: 0;
	list-style: none;
}

.map-filters__rows {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.map-filters__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	height: 3.25rem; /* 52 */
	padding: 0;
	font: var(--type-subtitle-l);
	color: var(--color-text-dark);
	text-align: left;
	cursor: pointer;
	background: none;
	border: 0;
	border-bottom: 1px solid var(--color-border-light);
}

.map-filters__count {
	font-weight: var(--font-weight-extrabold);
	color: var(--color-primary);
}

.map-filters__row-icon {
	display: inline-flex;
	width: 1.5rem;
	height: 1.5rem;
}

.map-filters__row-icon svg {
	width: 100%;
	height: 100%;
}

.map-filters__list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	scrollbar-color: var(--color-text-grey) var(--color-border-light);
	scrollbar-width: thin;
}

.map-filters__option {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	justify-content: space-between;
	min-height: 3.25rem;
	padding: 0.625rem 0; /* 10 */
	cursor: pointer;
	border-bottom: 1px solid var(--color-border-light);
}

.map-filters__option-icon {
	flex-shrink: 0;
	width: 2rem; /* 32 */
	height: 2rem;
}

.map-filters__option-label {
	flex: 1 1 auto;
	font: var(--type-subtitle-m);
	color: var(--color-text-dark);
	text-align: center;
}

.map-filters__checkbox {
	position: relative;
	flex-shrink: 0;
	width: 1.5rem;
	height: 1.5rem;
	margin: 0;
	cursor: pointer;
	border: 1.5px solid var(--color-border-light);
	border-radius: 0.375rem;
	appearance: none;
}

/* Checked: not designed. Primary fill with a white check. */
.map-filters__checkbox:checked {
	background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.875 6.75349L4.12151 9L10.1215 3' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 0.875rem no-repeat;
	border-color: var(--color-primary);
}

.map-filters__checkbox:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

/* ---- Project details ---- */

.project-modal {
	width: min(21.875rem, calc(100% - 2.5rem)); /* 350 */
	max-height: calc(100% - 2.5rem);
	margin: auto;
	background-color: var(--color-background-white);
	border-radius: var(--radius-20);
}

.project-modal__hero {
	position: relative;
	display: grid;
	flex-shrink: 0;
	place-items: center;
	height: 13.625rem; /* 218 */
	background-color: var(--color-background-purple);
}

.project-modal__icon {
	width: 8.875rem; /* 142 */
	height: 8.875rem;
	margin-top: -2.25rem; /* centre 18 above the middle */
}

.project-modal__tag {
	position: absolute;
	top: 10.625rem; /* 170 */
	left: 1.25rem;
}

.project-modal__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 1rem;
	min-height: 0;
	padding: 1rem 1.25rem 1.5rem;
	overflow-y: auto;
}

.project-modal__heading {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.project-modal__title {
	font: var(--type-header-m);
}

.project-modal__application {
	font: var(--type-body-m);
}

.project-modal__id {
	font: var(--type-body-xs);
}

.project-modal__description {
	font: var(--type-body-xs);
	color: var(--color-text-grey);
}

.project-modal__application:empty,
.project-modal__description:empty {
	display: none;
}

.project-modal__meta {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.project-modal__row {
	display: flex;
	gap: 0.375rem; /* 6 */
	align-items: center;
	font: var(--type-subtitle-l);
	color: var(--color-text-grey);
}

.project-modal__row-icon {
	display: inline-flex;
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	color: var(--color-primary);
}

.project-modal__row-icon svg {
	width: 100%;
	height: 100%;
}

.project-modal__actions {
	flex-direction: column;
	gap: 1rem;
	padding: 1rem 1.25rem;
}

/* ==================================================================
 * Desktop
 * ================================================================ */

@media (min-width: 64rem) {
	.live-map__toolbar {
		gap: 1.5rem; /* 24 */
		padding-top: 2rem;
		padding-bottom: 0;
	}

	.live-map__title {
		font: var(--type-header-2xl);
	}

	.live-map__subtitle {
		font: var(--type-body-m);
	}

	.live-map__search {
		width: 30rem; /* 480 */
	}

	.live-map__pills {
		margin-inline: 0;
		padding-inline: 0;
	}

	.live-map__area {
		height: 38.6875rem; /* 619 */
		margin-top: 2rem;
	}

	.live-map__controls {
		right: 1.5rem;
		bottom: 1.5rem;
	}

	/* card/mapprojects 1647:25597: 480x171, 24px above the bottom. Side column
	 * at 31, text at 159 (264 wide), close at 431/15. */
	.map-card {
		bottom: 1.5rem;
		gap: 0;
		width: 30rem; /* 480 */
		min-height: 10.6875rem; /* 171 */
		padding: 1rem 3.5rem 1rem 1.9375rem;
	}

	.map-card__side {
		gap: 1.25rem; /* 20 */
		width: 6.1875rem; /* 99: to the text column at 159 */
		margin-right: 1.8125rem;
	}

	.map-card .project-tag {
		font: var(--type-subtitle-m);
	}

	.map-card__icon {
		width: 5.25rem; /* 84 */
		height: 5.25rem;
	}

	.map-card__body {
		gap: 1rem;
		width: 16.5rem; /* 264 */
	}

	.map-card__title {
		font: var(--type-subtitle-l);
	}

	.map-card__application,
	.map-card__row {
		font: var(--type-subtitle-m);
	}

	/* Dialogs: 720 wide centred sheets, grey, radius 20, 480 content column. */
	.map-sheet {
		width: 45rem; /* 720 */
		max-height: calc(100% - 4rem);
		margin: auto;
		background-color: var(--color-background-grey);
		border-radius: var(--radius-20);
		box-shadow: 0 0 100px rgba(0, 0, 0, 0.05);
	}

	.map-sheet__close {
		top: 1.5rem;
		right: 1.5rem;
		width: 2rem;
		height: 2rem;
	}

	.map-sheet__grabber {
		display: none;
	}

	.map-sheet__actions {
		padding: 1rem 7.5rem; /* 16 120 */
	}

	.map-filters {
		position: fixed;
		inset: 0;
		height: 44.9375rem; /* 719 */
	}

	.map-filters__content {
		width: 30rem;
		padding: 1.5rem 0 0;
		margin-inline: auto;
		gap: 1.5rem;
	}

	.map-filters__level {
		gap: 0.5rem;
	}

	.map-filters__list {
		margin-right: -7.5rem;
		padding-right: 7.5rem;
	}

	.project-modal {
		width: 45rem;
	}

	.project-modal__hero {
		height: 19.6875rem; /* 315 */
		place-items: start center;
	}

	.project-modal__icon {
		width: 13.125rem; /* 210 */
		height: 13.125rem;
		margin-top: 2rem;
	}

	.project-modal__tag {
		top: 15.625rem; /* 250 */
		left: 7.5rem; /* 120 */
		font: var(--type-subtitle-l);
	}

	.project-modal__hero .map-sheet__close {
		top: 2rem;
		right: 2rem;
	}

	.project-modal__body {
		width: 30rem;
		padding: 1.5rem 0;
		margin-inline: auto;
	}

	.project-modal__actions {
		flex-direction: row;
		gap: 0.625rem;
		padding: 1rem 7.5rem;
	}
}
