/**
 * SA Map Pins - front-end styles.
 */

.smp-map {
	--smp-land: #dfe6df;
	--smp-land-hover: #c6d6c8;
	--smp-border: #ffffff;
	--smp-label: #5b6b60;
	--smp-pin-color: #c1440e;
	--smp-pin-hover: #8c3109;
	--smp-accent: #1f3d2b;
	--smp-pin-label: #243027;

	box-sizing: border-box;
	margin: 0 auto;
	width: 100%;
	font-size: 16px;
	line-height: 1.5;
}

.smp-map *,
.smp-map *::before,
.smp-map *::after {
	box-sizing: inherit;
}

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

.smp-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

.smp-filter {
	appearance: none;
	background: transparent;
	border: 1px solid rgba(0, 0, 0, 0.16);
	border-radius: 999px;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: 0.85em;
	line-height: 1;
	padding: 8px 14px;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.smp-filter:hover,
.smp-filter:focus-visible {
	border-color: var(--smp-accent);
	color: var(--smp-accent);
}

.smp-filter.is-active {
	background: var(--smp-accent);
	border-color: var(--smp-accent);
	color: #fff;
}

.smp-filter__count {
	display: inline-block;
	font-size: 0.85em;
	margin-left: 6px;
	opacity: 0.7;
}

/* ---------- Stage ---------- */

.smp-map__stage {
	position: relative;
	touch-action: pan-y;
}

.smp-map__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.smp-map--zoomable .smp-map__stage {
	overflow: hidden;
}

.smp-map--zoomable .smp-map__stage.is-panning {
	cursor: grabbing;
}

.smp-viewport {
	transform-origin: 0 0;
}

/* ---------- Provinces ---------- */

.smp-province {
	fill: var(--smp-land);
	stroke: var(--smp-border);
	stroke-width: 1.4px;
	stroke-linejoin: round;
	cursor: pointer;
	transition: fill 0.18s ease;
}

.smp-province:hover,
.smp-province.is-active {
	fill: var(--smp-land-hover);
}

.smp-province.is-selected {
	fill: var(--smp-land-hover);
	stroke: var(--smp-accent);
	stroke-width: 2px;
}

.smp-label {
	fill: var(--smp-label);
	font-family: inherit;
	font-weight: 600;
	letter-spacing: 0.02em;
	pointer-events: none;
	paint-order: stroke;
	stroke: rgba(255, 255, 255, 0.7);
	stroke-width: 1.2px;
	stroke-linejoin: round;
}

/* ---------- Pins ---------- */

.smp-pin {
	cursor: pointer;
	outline: none;
}

.smp-pin__inner {
	transition: transform 0.16s ease;
	transform-box: view-box;
}

.smp-pin__shape {
	fill: var(--smp-pin-color);
	stroke: #fff;
	stroke-width: 1.4;
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.35));
}

.smp-pin__dot {
	fill: #fff;
}

.smp-pin:hover .smp-pin__shape,
.smp-pin:focus-visible .smp-pin__shape,
.smp-pin.is-open .smp-pin__shape {
	fill: var(--smp-pin-hover);
}

.smp-pin:focus-visible .smp-pin__shape {
	stroke: var(--smp-accent);
	stroke-width: 2.2;
}

.smp-pin.is-hidden {
	display: none;
}

.smp-pin.is-dimmed {
	opacity: 0.32;
}

.smp-pin.is-dimmed:hover,
.smp-pin.is-dimmed:focus-visible {
	opacity: 1;
}

/* Labels and the article-count badge live in a group scaled to screen pixels. */

.smp-pin__px {
	pointer-events: none;
}

.smp-pin__label {
	fill: var(--smp-pin-label);
	font-family: inherit;
	font-weight: 600;
	paint-order: stroke;
	stroke: rgba(255, 255, 255, 0.9);
	stroke-width: 3px;
	stroke-linejoin: round;
}

.smp-pin.is-open .smp-pin__label {
	fill: var(--smp-accent);
}

.smp-pin__badge circle {
	fill: var(--smp-accent);
	stroke: #fff;
	stroke-width: 1.5px;
}

.smp-pin__badge text {
	fill: #fff;
	font-family: inherit;
	font-weight: 700;
}

/* ---------- Zoom controls ---------- */

