/* Locations section (pattern locations-map + this block): a full-bleed light section with northern
   Europe as its background, the edges fading into the page; the countries we operate in glow;
   pins pulse on the data centre campuses. On the left, the text and the list of places. A pin or a
   place, hovered or focused, opens its card beside the pin on the map; a click pins the card open.
   Below 1100px the map sits between the text and the list, and a card opens as a sheet at the
   bottom of the screen. */

.wp-block-group.cn-map {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	display: flex;
	align-items: center;
	min-height: clamp(760px, 94vh, 1040px);
	padding-block: var(--wp--preset--spacing--section);
	margin-block: 0;
	--cn-map-io: cubic-bezier(0.65, 0, 0.35, 1); /* ease in and out */
	color: var(--wp--preset--color--purple);
	background:
		radial-gradient(50% 60% at 70% 45%, rgba(0, 221, 255, 0.22), transparent 70%),
		radial-gradient(40% 45% at 100% 100%, rgba(0, 123, 168, 0.1), transparent 70%),
		linear-gradient(180deg, var(--wp--preset--color--white) 0%, var(--wp--preset--color--frost) 100%);
}

.wp-block-group.cn-map > * {
	margin-block: 0;
}

/* ---- The stage: map layers and cards -------------------------------------------------- */
.cn-map__stage {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.cn-map__svg {
	position: absolute;
	top: 50%;
	right: 1%;
	width: clamp(640px, 50vw, 980px); /* an inline SVG ignores width:auto, so the width sets the size */
	height: auto;
	aspect-ratio: 1000 / 1042;
	transform: translateY(-50%);
	overflow: visible;
}

/* The background layer fades out at its edges. */
.cn-map__svg--bg {
	-webkit-mask-image:
		linear-gradient(to right, transparent 0%, #000 16%, #000 90%, transparent 100%),
		linear-gradient(to bottom, transparent 0%, #000 10%, #000 88%, transparent 100%);
	-webkit-mask-composite: source-in;
	mask-image:
		linear-gradient(to right, transparent 0%, #000 16%, #000 90%, transparent 100%),
		linear-gradient(to bottom, transparent 0%, #000 10%, #000 88%, transparent 100%);
	mask-composite: intersect;
}

.cn-map__grid line {
	stroke: rgba(86, 61, 110, 0.07);
	stroke-width: 0.8;
	vector-effect: non-scaling-stroke;
}

.cn-map__land path {
	fill: rgba(86, 61, 110, 0.05);
	stroke: rgba(0, 123, 168, 0.32);
	stroke-width: 0.8;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	transition: fill 0.6s, stroke 0.6s;
}

.cn-map__land path.is-home {
	fill: rgba(0, 221, 255, 0.24);
	stroke: var(--wp--preset--color--fjord-blue);
}

.cn-map__land path.is-pipeline {
	fill: rgba(0, 221, 255, 0.1);
	stroke: rgba(0, 123, 168, 0.55);
}

.cn-map.has-card .cn-map__land path.is-home {
	fill: rgba(0, 221, 255, 0.32);
}

/* ---- Pins and labels ------------------------------------------------------------------- */
.cn-map__leads line {
	stroke: var(--wp--preset--color--fjord-blue);
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
}

.cn-map__leads circle {
	fill: var(--wp--preset--color--fjord-blue);
}

.cn-map__label {
	fill: var(--wp--preset--color--purple);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.16em;
	paint-order: stroke;
	stroke: rgba(255, 255, 255, 0.85);
	stroke-width: 3px;
	stroke-linejoin: round;
	transition: fill 0.3s;
}

.cn-map__label.is-active {
	fill: var(--wp--preset--color--fjord-blue);
}

.cn-map__pin {
	pointer-events: auto;
	cursor: pointer;
	outline: none;
}

.cn-map__pin circle {
	transform-box: fill-box;
	transform-origin: center;
}

.cn-map__hit {
	fill: transparent;
}

/* Only the hit circle takes the pointer: a neighbour's pulse never steals a hover or tap. */
.cn-map__pulse,
.cn-map__ring,
.cn-map__dot {
	pointer-events: none;
}

.cn-map__dot {
	fill: var(--wp--preset--color--fjord-blue);
	transition: transform 0.4s var(--ease), fill 0.3s;
}

.cn-map__ring {
	fill: var(--wp--preset--color--white);
	stroke: var(--wp--preset--color--fjord-blue);
	stroke-width: 1.5;
	vector-effect: non-scaling-stroke;
	transition: transform 0.4s var(--ease), stroke 0.3s, fill 0.3s;
}

.cn-map__pulse {
	fill: var(--wp--preset--color--sky-blue);
	opacity: 0;
	animation: cn-map-pulse 2.8s var(--ease) infinite;
}

.cn-map__pulse--2 {
	animation-delay: 1.4s;
}

@keyframes cn-map-pulse {
	0% { transform: scale(0.15); opacity: 0.6; }
	100% { transform: scale(1.1); opacity: 0; }
}

/* Under construction: dashed ring, light core, slower pulse. In planning: no pulse. */
.cn-map__pin--construction .cn-map__ring,
.cn-map__pin--planned .cn-map__ring {
	stroke-dasharray: 3 3;
}

.cn-map__pin--construction .cn-map__dot,
.cn-map__pin--planned .cn-map__dot {
	fill: var(--wp--preset--color--sky-blue);
}

.cn-map__pin--construction .cn-map__pulse {
	animation-duration: 4.2s;
}

.cn-map__pin--planned .cn-map__pulse,
.cn-map__pin--office .cn-map__pulse {
	display: none;
}

/* Offices: a small purple dot in a purple ring. */
.cn-map__pin--office .cn-map__ring {
	stroke: rgba(86, 61, 110, 0.6);
	transform: scale(0.72);
}

.cn-map__pin--office .cn-map__dot {
	fill: var(--wp--preset--color--purple);
	transform: scale(0.8);
}

/* Hover, focus, or the matching place in the list. */
.cn-map__pin:hover .cn-map__ring,
.cn-map__pin:focus-visible .cn-map__ring,
.cn-map__pin.is-active .cn-map__ring {
	transform: scale(1.7);
	stroke: var(--wp--preset--color--purple);
}

.cn-map__pin:hover .cn-map__dot,
.cn-map__pin:focus-visible .cn-map__dot,
.cn-map__pin.is-active .cn-map__dot {
	transform: scale(1.5);
	fill: var(--wp--preset--color--purple);
}

.cn-map__pin:focus-visible .cn-map__ring {
	stroke-width: 2.5;
	stroke-dasharray: none;
}

/* ---- The text column ----------------------------------------------------------------- */
.wp-block-group.cn-map__in {
	position: relative;
	z-index: 2;
	pointer-events: none;
}

.wp-block-group.cn-map__lead,
.cn-map__nav {
	max-width: 470px;
}

.cn-map__lead > *,
.cn-map__nav,
.cn-map__nav a {
	pointer-events: auto;
}

.wp-block-group.cn-map__lead > * {
	margin-block: 0;
}

.wp-block-group.cn-map__lead > * + * {
	margin-top: 22px;
}

.cn-map__lead p:not(.is-style-intro, .eyebrow) {
	color: var(--fg-2, rgba(86, 61, 110, 0.85));
}

/* The list of places. */
.cn-map__list {
	list-style: none;
	margin: 36px 0 0;
	padding: 0;
	display: grid;
	gap: 2px;
	border-top: 1px solid rgba(86, 61, 110, 0.14);
}

.cn-map__list li {
	margin: 0;
	border-bottom: 1px solid rgba(86, 61, 110, 0.14);
}

.wp-block-group.cn-map .cn-map__nav a {
	text-decoration: none;
}

.cn-map__place {
	position: relative;
	display: grid;
	grid-template-columns: 14px auto 1fr;
	align-items: baseline;
	gap: 14px;
	padding: 14px 16px 14px 4px;
	color: var(--wp--preset--color--purple);
	isolation: isolate;
	transition: color 0.5s var(--cn-map-io);
}

/* The hover wash: a gradient that fades and sweeps in from the left, and back out the same way. */
.cn-map__place::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(90deg, rgba(0, 221, 255, 0.3), rgba(0, 221, 255, 0.08) 70%, rgba(0, 221, 255, 0));
	opacity: 0;
	transform: scaleX(0.55);
	transform-origin: left center;
	transition: opacity 0.5s var(--cn-map-io), transform 0.6s var(--cn-map-io);
}

.cn-map__place::before {
	content: "";
	width: 10px;
	height: 10px;
	align-self: center;
	background: var(--wp--preset--color--fjord-blue);
	box-shadow: 0 0 0 3px rgba(0, 221, 255, 0.35);
	transition: transform 0.5s var(--cn-map-io);
}

.cn-map__place--construction::before {
	background: var(--wp--preset--color--sky-blue);
	box-shadow: none;
	outline: 1.5px dashed var(--wp--preset--color--fjord-blue);
	outline-offset: 2px;
}

.cn-map__place b {
	font-size: var(--wp--preset--font-size--intro);
	font-weight: 500;
	transition: transform 0.5s var(--cn-map-io);
}

.cn-map__place span {
	font-size: 0.9375rem;
	color: rgba(86, 61, 110, 0.8);
	text-align: right;
}

.cn-map__place:hover::after,
.cn-map__place:focus-visible::after,
.cn-map__place.is-active::after {
	opacity: 1;
	transform: none;
}

.cn-map__place:hover::before,
.cn-map__place:focus-visible::before,
.cn-map__place.is-active::before {
	transform: translateX(10px) scale(1.3);
}

.cn-map__place:hover b,
.cn-map__place:focus-visible b,
.cn-map__place.is-active b {
	transform: translateX(10px);
}

.cn-map__place:focus-visible,
.cn-map__offices a:focus-visible {
	outline: 2px solid var(--wp--preset--color--purple);
	outline-offset: 2px;
}

/* Offices: six cities in two even rows of three (one row of six does not fit the column). */
.cn-map__nav .cn-map__offices {
	display: grid;
	grid-template-columns: repeat(3, max-content);
	justify-content: start;
	gap: 12px 28px;
	margin: 34px 0 0;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.cn-map__offices span {
	grid-column: 1 / -1;
	margin-bottom: 4px;
	font-size: 13px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--fg-2, rgba(86, 61, 110, 0.85)); /* AU-H1 */
}

.cn-map__offices a {
	padding-bottom: 2px;
	color: var(--wp--preset--color--purple);
	background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
	transition: color 0.4s var(--cn-map-io), background-size 0.45s var(--cn-map-io);
}

.cn-map__offices a:hover,
.cn-map__offices a.is-active {
	color: var(--wp--preset--color--fjord-blue);
	background-size: 100% 1px;
}

/* Legend. */
.cn-map__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 22px;
	list-style: none;
	margin: 36px 0 0;
	padding: 0;
	font-size: 13px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--fg-2, rgba(86, 61, 110, 0.85)); /* AU-H1 */
}

/* AU2-L3: the 13px legend, the offices label and the 15px place subtitles are set in 400, not the
   body's 300, which draws as a hairline at these sizes. */
.cn-map__legend,
.cn-map__offices,
.cn-map__place span {
	font-weight: 400;
}

.cn-map__legend li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
}

.cn-map__legend li::before {
	content: "";
	width: 10px;
	height: 10px;
	border-radius: 50% !important;
	background: var(--wp--preset--color--fjord-blue);
	box-shadow: 0 0 0 3px rgba(0, 221, 255, 0.35);
}

.cn-map__legend--construction::before {
	background: var(--wp--preset--color--sky-blue) !important;
	box-shadow: none !important;
	outline: 1.5px dashed var(--wp--preset--color--fjord-blue);
	outline-offset: 2px;
}

.cn-map__legend--office::before {
	width: 7px !important;
	height: 7px !important;
	background: var(--wp--preset--color--purple) !important;
	box-shadow: 0 0 0 2px rgba(86, 61, 110, 0.35) !important;
}

/* ---- Cards: beside the pin ------------------------------------------------------------ */
.cn-map__cards {
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
}

.cn-map__card {
	--cn-card-w: 380px;
	position: absolute;
	top: 0;
	left: 0;
	width: var(--cn-card-w);
	padding: 22px 26px 18px;
	color: var(--wp--preset--color--purple);
	background: rgba(255, 255, 255, 0.94);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border: 1px solid var(--wp--preset--color--glacier-line);
	box-shadow: 0 34px 60px -30px rgba(43, 45, 66, 0.45), 0 0 0 1px rgba(0, 221, 255, 0.08);
	display: flex;
	flex-direction: column;
	gap: 10px;
	opacity: 0;
	visibility: hidden;
	transform: translateX(-14px);
	clip-path: inset(0 100% 0 0);
	transition: opacity 0.25s, transform 0.5s var(--ease), clip-path 0.55s var(--ease), border-color 0.3s, visibility 0s linear 0.55s;
}

/* A card left of its pin opens from the right. */
.cn-map__card[data-side="left"] {
	transform: translateX(14px);
	clip-path: inset(0 0 0 100%);
}

/* Below its pin it unfolds downwards, above its pin upwards. */
.cn-map__card[data-side="below"] {
	transform: translateY(-14px);
	clip-path: inset(0 0 100% 0);
}

.cn-map__card[data-side="above"] {
	transform: translateY(14px);
	clip-path: inset(100% 0 0 0);
}

/* Corner brackets. */
.cn-map__card::before,
.cn-map__card::after {
	content: "";
	position: absolute;
	width: 16px;
	height: 16px;
	border: 2px solid var(--wp--preset--color--sky-blue);
	pointer-events: none;
}

.cn-map__card::before {
	top: -1px;
	left: -1px;
	border-right: 0;
	border-bottom: 0;
}

.cn-map__card::after {
	right: -1px;
	bottom: -1px;
	border-left: 0;
	border-top: 0;
}

.cn-map__card.is-open {
	opacity: 1;
	visibility: visible;
	transform: none;
	clip-path: inset(0 0 0 0);
	transition-delay: 0s;
}

.cn-map__card.is-pinned {
	pointer-events: auto;
	border-color: var(--wp--preset--color--fjord-blue);
}

.cn-map__card > * {
	margin: 0;
}

.cn-map__kicker {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-right: 48px; /* room for the close button */
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--fg-2, rgba(86, 61, 110, 0.85)); /* AU-H1 */
}

