/* ==========================================================================
   workfromanywhere.co — the /cities/ page (v1.4.0)
   v1.4.0: the "Not sure where to go?" dropdowns use the site's own
   dropdown (no browser arrow, the thin chevron from the job search bar);
   a small flag before the country on each card.
   v1.3.0: pins show just the small round grey flag; the city name (and
   the flag's colour) appears on hover, focus, or when its card is hovered.
   Upload to: /wp-content/themes/wfa-theme/assets/css/wfa-cities-archive.css
   Loaded on the city guide archive only.

   Same system as the guides: small-capital eyebrows, serif headings,
   square corners, ink and cream. The map is drawn in the same two
   colours, so it reads as part of the page rather than a widget.
   ========================================================================== */

.wfa-cg {
	--cg-ink:     var(--wfa-text, #14171a);
	--cg-muted:   var(--wfa-muted, #5f6a70);
	--cg-paper:   var(--wfa-bg, #faf7f2);
	--cg-card:    var(--wfa-surface, #f2ede4);
	--cg-line:    var(--wfa-line, #e2dcd2);
	--cg-sea:     #f6f2eb;
	--cg-display: var(--wfa-display, "Fraunces", Georgia, "Times New Roman", serif);

	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	color: var(--cg-ink);
	font-family: var(--wfa-ui, "Public Sans", system-ui, sans-serif);
}

.wfa-cg *,
.wfa-cg *::before,
.wfa-cg *::after {
	box-sizing: border-box;
}

/* Lines up with the logo, as on the guides: 40px gutter, 30px on phones. */
.wfa-cg__wrap {
	padding: clamp(3rem, 7vw, 5rem) 40px clamp(4rem, 9vw, 6rem);
}

@media (max-width: 768px) {
	.wfa-cg__wrap {
		padding-left: 30px;
		padding-right: 30px;
	}
}

/* ---------- head ---------- */

.wfa-cg-eyebrow {
	margin: 0 0 .9rem;
	font-size: .75rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--cg-muted);
}

.wfa-cg__head {
	margin-bottom: clamp(2rem, 4vw, 2.75rem);
}

.wfa-cg__title {
	margin: 0;
	max-width: 20ch;
	font-family: var(--cg-display);
	font-size: clamp(2.5rem, 6vw, 3.75rem);
	font-weight: 400;
	line-height: 1.05;
	letter-spacing: -.02em;
	text-wrap: balance;
}

.wfa-cg__standfirst {
	max-width: 40rem;
	margin: 1.25rem 0 0;
	font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
	line-height: 1.65;
	color: var(--cg-muted);
}

.wfa-cg__empty {
	color: var(--cg-muted);
}

/* ---------- the map ---------- */

.wfa-cg-map {
	margin: 0 0 clamp(2rem, 4vw, 2.5rem);
}

.wfa-cg-map__canvas {
	width: 100%;
	height: clamp(260px, 46vw, 520px);
	border-top: 1px solid var(--cg-ink);
	border-bottom: 1px solid var(--cg-line);
	background: var(--cg-sea);
	z-index: 0;
}

.wfa-cg .leaflet-container {
	background: var(--cg-sea);
	font-family: var(--wfa-ui, "Public Sans", system-ui, sans-serif);
	outline: 0;
}

.wfa-cg-map__note {
	margin: .75rem 0 0;
	font-size: .75rem;
	color: var(--cg-muted);
}

/* Zoom buttons: square, ink, no Leaflet shadow. */
.wfa-cg .leaflet-bar {
	border: 1px solid var(--cg-line);
	border-radius: 0;
	box-shadow: none;
}

.wfa-cg .leaflet-bar a,
.wfa-cg .leaflet-bar a:first-child,
.wfa-cg .leaflet-bar a:last-child {
	border-radius: 0;
	background: var(--cg-paper);
	color: var(--cg-ink);
	border-bottom-color: var(--cg-line);
}

.wfa-cg .leaflet-bar a:hover {
	background: var(--cg-card);
}

/* The pins: an ink dot with the city name beside it. */
.wfa-cg-pin-holder {
	background: none;
	border: 0;
}

.wfa-cg-pin {
	position: relative;
	display: block;
	width: 14px;
	height: 14px;
	cursor: pointer;
}

.wfa-cg-pin__dot {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--cg-ink);
	box-shadow: 0 0 0 3px var(--cg-paper), 0 2px 6px -2px rgba(20, 23, 26, .5);
	transition: transform .15s ease;
}

.wfa-cg-pin__label {
	position: absolute;
	top: 50%;
	padding: .15rem .4rem;
	background: var(--cg-paper);
	color: var(--cg-ink);
	font-size: .6875rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .1em;
	text-transform: uppercase;
	white-space: nowrap;
	transform: translateY(-50%);
	pointer-events: none;
}

.wfa-cg-pin--right .wfa-cg-pin__label {
	left: 20px;
}

.wfa-cg-pin--left .wfa-cg-pin__label {
	right: 20px;
}

.leaflet-marker-icon:hover .wfa-cg-pin__dot,
.leaflet-marker-icon:focus .wfa-cg-pin__dot,
.leaflet-marker-icon.is-lit .wfa-cg-pin__dot {
	transform: scale(1.35);
}

.leaflet-marker-icon.is-lit .wfa-cg-pin__label,
.leaflet-marker-icon:hover .wfa-cg-pin__label {
	background: var(--cg-ink);
	color: var(--cg-paper);
}

.leaflet-marker-icon.is-lit {
	z-index: 1000 !important;
}

/* The popup: a small version of the card. */
.wfa-cg .wfa-cg-popup .leaflet-popup-content-wrapper,
.wfa-cg .wfa-cg-popup .leaflet-popup-tip {
	border-radius: 0;
	background: var(--cg-paper);
	box-shadow: 0 14px 28px -18px rgba(20, 23, 26, .5);
}

.wfa-cg .wfa-cg-popup .leaflet-popup-content-wrapper {
	padding: 0;
	border: 1px solid var(--cg-line);
}

.wfa-cg .wfa-cg-popup .leaflet-popup-content {
	margin: 0;
	width: 240px !important;
}

.wfa-cg a.wfa-cg-pop {
	display: flex;
	flex-direction: column;
	gap: .3rem;
	padding: 0 0 1rem;
	color: var(--cg-ink);
	text-decoration: none;
}

.wfa-cg-pop__img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	margin-bottom: .6rem;
	object-fit: cover;
}

.wfa-cg-pop__country,
.wfa-cg-pop__title,
.wfa-cg-pop__text,
.wfa-cg-pop__more {
	padding: 0 1rem;
}

.wfa-cg-pop__country {
	font-size: .625rem;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--cg-muted);
}

.wfa-cg-pop__title {
	font-family: var(--cg-display);
	font-size: 1.25rem;
	line-height: 1.15;
}

.wfa-cg-pop__text {
	font-size: .8125rem;
	line-height: 1.5;
	color: var(--cg-muted);
}

.wfa-cg-pop__more {
	margin-top: .35rem;
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* ---------- region filter ---------- */

.wfa-cg-filter {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	margin: 0 0 clamp(2rem, 4vw, 2.5rem);
}

.wfa-cg .wfa-cg-chip {
	display: inline-flex;
	align-items: center;
	min-height: 2.5rem;
	padding: .45rem .8rem;
	border: 1px solid var(--cg-line);
	border-radius: 0;
	background: transparent;
	color: var(--cg-ink);
	font-family: inherit;
	font-size: .6875rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .12em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.wfa-cg .wfa-cg-chip:hover {
	border-color: var(--cg-ink);
}

.wfa-cg .wfa-cg-chip.is-current {
	border-color: var(--cg-ink);
	background: var(--cg-ink);
	color: var(--cg-paper);
}

.wfa-cg .wfa-cg-chip:focus-visible,
.wfa-cg a:focus-visible {
	outline: 2px solid var(--cg-ink);
	outline-offset: 3px;
}

/* ---------- the grid ---------- */

/* Six tracks, each card taking two, so a leading pair can take three
   each. With one card over, the first runs the full width as a lead,
   image left and text right; with two over, the first two share a row.
   The last row is then always full. */
.wfa-cg-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 3rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wfa-cg-grid > .wfa-cg-card {
	grid-column: span 2;
}

.wfa-cg-grid--r3-2 > .wfa-cg-card:nth-child(-n+2) {
	grid-column: span 3;
}

.wfa-cg-grid--r3-1 > .wfa-cg-card:first-child {
	grid-column: 1 / -1;
}

@media (min-width: 1001px) {
	.wfa-cg-grid--r3-1 > .wfa-cg-card:first-child {
		display: grid;
		grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
		align-items: center;
		gap: clamp(2rem, 4vw, 3.5rem);
		padding-bottom: 3rem;
		border-bottom: 1px solid var(--cg-line);
	}

	.wfa-cg-grid--r3-1 > .wfa-cg-card:first-child .wfa-cg-card__body {
		padding-top: 0;
	}

	.wfa-cg-grid--r3-1 > .wfa-cg-card:first-child .wfa-cg-card__title {
		font-size: clamp(2rem, 3.4vw, 2.75rem);
	}

	.wfa-cg-grid--r3-1 > .wfa-cg-card:first-child .wfa-cg-card__text {
		font-size: 1.0625rem;
	}
}

@media (max-width: 1000px) {
	.wfa-cg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.wfa-cg-grid > .wfa-cg-card,
	.wfa-cg-grid--r3-1 > .wfa-cg-card:first-child,
	.wfa-cg-grid--r3-2 > .wfa-cg-card:nth-child(-n+2) {
		grid-column: span 1;
	}

	.wfa-cg-grid--r2-1 > .wfa-cg-card:first-child {
		grid-column: 1 / -1;
	}
}

@media (max-width: 600px) {
	.wfa-cg-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.wfa-cg-grid--r2-1 > .wfa-cg-card:first-child {
		grid-column: auto;
	}
}

.wfa-cg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
}

.wfa-cg-card[hidden] {
	display: none;
}

.wfa-cg-card__media {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--cg-card);
}

.wfa-cg-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s ease;
}

