/* AIVF Legislation Map — front end */

.aivf-lm {
	--aivf-lm-text: #1D2733;
	--aivf-lm-muted: #5B6673;
	--aivf-lm-rule: #E2E6EA;
	--aivf-lm-outline: #1D2733;
	--aivf-lm-link: var(--aivf-lm-blue, #2B5C9E);
	--aivf-lm-accent: var(--aivf-lm-grey, #D3D8DE);
	position: relative;
	max-width: 1100px;
	margin: 0 auto;
	color: var(--aivf-lm-text);
	font-family: inherit;
}

/* Legend */
.aivf-lm .aivf-lm-legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 28px;
	margin: 0 0 20px;
	padding: 0;
	list-style: none;
	font-size: 15px;
	line-height: 1.4;
}
.aivf-lm .aivf-lm-legend li {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0;
	padding: 0;
}
.aivf-lm .aivf-lm-swatch {
	flex: none;
	width: 14px;
	height: 14px;
	border-radius: 3px;
}

/* Map */
.aivf-lm .aivf-lm-stage {
	position: relative;
}
.aivf-lm .aivf-lm-svg {
	display: block;
	width: 100%;
	height: auto;
	max-width: none;
	overflow: visible;
}
.aivf-lm .aivf-lm-state {
	transition: filter 0.15s ease;
}
.aivf-lm .aivf-lm-state.is-blue,
.aivf-lm .aivf-lm-callout.is-blue rect { fill: var(--aivf-lm-blue); }
.aivf-lm .aivf-lm-state.is-red,
.aivf-lm .aivf-lm-callout.is-red rect { fill: var(--aivf-lm-red); }
.aivf-lm .aivf-lm-state.is-grey,
.aivf-lm .aivf-lm-callout.is-grey rect { fill: var(--aivf-lm-grey); }

.aivf-lm .aivf-lm-label.is-blue,
.aivf-lm .aivf-lm-callout.is-blue text { fill: var(--aivf-lm-blue-ink); }
.aivf-lm .aivf-lm-label.is-red,
.aivf-lm .aivf-lm-callout.is-red text { fill: var(--aivf-lm-red-ink); }
.aivf-lm .aivf-lm-label.is-grey,
.aivf-lm .aivf-lm-callout.is-grey text { fill: var(--aivf-lm-grey-ink); }

.aivf-lm .aivf-lm-labels,
.aivf-lm .aivf-lm-callouts text {
	font-family: inherit;
	pointer-events: none;
	user-select: none;
}
.aivf-lm .aivf-lm-leaders { pointer-events: none; }

.aivf-lm .is-interactive { cursor: pointer; }
.aivf-lm .aivf-lm-svg:focus,
.aivf-lm .aivf-lm-state:focus { outline: none; }
.aivf-lm .aivf-lm-state.is-interactive:hover,
.aivf-lm .aivf-lm-state.is-active,
.aivf-lm .aivf-lm-callout.is-interactive:hover rect,
.aivf-lm .aivf-lm-callout.is-active rect {
	filter: brightness(0.9);
}
.aivf-lm .aivf-lm-callout rect {
	stroke: #FFFFFF;
	stroke-width: 1;
}
.aivf-lm .aivf-lm-callout.is-active rect {
	stroke: var(--aivf-lm-outline);
	stroke-width: 1.5;
}

/* Outline drawn on top of the active state so neighbours never cover it */
.aivf-lm .aivf-lm-hl {
	display: none;
	fill: none;
	stroke: var(--aivf-lm-outline);
	stroke-width: 1.75;
	stroke-linejoin: round;
	pointer-events: none;
}
.aivf-lm .aivf-lm-hl.is-on { display: inline; }

/* Hover card */
.aivf-lm .aivf-lm-tip {
	position: absolute;
	z-index: 30;
	top: 0;
	left: 0;
	box-sizing: border-box;
	width: min(320px, calc(100% - 16px));
	padding: 14px 18px 16px;
	background: #FFFFFF;
	color: var(--aivf-lm-text);
	border-top: 4px solid var(--aivf-lm-accent);
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(29, 39, 51, 0.08), 0 10px 28px rgba(29, 39, 51, 0.16);
	font-size: 15px;
	line-height: 1.45;
	text-align: left;
	animation: aivf-lm-in 0.14s ease-out;
}
.aivf-lm .aivf-lm-tip[hidden] { display: none; }

@keyframes aivf-lm-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}

