/**
 * Destinations — the /destinations/ archive and region archives show each
 * region as a photo card with country pills that open a :target popup
 * (inc/pages/destinations.php). The single country page keeps the older
 * row, heading, pill and fact-line styles further down.
 */

/* Region cards ------------------------------------------------------------ */

.ax-dest-cards {
	display: grid;
	gap: 32px;
	margin: 16px 0 24px;
}

.ax-dest-card {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	overflow: hidden;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(14, 25, 54, 0.06), 0 24px 48px -24px rgba(14, 25, 54, 0.4);
}

.ax-dest-card:nth-child(even) {
	grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.ax-dest-card:nth-child(even) .ax-dest-card__media {
	order: 2;
}

.ax-dest-card__media {
	position: relative;
	min-height: 360px;
	overflow: hidden;
	background: #132146;
}

.ax-dest-card__media img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ax-dest-card:hover .ax-dest-card__media img {
	transform: scale(1.06);
}

.ax-dest-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(19, 33, 70, 0) 55%, rgba(19, 33, 70, 0.35));
	pointer-events: none;
}

.ax-dest-card__body {
	padding: 48px 52px;
}

.ax-dest-card__title {
	margin: 0 0 20px;
	font-size: clamp(26px, 2.4vw, 34px);
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.15;
	color: #132146;
}

.ax-dest-card__title::after {
	content: "";
	display: block;
	width: 48px;
	height: 4px;
	margin-top: 14px;
	border-radius: 4px;
	background: #ffb606;
}

.ax-dest-card__intro {
	margin: 0 0 32px;
	font-size: 15.5px;
	line-height: 1.75;
	color: #4b5474;
}

.ax-dest-card__label {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 16px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.16em;
	line-height: 1;
	text-transform: uppercase;
	color: #132146;
}

.ax-dest-card__label::after {
	content: "";
	flex: 1;
	height: 1px;
	background: #e3e7f2;
}

.ax-dest-card__countries {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.ax-dest-card__countries .ax-dest-country {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px 8px 13px;
	border: 1px solid #dfe4f1;
	border-radius: 999px;
	background: #f3f5fb;
	font-size: 14px;
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.3;
	color: #132146;
	text-decoration: none;
	transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.ax-dest-card__countries .ax-dest-country::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #ffb606;
	transition: transform 200ms ease;
}

.ax-dest-card__countries .ax-dest-country:hover,
.ax-dest-card__countries .ax-dest-country:focus-visible {
	border-color: #132146;
	background: #132146;
	color: #fff;
	text-decoration: none;
	transform: translateY(-2px);
	box-shadow: 0 10px 20px -10px rgba(19, 33, 70, 0.7);
}

.ax-dest-card__countries .ax-dest-country:hover::before,
.ax-dest-card__countries .ax-dest-country:focus-visible::before {
	transform: scale(1.3);
}

.ax-dest-card__countries .ax-dest-country:focus-visible {
	outline: 2px solid #ffb606;
	outline-offset: 2px;
}

@media (max-width: 991px) {
	.ax-dest-card,
	.ax-dest-card:nth-child(even) {
		grid-template-columns: minmax(0, 1fr);
	}

	.ax-dest-card:nth-child(even) .ax-dest-card__media {
		order: 0;
	}

	.ax-dest-card__media {
		min-height: 0;
		aspect-ratio: 16 / 9;
	}

	.ax-dest-card__body {
		padding: 36px 36px 40px;
	}
}

@media (max-width: 600px) {
	.ax-dest-cards {
		gap: 24px;
		margin-top: 0;
	}

	.ax-dest-card {
		border-radius: 18px;
	}

	.ax-dest-card__media {
		aspect-ratio: 4 / 3;
	}

	.ax-dest-card__body {
		padding: 26px 22px 28px;
	}

	.ax-dest-card__intro {
		margin-bottom: 26px;
		font-size: 15px;
		line-height: 1.7;
	}

	.ax-dest-card__countries {
		gap: 8px;
	}

	.ax-dest-card__countries .ax-dest-country {
		padding: 7px 14px 7px 11px;
		font-size: 13.5px;
	}
}

/* Country popup ----------------------------------------------------------- */

html:has(.ax-dest-overlay:target) {
	overflow: hidden;
}

.ax-dest-overlay {
	position: fixed;
	inset: 0;
	z-index: 1100; /* above the back-to-top button (1000) */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	visibility: hidden;
	opacity: 0;
	transition: opacity 250ms ease, visibility 0s linear 250ms;
}

.ax-dest-overlay:target {
	visibility: visible;
	opacity: 1;
	transition: opacity 250ms ease;
}

.ax-dest-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 14, 34, 0.62);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	cursor: default;
}

.ax-dest-popup {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 640px;
	max-height: min(760px, calc(100vh - 48px));
	max-height: min(760px, calc(100dvh - 48px));
	overflow: hidden;
	border-radius: 22px;
	background: #fff;
	box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.5);
	transform: translateY(16px) scale(0.97);
	transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ax-dest-overlay:target .ax-dest-popup {
	transform: none;
}

.ax-dest-popup__head {
	display: flex;
	flex: none;
	align-items: center;
	gap: 16px;
	padding: 20px 20px 20px 24px;
	background: linear-gradient(135deg, #132146 0%, #1f3775 100%);
}

/* Place photo behind the flag and name. The background only applies while
   the popup is the :target, so closed popups don't download their photo. */
.ax-dest-popup__head.has-photo {
	position: relative;
	align-items: flex-end;
	min-height: 250px;
	padding: 20px 24px 22px;
	overflow: hidden;
	background: #132146;
	isolation: isolate;
}

.ax-dest-popup__head.has-photo::before,
.ax-dest-popup__head.has-photo::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
}

