/* Morgan Ward locations map — pin and popup styling (replicates the original
   Image Map Pro look: red circular pins, click tooltips, red action buttons). */

.mw-map-wrap {
	position: relative;
	width: 100%;
	/* Confine Leaflet's high internal z-indexes (controls 1000, popups 1100) to
	   the map so they cannot render above the sticky site header. */
	isolation: isolate;
	z-index: 0;
}

.mw-map {
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #f6f6f5;
	border-radius: 12px;
	/* Clip the map neatly to the box. Popups are kept fully visible via Leaflet
	   auto-pan (a child cannot escape a clipped, transformed Leaflet container). */
	overflow: hidden;
}

.mw-map .leaflet-container {
	border-radius: 12px;
}

/*
 * A 16:9 box is only ~220px tall on a phone, which is shorter than the location
 * card and left the card's top clipped by the container. Give the map a portrait
 * box on small screens so there is room to place a card inside it.
 */
@media (max-width: 640px) {
	.mw-map {
		aspect-ratio: 3 / 4;
	}
}

/* Popups above the zoom controls (z 1000) so they are never overlapped. */
.mw-map .leaflet-pane.leaflet-popup-pane {
	z-index: 1100;
}

.mw-pop-wrap.leaflet-popup {
	z-index: 1100;
}

.mw-map-empty {
	margin-top: 0.75rem;
	font-size: 0.875rem;
	color: #5c5c55;
}

/* Pins ---------------------------------------------------------------- */
.mw-pin-wrap {
	background: none;
	border: 0;
}

