/* The Valleys map. Dark land, the Valleys in Welsh red, cream ink.
   Hover changes light only. */

.vm {
	--vm-land: #232327;
	--vm-land-hover: #2e2e33;
	--vm-edge: var(--bg-2);
	--vm-coast: #4a4a50;
	--vm-valleys: var(--red);
	--vm-valleys-hover: var(--red-hover);
	--vm-sel: var(--ink);
	--vm-grat: rgba(241, 238, 232, 0.06);
}

.vm-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 20px;
}

.vm-seg {
	display: inline-flex;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--bg-2);
}

.vm-seg button {
	min-height: 38px;
	padding: 0 16px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: var(--ink-2);
	font: 600 0.8125rem/1 var(--sans);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}

.vm-seg button:hover {
	color: var(--ink);
	background-color: var(--tint);
	border-color: var(--line-2);
}

.vm-seg button[aria-pressed="true"] {
	color: #fff;
	background-color: var(--red);
	border-color: var(--red);
}

.vm-stage {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
	gap: 20px;
	align-items: start;
}

@media (max-width: 900px) {
	.vm-stage {
		grid-template-columns: 1fr;
	}
}

.vm-card {
	min-width: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg-2);
	overflow: hidden;
}

.vm-mapwrap {
	position: relative;
	height: 460px;
	background: var(--bg-2);
}

.vm-mapwrap > svg {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

.vm-mapwrap > .vm-static {
	position: static;
	width: min(100%, 420px);
	height: auto;
	margin: 24px auto;
}

.vm-overlay {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
}

.vm-area {
	fill: var(--vm-land);
	stroke: var(--vm-edge);
	stroke-width: 1.6px;
	vector-effect: non-scaling-stroke;
	cursor: pointer;
	transition: fill 0.15s;
}

.vm-area.vm-is-v {
	fill: var(--vm-valleys);
}

.vm-area:hover {
	fill: var(--vm-land-hover);
}

.vm-area.vm-is-v:hover {
	fill: var(--vm-valleys-hover);
}

.vm-area:focus {
	outline: none;
}

.vm-area:focus-visible {
	stroke: var(--ink);
	stroke-width: 3px;
}

.vm-coast {
	fill: none;
	stroke: var(--vm-coast);
	stroke-width: 1px;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
}

.vm-vedge {
	fill: none;
	stroke: #ff6077;
	stroke-width: 1.2px;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
	transition: opacity 0.2s;
}

.vm-sel {
	fill: none;
	stroke: var(--vm-sel);
	stroke-width: 3px;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
}

.vm-grat {
	fill: none;
	stroke: var(--vm-grat);
	stroke-width: 1px;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
}

.vm-leader {
	fill: none;
	stroke: var(--ink-3);
	stroke-width: 1px;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
	transition: opacity 0.25s;
}

.vm-leader.vm-off {
	opacity: 0;
}

/* Labels are HTML over the map, so text stays crisp at every zoom. */
.vm-lbl {
	position: absolute;
	left: 0;
	top: 0;
	white-space: nowrap;
	will-change: transform;
	transition: opacity 0.25s;
}

.vm-lbl.vm-off {
	opacity: 0;
	visibility: hidden;
}

.vm-lbl.vm-cull {
	visibility: hidden;
}

.vm-pill > span {
	display: inline-block;
	transform: translate(-50%, -50%);
	padding: 4px 10px;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--bg);
	color: var(--ink);
	font: 600 0.8125rem/1.2 var(--display);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.vm-pill.vm-is-sel > span {
	border-color: var(--ink);
	box-shadow: 0 0 0 2px var(--ink);
}

.vm-town > i {
	position: absolute;
	left: 0;
	top: 0;
	width: 8px;
	height: 8px;
	margin: -4px 0 0 -4px;
	border-radius: 50%;
	background: var(--ink);
	box-shadow: 0 0 0 2px var(--bg-2);
}

.vm-town.vm-ctx > i {
	background: var(--bg-2);
	box-shadow: 0 0 0 1.5px var(--ink-2);
}

.vm-town.vm-inv > i {
	background: #fff;
	box-shadow: 0 0 0 2px var(--red);
}

.vm-town > .vm-t {
	position: absolute;
	font: 500 0.75rem/1.2 var(--sans);
	letter-spacing: 0.02em;
	color: var(--ink-2);
	text-shadow: 0 0 3px var(--bg-2), 0 0 3px var(--bg-2), 0 0 2px var(--bg-2);
}

.vm-town.vm-inv > .vm-t {
	color: #fff;
	font-weight: 600;
	text-shadow: 0 0 3px var(--red), 0 0 3px var(--red), 0 0 2px var(--red), 0 0 2px var(--red);
}

.vm-town.vm-ctx > .vm-t {
	font-style: italic;
}

.vm-s-r > .vm-t { left: 10px; top: 0; transform: translateY(-50%); }
.vm-s-l > .vm-t { right: 10px; top: 0; transform: translateY(-50%); }
.vm-s-t > .vm-t { left: 0; bottom: 10px; transform: translateX(-50%); }
.vm-s-b > .vm-t { left: 0; top: 10px; transform: translateX(-50%); }

.vm-sea > span {
	display: inline-block;
	transform: translate(-50%, -50%);
	font: italic 400 0.875rem/1.2 var(--serif);
	letter-spacing: 0.04em;
	color: var(--ink-3);
}

.vm-callout > span {
	display: inline-flex;
	flex-direction: column;
	gap: 2px;
	transform: translate(10px, -50%);
}

.vm-callout b {
	font: 800 1.25rem/1 var(--display);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--ink);
}