.cn-map__kicker::before {
	content: "";
	width: 28px;
	height: 2px;
	background: var(--wp--preset--color--sky-blue);
}

.cn-map__title {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 14px;
	font-size: clamp(1.75rem, 1.3rem + 1vw, 2.375rem);
	font-weight: 400;
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--purple);
}

.cn-map__title small {
	font-size: var(--wp--preset--font-size--body);
	font-weight: 500;
	letter-spacing: 0.02em;
	color: var(--wp--preset--color--fjord-blue);
}

.cn-map__sites {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	border-top: 1px solid rgba(86, 61, 110, 0.12);
}

.cn-map__sites li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 14px;
	margin: 0;
	padding: 9px 0;
	border-bottom: 1px solid rgba(86, 61, 110, 0.12);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}

.cn-map__card.is-open .cn-map__sites li {
	opacity: 1;
	transform: none;
	transition-delay: calc(0.14s + var(--i, 0) * 0.07s);
}

.cn-map__sites b {
	font-size: var(--wp--preset--font-size--body);
	font-weight: 500;
}

.cn-map__chips {
	display: flex;
	gap: 6px;
}

.cn-map__chip {
	padding: 3px 8px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1.3;
	border: 1px solid rgba(86, 61, 110, 0.3);
	color: var(--wp--preset--color--purple);
}

