/**
 * M16 Mapa Okolicy — style frontu.
 * Mapa monochromatyczna; wszystkie akcenty (trasa, aktywne elementy, marker
 * inwestycji) rysowane NA WIERZCHU w kolorze --m16map-akcent.
 */

/* ====== Rdzeń / zmienne ====== */

/* Wrapper widgetu Elementora jest dzieckiem flexa — bez jawnej szerokości
   zapada się do 0 (flex-basis: content, a mapa nie ma treści w flow). */
.elementor-widget-m16-mapa-okolicy {
	width: 100%;
}

.m16map {
	--m16map-akcent: #1a7a46;
	--m16map-h: 560px;
	--m16map-panel-w: 320px;
	position: relative;
	width: 100%; /* w kontenerach flex blok bez szerokości zapada się do 0 */
	color: #111;
	font-size: 15px;
	line-height: 1.45;
	border-radius: 18px;
	overflow: hidden;
	background: #ececec;
	box-shadow: 0 14px 44px rgba(17, 17, 17, 0.10);
}

.m16map *,
.m16map *::before,
.m16map *::after {
	box-sizing: border-box;
}

.m16map button {
	font: inherit;
}

.m16map .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.m16map__stage {
	position: relative;
	height: var(--m16map-h);
}

.m16map__canvas {
	position: absolute;
	inset: 0;
}

.m16map__canvas.mapboxgl-map {
	font: inherit;
}

/* Komunikat dla redaktorów przy złej konfiguracji */
.m16map--blad {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	padding: 18px;
	background: #fff6f6;
	border: 1px dashed #d9a0a0;
	border-radius: 14px;
	color: #8a4444;
	font-size: 14px;
	box-shadow: none;
}

/* ====== Placeholder (przed init / brak tokenu) ====== */

.m16map__ph {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 24px;
	text-align: center;
	background: radial-gradient(1100px 480px at 18% 0%, #fafafa, #e9e9e9);
	transition: opacity 0.4s ease;
}

.m16map__ph.is-ukryty {
	opacity: 0;
	pointer-events: none;
}

.m16map__ph-znak svg {
	width: 44px;
	height: 58px;
	opacity: 0.22;
}

.m16map__ph-nazwa {
	font-weight: 600;
	font-size: 15px;
	color: #3c3c3c;
}

.m16map__ph-hint {
	max-width: 440px;
	font-size: 12.5px;
	color: #767676;
}

.m16map__ph-hint a {
	color: inherit;
	text-decoration: underline;
}

/* ====== Marker inwestycji (puls) ====== */

.m16map-inw {
	position: relative;
	width: 48px;
	height: 48px;
	cursor: default;
}

.m16map-inw__punkt {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--m16map-akcent);
	border: 3px solid #fff;
	box-shadow: 0 8px 22px rgba(17, 17, 17, 0.30);
	color: #fff;
}

.m16map-inw__punkt svg {
	width: 22px;
	height: 22px;
}

.m16map-inw__punkt img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.m16map-inw__punkt::before,
.m16map-inw__punkt::after {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	border: 2px solid var(--m16map-akcent);
	animation: m16map-puls 2.4s ease-out infinite;
	pointer-events: none;
}

.m16map-inw__punkt::after {
	animation-delay: 1.2s;
}

.m16map-inw__punkt.bez-pulsu::before,
.m16map-inw__punkt.bez-pulsu::after {
	display: none;
}

@keyframes m16map-puls {
	0%   { transform: scale(0.65); opacity: 0.9; }
	70%  { transform: scale(2.05); opacity: 0; }
	100% { transform: scale(2.05); opacity: 0; }
}

.m16map-inw__etykieta {
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	white-space: nowrap;
	background: #fff;
	color: #111;
	font-size: 12.5px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(17, 17, 17, 0.18);
}

/* ====== Markery POI ====== */

.m16map-poi {
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	line-height: 0;
}

.m16map-poi__w {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.18s ease, filter 0.18s ease;
	will-change: transform;
}

