/* Route map (design: B-Mapa) on a real-world base map. Base map colours are baked into the two SVGs;
   --m-bg must match their background so the map blends into the frame. */

.route-map {
	--m-bg: #0c1d30;
	--m-pin: #f4efe8;
	--m-town: rgba(244, 239, 232, .62);
	--m-water-label: #8fc0ea;
	--m-glass: rgba(9, 22, 37, .74);
	--m-glass-line: rgba(244, 239, 232, .12);
	--m-halo: 0 1px 12px rgba(8, 21, 35, .9), 0 0 3px rgba(8, 21, 35, .9);
	position: relative;
	z-index: 2;
	padding-top: clamp(80px, 10vw, 140px);
	background: var(--bg);
}

:root[data-theme="light"] .route-map {
	--m-bg: #e4ebf0;
	--m-pin: #0b1a2b;
	--m-town: rgba(11, 26, 43, .62);
	--m-water-label: #2f6fa8;
	--m-glass: rgba(250, 251, 252, .86);
	--m-glass-line: rgba(11, 26, 43, .1);
	--m-halo: 0 1px 10px rgba(255, 255, 255, .95), 0 0 3px rgba(255, 255, 255, .95);
}

.route-map__head {
	max-width: 860px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 22px;
	text-align: center;
}

.route-map__title {
	font-size: clamp(2.5rem, 5.6vw, 5.25rem);
}

.route-map__filters {
	display: flex;
	gap: 2px;
	width: max-content;
	max-width: calc(100% - 32px);
	margin: clamp(32px, 4vw, 48px) auto 28px;
	padding: 4px;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 6px;
	scrollbar-width: none;
}

/* Frame and map ----------------------------------------------------------------- */
.route-map__frame {
	position: relative;
	background: var(--m-bg);
}

.route-map__viewport {
	position: relative;
	height: min(var(--screen), 980px);
	min-height: 600px;
	overflow: clip;
	container-type: size;
}

/* Edges fade into the section background above and below. */
.route-map__viewport::before,
.route-map__viewport::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	z-index: 3;
	height: 56px;
	pointer-events: none;
}

.route-map__viewport::before {
	top: 0;
	background: linear-gradient(180deg, var(--bg), rgba(0, 0, 0, 0));
}

.route-map__viewport::after {
	bottom: 0;
	background: linear-gradient(0deg, var(--bg), rgba(0, 0, 0, 0));
}

/*
 * The map covers the viewport but never zooms in further than 1.2× the height fit, so the outer pins (Stadion,
 * Czersk) are never cropped; on very wide screens its sides fade into the frame instead. Its centre moves right,
 * clear of the card; route-map.js fine-tunes that (--pan) and the labels from real measurements.
 */
.route-map__canvas {
	--base: calc(100cqh * var(--map-w) / var(--map-h));
	--cw: min(max(100cqw, var(--base)), var(--base) * 1.2);
	--shift: max(0px, min(6cqw, (var(--cw) - 100cqw) / 2));
	position: absolute;
	left: 50%;
	top: 50%;
	width: var(--cw);
	aspect-ratio: var(--map-w) / var(--map-h);
	transform: translate(calc(-50% + var(--shift) + var(--pan, 0px)), -50%);
}

.route-map__base {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
	mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
	user-select: none;
	-webkit-user-drag: none;
}

/* Town and river labels -------------------------------------------------------- */
.route-map__towns {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.route-map__town,
.route-map__water {
	position: absolute;
	left: var(--x);
	top: var(--y);
	transform: translate(-50%, -50%);
	white-space: nowrap;
	text-shadow: var(--m-halo);
}

.route-map__town {
	font-size: var(--fs-micro);
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--m-town);
}

.route-map__town--city {
	font-size: var(--fs-body-s);
	letter-spacing: .3em;
	font-weight: 700;
}

.route-map__water {
	transform: translate(-50%, -50%) rotate(var(--r, 0deg));
	font-family: var(--font-serif);
	font-size: var(--fs-title);
	font-style: italic;
	font-weight: 500;
	letter-spacing: .04em;
	color: var(--m-water-label);
}

/* Pins ----------------------------------------------------------------------- */
.route-map__pins {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	pointer-events: none;
}

.route-map__pin {
	position: absolute;
	left: var(--x);
	top: var(--y);
	transition: opacity .4s ease;
}

.route-map__town.is-hidden {
	visibility: hidden;
}

.route-map__pin[data-dim] {
	opacity: .28;
}

.route-map__pin button {
	position: absolute;
	left: -22px;
	top: -22px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--text);
	cursor: pointer;
	pointer-events: auto;
}

