/*
 * Flora Fauna Fun habitat maps. Everything is scoped under .fhb.fhb (figure) or .fhb-more.fhb-more (strip): the doubled
 * class (0,2,0) plus one more beats ruki's `.the-post .entry-content figure / a / h2` rules.
 * Area fill colors are NOT here: the builder writes them into the SVG as fill attributes, so the PNG download looks the
 * same as the page. CSS only draws sea, no-data land, borders, hover state, tooltip, legend, download button.
 * No <p> in the markup (AdSense Auto Ads injects beside <p> inside tools).
 */

.fhb.fhb {
	--fhb-ink: #29271f;
	--fhb-soft: #5a574a;
	--fhb-faint: #7a7765;
	--fhb-line: #b5dcc4;
	--fhb-accent: #2f7d4f;
	--fhb-accent-d: #1d4f33;
	--fhb-accent-bg: #eff7f1;
	--fhb-sea: #dfeff2;
	--fhb-land: #e8e2d3;
	--fhb-ctx: #f0ecdf;
	--fhb-border: #ffffff;
	--fhb-hot: #1f2a33;
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 1.8em 0;
	padding: 12px 12px 14px;
	background: #fff;
	border: 1px solid var(--fhb-line);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(20, 40, 60, .05);
	color: var(--fhb-ink);
	font-family: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}
.fhb.fhb *,
.fhb.fhb *::before,
.fhb.fhb *::after {
	box-sizing: border-box;
}
.fhb.fhb [hidden] {
	display: none !important;
}

/* map */
.fhb.fhb .fhb-stage {
	position: relative;
	margin: 0;
	border-radius: 10px;
	overflow: hidden;
	background: var(--fhb-sea);
	line-height: 0;
}
.fhb.fhb svg.fhb-map {
	display: block;
	width: 100%;
	height: auto;
	max-height: 75vh; /* tall regions (Madagascar, Chile) stay within one screen; the SVG centres itself, the stage sea fills the sides */
	margin: 0;
	max-width: none;
	-webkit-tap-highlight-color: transparent;
}
.fhb.fhb .fhb-sea {
	fill: var(--fhb-sea);
	stroke: none;
}
.fhb.fhb .fhb-map path,
.fhb.fhb .fhb-map circle {
	stroke: var(--fhb-border);
	stroke-width: .6px;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}
.fhb.fhb .fhb-map .fhb-areas path:not([fill]) {
	fill: var(--fhb-land);
}
.fhb.fhb .fhb-map .fhb-ctx path {
	fill: var(--fhb-ctx);
	stroke: #fff;
	stroke-width: .5px;
}
.fhb.fhb .fhb-map .fhb-dots circle {
	stroke-width: 1.2px;
}
.fhb.fhb .fhb-map [data-name] {
	cursor: default;
}
.fhb.fhb .fhb-map [data-name].is-hot {
	stroke: var(--fhb-hot);
	stroke-width: 1.7px;
	filter: brightness(.93);
}
@media (hover: hover) {
	.fhb.fhb .fhb-map [data-name]:hover {
		stroke: var(--fhb-hot);
		stroke-width: 1.7px;
		filter: brightness(.93);
	}
}

/* tooltip (created by js/fhb.js) */
.fhb.fhb .fhb-tip {
	position: absolute;
	z-index: 3;
	left: 0;
	top: 0;
	max-width: 86%;
	padding: 6px 10px;
	border-radius: 8px;
	background: var(--fhb-hot);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

/* legend */
.fhb.fhb .fhb-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 10px;
	margin: 12px 2px 0;
}
.fhb.fhb .fhb-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 11px 4px 6px;
	background: var(--fhb-accent-bg);
	border: 1px solid var(--fhb-line);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--fhb-accent-d);
}
.fhb.fhb .fhb-sw {
	flex: 0 0 auto;
	display: block;
	width: 16px;
	height: 16px;
	border-radius: 5px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}

/* caption + download */
.fhb.fhb figcaption.fhb-cap {
	margin: 10px 2px 0;
	font-size: 14px;
	line-height: 1.45;
	color: var(--fhb-soft);
}
.fhb.fhb .fhb-attr {
	display: inline;
	font-size: 12px;
	color: var(--fhb-faint);
}
.fhb.fhb .fhb-actions {
	margin: 10px 2px 0;
}
.fhb.fhb a.fhb-dl {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 16px;
	border: 2px solid var(--fhb-accent);
	border-radius: 999px;
	background: #fff;
	color: var(--fhb-accent-d) !important;
	font-size: 14px;
	font-weight: 800;
	line-height: 1.3;
	text-decoration: none !important;
	box-shadow: none;
	background-image: none !important;
}
.fhb.fhb a.fhb-dl:hover,
.fhb.fhb a.fhb-dl:focus-visible {
	background: var(--fhb-accent-bg);
}

/* "More habitat guides" strip */
.fhb-more.fhb-more {
	box-sizing: border-box;
	margin: 2em 0;
	font-family: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
.fhb-more.fhb-more *,
.fhb-more.fhb-more *::before,
.fhb-more.fhb-more *::after {
	box-sizing: border-box;
}
.fhb-more.fhb-more h2.fhb-more-h {
	margin: 0 0 12px;
	font-size: 1.25em;
	line-height: 1.3;
	color: #1d4f33;
}
.fhb-more.fhb-more .fhb-more-row {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 12px;
}
.fhb-more.fhb-more a.fhb-card {
	display: block;
	overflow: hidden;
	background: #fff;
	border: 1px solid #b5dcc4;
	border-radius: 14px;
	color: #29271f !important;
	text-decoration: none !important;
	box-shadow: 0 1px 2px rgba(20, 40, 60, .05);
	background-image: none !important;
}
.fhb-more.fhb-more a.fhb-card:hover,
.fhb-more.fhb-more a.fhb-card:focus-visible {
	border-color: #2f7d4f;
}
.fhb-more.fhb-more .fhb-card-img {
	display: block;
	aspect-ratio: 16 / 9;
	background: #dfeff2;
	line-height: 0;
}
.fhb-more.fhb-more .fhb-card-img img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
}
.fhb-more.fhb-more .fhb-card-t {
	display: block;
	padding: 8px 11px 10px;
	font-size: 14px;
	font-weight: 800;
	line-height: 1.3;
}

@media (max-width: 520px) {
	.fhb.fhb {
		padding: 8px 8px 12px;
		border-radius: 14px;
	}
	.fhb.fhb .fhb-chip {
		font-size: 13px;
	}
	.fhb-more.fhb-more .fhb-more-row {
		grid-template-columns: repeat(2, 1fr);
	}
}