.cn-map__chip.is-operational {
	background: var(--wp--preset--color--fjord-blue);
	border-color: var(--wp--preset--color--fjord-blue);
	color: var(--wp--preset--color--white);
}

.cn-map__chip.is-construction {
	border-color: var(--wp--preset--color--fjord-blue);
	color: var(--wp--preset--color--fjord-blue);
}

.cn-map__chip.is-sold {
	background: var(--wp--preset--color--frost);
	border-color: transparent;
}

.cn-map__note {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	color: rgba(86, 61, 110, 0.8);
}

.cn-map__card--office .cn-map__note {
	font-size: var(--wp--preset--font-size--body);
}

.cn-map__hint {
	padding-top: 4px;
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--fg-2, rgba(86, 61, 110, 0.85)); /* AU-H1 */
}

.cn-map__hint-pinned,
.cn-map__hint-key,
.cn-map__card.is-pinned .cn-map__hint-hover {
	display: none;
}

/* AU-M3 follow-up: a card opened from keyboard focus says how to keep it open by keyboard. */
.cn-map__card.is-key:not(.is-pinned) .cn-map__hint-hover {
	display: none;
}

.cn-map__card.is-key:not(.is-pinned) .cn-map__hint-key {
	display: inline;
}

.cn-map__card.is-pinned .cn-map__hint-pinned {
	display: inline;
	color: var(--wp--preset--color--fjord-blue);
}