.route-map__dot {
	position: relative;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--m-pin);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-bg) 70%, transparent);
	transition: transform .4s var(--ease), background-color .3s ease;
}

.route-map__pin[data-kind="base"] .route-map__dot {
	width: 14px;
	height: 14px;
	background: var(--acc);
}

.route-map__pin button:hover .route-map__dot {
	transform: scale(1.4);
}

.route-map__ring {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 12px;
	height: 12px;
	margin: -6px 0 0 -6px;
	border: 1.5px solid var(--acc);
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
}

.route-map__pin button[aria-pressed="true"] .route-map__dot {
	background: var(--acc);
	transform: scale(1.35);
}

@media (prefers-reduced-motion: no-preference) {
	.route-map__pin button[aria-pressed="true"] .route-map__ring {
		animation: route-map-pulse 2.2s ease-out infinite;
	}
}

@keyframes route-map-pulse {
	0% { opacity: .9; transform: scale(1); }
	100% { opacity: 0; transform: scale(4.4); }
}

/* The label starts a clear 16px from the dot (more beside the larger airfield pin), so it never touches it,
   even when the chosen pin grows. */
.route-map__label {
	--label-gap: 38px;
	position: absolute;
	top: 50%;
	left: var(--label-gap);
	display: flex;
	flex-direction: column;
	gap: 2px;
	transform: translateY(-50%);
	text-align: left;
	white-space: nowrap;
	text-shadow: var(--m-halo);
}

.route-map__pin[data-kind="base"] .route-map__label {
	--label-gap: 44px;
}

.route-map__pin[data-side="left"] .route-map__label {
	left: auto;
	right: var(--label-gap);
	text-align: right;
}

.route-map__kicker {
	font-family: var(--font-serif);
	font-size: var(--fs-body-l);
	font-style: italic;
	font-weight: 500;
	line-height: 1;
	color: var(--muted);
}

.route-map__name {
	font-size: var(--fs-caption);
	font-weight: 700;
	letter-spacing: .12em;
	line-height: 1.2;
	text-transform: uppercase;
}

.route-map__pin button[aria-pressed="true"] .route-map__name {
	color: var(--acc-text);
}

/* Scale and credit ------------------------------------------------------------- */
.route-map__scale {
	position: absolute;
	right: var(--gutter);
	bottom: 64px;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: var(--fs-micro);
	color: var(--muted);
}

.route-map__scale-bar {
	display: block;
	width: calc(min(max(100cqw, 100cqh * var(--map-w) / var(--map-h)), 120cqh * var(--map-w) / var(--map-h)) * var(--scale) / 100);
	height: 6px;
	border: 1.5px solid currentColor;
	border-top: 0;
}

.route-map__credit {
	position: absolute;
	right: var(--gutter);
	bottom: 30px;
	z-index: 4;
	margin: 0;
	font-size: var(--fs-micro);
	color: var(--muted);
}

.route-map__credit a {
	color: inherit;
}

/* Place card ------------------------------------------------------------------- */
.route-map__card {
	position: absolute;
	left: clamp(16px, 3vw, 44px);
	top: 64px;
	z-index: 5;
	width: min(400px, calc(100% - 32px));
	max-height: calc(100% - 128px);
	overflow: auto;
	/* Scrolling past the card's end carries on with the page (it used to stop there). */
	overscroll-behavior: auto;
	border: 1px solid var(--m-glass-line);
	border-radius: 6px;
	background: var(--m-glass);
	-webkit-backdrop-filter: blur(20px) saturate(140%);
	backdrop-filter: blur(20px) saturate(140%);
	color: var(--text);
}

.route-map__photo {
	margin: 0;
	aspect-ratio: 16 / 10;
	overflow: clip;
	background: var(--surface);
}

.route-map__photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.route-map__body {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 24px 26px 26px;
}

.route-map__place-title {
	margin: 0;
	font-size: clamp(1.625rem, 2.4vw, 2.125rem);
	font-weight: 500;
	letter-spacing: -.02em;
	line-height: 1.05;
}

.route-map__facts {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 14px 0;
	border-block: 1px solid var(--line);
}

.route-map__facts dt {
	font-size: var(--fs-micro);
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted);
}

.route-map__facts dd {
	margin: 4px 0 0;
	font-weight: 600;
}

.route-map__facts .mono {
	font-size: var(--fs-caption);
	font-weight: 500;
}

.route-map__desc,
.route-map__note {
	margin: 0;
	font-size: var(--fs-body-s);
	color: var(--muted);
}