.m16map-poi .m16map-svg-pin {
	width: 30px;
	height: 40px;
	filter: drop-shadow(0 4px 8px rgba(17, 17, 17, 0.35));
}

.m16map-poi .m16map-svg-pin path {
	fill: #161616;
	transition: fill 0.15s ease;
}

.m16map-poi--obraz .m16map-poi__w {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid #161616;
	box-shadow: 0 6px 16px rgba(17, 17, 17, 0.28);
	overflow: hidden;
}

.m16map-poi--obraz img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

@media (hover: hover) {
	.m16map-poi:hover .m16map-poi__w {
		transform: translateY(-4px) scale(1.06);
	}
}

.m16map-poi:focus-visible {
	outline: none;
}

.m16map-poi:focus-visible .m16map-poi__w {
	outline: 3px solid var(--m16map-akcent);
	outline-offset: 3px;
	border-radius: 50%;
	transform: translateY(-4px) scale(1.06);
}

.m16map-poi.is-active .m16map-svg-pin path {
	fill: var(--m16map-akcent);
}

.m16map-poi.is-active .m16map-poi__w {
	transform: translateY(-3px) scale(1.08);
}

.m16map-poi--obraz.is-active .m16map-poi__w {
	border-color: var(--m16map-akcent);
	box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.12), 0 6px 16px rgba(17, 17, 17, 0.28);
}

/* ====== Karta lokacji (popup) ====== */

.m16map .mapboxgl-popup.m16map-pop .mapboxgl-popup-content {
	font: inherit;
	color: #111;
	border-radius: 14px;
	padding: 15px 16px 14px;
	min-width: 230px;
	box-shadow: 0 16px 44px rgba(17, 17, 17, 0.22);
}

.m16map .m16map-pop .mapboxgl-popup-close-button {
	font-size: 20px;
	line-height: 1;
	color: #999;
	right: 6px;
	top: 6px;
	padding: 4px 8px;
	border-radius: 8px;
}

.m16map .m16map-pop .mapboxgl-popup-close-button:hover {
	color: #111;
	background: #f1f1f1;
}

.m16map-karta__tytul {
	margin: 0 14px 4px 0;
	font-size: 15.5px;
	font-weight: 700;
	line-height: 1.3;
}

.m16map-karta__kat {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 4px;
}

.m16map-karta__kat-chip {
	font-size: 10.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #555;
	background: #f1f1f1;
	border-radius: 999px;
	padding: 2px 8px;
}

.m16map-karta__fakty {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 8px 0 0;
	font-size: 13px;
}

.m16map-karta__fakt {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #1c1c1c;
}

.m16map-karta__fakt svg {
	width: 13px;
	height: 13px;
	color: #6d6d6d;
	flex: none;
}

.m16map-karta__fakt .m16map-svg-pin {
	width: 11px;
	height: 15px;
}

.m16map-karta__fakt .m16map-svg-pin path {
	fill: #6d6d6d;
}

.m16map-karta__fakt.is-szacunek {
	color: #7a7a7a;
}

.m16map-karta__opis {
	margin: 8px 0 0;
	font-size: 12.5px;
	color: #555;
}

.m16map-karta__stopka {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 12px;
}

/* ====== Przyciski / segmenty trybu ====== */

.m16map-btn {
	border: 0;
	border-radius: 10px;
	background: var(--m16map-akcent);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 14px;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.15s ease;
}

.m16map-btn:hover {
	filter: brightness(0.9);
}

.m16map-btn:focus-visible {
	outline: 3px solid #111;
	outline-offset: 2px;
}

.m16map-tryby {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border-radius: 999px;
	background: #f0f0f0;
}

.m16map-tryby__btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #4a4a4a;
	font-size: 12px;
	padding: 5px 10px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.m16map-tryby__btn svg {
	width: 13px;
	height: 13px;
}

.m16map-tryby__btn[aria-pressed="true"] {
	background: #141414;
	color: #fff;
}

