/**
 * ACF Card Grid widget.
 *
 * Layout only — colours, spacing and typography come from the Elementor
 * controls so the widget inherits whatever the section is styled with.
 */

.afinia-card-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 30px;
}

.afinia-card {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	/* Clips the image to the card's border radius. Without this the image
	   corners sit square outside a rounded card. */
	overflow: hidden;
}

.afinia-card-media {
	min-width: 0;
	line-height: 0;
}

.afinia-card-media img,
.afinia-card-img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

.afinia-card-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}

.afinia-card-eyebrow {
	margin: 0;
}

.afinia-card-title {
	margin: 0;
}

.afinia-card-desc > :first-child {
	margin-top: 0;
}

.afinia-card-desc > :last-child {
	margin-bottom: 0;
}

.afinia-card-btn {
	display: inline-block;
	align-self: flex-start;
	margin-top: auto;
	padding: 12px 22px;
	border-radius: 4px;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.afinia-card-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* A per-row accent is applied inline, so the hover state cannot be a plain
   colour rule — it would lose to the inline style. Darkening the whole button
   works whatever colour it ended up with, and leaves cards without an accent
   to the widget's own hover controls. */
.afinia-card[style*="--afinia-accent"] .afinia-card-btn:hover,
.afinia-card[style*="--afinia-accent"] .afinia-card-btn:focus-visible {
	filter: brightness(0.9);
}

@media (prefers-reduced-motion: reduce) {

	.afinia-card-btn {
		transition: none;
	}
}

@media (max-width: 767px) {

	.afinia-card-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}
