/**
 * The clickable map of Devon ("Devon Map" Elementor widget).
 *
 * Markup: templates/devon-map.php. Behaviour: assets/js/devon-map.js.
 * Loaded only on pages that use the widget.
 *
 * Layout: map on the left, details panel on the right (desktop). On tablet
 * and phone the panel slides up from the bottom of the screen instead.
 */

.ddm {
	--n: #1F3140;      /* navy: text, buttons */
	--s: #4F6E65;      /* sage: accents, the chosen area */
	--land: #DDE6E1;   /* an area at rest */
	--landh: #BFD0C7;  /* an area under the pointer */
	--g: #4B5661;      /* body text */
	--r: #DCE5DF;      /* hairlines */
	font-family: 'Jost', 'Helvetica Neue', Arial, sans-serif;
	color: var(--n);
}

.ddm * {
	box-sizing: border-box;
}

.ddm-grid {
	display: grid;
	gap: 36px;
	align-items: start;
}

/* ---------- The drawing ---------- */

.ddm svg {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	overflow: hidden;
}

.ddm-area {
	fill: var(--land);
	stroke: var(--land);
	stroke-width: 1.2;
	stroke-linejoin: round;
	cursor: pointer;
	transition: fill .35s ease, stroke .35s ease;
}

.ddm-ar:hover .ddm-area,
.ddm-ar.hint .ddm-area {
	fill: var(--landh);
	stroke: var(--landh);
}

.ddm-ar.on .ddm-area {
	fill: var(--s);
	stroke: var(--s);
}

.ddm-ar:focus {
	outline: none;
}

.ddm-ar:focus-visible .ddm-area {
	fill: var(--landh);
	stroke: var(--n);
	stroke-width: 4;
}

.ddm-borders {
	fill: none;
	stroke: #fff;
	stroke-width: 3;
	stroke-linejoin: round;
	stroke-linecap: round;
	pointer-events: none;
}

.ddm-lab {
	cursor: pointer;
	font-family: 'Jost', Arial, sans-serif;
	font-size: 32px;
	font-weight: 500;
	letter-spacing: .08em;
	text-transform: uppercase;
	fill: var(--n);
	transition: fill .35s;
}

.ddm-lab.on {
	fill: #fff;
}

.ddm-lab.out.on {
	fill: var(--s);
}

.ddm-lead {
	stroke: var(--n);
	stroke-width: 1.5;
	pointer-events: none;
}

.ddm-sea {
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-style: italic;
	font-size: 30px;
	fill: #8FA39A;
	pointer-events: none;
}

/* Invisible, larger click targets over labels and the two small areas. */
.ddm-hit {
	fill: transparent;
	cursor: pointer;
}

.ddm-north path {
	fill: var(--s);
}

.ddm-north .ddm-north-s {
	fill: none;
	stroke: var(--s);
	stroke-width: 1.5;
}

.ddm-north text {
	font-family: 'Jost', Arial, sans-serif;
	font-size: 18px;
	font-weight: 500;
	fill: var(--s);
}

.ddm-src {
	margin: 44px 0 0;
	padding-top: 10px;
	font-size: 10px;
	line-height: 1.5;
	color: #7A858F;
}

/* "Tap an area" prompt: tablet and phone only. */
.ddm-tap {
	display: none;
	margin: 4px 0 8px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--s);
}

.ddm-dot {
	position: relative;
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 14px;
	border-radius: 50%;
	background: var(--s);
	vertical-align: 1px;
}

.ddm-dot::after {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 1px solid var(--s);
	animation: ddm-pulse 1.8s ease-out infinite;
}

@keyframes ddm-pulse {
	from { transform: scale(.5); opacity: 1; }
	to { transform: scale(1.4); opacity: 0; }
}

/* ---------- The details panel ---------- */

.ddm-panel {
	display: flex;
	flex-direction: column;
	min-height: 400px;
	padding: clamp(26px, 4vw, 44px);
	background: #fff;
}

.ddm-k {
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--s);
}

