.fwf-services-grid {
	padding-block: var(--wp--preset--spacing--60);
	background: var(--wp--preset--color--surface);
}

.fwf-services-grid__inner {
	max-width: var(--wp--style--global--wide-size, 1280px);
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--20);
}

/* Header ------------------------------------------------------------------ */

/*
 * Same dead wrapper as the checklist had: the prose used to sit inside
 * `.fwf-services-grid__header`, which carried the centering. Moving it to
 * InnerBlocks left these as direct children with no wrapper, so the rule
 * matched nothing and the header silently went left-aligned. Each part centers
 * itself now, which also holds if an editor adds another paragraph.
 */
.fwf-services-grid__eyebrow,
.fwf-services-grid__heading,
.fwf-services-grid__intro {
	max-width: 62ch;
	margin-inline: auto;
	text-align: center;
}

.fwf-services-grid__intro {
	margin-block-end: var(--wp--preset--spacing--40);
}

.fwf-services-grid__eyebrow {
	margin-block-end: var(--wp--preset--spacing--10);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--wp--preset--color--primary);
}

.fwf-services-grid__heading {
	margin: 0;
	font-size: var(--wp--preset--font-size--xx-large);
	color: var(--wp--preset--color--secondary);
}

.fwf-services-grid__intro {
	margin-block-start: var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--muted);
}

/* Grid -------------------------------------------------------------------- */

.fwf-services-grid__list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: var(--wp--preset--spacing--30);
	margin: 0;
	padding: 0;
	list-style: none;
}

.fwf-services-grid--cols-3 .fwf-services-grid__list { grid-template-columns: repeat(3, 1fr); }
.fwf-services-grid--cols-4 .fwf-services-grid__list { grid-template-columns: repeat(4, 1fr); }
.fwf-services-grid--cols-5 .fwf-services-grid__list { grid-template-columns: repeat(5, 1fr); }

.fwf-services-grid--cols-5 .fwf-service-card,
.fwf-services-grid--cols-4 .fwf-service-card {
	padding: var(--wp--preset--spacing--20);
}

.fwf-services-grid--cols-5 .fwf-service-card__title {
	font-size: var(--wp--preset--font-size--medium);
}

@media (max-width: 1100px) {
	.fwf-services-grid--cols-5 .fwf-services-grid__list,
	.fwf-services-grid--cols-4 .fwf-services-grid__list {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 700px) {
	.fwf-services-grid--cols-3 .fwf-services-grid__list,
	.fwf-services-grid--cols-4 .fwf-services-grid__list,
	.fwf-services-grid--cols-5 .fwf-services-grid__list {
		grid-template-columns: 1fr;
	}
}

/* Card -------------------------------------------------------------------- */
.fwf-service-card {
	display: flex;
	flex-direction: column;
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
}

.fwf-service-card__head {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-block-end: var(--wp--preset--spacing--20);
}

.fwf-service-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--wp--preset--color--primary-tint);
	color: var(--wp--preset--color--primary-deep);
}

/* Comp: a 15px mark inside the 40px tile. */
.fwf-service-card__icon .fwf-icon {
	width: 16px;
	height: 16px;
}

.fwf-service-card__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--secondary);
}

.fwf-service-card__text {
	margin-block-start: 0.5rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

/* Tags -------------------------------------------------------------------- */
.fwf-service-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	margin: auto 0 0;
	padding: var(--wp--preset--spacing--20) 0 0;
	list-style: none;
}

.fwf-service-card__tag {
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--wp--preset--color--primary-deep);
}

.fwf-service-card__tag + .fwf-service-card__tag::before {
	content: "·";
	margin-inline: 0.35em;
	opacity: 0.55;
}

/* Footer ------------------------------------------------------------------ */
.fwf-services-grid__footer {
	margin-block-start: var(--wp--preset--spacing--40);
	text-align: center;
}

.fwf-services-grid .fwf-services-grid__button {
	display: inline-block;
	padding: 0.9rem 1.75rem;
	border-radius: var(--fwf--button--radius);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-decoration: none;
	transition: background-color var(--fwf--transition);
}

.fwf-services-grid .fwf-services-grid__button:hover,
.fwf-services-grid .fwf-services-grid__button:focus-visible {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--base);
}

.fwf-services-grid--centered .fwf-service-card {
	align-items: center;
	text-align: center;
}

.fwf-services-grid--centered .fwf-service-card__tags {
	justify-content: center;
}