.route-map__note {
	font-size: var(--fs-small);
}

.route-map__in {
	color: var(--muted);
}

.route-map__products {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.route-map__products a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--line2);
	border-radius: var(--radius);
	color: var(--text);
	font-size: var(--fs-small);
	font-weight: 600;
	text-decoration: none;
	transition: border-color .3s ease;
}

.route-map__products a:hover {
	border-color: var(--text);
}

/* Index of places (also the way to reach places without a pin) ---------------------- */
.route-map__index {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--line);
	border-left: 1px solid var(--line);
}

.route-map__row {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	min-height: 64px;
	padding: 0 clamp(16px, 2vw, 28px);
	border: 0;
	border-right: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	background: transparent;
	color: var(--text);
	font: 600 var(--fs-body-s)/1.3 var(--font-sans);
	text-align: left;
	cursor: pointer;
	transition: background-color .3s ease, color .3s ease, opacity .4s ease;
}

.route-map__row:hover {
	background: var(--line);
}

.route-map__row[aria-pressed="true"] {
	color: var(--acc-text);
}

.route-map__row[data-dim] {
	opacity: .4;
}

.route-map__row-dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.route-map__row-meta {
	margin-left: auto;
	font-size: var(--fs-caption);
	font-weight: 500;
	color: var(--muted);
}

/* Small screens: card below the map ---------------------------------------------- */
@media (max-width: 860px) {
	.route-map__viewport {
		height: 72vh;
		height: 72svh;
		min-height: 480px;
	}

	.route-map__card {
		position: relative;
		left: auto;
		top: auto;
		width: auto;
		max-height: none;
		overflow: visible;
		margin: -24px 12px 0;
		background: var(--surface);
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.route-map__kicker {
		font-size: var(--fs-ui);
	}

	.route-map__name {
		font-size: var(--fs-micro);
	}

	.route-map__label {
		left: calc(var(--label-gap) - 4px);
	}

	.route-map__pin[data-side="left"] .route-map__label {
		right: calc(var(--label-gap) - 4px);
	}

	/* Phones: pin names only, and only the city label, so nothing competes for space. */
	.route-map__kicker,
	.route-map__town--town {
		display: none;
	}

	.route-map__scale,
	.route-map__credit {
		right: auto;
		left: var(--gutter);
	}

	.route-map__index {
		margin-top: 24px;
	}
}

/* Flight range circles ---------------------------------------------------------- */
.route-map__range-note {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: 8px;
	max-width: 640px;
	margin: -12px auto 28px;
	padding: 0 var(--gutter);
	font-size: var(--fs-small);
	line-height: 1.5;
	color: var(--muted);
}

.route-map__range-note svg {
	flex: none;
	margin-top: 2px;
}

.route-map__ranges {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
}

.route-map__range {
	fill: color-mix(in srgb, var(--c) 4%, transparent);
	stroke: var(--c);
	stroke-width: 1.5px;
	stroke-dasharray: 7 7;
	opacity: .5;
	transition: opacity .45s ease, fill .45s ease;
}

.route-map[data-range] .route-map__range {
	opacity: 0;
}

.route-map[data-range] .route-map__range.is-active {
	fill: color-mix(in srgb, var(--c) 8%, transparent);
	stroke-width: 2px;
	opacity: 1;
}

.route-map__range-labels {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.route-map__range-label {
	position: absolute;
	left: var(--x);
	top: var(--y);
	padding: 3px 8px;
	border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
	border-radius: 999px;
	background: var(--m-glass);
	color: var(--text);
	font-size: var(--fs-caption);
	font-weight: 600;
	white-space: nowrap;
	transform: translate(-50%, -50%) scale(.9);
	opacity: 0;
	transition: opacity .35s ease, transform .35s var(--ease);
}

.route-map__range-label.is-active {
	opacity: 1;
	transform: translate(-50%, -50%);
}

@media (prefers-reduced-motion: reduce) {
	.route-map__range,
	.route-map__range-label {
		transition: none;
	}
}

/* Glass fallback for the place card. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
	.route-map__card {
		background: var(--surface);
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}
}

@media (forced-colors: active) {
	.route-map__card {
		border: 1px solid CanvasText;
	}
}

/* Light mode: the accent is too pale on the light map; pins and rings use its darker variant. */
:root[data-theme="light"] .route-map__pin[data-kind="base"] .route-map__dot,
:root[data-theme="light"] .route-map__pin button[aria-pressed="true"] .route-map__dot {
	background: var(--acc-text);
}

:root[data-theme="light"] .route-map__ring {
	border-color: var(--acc-text);
}
