/*
 * Section: services (the "jl-services" group).
 *
 * A heading, a short intro with a button, and a row of service cards, each
 * with a line-drawn icon. Built from ordinary blocks; each icon is a Custom
 * HTML block holding an inline SVG, so it can be replaced by pasting another.
 *
 * Colours, fonts and edge spacing come from the theme. The reveal and the
 * line-drawing only start once the script is running (html.jl-js), and each
 * part waits until it is actually on screen.
 */

.jl-services.jl-services {
	--svc-pad: 48px;
	--svc-bg: color-mix(in srgb, var(--wp--preset--color--accent-1) 26%, var(--wp--preset--color--base));
	--svc-bg-hover: color-mix(in srgb, var(--wp--preset--color--accent-1) 42%, var(--wp--preset--color--base));
	margin-block: 0;
	padding: clamp(96px, 14vh, 150px) 0 72px;
	overflow: hidden;
	/* Starts as the page colour and eases into the sage tint, so it follows the section above without a seam. */
	background: linear-gradient(
		to bottom,
		var(--wp--preset--color--base) 0,
		color-mix(in srgb, var(--svc-bg) 12%, var(--wp--preset--color--base)) 70px,
		color-mix(in srgb, var(--svc-bg) 45%, var(--wp--preset--color--base)) 150px,
		color-mix(in srgb, var(--svc-bg) 82%, var(--wp--preset--color--base)) 230px,
		var(--svc-bg) 300px
	);
	color: var(--wp--preset--color--contrast);
}

/* WordPress spaces out a Group's children; every part here sets its own spacing. */
.jl-services.jl-services > *,
.jl-services .jl-services__head > *,
.jl-services .jl-services__side > *,
.jl-services .jl-services__grid > *,
.jl-services .jl-card > * {
	margin-block: 0;
}

/* ---------- Heading and intro ---------- */

.jl-services .jl-services__head {
	display: grid;
	grid-template-columns: 1fr 360px;
	gap: 120px;
	align-items: start;
	padding: 0 var(--svc-pad);
}

.jl-services .jl-services__head h2 {
	max-width: 900px;
	font-size: clamp(2.75rem, 6.2vw, 5.5rem);
	letter-spacing: -0.03em;
	line-height: 1;
}

.jl-services .jl-services__side {
	display: flex;
	flex-direction: column;
	gap: 56px;
	padding-top: 12px;
}

.jl-services .jl-services__side p {
	font-size: 1.1875rem;
	letter-spacing: -0.01em;
	line-height: 1.35;
}

/* Small label above the cards, and the card numbers */
.jl-services .jl-services__tag,
.jl-services .jl-card::before {
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	line-height: 1.4;
	text-transform: uppercase;
}

.jl-services .jl-services__tag {
	margin-top: 120px;
	padding: 0 var(--svc-pad);
}

/* ---------- Cards ---------- */

.jl-services .jl-services__grid {
	display: grid;
	/* Any number of cards share the row equally. */
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	margin: 56px var(--svc-pad) 0;
	counter-reset: jl-svc;
}

.jl-services .jl-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 400px;
	padding: 0 28px 12px;
	border-left: 1px solid var(--jl-line);
	counter-increment: jl-svc;
	transition: background-color 0.4s;
}

.jl-services .jl-card:hover,
.jl-services .jl-card:focus-within {
	background: var(--svc-bg-hover);
}

.jl-services .jl-card::before {
	content: "0" counter(jl-svc, decimal-leading-zero);
}