.ddm-panel h3 {
	margin: 12px 0 0;
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-weight: 500;
	font-size: clamp(34px, 4vw, 46px);
	line-height: 1.05;
	color: var(--n);
}

.ddm-panel.empty h3 {
	font-style: italic;
	color: var(--s);
}

.ddm-panel p {
	margin: 16px 0 0;
	font-size: 16px;
	line-height: 1.65;
	color: var(--g);
}

.ddm-img {
	margin: 0 0 22px;
	overflow: hidden;
}

.ddm-img img {
	display: block;
	width: 100%;
	height: 240px;
	object-fit: cover;
	border-radius: 0;
}

.ddm-fade {
	animation: ddm-fade .45s ease both;
}

@keyframes ddm-fade {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

/* Towns list inside the panel. */
.ddm-ptl {
	margin: 22px 0 0;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--s);
}

.ddm-ptl span {
	font-weight: 400;
	letter-spacing: .04em;
	text-transform: none;
	color: #8A949C;
}

.ddm-panel ul {
	list-style: none;
	margin: 24px 0 0;
	padding: 0;
	border-top: 1px solid var(--r);
}

.ddm-panel li {
	display: block;
	margin: 0;
	padding: 0;
	border-bottom: 1px solid var(--r);
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-size: 21px;
}

.ddm .ddm-hl {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	width: calc(100% + 20px);
	margin: 0 -10px;
	padding: 12px 10px;
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
	transition: background .2s;
}

.ddm .ddm-hl:hover {
	background: #F2F4F2;
}

.ddm-hl > div {
	margin-right: auto;
}

.ddm-kind {
	display: block;
	margin: 0 0 5px;
	font-family: 'Jost', Arial, sans-serif;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .18em;
	line-height: 1.3;
	text-transform: uppercase;
	color: var(--s);
}

.ddm-hl b {
	display: block;
	font-weight: 500;
	font-size: 22px;
	line-height: 1.15;
}

.ddm-hl:hover b {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.ddm-hl i {
	display: block;
	margin-top: 3px;
	font-family: 'Jost', Arial, sans-serif;
	font-style: normal;
	font-size: 13px;
	line-height: 1.4;
	color: #8A949C;
}

.ddm-go {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid rgba(31, 49, 64, .3);
	border-radius: 50%;
	font-family: 'Jost', Arial, sans-serif;
	font-style: normal;
	font-size: 15px;
	line-height: 1;
	color: var(--n);
	transition: background .25s, color .25s, border-color .25s;
}

.ddm-hl:hover .ddm-go {
	background: var(--n);
	border-color: var(--n);
	color: #fff;
}

/* Buttons at the foot of the panel. */
.ddm-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px 26px;
	margin-top: auto;
	padding-top: 30px;
}

.ddm .ddm-btn {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 16px 28px;
	border: 1px solid var(--n);
	border-radius: 0;
	background: var(--n);
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background .3s, border-color .3s;
}

.ddm .ddm-btn:hover {
	background: var(--s);
	border-color: var(--s);
	color: #fff;
}

.ddm-btn svg {
	width: 12px;
	height: 12px;
}

.ddm .ddm-stay {
	padding-bottom: 3px;
	border-bottom: 1px solid currentColor;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--n);
	transition: color .3s;
}

.ddm .ddm-stay:hover {
	color: var(--s);
}

/* Close button: only where the panel slides up (tablet and phone). */
.ddm .ddm-panel .ddm-x {
	display: none;
}

/* ---------- The list of areas under the panel ---------- */

.ddm-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 24px;
	margin-top: 24px;
}

.ddm .ddm-list button,
.ddm .ddm-list button:hover,
.ddm .ddm-list button:focus {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	min-width: 0;
	padding: 14px 0;
	border: 0;
	border-top: 1px solid var(--r);
	border-radius: 0;
	background: none;
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-size: 19px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	text-align: left;
	white-space: normal;
	overflow-wrap: anywhere;
	color: var(--n);
	cursor: pointer;
}