.vm-callout small {
	font: 500 0.75rem/1.2 var(--sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.vm-gl {
	position: absolute;
	font: 500 0.6875rem/1 var(--sans);
	font-variant-numeric: tabular-nums;
	color: var(--ink-3);
}

/* Locator inset when zoomed in. */
.vm-inset {
	position: absolute;
	left: 12px;
	top: 12px;
	width: 92px;
	padding: 6px 6px 4px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s;
	font: 600 0.5625rem/1.2 var(--sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-3);
	text-align: center;
}

.vm-inset.vm-on {
	opacity: 1;
	visibility: visible;
}

.vm-inset svg {
	display: block;
	width: 100%;
	height: auto;
}

.vm-inset .vm-ia { fill: var(--vm-land); }
.vm-inset .vm-iv { fill: var(--vm-valleys); }
.vm-inset rect { fill: none; stroke: var(--ink); stroke-width: 14; }

.vm-tip {
	position: absolute;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-width: 240px;
	padding: 8px 12px;
	border: 1px solid var(--line-2);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--ink);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	pointer-events: none;
}

.vm-tip[hidden] {
	display: none;
}

.vm-tip b { font: 700 1.125rem/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.vm-tip span { font: 400 0.8125rem/1.3 var(--sans); color: var(--ink-2); }
.vm-tip em { font: 600 0.6875rem/1.3 var(--sans); font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red-hover); }

.vm-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 20px;
	padding: 12px 16px;
	border-top: 1px solid var(--line);
	font: 500 0.8125rem/1.3 var(--sans);
	font-variant-numeric: tabular-nums;
	color: var(--ink-3);
}

.vm-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--ink-2);
}

.vm-legend li {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.vm-sw {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 3px;
}

.vm-sw-v { background: var(--vm-valleys); }
.vm-sw-r { background: var(--vm-land); outline: 1px solid var(--vm-coast); outline-offset: -1px; }

.vm-scale {
	display: inline-flex;
	align-items: flex-end;
	gap: 8px;
}

.vm-scale i {
	display: block;
	width: 60px;
	min-width: 20px;
	height: 7px;
	border: 1.5px solid var(--ink-2);
	border-top: 0;
}

@media (hover: none) {
	.vm-coords { display: none; }
}

/* Side panel. */
.vm-panel {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background:
		radial-gradient(ellipse at 0% 0%, rgba(200, 16, 46, 0.16), transparent 60%),
		var(--bg-2);
}

.vm-panel .vm-pk {
	margin: 0;
	font: 600 0.75rem/1.3 var(--sans);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--red-hover);
}

.vm-panel h2 {
	margin: 0;
	font-size: clamp(2.25rem, 4vw, 3rem);
	font-weight: 800;
	line-height: 0.95;
	text-transform: uppercase;
}

.vm-panel .vm-alt {
	margin: -6px 0 0;
	font: 500 1rem/1.3 var(--display);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.vm-panel .vm-meta,
.vm-panel .vm-hint {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--ink-2);
}

