/*
 * Reusable curated Tool Card + grid treatment.
 * The card is intentionally product-neutral: the representative image carries
 * the Tool-specific visual identity while the container stays restrained.
 */

.em-tools-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1rem, 2.5vw, 2rem);
	align-items: stretch;
	justify-content: start;
}


.em-related-tools {
	box-sizing: border-box;
	margin-top: clamp(3rem, 7vw, 5rem) !important;
	padding-top: clamp(2rem, 4vw, 3rem);
	border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
}

.em-related-tools__title {
	margin: 0 0 clamp(1.25rem, 3vw, 2rem) !important;
}

/*
 * Core flow/constrained Groups add margins and max-width rules to children.
 * A grid owns that spacing, so neutralize those child layout rules here.
 */
.wp-block-group.em-tools-grid > * {
	min-width: 0;
	max-width: none;
	margin: 0 !important;
}

/* Preserve the restrained single-card width used by the current /tools/ hub. */
.em-tools-grid > :only-child {
	width: 100%;
	max-width: 34rem;
	justify-self: start;
}

.em-tool-card {
	--em-tool-card-accent: var(--wp--preset--color--primary, #06a6b7);
	--em-tool-card-border: color-mix(in srgb, currentColor 16%, transparent);
	--em-tool-card-muted: color-mix(in srgb, currentColor 68%, transparent);
	position: relative;
	display: flex;
	min-width: 0;
	height: 100%;
	box-sizing: border-box;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--em-tool-card-border);
	background: var(--wp--preset--color--base-2, var(--wp--preset--color--tertiary, transparent));
	color: inherit;
}

.em-tool-card:focus-within {
	border-color: var(--em-tool-card-accent);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--em-tool-card-accent) 45%, transparent);
}

.em-tool-card__media {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: color-mix(in srgb, currentColor 5%, transparent);
}

.em-tool-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.em-tool-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: .65rem;
	padding: clamp(1rem, 2vw, 1.35rem);
}

.em-tool-card__title {
	margin: 0;
	font-family: inherit;
	font-size: clamp(1.15rem, 2vw, 1.4rem);
	font-weight: 650;
	line-height: 1.25;
}

.em-tool-card__link {
	color: inherit;
	text-decoration: none;
	text-underline-offset: .18em;
}

.em-tool-card__link::after {
	position: absolute;
	inset: 0;
	z-index: 1;
	content: "";
}

.em-tool-card__link:hover {
	text-decoration: underline;
}

.em-tool-card__link:focus-visible {
	outline: 3px solid var(--em-tool-card-accent);
	outline-offset: 4px;
	border-radius: 2px;
}

.em-tool-card__excerpt {
	margin: 0;
	color: var(--em-tool-card-muted);
	font-size: .98rem;
	line-height: 1.55;
}

.em-tool-card--no-image .em-tool-card__body {
	padding-top: clamp(1.2rem, 2.5vw, 1.6rem);
}

@media (max-width: 899px) {
	.em-tools-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 599px) {
	.em-tools-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Keep the Gutenberg preview selectable instead of making its whole card a live stretched link. */
.editor-styles-wrapper .em-tool-card__link::after {
	content: none;
}