.ddm-list button span {
	font-size: 12px;
	color: var(--s);
}

.ddm .ddm-list button.on {
	font-style: italic;
	color: var(--s);
}

.ddm .ddm-list button:focus {
	outline: none;
}

.ddm .ddm-list button:focus-visible {
	outline: 2px solid var(--s);
	outline-offset: 2px;
}

/* ---------- The small area-page map ("Devon Area Map") ---------- */

.ddm-locator {
	max-width: 560px;
	margin: 0 auto;
}

/* A picture, not a control: no hover or pointer. */
.ddm-locator svg {
	pointer-events: none;
}

.ddm-locator .ddm-src {
	margin-top: 20px;
	padding-top: 0;
	text-align: center;
}

/* ---------- Desktop ---------- */

@media (min-width: 1025px) {
	.ddm-grid {
		grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
		gap: 64px;
	}
}

/* ---------- Tablet and phone: the panel slides up from the bottom ---------- */

@media (max-width: 1024px) {
	.ddm-tap {
		display: flex;
		align-items: center;
	}

	.ddm-panel.empty {
		display: none;
	}

	.ddm-panel {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 99999;
		min-height: 0;
		width: 100%;
		max-width: 100vw;
		max-height: 84vh;
		box-sizing: border-box;
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		touch-action: pan-y;
		padding: 28px 24px max(16px, env(safe-area-inset-bottom, 0px));
		box-shadow: 0 -16px 40px rgba(18, 32, 44, .16);
		transform: translateY(105%);
		transition: transform .4s cubic-bezier(.22, .61, .36, 1);
	}

	.ddm-panel * {
		max-width: 100%;
		box-sizing: border-box;
	}

	.ddm-panel::before {
		content: "";
		position: absolute;
		top: 9px;
		left: 50%;
		width: 36px;
		height: 3px;
		margin-left: -18px;
		background: var(--r);
	}

	.ddm-panel.open {
		transform: none;
	}

	.ddm .ddm-panel .ddm-x,
	.ddm .ddm-panel .ddm-x:hover,
	.ddm .ddm-panel .ddm-x:focus {
		position: absolute;
		z-index: 2;
		top: 16px;
		right: 16px;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		padding: 0;
		border: 1px solid var(--r);
		border-radius: 0;
		background: #fff;
		color: var(--n);
		cursor: pointer;
	}

	.ddm-x svg {
		width: 12px;
		height: 12px;
	}

	.ddm-top {
		display: flex;
		align-items: center;
		gap: 16px;
		padding-right: 44px;
	}

	.ddm-top .ddm-img {
		flex: 0 0 112px;
		width: 112px;
		height: 112px;
		margin: 0;
	}

	.ddm-top .ddm-img img {
		width: 112px;
		height: 112px;
		aspect-ratio: 1 / 1;
	}

	.ddm-panel .ddm-k {
		font-size: 10.5px;
		letter-spacing: .18em;
	}

	.ddm-panel h3 {
		margin-top: 6px;
		font-size: 27px;
	}

	.ddm-panel p {
		margin-top: 14px;
		font-size: 14.5px;
		line-height: 1.55;
	}

	.ddm-panel ul {
		margin-top: 14px;
	}

	.ddm-hl b {
		font-size: 21px;
	}

	.ddm-hl i {
		font-size: 12.5px;
	}

	.ddm-cta {
		padding-top: 26px;
	}

	.ddm .ddm-btn {
		width: 100%;
		justify-content: center;
		padding: 14px 20px;
	}
}

@media (min-width: 640px) and (max-width: 1024px) {
	.ddm-list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.ddm-list {
		display: none;
	}
}

@media (max-width: 640px) {
	.ddm-lab {
		font-size: 36px;
		letter-spacing: .05em;
	}

	.ddm-sea {
		font-size: 32px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ddm-panel,
	.ddm-area,
	.ddm-lab {
		transition: none;
	}

	.ddm-dot::after,
	.ddm-fade {
		animation: none;
	}
}