.mw-pin {
	position: relative;
	display: block;
	width: 18px;
	height: 18px;
	border-radius: 9999px;
	background: var(--mw-pin, #ff0000);
	border: 3px solid #ffffff;
	box-shadow: 0 1px 4px rgba(13, 8, 2, 0.4);
	transition: transform 0.15s ease;
	cursor: pointer;
}

.mw-pin-wrap:hover .mw-pin,
.mw-pin-wrap:focus .mw-pin {
	transform: scale(1.25);
}

/* Subtle ping ring on the pins, echoing the live map. */
.mw-pin::after {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: 9999px;
	border: 2px solid var(--mw-pin, #ff0000);
	opacity: 0.45;
	animation: mw-ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes mw-ping {
	0% { transform: scale(1); opacity: 0.45; }
	70%, 100% { transform: scale(2.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.mw-pin::after { animation: none; }
}

/* Popups -------------------------------------------------------------- */
/*
 * The arrow is taken out of the popup's normal flow so it can be parked on
 * whichever edge the card ends up on, and slid along that edge to stay on the
 * pin when the card has been nudged sideways. Because it no longer contributes
 * height, map.js sets the popup offset to account for it explicitly.
 */
.mw-pop-wrap .leaflet-popup-tip-container {
	position: absolute;
	left: 50%;
	bottom: -20px;
	margin: 0;
	transform: translateX( calc( -50% + var( --mw-tip-x, 0px ) ) );
}

.mw-pop-wrap.mw-pop--below .leaflet-popup-tip-container {
	top: -20px;
	bottom: auto;
	transform: translateX( calc( -50% + var( --mw-tip-x, 0px ) ) ) rotate( 180deg );
}

.mw-pop-wrap .leaflet-popup-content-wrapper {
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(13, 8, 2, 0.25);
	padding: 0;
	overflow: hidden;
}

.mw-pop-wrap .leaflet-popup-content {
	margin: 0;
	width: 260px !important;
	/*
	 * Never let a card exceed the room inside the map. The cap is measured in JS
	 * when the card opens and passed in as --mw-pop-max; anything longer scrolls
	 * inside the card rather than being clipped by the map's rounded overflow.
	 */
	max-height: var(--mw-pop-max, none);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.mw-pop {
	font-family: inherit;
}

.mw-pop__title {
	margin: 0;
	background: #1e1e82;
	color: #fff;
	padding: 12px 16px;
	font-size: 1rem;
	font-weight: 700;
}

.mw-pop__addr {
	margin: 0;
	padding: 12px 16px 4px;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: #33332f;
}

.mw-pop__actions {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 8px 16px 12px;
}

.mw-pop__btn {
	display: inline-block;
	background: #db0000;
	color: #fff !important;
	text-align: center;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 0.8125rem;
	font-weight: 600;
	text-decoration: none;
}

.mw-pop__btn:hover {
	background: #db0000;
}

.mw-pop__team {
	list-style: none;
	margin: 0;
	padding: 4px 16px 14px;
	border-top: 1px solid #e7e7e5;
}

.mw-pop__person {
	padding: 8px 0;
	border-bottom: 1px solid #f0f0ee;
}

.mw-pop__person:last-child {
	border-bottom: 0;
}

.mw-pop__name {
	display: block;
	font-weight: 600;
	font-size: 0.8125rem;
	color: #0d0802;
}

.mw-pop__role {
	display: block;
	font-size: 0.75rem;
	color: #5c5c55;
}

.mw-pop__links {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 4px;
}

.mw-pop__links a {
	font-size: 0.75rem;
	color: #1e1e82;
	text-decoration: none;
}

.mw-pop__links a:hover {
	text-decoration: underline;
}

/* ---------------------------------------------------------------------------
 * Enquiry panel
 *
 * Sits over the map rather than replacing it: the map dims but stays legible,
 * so the visitor keeps their sense of which location they are writing to.
 * The look leans on instrument conventions - hairline rules, calibration
 * ticks, tabular labels - rather than decoration.
 * ------------------------------------------------------------------------ */

.mw-map-wrap { position: relative; }

.mw-map-wrap.is-mailing .mw-map {
	filter: saturate(0.55) brightness(0.5);
	transition: filter 320ms ease;
}

.mw-mail {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(0.75rem, 3vw, 2rem);
}

.mw-mail__scrim {
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at 50% 40%, rgba(30, 30, 130, 0.35), rgba(6, 6, 32, 0.82));
	opacity: 0;
	transition: opacity 320ms ease;
}

.mw-mail.is-open .mw-mail__scrim { opacity: 1; }

.mw-mail__panel {
	position: relative;
	width: min(30rem, 100%);
	max-height: 100%;
	overflow-y: auto;
	padding: clamp(1.1rem, 3vw, 1.6rem);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 14px;
	background:
		linear-gradient(160deg, rgba(24, 24, 96, 0.97), rgba(9, 9, 42, 0.98));
	box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.12);
	color: #eef0ff;
	opacity: 0;
	transform: translateY(10px) scale(0.985);
	transition: opacity 300ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mw-mail.is-open .mw-mail__panel { opacity: 1; transform: none; }

/* Calibration grid, held right back so it reads as texture not pattern. */
.mw-mail__panel::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
	background-size: 28px 28px;
	mask-image: radial-gradient(ellipse at 50% 0%, #000 35%, transparent 78%);
}

/* Single sweep across the top edge when the panel opens. */
.mw-mail__sweep {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, #db0000, transparent);
	transform: scaleX(0);
	transform-origin: left center;
}

.mw-mail.is-open .mw-mail__sweep { animation: mw-sweep 900ms ease-out forwards; }

@keyframes mw-sweep {
	0%   { transform: scaleX(0); opacity: 0; }
	35%  { opacity: 1; }
	100% { transform: scaleX(1); opacity: 0.5; }
}

.mw-mail__head {
	position: relative;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding-bottom: 0.85rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.mw-mail__eyebrow {
	margin: 0 0 0.3rem;
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #ff6b6b;
}

.mw-mail__title { margin: 0; font-size: 1.12rem; line-height: 1.25; font-weight: 700; }

.mw-mail__loc {
	margin: 0.2rem 0 0;
	font-size: 0.76rem;
	letter-spacing: 0.03em;
	color: rgba(238, 240, 255, 0.62);
}

.mw-mail__loc:empty { display: none; }

.mw-mail__close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: -6px -6px 0 0;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 9px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background 160ms ease, border-color 160ms ease;
}

.mw-mail__close svg { width: 18px; height: 18px; }
.mw-mail__close:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.32); }

.mw-mail__form { position: relative; padding-top: 0.9rem; }

.mw-mail__grid { display: grid; gap: 0.7rem; }
@media (min-width: 30rem) { .mw-mail__grid { grid-template-columns: 1fr 1fr; } }

.mw-mail__field { display: block; margin-bottom: 0.7rem; }

.mw-mail__label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	font-variant-numeric: tabular-nums;
	color: rgba(238, 240, 255, 0.66);
}

.mw-mail__field input,
.mw-mail__field textarea {
	width: 100%;
	padding: 0.6rem 0.7rem;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	background: rgba(4, 4, 26, 0.55);
	color: #fff;
	font: inherit;
	font-size: 0.92rem;
	transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.mw-mail__field textarea { resize: vertical; min-height: 5.5rem; }

.mw-mail__field input:focus,
.mw-mail__field textarea:focus {
	outline: none;
	border-color: #db0000;
	background: rgba(4, 4, 26, 0.8);
	box-shadow: 0 0 0 3px rgba(255, 45, 45, 0.22);
}

.mw-mail__field--sum { max-width: 11rem; }

/* Honeypot: moved off-screen rather than hidden, so bots still fill it. */
.mw-mail__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.mw-mail__error {
	margin: 0 0 0.7rem;
	padding: 0.5rem 0.65rem;
	border-left: 2px solid #ff2d2d;
	background: rgba(255, 45, 45, 0.12);
	font-size: 0.82rem;
	color: #ffd9d9;
}

.mw-mail__actions { display: flex; justify-content: flex-end; }

.mw-mail__send {
	min-height: 44px;
	padding: 0.6rem 1.3rem;
	border: 0;
	border-radius: 9px;
	background: #db0000;
	color: #fff;
	font: inherit;
	font-size: 0.86rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: background 160ms ease, transform 160ms ease;
}

.mw-mail__send:hover:not(:disabled) { background: #e01d1d; transform: translateY(-1px); }
.mw-mail__send:disabled { opacity: 0.62; cursor: progress; }
.mw-mail__send.is-sending span::after {
	content: "";
	display: inline-block;
	width: 0.75em;
	animation: mw-dots 1s steps(4, end) infinite;
}

@keyframes mw-dots {
	0%   { content: ""; }
	25%  { content: "."; }
	50%  { content: ".."; }
	75%  { content: "..."; }
}

/* Success: reticle draws itself, then the whole panel fades back to the map. */
.mw-mail__done {
	position: relative;
	padding: 1.6rem 0 1rem;
	text-align: center;
}

.mw-mail__reticle { color: #63f5a5; }
.mw-mail__reticle svg { width: 82px; height: 82px; }

.mw-mail__ring {
	stroke-dasharray: 252;
	stroke-dashoffset: 252;
	animation: mw-draw 620ms ease-out forwards;
}

.mw-mail__tick {
	stroke-dasharray: 52;
	stroke-dashoffset: 52;
	animation: mw-draw 380ms ease-out 420ms forwards;
}

@keyframes mw-draw { to { stroke-dashoffset: 0; } }

.mw-mail__donetitle {
	margin: 0.9rem 0 0.25rem;
	font-size: 1.02rem;
	font-weight: 700;
}

.mw-mail__donenote {
	margin: 0;
	font-size: 0.8rem;
	color: rgba(238, 240, 255, 0.62);
}

/* Popup email buttons: styled as controls, carrying no address. */
.mw-pop__btn--mail { cursor: pointer; border: 0; font: inherit; }

/*
 * Per-person email control. A quiet grey button rather than a link: it does the
 * same job as the red buttons above but is secondary to them, and a button reads
 * as an action where an underlined "Email" read as a mailto address.
 */
.mw-pop__mail {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	padding: 0.3rem 0.75rem;
	border: 1px solid var(--color-ink-200, #cfcfcb);
	border-radius: 7px;
	background: var(--color-ink-50, #f6f6f5);
	color: var(--color-ink-800, #1f1f1c);
	font: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.mw-pop__mail:hover,
.mw-pop__mail:focus-visible {
	border-color: var(--color-ink-300, #a9a9a3);
	background: var(--color-ink-100, #e7e7e5);
	color: var(--color-ink-900, #0d0802);
}

.mw-pop__mail:focus-visible {
	outline: 2px solid #1e1e82;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.mw-mail__panel,
	.mw-mail__scrim,
	.mw-map-wrap.is-mailing .mw-map { transition-duration: 1ms; }
	.mw-mail__sweep,
	.mw-mail__ring,
	.mw-mail__tick,
	.mw-mail__send.is-sending span::after { animation: none; }
	.mw-mail__ring,
	.mw-mail__tick { stroke-dashoffset: 0; }
}

/* ---------------------------------------------------------------------------
 * Text alternative to the map.
 *
 * Hidden from sight but not from assistive technology or the document. It
 * un-hides on focus so a keyboard user tabbing through the phone links can see
 * where they are, rather than following focus into nothing.
 * ------------------------------------------------------------------------ */
.mw-map-a11y {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.mw-map-a11y:focus-within {
	position: static;
	width: auto;
	height: auto;
	margin: 1.5rem 0 0;
	padding: 1.25rem 1.5rem;
	overflow: visible;
	clip: auto;
	clip-path: none;
	white-space: normal;
	border: 1px solid var(--color-ink-100, #e7e7e5);
	border-radius: 12px;
	background: #fff;
}

.mw-map-a11y:focus-within h3 {
	margin: 0 0 0.75rem;
	font-size: 1.0625rem;
	font-weight: 700;
}

.mw-map-a11y:focus-within ul {
	display: grid;
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 40rem) {
	.mw-map-a11y:focus-within ul {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.mw-map-a11y:focus-within li {
	font-size: 0.875rem;
	line-height: 1.5;
}

.mw-map-a11y:focus-within strong,
.mw-map-a11y:focus-within span,
.mw-map-a11y:focus-within a {
	display: block;
}