.m16map-tryby__btn:focus-visible {
	outline: 2px solid var(--m16map-akcent);
	outline-offset: 1px;
}

/* ====== Pastylka aktywnej trasy ====== */

.m16map__pill {
	position: absolute;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	z-index: 22;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: calc(100% - 28px);
	padding: 7px 8px 7px 16px;
	border-radius: 999px;
	background: rgba(17, 17, 17, 0.92);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: #fff;
	box-shadow: 0 12px 34px rgba(17, 17, 17, 0.35);
}

.m16map__pill[hidden] {
	display: none;
}

.m16map__pill-nazwa {
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 190px;
}

.m16map__pill-info {
	font-size: 12.5px;
	color: #cfcfcf;
	white-space: nowrap;
}

.m16map__pill-info.is-blad {
	color: #ffb9b9;
}

.m16map__pill .m16map-tryby {
	background: rgba(255, 255, 255, 0.16);
}

.m16map__pill .m16map-tryby__btn {
	color: #d9d9d9;
}

.m16map__pill .m16map-tryby__btn[aria-pressed="true"] {
	background: var(--m16map-akcent);
	color: #fff;
}

.m16map__pill-x {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #b5b5b5;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.m16map__pill-x svg {
	width: 14px;
	height: 14px;
}

.m16map__pill-x:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.14);
}

.m16map__pill-x:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

/* ====== Panel z listą lokacji ====== */

.m16map__panel {
	position: absolute;
	top: 14px;
	left: 14px;
	bottom: 14px;
	z-index: 20;
	display: flex;
	flex-direction: column;
	width: min(var(--m16map-panel-w), calc(100% - 28px));
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.93);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	box-shadow: 0 12px 40px rgba(17, 17, 17, 0.16);
	overflow: hidden;
}

.m16map__panel-glowa {
	padding: 15px 16px 9px;
}

.m16map__panel-nadpis {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: #7c7c7c;
}

.m16map__panel-tytul {
	display: block;
	font-size: 16.5px;
	line-height: 1.25;
	color: #111;
}

.m16map__chipy {
	display: flex;
	gap: 6px;
	padding: 2px 14px 10px;
	overflow-x: auto;
	scrollbar-width: thin;
}

.m16map__chip {
	flex: none;
	border: 1px solid #ddd;
	border-radius: 999px;
	background: #fff;
	color: #333;
	font-size: 12px;
	padding: 5px 11px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.m16map__chip-n {
	opacity: 0.5;
	font-size: 11px;
}

.m16map__chip.is-active {
	background: #141414;
	border-color: #141414;
	color: #fff;
}

.m16map__chip:focus-visible {
	outline: 2px solid var(--m16map-akcent);
	outline-offset: 1px;
}

.m16map__lista {
	flex: 1 1 auto;
	overflow-y: auto;
	margin: 0;
	padding: 2px 8px 8px;
	list-style: none;
	scrollbar-width: thin;
}

.m16map__el {
	margin: 0;
	padding: 0;
}

.m16map__el[hidden] {
	display: none;
}

.m16map__poz {
	width: 100%;
	display: grid;
	grid-template-columns: 36px 1fr 12px;
	gap: 10px;
	align-items: center;
	border: 0;
	background: transparent;
	border-radius: 12px;
	padding: 8px;
	text-align: left;
	cursor: pointer;
	color: #111;
	transition: background 0.15s ease;
}

.m16map__poz:hover {
	background: #f0f0f0;
}

.m16map__poz:focus-visible {
	outline: 2px solid var(--m16map-akcent);
	outline-offset: -2px;
}

.m16map__poz.is-active {
	background: #141414;
	color: #fff;
}

.m16map__poz-ikona {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #f2f2f2;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex: none;
}

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

.m16map__poz-ikona .m16map-svg-pin {
	width: 14px;
	height: 19px;
}

.m16map__poz-ikona .m16map-svg-pin path {
	fill: #3a3a3a;
}

.m16map__poz.is-active .m16map__poz-ikona {
	background: rgba(255, 255, 255, 0.14);
}

.m16map__poz.is-active .m16map__poz-ikona .m16map-svg-pin path {
	fill: #fff;
}

.m16map__poz-nazwa {
	display: block;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.3;
}

.m16map__poz-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 5px;
	margin-top: 2px;
	font-size: 11.5px;
	color: #6d6d6d;
}