.smp-controls {
	position: absolute;
	right: 10px;
	top: 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.smp-controls__btn {
	appearance: none;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	color: #222;
	cursor: pointer;
	font: inherit;
	font-size: 16px;
	height: 32px;
	line-height: 1;
	width: 32px;
	padding: 0;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.smp-controls__btn:hover,
.smp-controls__btn:focus-visible {
	border-color: var(--smp-accent);
	color: var(--smp-accent);
}

/* ---------- Pop-up card ---------- */

.smp-popup {
	position: absolute;
	z-index: 5;
	width: 300px;
	max-width: calc(100% - 20px);
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	transform: translate(-50%, -100%);
	animation: smp-pop 0.16s ease-out;
}

@keyframes smp-pop {
	from {
		opacity: 0;
		transform: translate(-50%, calc(-100% + 6px));
	}
}

.smp-popup--below {
	transform: translate(-50%, 0);
	animation: smp-pop-below 0.16s ease-out;
}

@keyframes smp-pop-below {
	from {
		opacity: 0;
		transform: translate(-50%, -6px);
	}
}

.smp-popup__close {
	position: absolute;
	top: 6px;
	right: 6px;
	appearance: none;
	background: rgba(255, 255, 255, 0.9);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	font-size: 18px;
	height: 26px;
	line-height: 24px;
	width: 26px;
	padding: 0;
	color: #444;
}

.smp-popup__close:hover {
	color: #000;
}

.smp-popup__thumb {
	display: block;
	width: 100%;
	height: 120px;
	object-fit: cover;
}

.smp-popup__body {
	padding: 12px 14px 14px;
}

h3.smp-popup__title {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 4px;
}

.smp-popup__title a {
	color: inherit;
	text-decoration: none;
}

.smp-popup__title a:hover,
.smp-popup__title a:focus-visible {
	color: var(--smp-accent);
	text-decoration: underline;
}

.smp-popup__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 0.75em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.65;
	margin: 0 0 8px;
}

.smp-popup__excerpt {
	font-size: 0.875em;
	margin: 0 0 10px;
}

.smp-popup__single {
	margin: 0;
}

.smp-popup__link {
	color: var(--smp-accent);
	font-size: 0.875em;
	font-weight: 600;
	text-decoration: none;
}

.smp-popup__link:hover,
.smp-popup__link:focus-visible {
	text-decoration: underline;
}

.smp-popup__articles {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 264px;
	overflow-y: auto;
}

.smp-popup__article a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-top: 1px solid rgba(0, 0, 0, 0.07);
	color: inherit;
	text-decoration: none;
}

.smp-popup__article:first-child a {
	border-top: 0;
	padding-top: 2px;
}

.smp-popup__rowthumb {
	width: 46px;
	height: 46px;
	flex: none;
	object-fit: cover;
	border-radius: 6px;
}

.smp-popup__rowtext {
	min-width: 0;
}

.smp-popup__rowtitle {
	display: block;
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.3;
}

.smp-popup__rowdate {
	display: block;
	font-size: 0.75em;
	opacity: 0.6;
}

.smp-popup__article a:hover .smp-popup__rowtitle,
.smp-popup__article a:focus-visible .smp-popup__rowtitle {
	color: var(--smp-accent);
	text-decoration: underline;
}

/* ---------- Results below the map ---------- */

.smp-results {
	margin-top: 20px;
}

.smp-results__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
	padding-bottom: 8px;
}

.smp-results__title {
	font-size: 1.05em;
	font-weight: 700;
	margin: 0;
}

.smp-results__clear {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 0.85em;
	color: var(--smp-accent);
	cursor: pointer;
	text-decoration: underline;
}

.smp-results__empty {
	margin: 14px 0 0;
	opacity: 0.7;
}

.smp-list {
	display: grid;
	gap: 4px 24px;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.smp-list__item {
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	padding: 12px 0;
	margin: 0;
}

.smp-list__label {
	margin: 0 0 4px;
}

.smp-list__pin {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-weight: 700;
	color: inherit;
	cursor: pointer;
	text-align: left;
}

.smp-list__pin:hover,
.smp-list__pin:focus-visible {
	color: var(--smp-accent);
}

.smp-list__label small {
	display: block;
	font-size: 0.78em;
	font-weight: 400;
	opacity: 0.6;
}

.smp-list__articles {
	list-style: none;
	margin: 0;
	padding: 0;
}

.smp-list__articles li {
	margin: 0 0 4px;
}

.smp-list__articles a {
	color: inherit;
	font-size: 0.92em;
	text-decoration: none;
}

.smp-list__articles a:hover,
.smp-list__articles a:focus-visible {
	color: var(--smp-accent);
	text-decoration: underline;
}

.smp-list__articles time {
	display: block;
	font-size: 0.75em;
	opacity: 0.55;
}

.smp-list__item.is-hidden {
	display: none;
}

.smp-list__item.is-highlight {
	background: rgba(0, 0, 0, 0.035);
}

.smp-map__empty {
	margin: 0 0 12px;
	opacity: 0.7;
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
	.smp-popup {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		width: 100%;
		max-width: none;
		border-radius: 14px 14px 0 0;
		transform: none;
		animation: smp-sheet 0.2s ease-out;
	}

	@keyframes smp-sheet {
		from {
			transform: translateY(12px);
			opacity: 0;
		}
	}

	.smp-popup__thumb {
		height: 140px;
	}

	.smp-popup__articles {
		max-height: 40vh;
	}
}

@media (prefers-reduced-motion: reduce) {
	.smp-map *,
	.smp-map *::before,
	.smp-map *::after {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
	}
}
