/**
 * STW Routes - the route finder.
 *
 * The finder root carries .stw-route as well, so it inherits the palette tokens
 * (and their dark-mode redefinitions) from stw-routes.css. Nothing here may
 * hard-code a colour that is not also correct on a #121212 page - see the note
 * at the top of that file.
 *
 * Grade colours are the exception: they are meaning, not decoration, and are
 * the same in both modes so the key stays learnable. They are set in one place
 * here and mirrored in the JS that draws the pins.
 */

.stw-routes-finder {
	padding-bottom: 40px;
}

.stw-routes-archive-header {
	padding-bottom: 0;
}

/* Filters */
.stw-routes-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	align-items: flex-end;
	background: var(--stw-route-panel);
	border: 1px solid var(--stw-route-rule);
	border-radius: 6px;
	padding: 16px 18px;
	margin: 0 0 14px;
}

.stw-routes-filter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.stw-route .stw-routes-filter label {
	font-size: 0.6875rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--stw-route-muted);
	font-weight: 700;
}

.stw-route .stw-routes-filter select,
.stw-route .stw-routes-filter input[type="search"] {
	background: var(--stw-route-surface);
	color: var(--stw-route-ink);
	border: 1px solid var(--stw-route-rule);
	border-radius: 4px;
	padding: 7px 10px;
	font-size: 0.9375rem;
	min-height: 38px;
	max-width: 100%;
}

.stw-routes-filter--search {
	flex: 1 1 220px;
}

.stw-route .stw-routes-filter--search input {
	width: 100%;
}

.stw-routes-filter--actions {
	flex-direction: row;
	gap: 8px;
	margin-left: auto;
}

.stw-route .stw-routes-near,
.stw-route .stw-routes-reset {
	background: var(--stw-route-surface);
	color: var(--stw-route-ink);
	border: 1px solid var(--stw-route-rule);
	border-radius: 4px;
	padding: 8px 14px;
	min-height: 38px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
}

.stw-route .stw-routes-near {
	border-color: var(--stw-route-accent);
	color: var(--stw-route-accent);
}

.stw-route .stw-routes-near:hover:not( :disabled ),
.stw-route .stw-routes-reset:hover {
	border-color: var(--stw-route-ink);
}

.stw-route .stw-routes-near:disabled {
	opacity: 0.6;
	cursor: default;
}

.stw-route .stw-routes-count {
	margin: 0 0 12px;
	color: var(--stw-route-muted);
	font-size: 0.9375rem;
}

.stw-route .stw-routes-count strong {
	color: var(--stw-route-ink);
	font-size: 1.0625rem;
}

.stw-routes-count-note {
	font-style: italic;
}

/* Layout: map beside a scrolling list, stacked on narrow screens. */
.stw-routes-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
	gap: 20px;
	align-items: start;
}

@media (max-width: 900px) {
	.stw-routes-layout {
		grid-template-columns: 1fr;
	}
}

.stw-routes-map-wrap {
	position: relative;
	border: 1px solid var(--stw-route-rule);
	border-radius: 6px;
	overflow: hidden;
}

#stw-routes-map {
	width: 100%;
	background: #e8e4dd;
}

/* Key sits on the map, so it needs its own light ground in both modes. */
.stw-route .stw-routes-key {
	position: absolute;
	left: 10px;
	bottom: 10px;
	z-index: 500;
	margin: 0;
	padding: 8px 10px;
	list-style: none;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 4px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	font-size: 0.75rem;
	line-height: 1.6;
	color: #1f2933;
}

.stw-route .stw-routes-key li {
	display: flex;
	align-items: center;
	gap: 6px;
	color: #1f2933;
	margin: 0;
}

.stw-routes-key-dot,
.stw-routes-item-dot {
	display: inline-block;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	flex: 0 0 auto;
	box-shadow: 0 0 0 1.5px #fff;
}

/* Grade colours - meaning, identical in both modes. Mirrored in the JS. */
[data-grade="easy"] { background: #1a7f37; }
[data-grade="moderate"] { background: #1f6feb; }
[data-grade="hard"] { background: #c8102e; }
[data-grade="severe"] { background: #1b1f24; }
[data-grade=""] { background: #8b949e; }

/* Results list */
.stw-route .stw-routes-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 560px;
	overflow-y: auto;
	border: 1px solid var(--stw-route-rule);
	border-radius: 6px;
}

@media (max-width: 900px) {
	.stw-route .stw-routes-list {
		max-height: 420px;
	}
}

.stw-routes-item {
	margin: 0;
	border-bottom: 1px solid var(--stw-route-rule);
}

.stw-routes-item:last-child {
	border-bottom: 0;
}

.stw-routes-item.is-hover {
	background: var(--stw-route-panel);
}

.stw-route a.stw-routes-item-link {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 12px 14px;
	text-decoration: none;
	color: inherit;
}

.stw-route a.stw-routes-item-link:hover,
.stw-route a.stw-routes-item-link:focus {
	background: var(--stw-route-panel);
}

.stw-routes-item-dot {
	margin-top: 5px;
}

.stw-routes-item-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.stw-route .stw-routes-item-title {
	font-weight: 700;
	line-height: 1.3;
	color: var(--stw-route-ink);
}

.stw-route .stw-routes-item-meta,
.stw-route .stw-routes-item-away {
	font-size: 0.8125rem;
	color: var(--stw-route-muted);
}

.stw-route .stw-routes-item-away {
	font-weight: 600;
	color: var(--stw-route-accent);
}

.stw-route .stw-routes-noresults,
.stw-route .stw-routes-finder-empty {
	color: var(--stw-route-muted);
	padding: 16px 0;
}

/* The Routes tab on a member's Ultimate Member profile */
.stw-routes-profile {
	padding: 0;
	max-width: none;
}

.stw-route .stw-routes-profile-intro {
	margin: 0 0 14px;
	color: var(--stw-route-ink);
}

.stw-routes-profile-list {
	max-height: none;
}

.stw-route .stw-routes-profile-more {
	margin: 14px 0 0;
	font-size: 0.875rem;
}

.stw-route .stw-routes-profile-more a {
	color: var(--stw-route-accent);
	font-weight: 600;
}

/* Popups are Leaflet's own furniture, sitting on the light map. */
.stw-routes-popup {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.stw-routes-popup-thumb {
	width: 100%;
	height: 90px;
	object-fit: cover;
	border-radius: 3px;
	margin-bottom: 4px;
}

.leaflet-popup-content .stw-routes-popup-title {
	font-weight: 700;
	font-size: 0.9375rem;
	color: #1f2933;
	text-decoration: none;
	line-height: 1.25;
}

.leaflet-popup-content .stw-routes-popup-title:hover {
	text-decoration: underline;
}

.stw-routes-popup-meta {
	font-size: 0.8125rem;
	color: #5b6570;
}

.stw-routes-popup-verified {
	font-size: 0.75rem;
	color: #1a5c2a;
	font-weight: 600;
}