.aivf-lm .aivf-lm-tip p {
	margin: 0;
	padding: 0;
}
.aivf-lm .aivf-lm-tip p[hidden],
.aivf-lm .aivf-lm-tip a[hidden] { display: none; }

.aivf-lm .aivf-lm-tip .aivf-lm-tip-state {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-bottom: 6px;
	padding-right: 28px;
	color: var(--aivf-lm-muted);
	font-size: 13px;
	font-weight: 600;
}
.aivf-lm .aivf-lm-tip-dot {
	flex: none;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--aivf-lm-accent);
	box-shadow: inset 0 0 0 1px rgba(29, 39, 51, 0.12);
}
.aivf-lm .aivf-lm-tip .aivf-lm-tip-title {
	margin-bottom: 4px;
	color: var(--aivf-lm-text);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}
.aivf-lm .aivf-lm-tip .aivf-lm-tip-topic {
	margin-bottom: 8px;
	color: var(--aivf-lm-muted);
	font-size: 13px;
	font-weight: 600;
}
.aivf-lm .aivf-lm-tip .aivf-lm-tip-desc {
	margin-bottom: 12px;
}
.aivf-lm .aivf-lm-tip .aivf-lm-tip-desc:last-child { margin-bottom: 0; }

.aivf-lm .aivf-lm-tip .aivf-lm-tip-link,
.aivf-lm .aivf-lm-tip .aivf-lm-tip-link:visited {
	display: inline-block;
	color: var(--aivf-lm-link);
	font-size: 15px;
	font-weight: 700;
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
}
.aivf-lm .aivf-lm-tip .aivf-lm-tip-link:hover {
	color: var(--aivf-lm-text);
}
.aivf-lm .aivf-lm-tip .aivf-lm-tip-link:focus-visible {
	outline: 2px solid var(--aivf-lm-outline);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Close button: shown once a card is opened by click/tap */
.aivf-lm .aivf-lm-tip .aivf-lm-tip-close {
	all: unset;
	position: absolute;
	top: 8px;
	right: 8px;
	display: none;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	color: var(--aivf-lm-muted);
	cursor: pointer;
}
.aivf-lm .aivf-lm-tip.is-pinned .aivf-lm-tip-close { display: flex; }
.aivf-lm .aivf-lm-tip .aivf-lm-tip-close:hover { background: #F0F2F4; color: var(--aivf-lm-text); }
.aivf-lm .aivf-lm-tip .aivf-lm-tip-close:focus-visible { outline: 2px solid var(--aivf-lm-outline); outline-offset: 1px; }

/* State picker (narrow layouts only) */
.aivf-lm .aivf-lm-picker { display: none; }
.aivf-lm .aivf-lm-picker label {
	display: block;
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
}
.aivf-lm .aivf-lm-picker select {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid #C5CCD3;
	border-radius: 6px;
	background-color: #FFFFFF;
	color: var(--aivf-lm-text);
	font: inherit;
	font-size: 16px;
}
.aivf-lm .aivf-lm-picker select:focus-visible {
	outline: 2px solid var(--aivf-lm-outline);
	outline-offset: 1px;
}

/* Narrow: card docks under the map instead of floating */
.aivf-lm.is-narrow .aivf-lm-picker {
	display: block;
	margin-top: 16px;
}
.aivf-lm.is-narrow .aivf-lm-stage {
	display: flex;
	flex-direction: column;
}
.aivf-lm.is-narrow .aivf-lm-tip {
	position: relative;
	width: auto;
	margin-top: 16px;
	border: 1px solid var(--aivf-lm-rule);
	border-top: 4px solid var(--aivf-lm-accent);
	box-shadow: none;
}
.aivf-lm.is-tiny .aivf-lm-labels,
.aivf-lm.is-tiny .aivf-lm-leaders,
.aivf-lm.is-tiny .aivf-lm-callouts { display: none; }

/* Text list (visible with list="show", otherwise for screen readers / search engines) */
.aivf-lm .aivf-lm-list { margin-top: 28px; }
.aivf-lm .aivf-lm-list ul {
	margin: 0;
	padding: 0;
	list-style: none;
}
.aivf-lm .aivf-lm-list li {
	margin: 0;
	padding: 10px 0;
	border-top: 1px solid var(--aivf-lm-rule);
	line-height: 1.5;
}
.aivf-lm .aivf-lm-list-topic { color: var(--aivf-lm-muted); }
.aivf-lm .aivf-lm-list-desc { display: block; }

.aivf-lm .aivf-lm-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
	.aivf-lm .aivf-lm-tip { animation: none; }
	.aivf-lm .aivf-lm-state { transition: none; }
}
