/* WP GPX Maps Pro: story map */

/* Story points in the text */
.wpgpxmaps-story-point {
	display: flex;
	gap: 0.5em;
	align-items: center;
	margin-top: 1.5em;
	padding: 0.45em 0.75em;
	border-left: 3px solid #3366cc;
	border-radius: 4px;
	background: rgba(51, 102, 204, 0.07);
	font-weight: 600;
	cursor: pointer;
	scroll-margin-top: 30vh;
	transition: background-color 0.2s;
}

.wpgpxmaps-story-point.is-active {
	background: rgba(51, 102, 204, 0.18);
}

.wpgpxmaps-story-point-icon {
	font-size: 1.2em;
	line-height: 1;
}

/* Editor */
.wpgpxmaps-story-point-input {
	flex: 1;
	border: 0;
	background: transparent;
	font: inherit;
}

.wpgpxmaps-story-point.is-missing-place {
	border-left-color: #d63638;
}

.wpgpxmaps-story-point-warning {
	margin-left: auto;
	color: #d63638;
	font-weight: 400;
}

/* Text and map side by side */
.wpgpxmaps-story {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 2.5rem;
	align-items: start;
}

.wpgpxmaps-story-text > * {
	max-width: none;
}

.wpgpxmaps-story-aside {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + 16px);
	max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - 32px);
	overflow: auto;
}

.wpgpxmaps-story-aside div[id^="map_"] {
	height: 60vh !important;
}

.wpgpxmaps-story-toggle {
	display: none;
}

/* Markers of the story points on the map */
.wpgpxmaps-story-marker {
	cursor: pointer;
}

.wpgpxmaps-story-marker-dot {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 30px;
	height: 30px;
	border: 2px solid #3366cc;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
	font-size: 15px;
	line-height: 1;
	transition: transform 0.2s, background-color 0.2s;
}

.wpgpxmaps-story-marker-dot img.emoji {
	width: 16px !important;
	height: 16px !important;
	margin: 0 !important;
}

.wpgpxmaps-story-marker.is-active .wpgpxmaps-story-marker-dot {
	transform: scale(1.35);
	background: #3366cc;
}

/* Mapbox: above the other markers of the map (distance markers, current position), so they can be clicked */
.mapboxgl-marker.wpgpxmaps-story-marker {
	z-index: 2;
}

.mapboxgl-marker.wpgpxmaps-story-marker.is-active {
	z-index: 3;
}

/* Leaflet: the marker is inside the icon box that Leaflet positions */
.leaflet-marker-icon:has(> .wpgpxmaps-story-marker) {
	z-index: 1000 !important;
}

/* Small screens: the map stays at the top of the window and can be hidden */
@media (max-width: 781px) {
	.wpgpxmaps-story {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.wpgpxmaps-story-aside {
		order: -1;
		top: var(--wp-admin--admin-bar--height, 0px);
		z-index: 50;
		max-height: none;
		overflow: visible;
		padding-bottom: 0.5rem;
		background: var(--wp--preset--color--base, #fff);
	}

	.wpgpxmaps-story-aside div[id^="map_"] {
		height: 38vh !important;
	}

	.wpgpxmaps-story-aside canvas.plot,
	.wpgpxmaps-story-aside .wpgpxmaps-pro-chart-download,
	.wpgpxmaps-story-aside .wpgpxmaps_summary {
		display: none !important;
	}

	.wpgpxmaps-story-toggle {
		display: block;
		width: 100%;
		margin-bottom: 0.4rem;
		padding: 0.4em;
		border: 1px solid rgba(0, 0, 0, 0.15);
		border-radius: 4px;
		background: rgba(255, 255, 255, 0.9);
		font: inherit;
		font-size: 0.9em;
		cursor: pointer;
	}

	.wpgpxmaps-story.is-map-hidden .wpgpxmaps-story-aside .wpgpxmaps-story-map {
		display: none;
	}
}
