/* Crow's Path animated map. Everything is scoped to .cpm-map so theme styles don't leak in or out. */
.cpm-map {
	--ink: #e9ecf1; --ink-soft: #a1aab8; --paper: #202226; --panel: rgba(28,31,37,.9);
	--rule: #3d4452; --station: #d7dce4; --focus: #8fb2ff;
	position: relative; width: 100%; min-height: 360px; overflow: hidden;
	background: var(--paper); color: var(--ink); border-radius: 0;
	font-family: inherit; font-size: 14px; line-height: 1.45; color-scheme: dark;
	isolation: isolate;
}
.cpm-map *, .cpm-map *::before, .cpm-map *::after { box-sizing: border-box; }
.cpm-map .cpm-canvas { position: absolute; inset: 0; background: var(--paper); }
.cpm-map .cpm-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); padding: 24px; text-align: center; z-index: 900; background: var(--paper); }

.cpm-map .cpm-card { position: absolute; z-index: 700; top: 12px; left: 12px; max-width: min(320px, calc(100% - 24px));
	background: var(--panel); border-radius: 10px; padding: 12px 14px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.25); backdrop-filter: blur(6px); }
.cpm-map .cpm-title { font: inherit; font-size: 18px; font-weight: 600; line-height: 1.25; margin: 0 0 4px; color: var(--ink); letter-spacing: normal; text-transform: none; }
.cpm-map .cpm-date { margin: 0; color: var(--ink-soft); font-size: 13px; }
.cpm-map .cpm-date select { font: inherit; font-size: 13px; color: var(--ink); background: #2a2e36; border: 1px solid var(--rule); border-radius: 6px; padding: 3px 6px; margin: 0; max-width: 100%; height: auto; }
.cpm-map .cpm-key { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.cpm-map .cpm-key-text { margin: 0 0 6px; font-size: 12px; line-height: 1.4; color: var(--ink-soft); }
.cpm-map .cpm-key-bar { height: 8px; border-radius: 4px; }
.cpm-map .cpm-key-labels { display: flex; justify-content: space-between; margin-top: 3px; font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.cpm-map .cpm-clock { position: absolute; z-index: 700; top: 12px; right: 12px; text-align: right; pointer-events: none;
	font-style: italic; font-size: 40px; line-height: 1; color: var(--ink); text-shadow: 0 0 6px var(--paper), 0 0 16px var(--paper); }
.cpm-map .cpm-clock small { display: block; font-style: normal; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.cpm-map .cpm-controls { position: absolute; z-index: 700; left: 12px; right: 12px; bottom: 26px;
	background: var(--panel); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.25);
	display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; backdrop-filter: blur(6px); }
.cpm-map button.cpm-btn { appearance: none; -webkit-appearance: none; font: inherit; font-size: 13px; line-height: 1; letter-spacing: normal; text-transform: none;
	color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 8px; box-shadow: none;
	height: 36px; min-height: 0; padding: 0 10px; margin: 0; cursor: pointer; text-decoration: none; }
.cpm-map button.cpm-btn:hover { border-color: var(--ink-soft); background: transparent; color: var(--ink); }
.cpm-map button.cpm-btn:focus-visible, .cpm-map select:focus-visible, .cpm-map input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cpm-map .cpm-play { width: 44px; padding: 0; display: grid; place-items: center; }
.cpm-map .cpm-play svg { display: block; }
.cpm-map .cpm-timeline { position: relative; height: 44px; }
.cpm-map .cpm-bars { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; }
.cpm-map input.cpm-scrub { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; border: 0; }
.cpm-map .cpm-head { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; pointer-events: none; transform: translateX(-1px); }
.cpm-map input.cpm-scrub:focus-visible + .cpm-head { box-shadow: 0 0 0 2px var(--focus); }
.cpm-map .cpm-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.cpm-map .cpm-right { display: flex; gap: 8px; align-items: center; }
.cpm-map .cpm-speed { display: flex; gap: 4px; }
.cpm-map .cpm-speed button.cpm-btn { height: 28px; padding: 0 8px; font-size: 12px; }
.cpm-map .cpm-speed button.cpm-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.cpm-map canvas.cpm-flow { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; max-width: none !important; z-index: 450; pointer-events: none; }
.cpm-map canvas.cpm-bars { max-width: none !important; }
.cpm-map .cpm-arrow svg { overflow: visible; display: block; }

/* Leaflet inside the dark map */
.cpm-map .leaflet-container { background: var(--paper); font: inherit; }
.cpm-map .leaflet-tooltip { font: inherit; font-size: 12px; background: #2a2e36; color: var(--ink); border-color: #2a2e36; box-shadow: none; }
.cpm-map .leaflet-tooltip-top::before { border-top-color: #2a2e36; }
.cpm-map .leaflet-control-attribution { background: rgba(28,31,37,.75) !important; color: var(--ink-soft); font-size: 10px; }
.cpm-map .leaflet-control-attribution a { color: #b9c6da; }
.cpm-map .leaflet-bar a { background: #2a2e36; color: var(--ink); border-bottom-color: var(--rule); }
.cpm-map .leaflet-bar a:hover { background: #353a44; }
.cpm-map .leaflet-top.leaflet-right { margin-top: 84px; display: flex; flex-direction: column; align-items: flex-end; }
/* Maximize button, top right above the zoom buttons */
.cpm-map .cpm-max { clear: both; }
.cpm-map button.cpm-max-btn {
	appearance: none; -webkit-appearance: none; display: inline-flex; align-items: center; gap: 7px;
	height: 36px; min-height: 0; margin: 0; padding: 0 12px 0 10px;
	font: inherit; font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: normal; text-transform: none;
	color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0,0,0,.25); cursor: pointer; backdrop-filter: blur(6px);
}
.cpm-map button.cpm-max-btn:hover { border-color: var(--ink-soft); background: #2a2e36; color: var(--ink); }
.cpm-map button.cpm-max-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cpm-map button.cpm-max-btn svg { flex: none; display: block; }

@media (max-width: 560px) {
	.cpm-map .cpm-clock { font-size: 30px; top: auto; bottom: 150px; }
	.cpm-map .cpm-controls { grid-template-columns: auto 1fr; }
	.cpm-map .cpm-right { grid-column: 1 / -1; justify-content: flex-end; }
	.cpm-map .cpm-key-text { display: none; }
	.cpm-map .leaflet-control-zoom { display: none; }
}

/* Full window: [crowspath_map height="full"] fills the browser window, edge to edge */
.cpm-map.cpm-full {
	height: 100vh; height: 100dvh; min-height: 420px;
	width: 100vw; max-width: 100vw;
	margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
	border-radius: 0;
}
body.admin-bar .cpm-map.cpm-full { height: calc(100vh - 32px); height: calc(100dvh - 32px); }
@media (max-width: 782px) { body.admin-bar .cpm-map.cpm-full { height: calc(100vh - 46px); height: calc(100dvh - 46px); } }

/* Fullscreen button: real fullscreen where the browser allows it, otherwise cover the window */
.cpm-map:fullscreen { width: 100vw; height: 100vh; border-radius: 0; margin: 0; }
.cpm-map.cpm-cover {
	position: fixed !important; inset: 0; z-index: 999999;
	width: 100vw !important; max-width: none !important; height: 100vh !important; height: 100dvh !important;
	margin: 0 !important; border-radius: 0;
}
html.cpm-noscroll, html.cpm-noscroll body { overflow: hidden; }
.cpm-map .cpm-controls, .cpm-map .cpm-card, .cpm-map .cpm-clock { margin-bottom: env(safe-area-inset-bottom, 0px); }

/* Link back to the site on the full-screen page */
.cpm-map a.cpm-home { display: inline-flex; align-items: center; gap: 4px; margin: -2px 0 6px; min-height: 28px;
	font-size: 13px; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
.cpm-map a.cpm-home:hover { color: var(--ink); text-decoration: underline; }
.cpm-map a.cpm-home:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
