/*
 * Camp map: [camp_map] and the Camp map widget.
 *
 * Colors and type come from the theme's page kit tokens (--ca-kit-*), like the
 * schedule, with fallbacks so it still looks right under another theme. The
 * map's own colors match the printed map.
 */

.camp-map {
	--cm-ink: var(--ca-kit-ink, #2a1f16);
	--cm-muted: var(--ca-kit-ink-muted, #5c3d28);
	--cm-heading: var(--ca-kit-heading, #1a4a2e);
	--cm-border: var(--ca-kit-border, #e4dccd);
	--cm-card: var(--ca-kit-card, #ffffff);
	--cm-focus: var(--ca-focus-on-light, #1a4a2e);
	--cm-heading-font: "Roboto Slab", Georgia, serif;
	--cm-camp: #2e6b3c;
	--cm-building: #33393a;
	--cm-paper: #fbfaf6;

	container-type: inline-size;
	color: var(--cm-ink);
	font-size: 16px;
	line-height: 1.45;
}

.camp-map *,
.camp-map *::before,
.camp-map *::after {
	box-sizing: border-box;
}

.camp-map :focus-visible {
	outline: 3px solid var(--cm-focus);
	outline-offset: 2px;
}

/* Anything marked hidden stays hidden, even where a rule below sets display (the search box
   before the map has drawn, or when it can't load). */
.camp-map [hidden] {
	display: none !important;
}

/* Heading */
.camp-map .cm-title {
	margin: 0 0 16px;
	color: var(--cm-heading);
	font-family: var(--cm-heading-font);
}

/* Search */
.cm-search {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: 420px;
	margin-bottom: 12px;
}

.cm-search-label {
	font-weight: 600;
}

.camp-map .cm-search-input {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid var(--cm-border);
	border-radius: 4px;
	background: var(--cm-card);
	color: var(--cm-ink);
	font: inherit;
}

.cm-search-none {
	min-height: 1.45em;
	margin: 0;
	color: var(--cm-muted);
	font-size: 14px;
}

/* Preview note, the same as the program pages' (.cp-preview) */
.camp-map .cm-preview {
	margin: 0 0 20px;
	padding: 12px 16px;
	border: 1px solid var(--ca-kit-btn-primary, #c9843a);
	border-radius: 6px;
	background: var(--ca-gold-light, #f5e8d6);
	color: var(--cm-ink);
	font-size: 0.95rem;
	line-height: 1.5;
}

.camp-map .cm-preview p {
	margin: 0;
}

.camp-map .cm-preview-label {
	display: inline-block;
	margin-right: 8px;
	padding: 1px 8px;
	border-radius: 3px;
	background: var(--cm-ink);
	color: #fff;
	font-size: 0.8rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	vertical-align: 0.1em;
}

.camp-map .cm-preview a {
	color: inherit;
	font-weight: 600;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

@media print {
	.camp-map .cm-preview {
		display: none;
	}
}

/* Link to the full-screen map */
.cm-open-app {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	margin: 0 0 12px;
}

.camp-map .cm-open-app-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 8px 18px;
	border-radius: 22px;
	background: var(--cm-heading);
	color: #fff;
	font-weight: 700;
	text-decoration: none;
}

.camp-map .cm-open-app-link:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.cm-open-app-note {
	color: var(--cm-muted);
	font-size: 14px;
}

/* The map */
.cm-map {
	position: relative;
	z-index: 0; /* keeps Leaflet's layers under the site's menus */
	width: 100%;
	height: 460px;
	border: 1px solid var(--cm-border);
	border-radius: 6px;
	background: var(--cm-paper);
	font: inherit;
}

.cm-map.cm-short { height: 340px; }
.cm-map.cm-tall { height: 640px; }

@container (max-width: 600px) {
	.cm-map.cm-medium,
	.cm-map.cm-tall { height: 70vh; max-height: 560px; }
}

.camp-map .leaflet-container {
	background: var(--cm-paper);
	font-family: inherit;
}

.camp-map .leaflet-control-zoom a {
	width: 40px;
	height: 40px;
	line-height: 40px;
	font-size: 20px;
}

/* Place symbols */
.cm-marker {
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
}

.cm-marker svg {
	display: block;
	overflow: visible;
}

/* A traced building's footprint stands in for its square until it's too small to see. */
.cm-marker-traced:not(.cm-trace-small) svg {
	visibility: hidden;
}

.cm-marker.cm-selected svg {
	transform: scale(1.4);
	filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
}

/* Region names: quiet spaced capitals in the middle of the area, under the place names */
.cm-region {
	background: none;
	border: 0;
	width: auto !important;
	height: auto !important;
}

.cm-region-name {
	display: block;
	transform: translate(-50%, -50%);
	color: #4a3b2e;
	font-size: 11px;
	font-style: italic;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff;
}

/* Parcel names: small and quiet, under everything else, shown only zoomed out */
.cm-parcel {
	background: none;
	border: 0;
	width: auto !important;
	height: auto !important;
	pointer-events: none;
}

.cm-parcel-name {
	display: block;
	transform: translate(-50%, -50%);
	color: #4a3b2e;
	font-size: 11px;
	font-style: italic;
	white-space: nowrap;
	text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff;
}

.cm-region.cm-selected .cm-region-name,
.cm-region.cm-hover .cm-region-name,
.cm-region:focus-visible .cm-region-name {
	opacity: 1;
	color: #3d342b;
}

/* Names on the map: campsites in bold, everything else plain, both with a white halo like the print */
.camp-map .leaflet-tooltip.cm-label {
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: #1d231f;
	font-size: 13px;
	font-weight: 700;
	white-space: nowrap;
	text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff, 0 0 5px #fff;
}

.camp-map .leaflet-tooltip.cm-label::before {
	display: none;
}

.camp-map .leaflet-tooltip.cm-label-place {
	color: #33393a;
	font-size: 12px;
	font-weight: 400;
}

/* Names are a size smaller when zoomed out, so more of them fit */
.camp-map .cm-zoom-0 .leaflet-tooltip.cm-label {
	font-size: 12px;
}

.camp-map .cm-zoom-0 .leaflet-tooltip.cm-label-place {
	font-size: 11px;
}

/* The picked place, or the one pointed at in a list, always shows its name, on top */
.camp-map .leaflet-tooltip.cm-label.cm-selected,
.camp-map .leaflet-tooltip.cm-label.cm-hover {
	visibility: visible !important;
	z-index: 1000;
	color: #1a4a2e;
	font-weight: 700;
}

.cm-marker.cm-hover svg {
	transform: scale(1.4);
	filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
}

.camp-map .leaflet-popup-content {
	margin: 12px 16px;
	font-size: 15px;
}

.cm-popup-name {
	margin: 0;
	font-weight: 700;
}

.cm-popup-note {
	margin: 4px 0 0;
	color: var(--cm-muted);
	font-size: 13px;
}

.camp-map .leaflet-control-attribution {
	font-size: 11px;
}

/* The list of places */
.cm-list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 8px 24px;
	margin-top: 20px;
}

.camp-map .cm-group-title {
	margin: 0 0 6px;
	color: var(--cm-heading);
	font-family: var(--cm-heading-font);
	font-size: 18px;
}

.cm-places {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cm-place {
	margin: 0;
	padding: 2px 0;
}

.cm-place[hidden] {
	display: none;
}

.camp-map .cm-show {
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--cm-ink);
	font: inherit;
	text-align: left;
	text-decoration: underline;
	text-decoration-color: var(--cm-border);
	text-underline-offset: 3px;
	cursor: pointer;
}

.camp-map .cm-show:hover {
	color: var(--cm-heading);
	text-decoration-color: currentColor;
}

.cm-note,
.cm-missing {
	color: var(--cm-muted);
}

@media (prefers-reduced-motion: reduce) {
	.camp-map .leaflet-zoom-anim .leaflet-zoom-animated {
		transition: none;
	}
}
