/**
 * LopoRail Infrastructure — global rail megaprojects (#1119)
 * Scoped .lgr-*; theme tokens with fallbacks.
 */

.lgr-projects {
	scroll-margin-top: 90px;
	margin-block: 18px 26px;
	color: var(--fg, #f5f5f7);
	font-family: var(--font, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);
}

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

.lgr-head {
	max-width: 720px;
	margin-bottom: 14px;
}

.lgr-eyebrow {
	margin: 0 0 6px;
	color: var(--muted, #a9a9b3);
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.lgr-title {
	margin: 0 0 6px !important;
	font-size: clamp(20px, 2.6vw, 28px) !important;
	line-height: 1.15 !important;
	letter-spacing: -0.01em;
}

.lgr-intro {
	margin: 0 !important;
	color: var(--muted, #a9a9b3);
	font-size: 14px !important;
	line-height: 1.55 !important;
}

.lgr-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 18px;
	justify-content: space-between;
	margin: 14px 0;
}

.lgr-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.lgr-chip {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 9px 14px;
	border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
	border-radius: 999px;
	background: var(--surface, #17171d);
	color: var(--muted, #a9a9b3);
	font: inherit;
	font-size: 12.5px;
	cursor: pointer;
}

.lgr-chip:hover {
	border-color: var(--border-strong, rgba(255, 255, 255, 0.4));
	color: var(--fg, #f5f5f7);
}

.lgr-chip.is-on,
.lgr-chip[aria-pressed="true"] {
	background: var(--accent, #e0559b);
	border-color: transparent;
	color: var(--on-accent, #101014);
	font-weight: 600;
}

.lgr-chip:focus-visible {
	outline: 2px solid var(--accent, #e0559b);
	outline-offset: 2px;
}

.lgr-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	gap: 16px;
	align-items: start;
}

.lgr-map-stage {
	position: relative;
	border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
	border-radius: var(--radius-lg, 18px);
	overflow: hidden;
	background: var(--surface-2, #1b1b22);
}

.lgr-map {
	width: 100%;
	height: 560px;
	min-height: 300px;
	background: var(--surface-2, #1b1b22);
}

.lgr-map-note {
	position: absolute;
	left: 10px;
	bottom: 34px;
	z-index: 2;
	margin: 0;
	padding: 4px 8px;
	border-radius: 8px;
	background: color-mix(in oklch, var(--surface, #17171d) 88%, transparent);
	color: var(--muted, #a9a9b3);
	font-size: 11px;
	pointer-events: none;
}

.lgr-legend {
	position: absolute;
	left: 10px;
	bottom: 8px;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	padding: 4px 8px;
	border-radius: 8px;
	background: color-mix(in oklch, var(--surface, #17171d) 88%, transparent);
	color: var(--muted, #a9a9b3);
	font-size: 11px;
	pointer-events: none;
}

.lgr-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.lgr-swatch {
	width: 18px;
	height: 4px;
	border-radius: 2px;
}

.lgr-swatch--uc {
	background: var(--warn, #f0bd4d);
}

.lgr-swatch--planned {
	background: var(--info, #67a9f5);
}

.lgr-list {
	display: grid;
	gap: 10px;
	max-height: 560px;
	overflow: auto;
	padding-right: 4px;
	scrollbar-width: thin;
}

.lgr-card {
	padding: 14px;
	border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
	border-radius: var(--radius, 12px);
	background: var(--surface, #17171d);
}

.lgr-card:focus-visible {
	outline: 2px solid var(--accent, #e0559b);
	outline-offset: 2px;
}

.lgr-card.is-active {
	border-color: var(--accent, #e0559b);
}

.lgr-card[hidden] {
	display: none;
}

.lgr-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
}

.lgr-card-head h3 {
	margin: 0;
	font-size: 15px;
	line-height: 1.25;
}

.lgr-status {
	flex: none;
	padding: 2px 8px;
	border: 1px solid currentColor;
	border-radius: 999px;
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
}

.lgr-status--uc {
	color: var(--warn, #f0bd4d);
}

.lgr-status--planned {
	color: var(--info, #67a9f5);
}

.lgr-countries {
	margin: 4px 0 0;
	color: var(--muted, #a9a9b3);
	font-size: 11.5px;
	line-height: 1.4;
}

/* #8318: the age of the facts, stated. Small, monospaced, and visibly different
   once a row has gone more than 180 days without a check. */
.lgr-checked {
	display: inline-block;
	margin: 6px 0 0;
	padding: 2px 7px;
	border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
	border-radius: 999px;
	color: var(--muted, #a9a9b3);
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 10.5px;
	line-height: 1.5;
}

.lgr-checked--stale {
	border-color: #f59e0b;
	color: #f59e0b;
}

.lgr-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 9px 0 0;
}

.lgr-meta div {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
}

.lgr-meta dt {
	color: var(--muted, #a9a9b3);
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 9.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.lgr-meta dd {
	margin: 0;
	color: var(--fg, #f5f5f7);
	font-size: 12.5px;
	font-weight: 600;
}

.lgr-desc {
	margin: 9px 0 0;
	color: var(--muted, #a9a9b3);
	font-size: 12.5px;
	line-height: 1.5;
}

.lgr-facts {
	margin: 8px 0 0;
	padding-left: 16px;
	color: var(--muted, #a9a9b3);
	font-size: 12px;
	line-height: 1.5;
}

.lgr-sources {
	margin: 8px 0 0;
	color: var(--muted, #a9a9b3);
	font-size: 11px;
	line-height: 1.4;
}

.lgr-sources a {
	color: var(--muted, #a9a9b3);
	text-decoration: underline;
}

.lgr-sources a:hover {
	color: var(--fg, #f5f5f7);
}

.lgr-nomatch,
.lgr-empty {
	margin: 8px 0;
	color: var(--muted, #a9a9b3);
	font-size: 13px;
}

.lgr-caveat {
	margin: 12px 0 0;
	color: var(--muted, #a9a9b3);
	font-size: 11.5px;
	line-height: 1.5;
}

.lgr-map .maplibregl-popup-content {
	background: var(--surface, #17171d);
	color: var(--fg, #f5f5f7);
	border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.4));
	border-radius: 10px;
	font-family: var(--font, ui-sans-serif, system-ui, sans-serif);
	font-size: 12.5px;
	line-height: 1.4;
}

.lgr-map .maplibregl-popup-tip {
	border-top-color: var(--surface, #17171d);
}

@media (max-width: 980px) {
	.lgr-layout {
		grid-template-columns: 1fr;
	}

	.lgr-map {
		height: 380px;
	}

	.lgr-list {
		max-height: none;
		overflow: visible;
	}
}

@media (max-width: 560px) {
	.lgr-map {
		height: 320px;
	}

	.lgr-controls {
		gap: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lgr-projects *,
	.lgr-projects *::before,
	.lgr-projects *::after {
		transition: none !important;
		animation: none !important;
	}
}

.lgr-promoter {
	margin: 6px 0 0;
	color: var(--muted, #a9a9b3);
	font-size: 11.5px;
	line-height: 1.45;
}

.lgr-promoter span {
	margin-right: 4px;
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 9.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.lgr-sources a {
	color: var(--fg, #f5f5f7);
}

/* MapLibre controls: 44px touch targets + keyboard focus ring. */
.lgr-map .maplibregl-ctrl-group button,
.lgr-map .maplibregl-ctrl-group button:hover {
	width: 44px;
	height: 44px;
}

.lgr-map .maplibregl-ctrl-group button:focus-visible,
.lgr-map .maplibregl-ctrl-attrib-button:focus-visible {
	outline: 2px solid var(--accent, #e0559b);
	outline-offset: 2px;
}

@media (hover: none) and (pointer: coarse) {
	.lgr-map .maplibregl-ctrl-group button {
		width: 44px;
		height: 44px;
	}
}
