/**
 * Services grid — white cards on white with a soft sage wash behind them.
 * Swiper below 768px, CSS grid from tablet up (carousels.js destroys the
 * Swiper instance above mobile).
 */

.services-grid {
	position: relative;
	isolation: isolate;
	background-color: var(--color-surface);
}

/* Sage haze that fades into the soft-surface section below. */
.services-grid__wash {
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient(90% 55% at 50% 0%, var(--color-surface-soft) 0%, transparent 70%),
		linear-gradient(180deg, transparent 55%, var(--color-surface-soft) 100%);
	pointer-events: none;
}

/* -------------------------------------------------------------------------
   Header — stacked on mobile, title left / lede right from tablet up
   ------------------------------------------------------------------------- */

.services-grid__header {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	margin-bottom: clamp(var(--space-5), 5vw, var(--space-8));
}

.services-grid__title {
	margin: 0;
	font-size: var(--fs-h2);
}

.services-grid__lede {
	margin: 0 0 var(--space-2);
	max-width: 34rem;
	color: var(--color-text-muted);
	font-weight: var(--fw-light);
}

/* -------------------------------------------------------------------------
   Card
   ------------------------------------------------------------------------- */

.service-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: auto;
	overflow: hidden;
	padding: var(--space-3);
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	transition:
		border-color var(--duration-fast) var(--easing),
		box-shadow var(--duration-fast) var(--easing),
		transform var(--duration-fast) var(--easing);
}

/* Accent hairline that draws itself across the top edge on hover. */
.service-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 2px;
	background: linear-gradient(90deg, var(--color-accent), var(--color-accent-bright));
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform var(--duration) var(--easing);
}

/* Warm tint rising from the bottom of the card, revealed on hover. */
.service-card__glow {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: linear-gradient(180deg, transparent 35%, var(--color-accent-soft) 100%);
	opacity: 0;
	transition: opacity var(--duration) var(--easing);
	pointer-events: none;
}

.service-card:hover,
.service-card:focus-within {
	border-color: color-mix(in srgb, var(--color-accent) 32%, transparent);
	box-shadow: var(--shadow-soft-hover);
	transform: translateY(-4px);
}

.service-card:hover::before,
.service-card:focus-within::before {
	transform: scaleX(1);
}

.service-card:hover .service-card__glow,
.service-card:focus-within .service-card__glow {
	opacity: 1;
}

/* Content sits above the glow layer. */
.service-card__top,
.service-card__title,
.service-card__text,
.service-card__link {
	position: relative;
	z-index: 1;
}

/* One card carries the accent treatment so the grid has a focal point. */
.service-card--featured {
	background-color: var(--color-accent-soft);
	border-color: color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.service-card--featured .service-card__glow {
	background: linear-gradient(180deg, transparent 35%, rgba(255, 255, 255, 0.55) 100%);
}

.service-card__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
}

/* -------------------------------------------------------------------------
   Icon medallion
   ------------------------------------------------------------------------- */

.service-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 54px;
	height: 54px;
	border-radius: var(--radius-pill);
	background-color: var(--color-surface);
	box-shadow:
		0 0 0 1px var(--color-border),
		0 0 0 6px color-mix(in srgb, var(--color-accent) 7%, transparent);
	color: var(--color-accent);
	font-size: 1.5rem;
	transition:
		background-color var(--duration-fast) var(--easing),
		box-shadow var(--duration-fast) var(--easing),
		color var(--duration-fast) var(--easing),
		transform var(--duration) var(--easing);
}

.service-card:hover .service-card__icon,
.service-card:focus-within .service-card__icon {
	background-color: var(--color-accent);
	box-shadow:
		0 0 0 1px transparent,
		0 0 0 8px color-mix(in srgb, var(--color-accent) 12%, transparent);
	color: var(--color-white);
	transform: translateY(-2px);
}

.service-card__badge {
	flex-shrink: 0;
	padding: 0.4em 0.85em;
	border-radius: var(--radius-pill);
	background-color: var(--color-surface);
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent) 30%, transparent);
	color: var(--color-accent);
	font-size: var(--fs-micro);
	font-weight: var(--fw-medium);
	letter-spacing: 0.1em;
	line-height: 1.3;
	text-transform: uppercase;
	white-space: nowrap;
}

/* -------------------------------------------------------------------------
   Copy
   ------------------------------------------------------------------------- */

.service-card__title {
	margin: 0 0 var(--space-1);
	color: var(--color-heading);
	font-size: var(--fs-h3);
	font-weight: var(--fw-semibold);
}

.service-card__text {
	margin: 0 0 var(--space-4);
	color: var(--color-text-muted);
	font-size: var(--fs-small);
	font-weight: var(--fw-light);
	line-height: 1.65;
}

/* -------------------------------------------------------------------------
   Footer link — stretched over the whole card
   ------------------------------------------------------------------------- */

.service-card__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
	margin-top: auto;
	padding-top: var(--space-3);
	border-top: 1px solid var(--color-border);
	color: var(--color-accent);
	font-size: var(--fs-small);
	font-weight: var(--fw-medium);
	text-decoration: none;
}

.service-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.service-card__link:focus-visible {
	outline: none;
}

.service-card__link:focus-visible::after {
	outline: 2px solid var(--color-accent);
	outline-offset: -4px;
	border-radius: var(--radius-lg);
}

.service-card__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-pill);
	color: var(--color-heading);
	font-size: 1rem;
	transition:
		background-color var(--duration-fast) var(--easing),
		border-color var(--duration-fast) var(--easing),
		color var(--duration-fast) var(--easing),
		transform var(--duration-fast) var(--easing);
}

.service-card:hover .service-card__arrow,
.service-card:focus-within .service-card__arrow {
	background-color: var(--color-accent);
	border-color: var(--color-accent);
	color: var(--color-white);
	transform: translateX(3px);
}

/* Mobile carousel: cards need equal heights inside Swiper. */
.services-grid__swiper {
	overflow: hidden;
	padding-bottom: 2px;
}

.services-grid__swiper .swiper-slide {
	height: auto;
}

/* -------------------------------------------------------------------------
   Tablet — 2 columns, Swiper off
   ------------------------------------------------------------------------- */

@media (min-width: 768px) {
	.services-grid__header {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
		gap: var(--space-5);
	}

	.services-grid__intro {
		flex: 1 1 auto;
		max-width: 34rem;
	}

	.services-grid__aside {
		flex: 0 1 24rem;
		text-align: right;
	}

	.services-grid__lede {
		margin-left: auto;
	}

	.services-grid__swiper {
		overflow: visible;
	}

	.services-grid__swiper .swiper-wrapper {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-3);
	}

	.services-grid__pagination {
		display: none;
	}
}

/* -------------------------------------------------------------------------
   Desktop — 4 columns
   ------------------------------------------------------------------------- */

@media (min-width: 1024px) {
	.services-grid__swiper .swiper-wrapper {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: var(--space-3);
	}

	.service-card {
		padding: var(--space-4) var(--space-3) var(--space-3);
	}

	/*
	 * Narrow four-column cards wrap most titles onto a second line; reserving
	 * that line keeps the descriptions on a shared baseline across a row.
	 */
	.service-card__title {
		min-height: calc(2em * var(--lh-heading));
	}
}

/* -------------------------------------------------------------------------
   Reduced motion — keep the hover states, drop the movement
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.service-card:hover,
	.service-card:focus-within,
	.service-card:hover .service-card__icon,
	.service-card:focus-within .service-card__icon,
	.service-card:hover .service-card__arrow,
	.service-card:focus-within .service-card__arrow {
		transform: none;
	}
}