.vm-back {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 6px;
	min-height: 36px;
	padding: 0 12px 0 6px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: var(--ink-2);
	font: 600 0.8125rem/1 var(--sans);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}

.vm-back:hover {
	color: var(--ink);
	background-color: var(--tint);
	border-color: var(--line-2);
}

.vm-back .icon {
	color: var(--red-hover);
	font-size: 1.2em;
}

.vm-pl {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vm-pl li + li {
	border-top: 1px solid var(--line);
}

.vm-pl button {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	width: 100%;
	min-height: 56px;
	padding: 10px 8px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: transparent;
	color: var(--ink);
	text-align: left;
	cursor: pointer;
}

.vm-pl button:hover {
	background-color: var(--tint);
}

.vm-pl b {
	font: 700 1.25rem/1.1 var(--display);
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.vm-pl span {
	font-size: 0.8125rem;
	color: var(--ink-3);
}

.vm-panel dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 8px 16px;
	margin: 0;
}

.vm-panel dt {
	font: 600 0.75rem/1.6 var(--sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.vm-panel dd {
	margin: 0;
	color: var(--ink);
}

.vm-num {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

.vm-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Table view. */
.vm-table {
	margin-top: 20px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg-2);
}

.vm-table > summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 16px;
	padding: 16px 20px;
	font: 700 1.375rem/1.1 var(--display);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	list-style: none;
	cursor: pointer;
}

.vm-table > summary::-webkit-details-marker {
	display: none;
}

.vm-table > summary::before {
	content: '+';
	width: 18px;
	color: var(--red-hover);
}

.vm-table[open] > summary::before {
	content: '\2212';
}

.vm-table > summary:hover {
	background-color: var(--tint);
}

.vm-table > summary small {
	font: 400 0.875rem/1.3 var(--sans);
	text-transform: none;
	letter-spacing: 0;
	color: var(--ink-3);
}

.vm-tablewrap {
	overflow-x: auto;
	border-top: 1px solid var(--line);
}

.vm-table table {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.vm-table th,
.vm-table td {
	padding: 10px 20px;
	border-bottom: 1px solid var(--line);
	text-align: left;
}

.vm-table thead th {
	font: 600 0.75rem/1.3 var(--sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.vm-table tbody th {
	font-weight: 600;
}

.vm-table tbody th::before {
	content: '';
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 10px;
	border-radius: 2px;
	background: var(--vm-land);
	outline: 1px solid var(--vm-coast);
	outline-offset: -1px;
}

.vm-table tbody tr.vm-is-v th::before {
	background: var(--vm-valleys);
	outline: 0;
}

.vm-table tbody tr.vm-is-sel {
	background: var(--tint);
}

.vm-code {
	font-variant-numeric: tabular-nums;
	color: var(--ink-3);
}

.vm-chk input {
	width: 20px;
	height: 20px;
	accent-color: var(--red);
	cursor: pointer;
}

.vm-chk span {
	color: var(--ink-2);
}

.vm-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	padding: 16px 20px;
}

.vm-admin-note {
	flex: 1 1 100%;
	margin: 0;
	font-size: 0.875rem;
	color: var(--ink-3);
}

.vm-tools .btn:disabled {
	opacity: 0.45;
	cursor: default;
	box-shadow: none;
}

.vm-status {
	font-size: 0.875rem;
	color: var(--ink-2);
}

.vm-notes {
	max-width: 90ch;
	margin: 20px 0 0;
	font-size: 0.8125rem;
	color: var(--ink-3);
}

.vm-failed .vm-mapwrap::after {
	content: 'The map could not load. Try reloading the page.';
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--ink-3);
}

@media (max-width: 640px) {
	.vm-inset {
		top: auto;
		bottom: 10px;
		left: 10px;
		width: 68px;
		padding: 4px 4px 2px;
	}

	.vm-pill > span {
		padding: 3px 8px;
		font-size: 0.75rem;
	}

	.vm-panel {
		padding: 20px;
	}

	.vm-table > summary {
		padding: 14px 16px;
	}

	.vm-table th,
	.vm-table td {
		padding: 10px 14px;
	}

	.vm-lbl.vm-minor,
	.vm-callout {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vm * {
		transition: none !important;
	}
}
