/**
 * UK Social Care Directory — Leaflet skin
 * ----------------------------------------------------------------------------
 * Loaded only on pages with a map, and registered with `leaflet` as a
 * dependency so it can never arrive before the library's own stylesheet.
 *
 * Leaflet's default chrome is built for a light basemap; these overrides
 * make it read correctly against the dark theme without touching Leaflet's
 * own CSS file.
 */

/* Leaflet writes its own inline height onto the container, so the sizing
 * comes from .scd-map in components.css and this only handles the skin. */

.scd-map .leaflet-container {
	width: 100%;
	height: 100%;
	background: var(--scd-surface-3);
	font-family: var(--scd-font-sans);
	font-size: var(--scd-text-sm);
}

/* --- Controls --------------------------------------------------------- */

.scd-map .leaflet-bar {
	border: 1px solid var(--scd-border);
	border-radius: var(--scd-radius-md);
	box-shadow: var(--scd-shadow-2);
	overflow: hidden;
}

.scd-map .leaflet-bar a,
.scd-map .leaflet-bar a:hover {
	width: 34px;
	height: 34px;
	line-height: 34px;
	border-bottom-color: var(--scd-border-subtle);
	background: var(--scd-surface-2);
	color: var(--scd-text);
	text-decoration: none;
}

.scd-map .leaflet-bar a:hover { background: var(--scd-surface-1); color: var(--scd-accent-on-soft); }

.scd-map .leaflet-bar a.leaflet-disabled {
	background: var(--scd-surface-3);
	color: var(--scd-text-subtle);
}

/* --- Popup ------------------------------------------------------------ */

.scd-map .leaflet-popup-content-wrapper {
	border: 1px solid var(--scd-border);
	border-radius: var(--scd-radius-lg);
	background: var(--scd-surface-2);
	color: var(--scd-text);
	box-shadow: var(--scd-shadow-3);
}

.scd-map .leaflet-popup-content {
	margin: var(--scd-space-4);
	font-size: var(--scd-text-sm);
	line-height: var(--scd-leading-normal);
}

.scd-map .leaflet-popup-content a { color: var(--scd-link); font-weight: var(--scd-weight-semibold); }

/* The popup tail is drawn as a rotated square; it must match the wrapper
 * background or it reads as a stray shape. */
.scd-map .leaflet-popup-tip {
	background: var(--scd-surface-2);
	border: 1px solid var(--scd-border);
	box-shadow: none;
}

.scd-map .leaflet-popup-close-button {
	width: 28px;
	height: 28px;
	padding: 0;
	color: var(--scd-text-muted);
	font-size: 20px;
	line-height: 28px;
}

.scd-map .leaflet-popup-close-button:hover { color: var(--scd-text); background: transparent; }

.scd-map__popup-title {
	display: block;
	margin-bottom: var(--scd-space-1);
	font-size: var(--scd-text-base);
	font-weight: var(--scd-weight-semibold);
	color: var(--scd-text);
}

.scd-map__popup-meta { color: var(--scd-text-muted); font-size: var(--scd-text-xs); }

/* --- Attribution ------------------------------------------------------
 * Required by the OSM/Carto tile licence — restyle, never remove. */

.scd-map .leaflet-control-attribution {
	background: var(--scd-overlay);
	color: var(--scd-text-subtle);
	font-size: 10px;
	padding: 2px var(--scd-space-2);
}

.scd-map .leaflet-control-attribution a { color: var(--scd-text-muted); }

/* --- Markers ----------------------------------------------------------- */

.scd-marker {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border: 2px solid var(--scd-surface-0);
	border-radius: var(--scd-radius-circle);
	background: var(--scd-marker-colour, var(--scd-accent));
	color: var(--scd-accent-contrast);
	font-size: 11px;
	font-weight: var(--scd-weight-bold);
	box-shadow: var(--scd-shadow-2);
}

.scd-marker--outstanding { --scd-marker-colour: var(--scd-success); }
.scd-marker--good { --scd-marker-colour: var(--scd-info); }
.scd-marker--requires-improvement { --scd-marker-colour: var(--scd-warning); }
.scd-marker--inadequate { --scd-marker-colour: var(--scd-danger); }

/* Leaflet applies its own positioning to divIcon wrappers; keep ours clean. */
.scd-map .leaflet-div-icon { background: transparent; border: 0; }

/* Search-radius circle. */
.scd-map .scd-radius {
	stroke: var(--scd-accent);
	fill: var(--scd-accent);
	fill-opacity: 0.08;
}