.wfa-cg-card:hover .wfa-cg-card__media img {
	transform: scale(1.03);
}

.wfa-cg-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding-top: 1.25rem;
}

.wfa-cg-card__country {
	display: flex;
	align-items: center;
	gap: .45rem;
	margin: 0 0 .5rem;
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--cg-muted);
}

.wfa-cg-card__title {
	margin: 0;
	font-family: var(--cg-display);
	font-size: 1.75rem;
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: -.01em;
}

.wfa-cg .wfa-cg-card__title a {
	color: var(--cg-ink);
	text-decoration: none;
}

/* The whole card clicks through the title. */
.wfa-cg .wfa-cg-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.wfa-cg .wfa-cg-card:hover .wfa-cg-card__title a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

.wfa-cg-card__text {
	margin: .75rem 0 0;
	font-size: .9375rem;
	line-height: 1.6;
	color: var(--cg-muted);
}

.wfa-cg-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

.wfa-cg-card__tags li {
	margin: 0;
	padding: .3rem .55rem;
	border: 1px solid var(--cg-line);
	font-size: .6875rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .06em;
	color: var(--cg-ink);
}

@media (prefers-reduced-motion: reduce) {
	.wfa-cg * {
		transition: none !important;
	}
}

@media (max-width: 600px) {
	/* Labels crowd at phone width; the dots and popups carry it. */
	.wfa-cg-pin__label {
		display: none;
	}
}