.m16map__poz.is-active .m16map__poz-meta {
	color: #c4c4c4;
}

.m16map__poz-meta .m16map-svg-ikona {
	width: 12px;
	height: 12px;
	vertical-align: -1px;
}

.m16map__meta-el {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
}

.m16map__kropka {
	color: #c0c0c0;
}

.m16map__poz-strzalka {
	color: #bdbdbd;
	font-size: 16px;
}

.m16map__poz.is-active .m16map__poz-strzalka {
	color: #8f8f8f;
}

.m16map__pusto {
	margin: 0;
	padding: 14px 16px;
	font-size: 13px;
	color: #777;
}

/* ====== Legenda ====== */

.m16map__legenda {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 16px 12px;
	border-top: 1px solid #e8e8e8;
	font-size: 11.5px;
	color: #5c5c5c;
	flex-wrap: wrap;
}

.m16map__legenda--plywajaca {
	position: absolute;
	left: 14px;
	bottom: 14px;
	z-index: 10;
	border-top: 0;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.92);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	box-shadow: 0 6px 20px rgba(17, 17, 17, 0.14);
	padding: 8px 12px;
}

.m16map__leg-el {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.m16map__leg-inw {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--m16map-akcent);
	box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.10);
}

.m16map__leg-poi {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #161616;
}

.m16map__leg-trasa {
	width: 20px;
	height: 0;
	border-top: 3px dashed var(--m16map-akcent);
	border-radius: 2px;
}

/* ====== Przycisk panelu (mobile FAB) ====== */

.m16map__panelbtn {
	display: none;
	position: absolute;
	left: 14px;
	bottom: 14px;
	z-index: 26;
	align-items: center;
	gap: 8px;
	border: 0;
	border-radius: 999px;
	background: #141414;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 11px 16px;
	cursor: pointer;
	box-shadow: 0 10px 26px rgba(17, 17, 17, 0.35);
}

.m16map__panelbtn svg {
	width: 15px;
	height: 15px;
}

.m16map__panelbtn:focus-visible {
	outline: 3px solid var(--m16map-akcent);
	outline-offset: 2px;
}

/* ====== Kontrolki Mapbox — spójne z mono UI ====== */

.m16map .mapboxgl-ctrl-group {
	border-radius: 12px;
	box-shadow: 0 6px 20px rgba(17, 17, 17, 0.16);
	overflow: hidden;
}

.m16map .mapboxgl-ctrl-group button {
	width: 34px;
	height: 34px;
}

.m16map .mapboxgl-ctrl-attrib {
	font-size: 10px;
}

/* ====== Responsywność ====== */

@media (max-width: 781px) {
	.m16map {
		--m16map-h: 480px;
		border-radius: 14px;
	}

	.m16map__panel {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-height: min(64%, 430px);
		border-radius: 16px 16px 0 0;
		transform: translateY(105%);
		transition: transform 0.3s ease;
		z-index: 30;
	}

	.m16map__panel.is-open {
		transform: translateY(0);
	}

	.m16map--bez-panelu .m16map__panelbtn {
		display: none;
	}

	.m16map__panelbtn {
		display: inline-flex;
	}

	.m16map__pill {
		bottom: 72px;
		padding-left: 13px;
		gap: 8px;
	}

	.m16map__pill-nazwa {
		max-width: 110px;
	}

	.m16map__legenda--plywajaca {
		display: none;
	}
}

/* ====== Redukcja ruchu / animacje wyłączone ====== */

@media (prefers-reduced-motion: reduce) {
	.m16map *,
	.m16map *::before,
	.m16map *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