/* Close: only on a pinned card. */
.cn-map__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid rgba(86, 61, 110, 0.3);
	background: transparent;
	color: var(--wp--preset--color--purple);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s, background 0.3s, border-color 0.3s, color 0.3s, transform 0.4s var(--ease);
}

.cn-map__close span::before,
.cn-map__close span::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 14px;
	height: 1.5px;
	background: currentColor;
	transform: translate(-50%, -50%) rotate(45deg);
}

.cn-map__close span::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.cn-map__card.is-pinned .cn-map__close {
	opacity: 1;
	pointer-events: auto;
}

.cn-map__close:hover,
.cn-map__close:focus-visible {
	background: var(--wp--preset--color--purple);
	border-color: var(--wp--preset--color--purple);
	color: var(--wp--preset--color--white);
	transform: rotate(90deg);
	outline: none;
}

/* ---- Tablets and phones -------------------------------------------------------------- */
@media (max-width: 1099px) {
	/* No stacking contexts on the way to the fixed card sheet. */
	.wp-block-group.cn-map {
		isolation: auto;
		display: flex;
		flex-direction: column;
		align-items: stretch;
		min-height: 0;
	}

	.wp-block-group.cn-map__in {
		display: contents;
	}

	.wp-block-group.cn-map__lead,
	.cn-map__nav {
		order: 1;
		width: min(100% - 2 * var(--gutter), var(--w));
		max-width: 640px;
		margin-inline: auto;
		position: relative;
		z-index: auto;
	}

	.cn-map__stage {
		order: 2;
		position: relative;
		inset: auto;
		width: 100%;
		aspect-ratio: 1000 / 1000;
		margin: 24px 0 8px;
	}

	.cn-map__nav {
		order: 3;
	}

	.cn-map__svg {
		top: 0;
		right: 0;
		left: 0;
		width: 100%;
		height: 100%;
		transform: none;
	}

	.cn-map__svg--bg {
		-webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 90%, transparent 100%);
		mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 90%, transparent 100%);
	}

	.cn-map__list {
		margin-top: 8px;
	}

	/* The map is drawn at about 40% here: bigger labels and pins, and a finger-sized tap area. */
	.cn-map__label {
		font-size: 26px;
		letter-spacing: 0.12em;
		stroke-width: 6px;
		dominant-baseline: central;
	}

	.cn-map__label[text-anchor="end"] {
		translate: -10px 0;
	}

	.cn-map__label[text-anchor="start"] {
		translate: 10px 0;
	}

	.cn-map__ring {
		r: 11px;
	}

	.cn-map__dot {
		r: 5px;
	}

	.cn-map__hit {
		r: 34px; /* AU-L16: at least 24px on a 390px phone (30 gave 22px) */
	}

	/* A card opens as a sheet at the bottom of the screen (view.js moves the cards to the body). */
	.cn-map__cards {
		position: static;
		z-index: auto;
	}

	.cn-map__card,
	.cn-map__card[data-side] {
		position: fixed;
		inset: auto 12px 12px;
		z-index: 1000;
		width: auto;
		max-height: 72vh;
		overflow: auto;
		padding: 22px 22px 18px;
		transform: translateY(24px);
		clip-path: inset(100% 0 0 0);
	}

	.cn-map__card.is-open {
		pointer-events: auto;
		transform: none;
		clip-path: inset(0 0 0 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cn-map__pulse {
		display: none;
	}

	.cn-map__card,
	.cn-map__card .cn-map__sites li,
	.cn-map__place,
	.cn-map__place::before,
	.cn-map__place::after,
	.cn-map__place b,
	.cn-map__ring,
	.cn-map__dot {
		transition: none !important;
	}
}