.ax-dest-popup__head.has-photo::before {
	background: center / cover no-repeat;
	transform: scale(1.08);
	transition: transform 1.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ax-dest-overlay:target .ax-dest-popup__head.has-photo::before {
	background-image: var(--ax-dest-photo);
	transform: none;
}

.ax-dest-popup__head.has-photo::after {
	background: linear-gradient(180deg, rgba(8, 14, 34, 0.4) 0%, rgba(8, 14, 34, 0) 32%, rgba(8, 14, 34, 0.1) 55%, rgba(8, 14, 34, 0.85) 100%);
}

.ax-dest-popup__head.has-photo h2 {
	font-size: 34px;
	text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.ax-dest-popup__head.has-photo .ax-dest-popup__close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: rgba(8, 14, 34, 0.45);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.ax-dest-popup__head.has-photo .ax-dest-popup__close:hover,
.ax-dest-popup__head.has-photo .ax-dest-popup__close:focus-visible {
	background: #ffb606;
}

.ax-dest-popup__flag {
	flex: none;
	width: 60px;
	height: 60px;
	object-fit: contain;
}

.ax-dest-popup h2 {
	flex: 1;
	min-width: 0;
	margin: 0;
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: #fff;
}

.ax-dest-popup__close {
	display: grid;
	flex: none;
	place-items: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	font-size: 28px;
	line-height: 1;
	color: #fff;
	transition: background-color 200ms ease, color 200ms ease;
}

.ax-dest-popup__close:hover,
.ax-dest-popup__close:focus-visible {
	background: #ffb606;
	color: #132146;
	text-decoration: none;
}

.ax-dest-popup__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.ax-dest-popup__body {
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 24px;
}

.ax-dest-popup__facts {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}

.ax-dest-fact {
	flex: 1 1 150px;
	padding: 12px 16px 13px;
	border-radius: 14px;
	background: #f3f5fb;
}

.ax-dest-fact.is-wide {
	flex-basis: 100%;
	margin-top: 10px;
	padding: 0;
	background: none;
}

.ax-dest-fact dt {
	margin-bottom: 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #7c86a3;
}

.ax-dest-fact dd {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: #132146;
}

.ax-dest-fact.is-wide dt {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
}

.ax-dest-fact.is-wide dt::after {
	content: "";
	flex: 1;
	height: 1px;
	background: #e3e7f2;
}

.ax-dest-fact.is-wide dd {
	font-size: 15px;
	font-weight: 400;
	line-height: 1.7;
	color: #3f4866;
}

@media (max-width: 600px) {
	.ax-dest-overlay {
		align-items: flex-end;
		padding: 12px;
	}

	.ax-dest-popup {
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
		border-radius: 20px;
	}

	.ax-dest-popup__head {
		gap: 12px;
		padding: 16px 16px 16px 18px;
	}

	.ax-dest-popup__flag {
		width: 46px;
		height: 46px;
	}

	.ax-dest-popup h2 {
		font-size: 22px;
	}

	.ax-dest-popup__head.has-photo {
		min-height: 180px;
		padding: 16px 18px 16px;
	}

	.ax-dest-popup__head.has-photo h2 {
		font-size: 26px;
	}

	.ax-dest-popup__head.has-photo .ax-dest-popup__close {
		top: 12px;
		right: 12px;
	}

	.ax-dest-popup__body {
		padding: 18px;
	}

	.ax-dest-fact {
		flex-basis: 120px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ax-dest-card__media img,
	.ax-dest-card__countries .ax-dest-country,
	.ax-dest-popup,
	.ax-dest-popup__head.has-photo::before {
		transition: none;
	}

	.ax-dest-card:hover .ax-dest-card__media img {
		transform: none;
	}
}

/* Country page: title, intro, label, pills and photo ------------------------------------------------------------ */

.ax-dest-region__title {
	margin-top: 20px;
	padding-bottom: 15px;
	border-bottom: 1px solid #c5c5c5;
	font-weight: 700;
}

.ax-dest-region__intro,
.ax-dest-body p {
	padding-top: 5px;
	font-size: 14px;
	font-style: italic;
	font-weight: 400;
	line-height: 18px;
	color: #303030;
	text-align: justify;
}

.ax-dest-region__label {
	margin-bottom: 15px;
	padding: 0 0 10px;
	border-bottom: 1px dashed #303030;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
}

.ax-dest-region__label a {
	color: inherit;
}

.ax-dest-country {
	display: inline-block;
	margin: 0 3px 7px 0;
	padding: 3px 12px;
	border-radius: 5px;
	background: #132146;
	font-size: 15px;
	font-style: italic;
	font-weight: 400;
	letter-spacing: 1px;
	color: #fff;
}

.ax-dest-region__media {
	margin: 0 0 10px;
	text-align: center;
}

.ax-dest-region__media img {
	width: 100%;
	height: auto;
}

/* The fact lines, on a country page. */
.ax-dest-facts {
	display: inline-block;
	float: left;
	font-size: 16px;
	font-style: italic;
	line-height: 28px;
	color: #303030;
}

.ax-dest-facts b {
	font-weight: 700;
}

.ax-dest-facts__flag {
	float: right;
	width: 140px;
	max-width: 100%;
}

/* Single country page ----------------------------------------------------- */

.ax-dest-body > :last-child {
	margin-bottom: 1rem;
}

.ax-dest-profile {
	display: flow-root;
	margin-bottom: 1rem;
	text-align: justify;
}

.ax-dest-profile .ax-dest-facts {
	display: block;
	float: none;
}

.ax-dest-more {
	margin-top: 8px;
}

.ax-dest-region .wp-block-post-featured-image {
	margin: 0 0 10px;
}

.ax-dest-region .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto;
}
