/* Flip Cards — stand-in for Enfold's icongrid flipbox on the old site.
   Brand tokens only: Quincy for the question, Source Sans for the answer,
   navy #000d26. */

.flip-cards {
	max-width: 90rem;
	margin: 2.5rem auto;
	padding: 0 5rem;
	box-sizing: border-box;
}

.flip-cards__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	/* Full row or fully stacked — never an orphan. auto-fit was leaving a
	   2 + 1 at tablet widths, the same stranded-last-item look as the trust
	   badges. Below 900px the cards stack one per row instead. */
	grid-template-columns: repeat( var( --fc-cols, 3 ), 1fr );
	gap: 1.5rem;
}

/* Inside post content the article column already provides the gutters. */
.single-post__content .flip-cards,
.entry-content .flip-cards {
	padding: 0;
	margin: 2rem 0;
	max-width: 100%;
}

.flip-cards__item { margin: 0; }

/* The card is a <button> so it is tabbable and tappable without extra markup. */
.flip-cards__card {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	border-radius: 1rem;
	transform-style: preserve-3d;
	transition: transform 0.55s cubic-bezier( 0.2, 0.7, 0.3, 1 );
	font: inherit;
	text-align: left;
}

.flip-cards__card:hover,
.flip-cards__card:focus-visible,
.flip-cards__card.is-flipped { transform: rotateY( 180deg ); }

.flip-cards__card:focus-visible {
	outline: 0.1875rem solid #0b5cff;
	outline-offset: 0.25rem;
}

.flip-cards__face {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	border-radius: 1rem;
	overflow: hidden;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

/* ── Front: image with a scrim so the question stays legible ── */
.flip-cards__face--front { background: #000d26; }

.flip-cards__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.flip-cards__face--front::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient( to top,
		rgba( 0, 13, 38, 0.85 ) 0%,
		rgba( 0, 13, 38, 0.35 ) 45%,
		rgba( 0, 13, 38, 0.10 ) 100% );
}

.flip-cards__title {
	position: relative;
	z-index: 1;
	font-family: 'Quincy', Georgia, serif;
	font-size: 1.5rem;
	line-height: 1.2;
	color: #ffffff;
	padding: 1.25rem;
}

/* ── Back: the answer ── */
.flip-cards__face--back {
	transform: rotateY( 180deg );
	background: #000d26;
	justify-content: flex-start;
	gap: 0.625rem;
	padding: 1.5rem;
	overflow-y: auto;
}

.flip-cards__back-title {
	font-family: 'Quincy', Georgia, serif;
	font-size: 1.125rem;
	line-height: 1.25;
	color: rgba( 255, 255, 255, 0.7 );
}

.flip-cards__text {
	font-family: 'Source Sans 3', system-ui, sans-serif;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: #ffffff;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
	.flip-cards { padding: 0 3rem; }
}

@media (max-width: 900px) {
	.flip-cards { padding: 0 1.5rem; }
	.flip-cards__grid { grid-template-columns: 1fr; }
	.flip-cards__card { aspect-ratio: 16 / 9; }
}

@media (max-width: 600px) {
	.flip-cards { padding: 0 1rem; }
	.flip-cards__grid { grid-template-columns: 1fr; gap: 1rem; }
	.flip-cards__card { aspect-ratio: 4 / 3; }
	/* Hover does not exist on touch — only the tap toggle should flip, or the
	   answer would be unreachable on a phone. */
	.flip-cards__card:hover { transform: none; }
	.flip-cards__card.is-flipped { transform: rotateY( 180deg ); }
}

@media (prefers-reduced-motion: reduce) {
	.flip-cards__card { transition: none; }
}
