/**
 * NovaBP Home — Our Services
 *
 * Section 5 of the Home page: a centred header capped at 800px over a two-up
 * grid of photo cards, closing with a single button.
 *
 * Built on `novabp-tax-base`, which supplies the section shell, the header
 * stack, the button and the screen-reader utility. Only what is particular to
 * this section lives here.
 *
 * Figma reference: NOVABP - Landing Page (Copy), node 46:132
 * — header 46:133, grid 46:142, featured card 46:144, plain card 46:152.
 */

.nova-home-services {
	/*
	 * The raised state. Figma draws it on the first card only, as a pale wash
	 * with a matching gradient hairline; it reads as a hover committed to the
	 * frame, so the same four values drive both `.is-featured` and `:hover`.
	 */
	--nova-home-services-wash-from: #d7e1f6;
	--nova-home-services-wash-to: #ffffff;
	--nova-home-services-wash-border-from: #96b5f9;
	--nova-home-services-wash-border-to: #dbe5fa;

	--nova-home-services-media-height: 240px;

	/* The scrim under the arrow badge, so a white badge holds on a pale photo. */
	--nova-home-services-scrim: linear-gradient(15deg, rgb(0 10 58 / 0.5) 0%, rgb(0 21 129 / 0) 71%);
}

.nova-home-services__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 80px;
}

.nova-home-services__header {
	--nova-tax-header-max: 800px;
}

/*
 * Figma insets the grid a further 80px inside the section's own gutter, so the
 * cards sit narrower than the header measure. `padding-inline` rather than a
 * width cap keeps the two columns dividing whatever is left.
 */
.nova-home-services__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
	width: 100%;
	padding-inline: 80px;
}

/* ---------------------------------------------------------------------------
 * Card
 * ------------------------------------------------------------------------ */

/*
 * The card is a frame around the photo: 8px of padding on all sides, the body
 * copy below it. The border is transparent-on-flat at rest and becomes the
 * gradient hairline when raised, which is why the flat colour is painted as a
 * border and the gradient as a `background-image` on a padding-box fill —
 * `border-image` cannot round its corners to match `border-radius`.
 */
.nova-home-services__card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px;
	border: 1px solid #dee3ee;
	border-radius: 20px;
	background-color: var(--nova-tax-white);
	transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.nova-home-services__card.is-featured,
.nova-home-services__card:hover,
.nova-home-services__card:focus-within {
	border-color: transparent;
	background-image:
		linear-gradient(180deg, var(--nova-home-services-wash-from) 0%, var(--nova-home-services-wash-to) 100%),
		linear-gradient(180deg, var(--nova-home-services-wash-border-from) 0%, var(--nova-home-services-wash-border-to) 100%);
	background-origin: padding-box, border-box;
	background-clip: padding-box, border-box;
}

.nova-home-services__media {
	position: relative;
	display: flex;
	justify-content: flex-end;
	height: var(--nova-home-services-media-height);
	padding: 16px;
	border-radius: 12px;
	background-color: #f7f7f7;
	background-image: var(--nova-home-services-image, none);
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

/*
 * The scrim is a pseudo-element rather than a second layer on the media's own
 * `background-image`, because that slot already carries the photograph and the
 * photograph comes in as a custom property set per card.
 */
.nova-home-services__media::before {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-image: var(--nova-home-services-scrim);
	opacity: 0;
	transition: opacity 0.25s ease;
	content: "";
}

.nova-home-services__card.is-featured .nova-home-services__media::before,
.nova-home-services__card:hover .nova-home-services__media::before,
.nova-home-services__card:focus-within .nova-home-services__media::before {
	opacity: 1;
}

/* The badge rides in on the raised state alongside the scrim. */
.nova-home-services__badge {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 100px;
	background-color: var(--nova-tax-white);
	color: var(--nova-tax-primary);
	opacity: 0;
	transform: scale(0.85);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.nova-home-services__card.is-featured .nova-home-services__badge,
.nova-home-services__card:hover .nova-home-services__badge,
.nova-home-services__card:focus-within .nova-home-services__badge {
	opacity: 1;
	transform: none;
}

.nova-home-services__badge .nova-tax-icon {
	width: 24px;
	height: 24px;
}

.nova-home-services__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 6px;
	padding: 12px;
}

.nova-home-services .nova-home-services__card-title {
	margin: 0;
	font-family: var(--nova-tax-font);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	color: var(--nova-tax-heading);
}

/*
 * The title's link covers the whole card, so the photo and body are clickable
 * without nesting the copy inside an anchor. `position: relative` on the card
 * is what it stretches against.
 */
.nova-home-services__card-link {
	color: inherit;
	text-decoration: none;
}

.nova-home-services__card-link::after {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	content: "";
}

.nova-home-services__card-text {
	font-size: 18px;
	font-weight: 500;
	line-height: 1.5;
	color: rgb(53 65 95 / 0.8);
}

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------ */

@media (max-width: 1366px) {
	.nova-home-services__inner {
		gap: 60px;
	}

	.nova-home-services__grid {
		padding-inline: 0;
	}
}

@media (max-width: 1024px) {
	.nova-home-services__inner {
		gap: 48px;
	}

	.nova-home-services {
		--nova-home-services-media-height: 220px;
	}

	.nova-home-services .nova-home-services__card-title {
		font-size: 22px;
	}
}

@media (max-width: 767px) {
	.nova-home-services__inner {
		gap: 32px;
	}

	.nova-home-services__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.nova-home-services {
		--nova-home-services-media-height: 200px;
	}

	.nova-home-services__body {
		padding: 12px 8px;
	}

	.nova-home-services__card-text {
		font-size: 16px;
	}
}

/*
 * A pointer-less device has no hover, so the raised state would never appear on
 * anything but the featured card — and a tap would leave it stuck on. Reduce it
 * to the featured card there.
 */
@media (hover: none) {
	.nova-home-services__card:hover {
		border-color: #dee3ee;
		background-image: none;
	}

	.nova-home-services__card:hover .nova-home-services__media::before,
	.nova-home-services__card:hover .nova-home-services__badge {
		opacity: 0;
	}

	.nova-home-services__card.is-featured:hover {
		border-color: transparent;
		background-image:
			linear-gradient(180deg, var(--nova-home-services-wash-from) 0%, var(--nova-home-services-wash-to) 100%),
			linear-gradient(180deg, var(--nova-home-services-wash-border-from) 0%, var(--nova-home-services-wash-border-to) 100%);
	}

	.nova-home-services__card.is-featured:hover .nova-home-services__media::before,
	.nova-home-services__card.is-featured:hover .nova-home-services__badge {
		opacity: 1;
	}
}

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

	.nova-home-services__card,
	.nova-home-services__media::before,
	.nova-home-services__badge {
		transition: none;
	}
}