/* ==========================================================================
   v1.1.0 — "Coming soon" pins: a hollow ring, smaller than a live pin,
   with the name only on hover or focus so forty of them don't crowd the
   live labels.
   ========================================================================== */

.wfa-cg-pin--soon {
	width: 12px;
	height: 12px;
}

.wfa-cg-pin--soon .wfa-cg-pin__dot {
	background: var(--cg-paper);
	box-shadow: inset 0 0 0 2px var(--cg-muted), 0 0 0 2px var(--cg-paper);
}

.wfa-cg-pin--soon .wfa-cg-pin__label {
	display: none;
	left: 18px;
	color: var(--cg-muted);
}

.leaflet-marker-icon:hover .wfa-cg-pin--soon .wfa-cg-pin__label,
.leaflet-marker-icon:focus .wfa-cg-pin--soon .wfa-cg-pin__label {
	display: block;
	background: var(--cg-ink);
	color: var(--cg-paper);
}

.leaflet-marker-icon:hover .wfa-cg-pin--soon .wfa-cg-pin__dot,
.leaflet-marker-icon:focus .wfa-cg-pin--soon .wfa-cg-pin__dot {
	box-shadow: inset 0 0 0 2px var(--cg-ink), 0 0 0 2px var(--cg-paper);
}

.wfa-cg-pop--soon {
	display: flex;
	flex-direction: column;
	gap: .2rem;
	padding: .85rem 0;
}

.wfa-cg-pop__soon {
	padding: 0 1rem;
	margin-top: .3rem;
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--cg-muted);
}

/* The key under the map. */
.wfa-cg-key {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	color: var(--cg-ink);
	font-weight: 600;
}

