/* IFA related posts grid — semantic classes (no Divi blog module markup) */

:root {
	--ifa-related-navy: #203248;
}

/* --- Grid --- */
.ifa-related__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px;
	align-items: stretch;
}

@media (max-width: 980px) {
	.ifa-related__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.ifa-related__grid {
		grid-template-columns: 1fr;
		gap: 22px;
	}
}

/* --- Card --- */
.ifa-related__card {
	display: flex;
	flex-direction: column;
	height: 100%;

	position: relative;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 14px;
	overflow: hidden;
	padding: 18px !important;
	background: #fff;
	box-shadow: 3px 4px 14px rgba(0, 0, 0, 0.06);

	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
		box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
		border-color 0.4s ease;
}

/* Bottom-fill hover layer */
.ifa-related__card::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ifa-related-navy);
	transform: scaleY(0);
	transform-origin: bottom;
	transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 0;
	pointer-events: none;
}

.ifa-related__card > * {
	position: relative;
	z-index: 1;
}

@media (hover: hover) and (pointer: fine) {
	.ifa-related__card:hover {
		transform: translateY(-6px);
		box-shadow: 10px 12px 26px rgba(0, 0, 0, 0.12);
		border-color: rgba(255, 255, 255, 0.25);
	}

	.ifa-related__card:hover::before {
		transform: scaleY(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ifa-related__card,
	.ifa-related__card::before,
	.ifa-related__card .ifa-related__title,
	.ifa-related__card .ifa-related__title a,
	.ifa-related__card .ifa-related__body,
	.ifa-related__card .ifa-related__excerpt,
	.ifa-related__card .ifa-related__excerpt-p,
	.ifa-related__card .ifa-related__more {
		transition: none !important;
	}

	.ifa-related__card:hover {
		transform: none;
	}

	.ifa-related__card:hover::before {
		transform: scaleY(0);
	}
}

/* --- Media (1:1) --- */
.ifa-related__media {
	display: block !important;
	width: 100% !important;
	aspect-ratio: 1 / 1 !important;
	overflow: hidden !important;
	margin: 0 0 14px 0 !important;
	border-radius: 12px;
	position: relative !important;
	flex-shrink: 0;
}

.ifa-related__media img {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	background: #f5f5f5;
	object-position: center center !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
}

.ifa-related__media:focus-visible {
	outline: 3px solid var(--ifa-related-navy);
	outline-offset: 3px;
}

/* --- Title --- */
.ifa-related__title {
	margin: 0 0 10px 0;
	line-height: 1.25;
	font-size: 22px;
	font-weight: 700;
}

.ifa-related__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.4s ease, opacity 0.4s ease;
}

.ifa-related__title a:focus-visible {
	outline: 3px solid var(--ifa-related-navy);
	outline-offset: 2px;
}

/* --- Body / excerpt / CTA --- */
.ifa-related__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.ifa-related__excerpt {
	flex: 1;
	margin-bottom: 10px;
	transition: color 0.4s ease, opacity 0.4s ease;
}

.ifa-related__excerpt-p {
	margin: 0;
	font-size: 1rem;
	line-height: 1.5;
	transition: color 0.4s ease, opacity 0.4s ease;
}

/* Divi primary button — scoped white ring so the blue doesn’t bleed into the card */
.ifa-related__more.et_pb_button {
	margin-top: auto;
	align-self: flex-start;
	min-height: 44px;
	box-sizing: border-box;
	box-shadow: 0 0 0 1px #fff;
}

.ifa-related__more.et_pb_button:focus-visible {
	outline: 3px solid var(--ifa-related-navy);
	outline-offset: 3px;
}

/* Card hover: ghost style on navy (beat global teal while over filled card) */
@media (hover: hover) and (pointer: fine) {
	.ifa-related__card:hover .ifa-related__title,
	.ifa-related__card:hover .ifa-related__title a,
	.ifa-related__card:hover .ifa-related__body,
	.ifa-related__card:hover .ifa-related__excerpt,
	.ifa-related__card:hover .ifa-related__excerpt-p {
		color: #fff !important;
	}

	.ifa-related__card:hover .ifa-related__more.et_pb_button {
		background: transparent !important;
		border-color: #fff !important;
		color: #fff !important;
		box-shadow: 0 0 0 1px #fff;
	}

	.ifa-related__card:hover .ifa-related__more.et_pb_button:hover {
		background: rgba(255, 255, 255, 0.12) !important;
		border-color: #fff !important;
		color: #fff !important;
	}
}

/* Optional section heading */
.ifa-related__heading {
	margin: 0 0 1rem;
	line-height: 1.2;
}

/* Visually hidden text (e.g. “Read more” context for SR) */
.ifa-related .screen-reader-text {
	border: 0;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	white-space: nowrap;
}