.jl-services .jl-card svg {
	display: block;
	width: 120px;
	height: 100px;
	margin: 44px 0 40px;
	color: inherit;
	transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.jl-services .jl-card:hover svg {
	transform: translateY(-8px) scale(1.05);
}

.jl-services .jl-card__title {
	font-size: 1.5rem;
	letter-spacing: -0.02em;
	line-height: 1.15;
}

.jl-services .jl-card__desc {
	max-width: 200px;
	margin-top: 14px;
	font-size: 0.875rem;
	line-height: 1.4;
	opacity: 0.75;
}

.jl-services .jl-card__more {
	margin-top: auto;
	padding-top: 20px;
	font-size: 0.8125rem;
	opacity: 0;
	transform: translateX(-8px);
	transition: opacity 0.4s, transform 0.4s;
}

.jl-services .jl-card:hover .jl-card__more,
.jl-services .jl-card:focus-within .jl-card__more {
	opacity: 1;
	transform: none;
}

.jl-services .jl-card__more a {
	color: inherit;
	text-decoration: none;
}

/* The "Learn more" link covers the whole card, so the card is one click target. */
.jl-services .jl-card__more a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* ---------- Motion (front only, once the script is running) ---------- */

@keyframes jl-svc-draw {
	from {
		stroke-dashoffset: 1;
	}
	to {
		stroke-dashoffset: 0;
	}
}

/* The script marks each stroked shape with "dr" so it can be drawn in. */
.jl-js .jl-services .dr {
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
}

/* Each card draws its own icon when that card comes into view (--c staggers cards in a row). */
.jl-js .jl-services .jl-card.is-in .dr {
	animation: jl-svc-draw 1.8s cubic-bezier(0.6, 0, 0.2, 1) forwards;
	animation-delay: calc(var(--d, 0s) + var(--c, 0s));
}

.jl-js .jl-services .jl-services__head > * {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.jl-js .jl-services .jl-services__head > :nth-child(2) {
	transition-delay: 0.15s;
}

.jl-js .jl-services .jl-services__head.is-in > * {
	opacity: 1;
	transform: none;
}

/* ---------- Tablet: two columns ---------- */
@media (max-width: 1099px) {
	.jl-services.jl-services {
		--svc-pad: 40px;
		padding-bottom: 56px;
	}

	.jl-services .jl-services__head {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.jl-services .jl-services__head h2 {
		max-width: 640px;
	}

	.jl-services .jl-services__side {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
		gap: 32px;
		padding-top: 0;
	}

	.jl-services .jl-services__side p {
		max-width: 380px;
	}

	.jl-services .jl-services__tag {
		margin-top: 72px;
	}

	.jl-services .jl-services__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-flow: row;
		row-gap: 24px;
		margin-top: 32px;
	}

	.jl-services .jl-card {
		min-height: 340px;
		padding: 0 24px 12px;
	}

	/* An odd card out at the end takes the full width. */
	.jl-services .jl-card:last-child:nth-child(odd) {
		grid-column: 1 / -1;
		min-height: 0;
	}

	.jl-services .jl-card svg {
		margin: 32px 0 28px;
	}

	.jl-services .jl-card__more {
		opacity: 1;
		transform: none;
	}
}

/* ---------- Mobile: a list, icon on the right ---------- */
@media (max-width: 639px) {
	.jl-services.jl-services {
		--svc-pad: 24px;
		padding-bottom: 24px;
	}

	.jl-services .jl-services__head {
		gap: 24px;
	}

	.jl-services .jl-services__side {
		flex-direction: column;
		align-items: flex-start;
		gap: 24px;
	}

	.jl-services .jl-services__side p {
		font-size: 1.0625rem;
	}

	.jl-services .jl-services__tag {
		margin-top: 48px;
	}

	.jl-services .jl-services__grid {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 0;
		margin-top: 20px;
	}

	.jl-services .jl-card,
	.jl-services .jl-card:last-child:nth-child(odd) {
		display: grid;
		grid-template-areas: "n i" "t i" "d i" "m i";
		grid-template-columns: 1fr 64px;
		align-content: start;
		column-gap: 16px;
		min-height: 0;
		padding: 20px 0 24px;
		border-top: 1px solid var(--jl-line);
		border-left: 0;
	}

	.jl-services .jl-card:last-child {
		border-bottom: 1px solid var(--jl-line);
	}

	.jl-services .jl-card:hover {
		background: none;
	}

	.jl-services .jl-card::before {
		grid-area: n;
	}

	.jl-services .jl-card svg {
		grid-area: i;
		width: 64px;
		height: auto;
		margin: 0;
	}

	.jl-services .jl-card:hover svg {
		transform: none;
	}

	.jl-services .jl-card__title {
		grid-area: t;
		margin-top: 14px;
		font-size: 1.375rem;
	}

	.jl-services .jl-card__desc {
		grid-area: d;
		max-width: none;
		margin-top: 8px;
	}

	.jl-services .jl-card__more {
		grid-area: m;
		margin-top: 0;
		padding-top: 12px;
	}
}

@media (hover: none) {
	.jl-services .jl-card__more {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jl-js .jl-services .dr {
		stroke-dashoffset: 0;
		animation: none;
	}

	.jl-js .jl-services .jl-services__head > * {
		opacity: 1;
		transform: none;
	}

	.jl-services.jl-services * {
		transition: none !important;
	}
}