.wfa-cg-key__dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--cg-ink);
}

.wfa-cg-key__dot.is-soon {
	background: var(--cg-paper);
	box-shadow: inset 0 0 0 2px var(--cg-muted);
}

.wfa-cg-map__note {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .35rem 1.25rem;
}

/* ==========================================================================
   v1.2.0 — flag pins. Each live city keeps the round pin, filled with its
   country's flag (the same flat flags as the footer): grey and slightly
   faded at rest, full colour and a little larger on hover, on focus, or
   when its card is hovered.
   ========================================================================== */

.wfa-cg-pin--flag {
	width: 16px;
	height: 16px;
}

.wfa-cg-pin--flag .wfa-cg-pin__dot {
	overflow: hidden;
	background: var(--cg-card);
}

.wfa-cg-pin__flag {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0;
	border-radius: 50%;
	object-fit: cover;
	filter: grayscale(1) contrast(1.1);
	opacity: .7;
	transition: filter .2s ease, opacity .2s ease;
}

.leaflet-marker-icon:hover .wfa-cg-pin__flag,
.leaflet-marker-icon:focus .wfa-cg-pin__flag,
.leaflet-marker-icon.is-lit .wfa-cg-pin__flag {
	filter: none;
	opacity: 1;
}

.wfa-cg-pin--flag.wfa-cg-pin--right .wfa-cg-pin__label {
	left: 25px;
}

.wfa-cg-pin--flag.wfa-cg-pin--left .wfa-cg-pin__label {
	right: 25px;
}

/* The key: a small grey striped circle, like a flag pin at rest. */
.wfa-cg-key__dot:not(.is-soon) {
	width: 12px;
	height: 12px;
	background: linear-gradient(90deg, #8a8f93 0 33%, #c9c6c0 33% 66%, #8a8f93 66%);
	box-shadow: 0 0 0 1px rgba(20, 23, 26, .15);
}

/* ==========================================================================
   v1.3.0 — quiet pins. At rest a pin is only its small round grey flag;
   the name appears, in the ink label, on hover, on focus, or when its
   card is hovered (is-lit). Fewer labels, a cleaner map.
   ========================================================================== */

.wfa-cg-pin__label {
	display: none;
}

.leaflet-marker-icon:hover .wfa-cg-pin__label,
.leaflet-marker-icon:focus .wfa-cg-pin__label,
.leaflet-marker-icon.is-lit .wfa-cg-pin__label {
	display: block;
	background: var(--cg-ink);
	color: var(--cg-paper);
}

.leaflet-marker-icon:hover,
.leaflet-marker-icon:focus {
	z-index: 1000 !important;
}

@media (max-width: 600px) {
	.leaflet-marker-icon:hover .wfa-cg-pin__label,
	.leaflet-marker-icon:focus .wfa-cg-pin__label {
		display: none;
	}
}

/* --------------------------------------------------------------------------
   v1.4.0: flag before the country on each card. Grey until the card is
   hovered, like the pins and the Countries page.
   -------------------------------------------------------------------------- */

.wfa-cg-card__flag {
	display: block;
	flex: 0 0 auto;
	width: 16px;
	height: 12px;
	object-fit: cover;
	box-shadow: 0 0 0 1px var(--cg-line);
	filter: grayscale(1);
	transition: filter .15s ease;
}

.wfa-cg-card:hover .wfa-cg-card__flag,
.wfa-cg-card:focus-within .wfa-cg-card__flag {
	filter: none;
}

/* --------------------------------------------------------------------------
   v1.4.0: "Not sure where to go?" dropdowns, styled like the rest of the
   site: no browser arrow, the job search bar's thin chevron, square
   corners, hairline border.
   -------------------------------------------------------------------------- */

.wfa-tp--cities select.wfa-tp__input {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding: 0 2.25rem 0 .75rem;
	/* !important because the tool panel's own rule sets background and
	   border with !important. */
	background: var(--tp-paper, #faf7f2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75L6 6.25l4.5-4.5' fill='none' stroke='%2314171a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .85rem center / 11px 8px !important;
	cursor: pointer;
	transition: border-color .15s ease;
}

.wfa-tp--cities select.wfa-tp__input:hover,
.wfa-tp--cities select.wfa-tp__input:focus {
	border-color: var(--tp-ink, #14171a) !important;
}

.wfa-tp--cities select.wfa-tp__input::-ms-expand {
	display: none;
}
