/* CTV entity location map — thumbnail (flush facts-panel header) + modal.
   Brand tokens from ctv-global.css :root. PX units (10px root). */

/* ------------------------------------------------------------------ *
 * Part 1 — thumbnail as the flush HEADER of the .ctv-card facts panel.
 * The Bricks 'shortcode' element wraps output in a div carrying the
 * custom class .ctv-emap-header; that wrapper is the direct first flex
 * child of .ctv-card, so the flush negative margins live on it. They
 * cancel the panel's 32px padding (24px under 767px) so the map bleeds
 * to the rounded top corners.
 * ------------------------------------------------------------------ */
.ctv-card > .ctv-emap-header {
	/* Sits below the "Plan Your Visit" heading now, so it's a full-width band
	   (bleeds to the panel's side padding) rather than a flush top header. */
	margin: 0 -32px;
	overflow: hidden;
	line-height: 0;
}
.ctv-emap-header .ctv-emap__thumb {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	line-height: 0;
	-webkit-appearance: none;
	appearance: none;
}
.ctv-emap-header img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: inherit;
	transition: opacity .15s ease;
}
.ctv-emap-header .ctv-emap__thumb:hover img { opacity: .93; }
.ctv-emap-header .ctv-emap__thumb:focus-visible {
	outline: 2px solid var(--ctv-gold);
	outline-offset: -2px;
}

/* "View in a map ›" — sits below the last facts row. */
.ctv-emap__viewlink {
	align-self: flex-start;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	font-size: 14px;
	color: var(--ctv-burgundy);
}
.ctv-emap__viewlink:hover { color: var(--ctv-burgundy-deep); text-decoration: underline; }
.ctv-emap__viewlink:focus-visible { outline: 2px solid var(--ctv-gold); outline-offset: 3px; }

@media (max-width: 767px) {
	.ctv-card > .ctv-emap-header { margin: 0 -24px; }
}

/* ------------------------------------------------------------------ *
 * Part 2 — modal
 * ------------------------------------------------------------------ */
.ctv-emap-modal[hidden] { display: none; }
.ctv-emap-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ctv-emap-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(26, 16, 16, .55);
}
.ctv-emap-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(920px, 94vw);
	height: min(680px, 88vh);
	background: var(--ctv-white);
	border-radius: var(--radius-lg);
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(26, 16, 16, .35);
}
.ctv-emap-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--ctv-linen, #ece3d7);
	flex: 0 0 auto;
}
.ctv-emap-modal__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ctv-emap-modal__name { font-size: 18px; color: var(--ctv-ink); line-height: 1.2; }
.ctv-emap-modal__addr { font-size: 13px; color: #6a5f57; }
.ctv-emap-modal__close {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: var(--ctv-cream);
	color: var(--ctv-ink);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.ctv-emap-modal__close:hover { background: var(--ctv-gold-tint, #f1e6d2); }
.ctv-emap-modal__close:focus-visible { outline: 2px solid var(--ctv-gold); outline-offset: 2px; }
.ctv-emap-modal__map { flex: 1 1 auto; min-height: 0; }
.ctv-emap-modal__chips {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid var(--ctv-linen, #ece3d7);
}

/* filter chips */
.ctv-emap-fchip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid var(--ctv-gold);
	border-radius: 999px;
	background: var(--ctv-white);
	color: var(--ctv-gold-deep, #7e5a24);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background .12s ease, color .12s ease, opacity .12s ease;
}
/* Active filter chip: burgundy fill + cream text (~13:1). Was gold #9A7030 + white
   (~3.9:1, fails AA for this 13px label) — gold is decorative only now. */
.ctv-emap-fchip.is-on { background: var(--ctv-burgundy); color: var(--ctv-cream); }
.ctv-emap-fchip:not(.is-on) { opacity: .6; }
.ctv-emap-fchip:focus-visible { outline: 2px solid var(--ctv-burgundy); outline-offset: 2px; }
.ctv-emap-fchip__n {
	font-variant-numeric: tabular-nums;
	opacity: .85;
	padding-left: 2px;
}

/* nearby markers — circular gold-stroked chips; icon carries type */
.ctv-emap-chip {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--ctv-white);
	border: 2px solid var(--ctv-gold);
	box-shadow: 0 1px 4px rgba(26, 16, 16, .25);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.ctv-emap-chip svg { display: block; }

/* this entity — dominant burgundy teardrop carrying its own type glyph */
.ctv-emap-pin {
	width: 40px;
	height: 40px;
	background: var(--ctv-burgundy);
	border: 2px solid var(--ctv-white);
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	box-shadow: 0 3px 8px rgba(26, 16, 16, .45);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: default;
}
.ctv-emap-pin__glyph {
	transform: rotate(45deg);
	display: flex;
	align-items: center;
	justify-content: center;
}
.ctv-emap-pin__glyph svg { display: block; }

/* popup */
.ctv-emap-pop { display: block; text-decoration: none; min-width: 120px; }
.ctv-emap-pop__name { display: block; font-weight: 700; color: var(--ctv-burgundy); font-size: 13px; }
.ctv-emap-pop__meta { display: block; color: #6a5f57; font-size: 12px; margin-top: 1px; }
.mapboxgl-popup-content { border-radius: 8px; padding: 8px 12px; }

/* ------------------------------------------------------------------ *
 * Mobile — full-height sheet, chips in the thumb zone (bottom)
 * ------------------------------------------------------------------ */
@media (max-width: 640px) {
	.ctv-emap-modal__dialog {
		width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}
	.ctv-emap-modal__chips {
		/* already after the map in DOM = bottom; keep it thumb-reachable.
		   Drop labels (below) so all five icon+count chips fit one row at 380px —
		   the icon carries the type, same principle as the legend-free map. */
		padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
		flex-wrap: wrap;
		justify-content: center;
	}
	.ctv-emap-fchip { flex: 0 0 auto; }
	.ctv-emap-fchip__label { display: none; }
}
