/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* container query */

.hover-cards {
	container-type: inline-size;
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* containers */

.hover-cards__inner {
	padding: 52px 30px;
	background: var(--blue-background-gradient);
	border-radius: var(--box-border-radius-lg);
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* title */

.hover-cards__header.section-header {
	text-align: center;
}

.hover-cards__title span {
	color: var(--white);
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* cards */

.hover-cards__cards {
	display: flex;
	flex-wrap: wrap;
	column-gap: 36px;
	row-gap: 32px;
	justify-content: center;
	align-items: stretch;
}

/*single card*/
.hover-cards__card {
	position: relative;
	min-height: 290px;

	border-radius: var(--box-border-radius-sm);
	overflow: hidden;

	flex: 0 0 calc((100% - (36px * 2)) / 3);
}

/*background*/
.hover-cards__card__image,
.hover-cards__card__image img {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.hover-cards__card__gradient.background-gradient {
	z-index: 2;
	top: unset;
	bottom: 0;
	height: 45%;
	background: var(--black-overlay-gradient);
}

/*content*/
.hover-cards__card__content {
	position: relative;
	z-index: 3;
	height: 100%;

	padding: 16px;

	text-align: center;
	color: var(--white);

	display: flex;
	flex-direction: column;
	justify-content: end;
	align-items: center;
}

/*flip link — the real anchor. Never transformed: a rotated <a> is hit-tested by its
  own edge-on box, which collapses the clickable area to a line at the centre.*/
.hover-cards__card__flip-link {
	display: block;
	width: 100%;
}

/*flip button wrapper*/
.hover-cards__card__flip-wrapper {
	width: 100%;
	perspective: 1000px;
}

/*flip button — rotates; must NOT be the anchor*/
/* height comes from --flip-h, set by hover_cards.js to one value per section: at least
   two lines of text, more if any card's front title or back "Explore …" text wraps
   further — so every button in a section is the same size. The 3D rotation still
   needs the translateZ offset to equal half that height. The px fallback only covers
   the instant before that JS runs. */
.hover-cards__card__flip-button {
	position: relative;
	display: block;
	width: 100%;
	height: var(--flip-h, 88px);

	transform-style: preserve-3d;
	transition: transform 0.4s ease, height 0.4s ease;
	transform: translateZ(calc(var(--flip-h, 88px) / -2));
}

/* Gate the flip behind real hover capability. On touch (hover: none) a :hover that
   changes rendering makes the first tap play the flip instead of following the link —
   forcing a second tap. Skipping hover on touch lets the first tap open the program. */
@media (hover: hover) {
	.hover-cards__card:hover .hover-cards__card__flip-button {
		transform: translateZ(calc(var(--flip-h, 88px) / -2)) rotateX(-90deg);
	}
}

/*faces*/
.flip-button__face {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;

	display: flex;
	justify-content: center;
	align-items: center;
	padding: 0 16px;

	border-radius: var(--box-border-radius-sm);
	backface-visibility: hidden;

	overflow: hidden;
	text-align: center;
}

.flip-button__face h3.hover-cards__card__title,
.flip-button__face .hover-cards__card__link {
	font-size: 22px;
	line-height: 1.1;
}

.flip-button__face--front {
	background: var(--blue-dk);
	color: var(--white);
	transform: rotateX(0deg) translateZ(calc(var(--flip-h, 88px) / 2));
}

.flip-button__face--front h3.hover-cards__card__title {
	margin: 0;
	padding: 0;
	background: transparent;
	color: inherit;
}

.flip-button__face--back {
	background: var(--white);
	color: var(--blue-dk);
	transform: rotateX(90deg) translateZ(calc(var(--flip-h, 88px) / 2));
}

.flip-button__face--back .hover-cards__card__link {
	margin: 0;
	color: inherit;
}

/* last word + arrow stay together so the arrow never wraps alone */
.hover-cards__card__link-end {
	white-space: nowrap;
}

.flip-button__face--back .icon.triangle-right {
	display: inline;
	font-size: 18px;
	margin-left: 5px;
}

.flip-button__face--back .icon.triangle-right svg {
	margin-bottom: 4px;
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* hover states */

/*non-hover*/
.hover-cards__card .hover-cards__card__gradient {
	transform: translateY(100%);
	transition: all 0.4s ease;
}

/*hover*/
@media (hover: hover) {
	.hover-cards__card:hover .hover-cards__card__gradient {
		transform: translateY(0%);
		transition: all 0.2s ease;
	}
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* read more */

.hover-cards__read-more-wrapper {
	display: none;
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* tablet */

@container (max-width: 1117px) {
	/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
	/* cards */
	.hover-cards__card {
		flex: 0 0 calc((100% - (36px)) / 2);
	}
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* mobile */

@media (max-width: 768px) {
	/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
	/*containers*/

	.hover-cards__inner {
		padding: 48px 30px;
		border-radius: 0;
	}
	.page-row--has-sidebar .hover-cards__inner {
		margin-right: -30px;
		margin-left: -30px;
	}
}

@container (max-width: 784px) {
	/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
	/* cards */

	.hover-cards__cards {
		row-gap: 16px;
	}

	.hover-cards__card {
		flex: 0 0 100%;
		aspect-ratio: 3 / 2;
	}

	/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
	/* read more */

	.hover-cards__card--mobile-hidden {
		display: none;
	}

	.hover-cards__read-more-wrapper {
		display: flex;
		justify-content: center;
		margin-top: 24px;
	}
}
