/* Tokens follow the house data-viz palette: chart surface, ink ladder,
 * hairline grid, and the blue/orange/red ramps used by the map itself. Dark
 * mode is a selected set of steps, not an inversion. */
:root {
	--surface-1: #fcfcfb;
	--plane: #f9f9f7;
	--text-primary: #0b0b0b;
	--text-secondary: #52514e;
	--text-muted: #898781;
	--gridline: #e1e0d9;
	--border: rgba(11, 11, 11, .10);
	--series-1: #2a78d6;
	--select-wash: rgba(42, 120, 214, .12);
	--map-water: #edece7;
	--map-coast: rgba(11, 11, 11, .38);
	--map-border: rgba(11, 11, 11, .22);
	--map-pin-ring: #fcfcfb;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--surface-1: #1a1a19;
		--plane: #0d0d0d;
		--text-primary: #ffffff;
		--text-secondary: #c3c2b7;
		--text-muted: #898781;
		--gridline: #2c2c2a;
		--border: rgba(255, 255, 255, .10);
		--series-1: #3987e5;
		--select-wash: rgba(57, 135, 229, .20);
		--map-water: #131312;
		--map-coast: rgba(255, 255, 255, .30);
		--map-border: rgba(255, 255, 255, .22);
		--map-pin-ring: #1a1a19;
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--surface-1: #1a1a19;
	--plane: #0d0d0d;
	--text-primary: #ffffff;
	--text-secondary: #c3c2b7;
	--text-muted: #898781;
	--gridline: #2c2c2a;
	--border: rgba(255, 255, 255, .10);
	--series-1: #3987e5;
	--select-wash: rgba(57, 135, 229, .20);
	--map-water: #131312;
	--map-coast: rgba(255, 255, 255, .30);
	--map-border: rgba(255, 255, 255, .22);
	--map-pin-ring: #1a1a19;
	color-scheme: dark;
}

* { box-sizing: border-box; }

body {
	margin: 0 auto;
	padding: 24px 20px 48px;
	max-width: 1180px;
	background: var(--plane);
	color: var(--text-primary);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.sr {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.sub { margin: 4px 0 0; color: var(--text-secondary); }

.controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px 20px;
	margin: 20px 0 10px;
}

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface-1); }
.seg button {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--text-secondary);
	padding: 7px 16px;
	font: inherit;
	cursor: pointer;
}
.seg button.on { background: var(--series-1); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--series-1); outline-offset: -2px; }

.weekpick { display: flex; align-items: center; gap: 10px; flex: 1 1 420px; }
.weekpick input[type=range] { flex: 1 1 auto; min-width: 160px; accent-color: var(--series-1); }
.weekread { min-width: 168px; display: flex; flex-direction: column; line-height: 1.25; }
.weekread strong { font-variant-numeric: tabular-nums; }
.weekread span { color: var(--text-secondary); font-size: 13px; }
.len select, .ghost {
	font: inherit;
	color: var(--text-primary);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 6px 10px;
	cursor: pointer;
}

.note { margin: 0 0 8px; color: var(--text-secondary); font-size: 13px; min-height: 1em; }

.finder {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 18px;
	padding: 10px 14px;
	margin-bottom: 14px;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 12px;
}
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.fields { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.fields label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-secondary); }
.fields input { accent-color: var(--series-1); width: 150px; }
.fields output { font-variant-numeric: tabular-nums; color: var(--text-primary); }
.hits { margin-left: auto; color: var(--text-secondary); font-size: 13px; }

main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }

.mapwrap { position: relative; margin: 0; }
#map {
	width: 100%;
	height: auto;
	display: block;
	background: var(--map-water);
	border: 1px solid var(--border);
	border-radius: 12px;
	cursor: crosshair;
}

.tip {
	position: absolute;
	z-index: 3;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: 7px 10px;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
	font-size: 12px;
	color: var(--text-secondary);
}
.tip strong { color: var(--text-primary); font-size: 13px; }

.legendbox { margin: 12px 2px 0; }
.legendtitle { font-size: 12px; color: var(--text-secondary); }
.legend { display: block; width: 100%; height: 14px; border-radius: 4px; margin-top: 4px; }
.ticks { position: relative; height: 16px; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; transform: translateX(-50%); top: 2px; }

.detail {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 14px 16px;
}
.detail h2 { margin: 0; font-size: 17px; }
.coords { margin: 2px 0 10px; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.detail dl { margin: 0; display: grid; gap: 8px; }
.detail dt { font-size: 12px; color: var(--text-secondary); }
.detail dd { margin: 0; font-size: 17px; font-variant-numeric: tabular-nums; }
.detail .soft { color: var(--text-muted); font-size: 12px; }
#profile { width: 100%; height: 120px; margin-top: 12px; }

.about { margin-top: 26px; max-width: 70ch; color: var(--text-secondary); }
.about h2 { font-size: 15px; color: var(--text-primary); }
.about a { color: var(--series-1); }

.foot {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 26px;
	padding-top: 12px;
	border-top: 1px solid var(--gridline);
	color: var(--text-muted);
	font-size: 12px;
}

.baseline { display: flex; align-items: center; gap: 8px; }
.ctl-label { font-size: 13px; color: var(--text-secondary); }
#periodSeg button { padding: 7px 12px; font-variant-numeric: tabular-nums; }

.zoomer {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	gap: 4px;
}
.zoomer .ghost { padding: 4px 9px; line-height: 1; }
.zoomer .ghost[disabled] { opacity: .4; cursor: default; }
.zoomlabel {
	font-size: 12px;
	color: var(--text-secondary);
	font-variant-numeric: tabular-nums;
	min-width: 30px;
}
#map { touch-action: none; }
