/* Morgan Interactive Map – container and hotspots */

.morgan-interactive-map {
	margin: 0 auto 2em;
	padding: 0;
}

/* Mobile: hidden by default; shown below 1024px */
.morgan-interactive-map-mobile {
	display: none;
}

.morgan-map-container {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10; /* adjust to match your map image ratio */
	overflow: visible; /* allow tooltip cards to extend beyond container */
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.morgan-map-background {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Extra top/bottom breathing room so tooltips aren't clipped visually */
.morgan-interactive-map {
	padding-top: 18px;
	padding-bottom: 18px;
}

/* Hotspot: positioned by percentage, centered on x/y. Size stays fixed to avoid shift. */
.morgan-map-hotspot {
	position: absolute;
	transform: translate(-50%, -50%);
	z-index: 2;
	cursor: pointer;
	transition: z-index 0.25s ease;
}

.morgan-map-hotspot--pin-large .morgan-hotspot-pin:has(.morgan-hotspot-logo),
.morgan-map-hotspot--pin-large.is-open .morgan-hotspot-pin:has(.morgan-hotspot-logo),
.morgan-map-hotspot--pin-large:focus-within .morgan-hotspot-pin:has(.morgan-hotspot-logo) {
	box-shadow: none;
}

/* Arrow above pin (e.g. Camp “14 Miles North”) */
.morgan-hotspot-arrow {
	position: absolute;
	left: 50%;
	bottom: 100%;
	transform: translateX(-50%);
	margin-bottom: 4px;
	width: 0;
	height: 0;
	border-left: 14px solid transparent;
	border-right: 14px solid transparent;
	border-bottom: 18px solid #fff;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
	pointer-events: none;
}

/* Label below pin (e.g. “14 Miles North”) */
.morgan-hotspot-pin-label {
	position: absolute;
	top: 115%;
	left: 50%;
	transform: translateX(-50%) translateX(8px);
	margin-top: 6px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #ffffff;
	white-space: nowrap;
	pointer-events: none;
	z-index: 1; /* keep callout label below tooltip card */
}

.morgan-map-hotspot.is-open,
.morgan-map-hotspot:focus-within {
	z-index: 10;
}

/* Pin: fixed size so hotspot doesn't shift; scale for growth */
.morgan-hotspot-pin {
	position: relative;
	width: 140px;
	height: 90px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	transform-origin: center center;
}

/* Logo-only pin: no background or shadow, just the logo */
.morgan-hotspot-pin:has(.morgan-hotspot-logo) {
	background: transparent;
	box-shadow: none;
	border-radius: 0;
}

.morgan-map-hotspot.is-open .morgan-hotspot-pin,
.morgan-map-hotspot:focus-within .morgan-hotspot-pin {
	transform: scale(1.17);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.morgan-map-hotspot.is-open .morgan-hotspot-pin:has(.morgan-hotspot-logo),
.morgan-map-hotspot:focus-within .morgan-hotspot-pin:has(.morgan-hotspot-logo) {
	box-shadow: none;
}

/* Slightly larger pin for specific hotspots (e.g. Wonderland, Camp) */
.morgan-map-hotspot--pin-large .morgan-hotspot-pin {
	transform: scale(1.25);
}

.morgan-map-hotspot--pin-large.is-open .morgan-hotspot-pin,
.morgan-map-hotspot--pin-large:focus-within .morgan-hotspot-pin {
	transform: scale(1.45);
}

.morgan-hotspot-logo {
	width: 140px;
	height: 90px;
	object-fit: contain;
	pointer-events: none;
}

.morgan-hotspot-dot {
	display: block;
	width: 14px;
	height: 14px;
	background: rgb(134, 62, 162);

	border-radius: 50%;
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Expanded content (tooltip). Bridge extends hover area into gap. */
.morgan-hotspot-expanded {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	min-width: 200px;
	max-width: 280px;
	padding: 12px 14px;
	padding-top: 14px; /* was 36px when expand icon (shelf) is active — restore with shelf */
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	z-index: 3; /* ensure tooltip appears above pin labels/callouts */
	transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

/* Expand-to-shelf icon: top right of tooltip, visible on hover */
/* Expand icon only (top-right of tooltip); text "Expand" link stays in links row */
.morgan-hotspot-expanded > .morgan-hotspot-expand-shelf:not(.morgan-hotspot-expand-link) {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: none;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 4px;
	font-size: 1rem;
	line-height: 1;
	color: #333;
	cursor: pointer;
	transition: background 0.2s ease;
}

.morgan-hotspot-expanded > .morgan-hotspot-expand-shelf:not(.morgan-hotspot-expand-link):hover {
	background: rgba(134, 62, 162, 0.2);
	color: rgb(134, 62, 162);
}

/* Links row: "Expand | Learn more" in tooltip */
.morgan-hotspot-links {
	font-size: 0.8125rem;
	font-weight: 600;
	margin-top: 8px;
}

/* "Expand" text: match .morgan-hotspot-link exactly */
.morgan-hotspot-expand-link {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 600;
	color: rgb(134, 62, 162);
	text-decoration: none;
	cursor: pointer;
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	line-height: inherit;
	font-family: inherit;
}

.morgan-hotspot-expand-link:hover {
	text-decoration: underline;
	color: rgb(134, 62, 162);
}

.morgan-hotspot-links-sep {
	color: #999;
	margin: 0 0.4em;
	user-select: none;
}

/* Invisible bridge so mouse can move from pin to tooltip without leaving hover */
.morgan-hotspot-expanded::before {
	content: '';
	position: absolute;
	left: 50%;
	bottom: 100%;
	width: 80px;
	height: 16px;
	transform: translateX(-50%);
}

/* When pin is near bottom, show tooltip above */
.morgan-map-hotspot.expand-up .morgan-hotspot-expanded {
	top: auto;
	bottom: 100%;
	transform: translateX(-50%) translateY(-4px);
}

.morgan-map-hotspot.expand-up .morgan-hotspot-expanded::before {
	bottom: auto;
	top: 100%;
}

.morgan-map-hotspot.is-open .morgan-hotspot-expanded,
.morgan-map-hotspot:focus-within .morgan-hotspot-expanded {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(8px);
}

.morgan-map-hotspot.expand-up.is-open .morgan-hotspot-expanded,
.morgan-map-hotspot.expand-up:focus-within .morgan-hotspot-expanded {
	transform: translateX(-50%) translateY(-8px);
}

.morgan-hotspot-title {
	font-weight: 600;
	font-size: 1rem;
	margin-bottom: 6px;
	color: #333;
}

.morgan-hotspot-text {
	font-size: 0.875rem;
	line-height: 1.4;
	color: #333;
	margin-bottom: 8px;
}

/* Tooltip: show short text only; shelf gets long text via clone */
.morgan-hotspot-text--shelf {
	display: none;
}

.morgan-hotspot-link {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 600;
	color: rgb(134, 62, 162);
	text-decoration: none;
}

.morgan-hotspot-link:hover {
	text-decoration: underline;
	color: rgb(134, 62, 162);
}

/* Focus style for accessibility */
.morgan-map-hotspot:focus {
	outline: none;
}

.morgan-map-hotspot .morgan-hotspot-pin:focus {
	color: rgb(134, 62, 162);
	outline-offset: 2px;
}

/* Shelf UI (inactive while shelf is commented out in PHP + map.js — restore both to use these rules) */
/* Shelf: slides in from left when a hotspot is focused */
.morgan-map-shelf {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 100%;
	max-width: 360px;
	background: #fff;
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
	z-index: 20;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
	pointer-events: none;
}

.morgan-map-shelf.is-open {
	transform: translateX(0);
	pointer-events: auto;
}

.morgan-map-shelf-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 50%;
	font-size: 1.5rem;
	line-height: 1;
	color: #333;
	cursor: pointer;
	z-index: 2;
	transition: background 0.2s ease;
}

.morgan-map-shelf-close:hover {
	background: rgba(0, 0, 0, 0.12);
}

.morgan-map-shelf-content {
	flex: 1;
	overflow-y: auto;
	padding: 24px 20px 24px 24px;
	padding-top: 56px;
}

/* Hide expand button when content is cloned into shelf */
.morgan-map-shelf-content .morgan-hotspot-expand-shelf {
	display: none;
}

.morgan-map-shelf-content .morgan-hotspot-links-sep {
	display: none;
}

/* Cloned tooltip content in shelf: visible, full-width layout */
.morgan-map-shelf-content .morgan-hotspot-expanded {
	position: static;
	opacity: 1;
	visibility: visible;
	min-width: 0;
	max-width: none;
	transform: none;
	box-shadow: none;
	padding: 0;
	pointer-events: auto;
}

.morgan-map-shelf-content .morgan-hotspot-expanded::before {
	display: none;
}

.morgan-map-shelf-content .morgan-hotspot-title {
	font-size: 1.25rem;
	margin-bottom: 10px;
}

.morgan-map-shelf-content .morgan-hotspot-text--tooltip {
	display: none;
}

.morgan-map-shelf-content .morgan-hotspot-text--shelf {
	display: block;
	font-size: 0.9375rem;
	line-height: 1.5;
	margin-bottom: 16px;
}

/* When shelf is open, hide the floating tooltip for the focused hotspot */
.morgan-map-hotspot.shelf-open .morgan-hotspot-expanded {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.morgan-hotspot-feature-img {
	width: 100%;
	height: auto;
	max-height: 300px;
	object-fit: contain;
	border-radius: 6px;
	margin-bottom: 16px;
	display: block;
}

/* ========== Mobile (max-width 1023px): flat map + accordion ========== */
@media (max-width: 1023px) {
	.morgan-map-container {
		display: none !important;
	}

	.morgan-interactive-map-mobile {
		display: block;
	}

	.morgan-map-flat {
		width: 100%;
		line-height: 0;
	}

	.morgan-map-flat-img {
		width: 100%;
		height: auto;
		display: block;
	}

	.morgan-map-accordion {
		margin-top: 0;
		border-top: 1px solid rgba(0, 0, 0, 0.08);
	}

	.morgan-accordion-item {
		border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	}

	.morgan-accordion-summary {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 16px 20px;
		list-style: none;
		cursor: pointer;
		font-weight: 600;
		font-size: 1rem;
		color: #1a1a1a;
		background: #fff;
		transition: background 0.2s ease;
	}

	.morgan-accordion-summary::-webkit-details-marker {
		display: none;
	}

	.morgan-accordion-summary::after {
		content: '+';
		margin-left: auto;
		font-size: 1.25rem;
		font-weight: 400;
		color: #666;
	}

	.morgan-accordion-item[open] .morgan-accordion-summary::after {
		content: '−';
	}

	.morgan-accordion-summary:hover {
		background: rgba(0, 0, 0, 0.03);
	}

	.morgan-accordion-logo {
		width: 48px;
		height: 48px;
		object-fit: contain;
		flex-shrink: 0;
	}

	.morgan-accordion-title {
		flex: 1;
		min-width: 0;
	}

	.morgan-accordion-content {
		display: grid;
		grid-template-rows: 0fr;
		transition: grid-template-rows 0.45s ease;
	}

	.morgan-accordion-item[open] .morgan-accordion-content {
		grid-template-rows: 1fr;
	}

	.morgan-accordion-content-inner {
		overflow: hidden;
		min-height: 0;
		padding: 0 20px 20px;
	}

	.morgan-accordion-img {
		width: 100%;
		height: auto;
		max-height: 340px;
		object-fit: cover;
		border-radius: 6px;
		margin-bottom: 14px;
		display: block;
	}

	.morgan-accordion-text {
		font-size: 0.9375rem;
		line-height: 1.55;
		color: #333;
		margin-bottom: 14px;
	}

	.morgan-accordion-link {
		display: inline-block;
		font-size: 0.875rem;
		font-weight: 600;
		color: rgb(134, 62, 162);
		text-decoration: none;
	}

	.morgan-accordion-link:hover {
		text-decoration: underline;
	}
}