.fwf-service-card--tint-sage  .fwf-service-card__icon { background: var(--wp--preset--color--primary-tint); }
.fwf-service-card--tint-sand  .fwf-service-card__icon { background: color-mix(in srgb, var(--wp--preset--color--accent) 22%, #fff); }
.fwf-service-card--tint-stone .fwf-service-card__icon { background: color-mix(in srgb, var(--wp--preset--color--secondary) 9%, #fff); }
.fwf-service-card--tint-rose  .fwf-service-card__icon { background: color-mix(in srgb, #c2705f 16%, #fff); }
.fwf-service-card--tint-sky   .fwf-service-card__icon { background: color-mix(in srgb, #5b7f96 15%, #fff); }

.fwf-service-card__icon {
	border-radius: 10px;
}

/* Linked cards ------------------------------------------------------------ */
/*
 * The hover rules have to out-specify the reveal system, which is why they look
 * heavier than they should.
 *
 * animations.css declares `.fwf-motion .fwf-reveal` at (0,2,0) and loads after
 * this file, and it animates `translate` — the same property the lift uses. A
 * rule here at (0,2,0) ties and loses, so the card snapped instead of easing.
 * Adding `.is-revealed` takes these past it and confines them to cards that
 * have finished revealing, which is exactly when hover matters. The unprefixed
 * rule below still covers reduced-motion and no-JS, where .fwf-motion is absent.
 */
.fwf-services-grid .fwf-service-card--linked {
	position: relative;
	transition: translate 0.25s ease;
}

.fwf-motion .fwf-services-grid .fwf-service-card--linked.is-revealed {
	transition: translate 0.25s ease;
}

/*
 * The hover shadow lives on a pseudo-element and fades with opacity.
 *
 * Transitioning box-shadow on the card repaints the whole card every frame —
 * background, border, text, icon — which is what made the lift stutter. Opacity
 * and translate are both compositor properties, so the browser can run this
 * without touching layout or paint.
 */
.fwf-services-grid .fwf-service-card--linked::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: 0 14px 34px rgb(0 0 0 / 0.13);
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.fwf-services-grid .fwf-service-card--linked:hover::before {
	opacity: 1;
}

.fwf-service-card__link,
.fwf-service-card__link:hover,
.fwf-service-card__link:focus,
.fwf-service-card--linked:hover .fwf-service-card__link {
	color: inherit;
	text-decoration: none;
}

.fwf-service-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.fwf-motion .fwf-services-grid .fwf-service-card--linked.is-revealed:hover,
.fwf-services-grid .fwf-service-card--linked:hover {
	translate: 0 -4px;
}

.fwf-services-grid .fwf-service-card--linked:hover .fwf-service-card__link {
	color: var(--wp--preset--color--primary-deep);
}

.fwf-service-card--linked:focus-within {
	outline: 2px solid var(--wp--preset--color--primary-deep);
	outline-offset: 3px;
}

.fwf-service-card__link:focus-visible {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	.fwf-services-grid .fwf-service-card--linked,
	.fwf-services-grid .fwf-service-card--linked::before,
	.fwf-motion .fwf-services-grid .fwf-service-card--linked.is-revealed {
		transition: none;
	}

	.fwf-motion .fwf-services-grid .fwf-service-card--linked.is-revealed:hover,
	.fwf-services-grid .fwf-service-card--linked:hover {
		translate: none;
	}
}

/*
 * Prose and cards share one InnerBlocks flow, because ACF repeats every inner
 * block at each <InnerBlocks /> tag rather than splitting them between two. The
 * grid therefore holds both, and anything that is not a card spans the row —
 * which is what the header did when it was separate markup.
 */
.fwf-services-grid__list > .acf-innerblocks-container {
	display: contents;
}

.fwf-services-grid__list > .acf-innerblocks-container > :not(.fwf-service-card),
.fwf-services-grid__list > :not(.fwf-service-card):not(.acf-innerblocks-container) {
	grid-column: 1 / -1;
	max-width: 62ch;
	margin-inline: auto;
	text-align: center;
}

.fwf-services-grid__list > .acf-innerblocks-container > .fwf-services-grid__eyebrow,
.fwf-services-grid__list > .fwf-services-grid__eyebrow {
	margin-block-end: 0;
}

/* The heading sits tight under its eyebrow and clear of the first card row. */
.fwf-services-grid__list > .acf-innerblocks-container > .fwf-services-grid__heading,
.fwf-services-grid__list > .fwf-services-grid__heading {
	margin-block: 0.25rem 0;
}

.fwf-services-grid__list > .acf-innerblocks-container > .fwf-services-grid__intro,
.fwf-services-grid__list > .fwf-services-grid__intro {
	margin-block: 0.5rem var(--wp--preset--spacing--20);
}
