/* Flexible content: "How it works" — image and numbered steps. Sizes follow the 1440px Figma frame. */

.section-how-it-works {
	padding: 100px 0;
	/* The steps slide in from the right (translateX): don't let them widen the page. */
	overflow-x: clip;
	background: var(--color-bg);
}

.how-it-works {
	display: grid;
	grid-template-columns: 608px minmax(0, 1fr);
	align-items: center;
	gap: 64px;
	margin-top: 64px;
}

.how-it-works--no-image {
	grid-template-columns: minmax(0, 1fr);
}

.how-it-works__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 608 / 445;
	object-fit: cover;
}

/* Steps */

.how-steps {
	--number-size: 56px;
	--step-gap: 71px;

	display: flex;
	flex-direction: column;
	gap: var(--step-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.how-steps__item {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 24px;
}

/*
 * Connector from this number down to the next one: a pale track (::before)
 * and the solid progress line on top (::after), filled on scroll via --fill (0–1).
 * Height: rest of this item below the number + the gap to the next item.
 */
.how-steps__item:not(:last-child)::before,
.how-steps__item:not(:last-child)::after {
	content: "";
	position: absolute;
	top: var(--number-size);
	left: calc(var(--number-size) / 2);
	width: 1px;
	height: calc(100% - var(--number-size) + var(--step-gap));
	background: var(--color-primary);
	transform-origin: top;
}

.how-steps__item:not(:last-child)::before {
	opacity: 0.3;
}

.how-steps__item:not(:last-child)::after {
	transform: scaleY(var(--fill, 1));
}

.how-steps__number {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: var(--number-size);
	height: var(--number-size);
	background: var(--color-primary);
	font-size: 24px;
	font-weight: 300;
	color: #fff;
}

.how-steps__content {
	padding-top: 4px;
}

.how-steps__title {
	margin: 0;
	font-size: 22px;
	font-weight: 400;
	line-height: 1.3;
	color: var(--color-text);
}

.how-steps__text {
	margin: 8px 0 0;
	font-size: 16px;
	line-height: 1.5;
	color: #333;
}

/*
 * Scroll reveal. JS adds .is-ready (hidden state), fills the progress lines as the page
 * scrolls and adds .is-visible to a step once the line reaches it. Without JS all is shown.
 */
.how-steps.is-ready .how-steps__item::after {
	transform: scaleY(var(--fill, 0));
}

.how-steps.is-ready .how-steps__number,
.how-steps.is-ready .how-steps__content {
	opacity: 0;
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.how-steps.is-ready .how-steps__number {
	transform: scale(0.6);
}

.how-steps.is-ready .how-steps__content {
	transform: translateX(24px);
	transition-delay: 0.15s;
}

.how-steps.is-ready .is-visible .how-steps__number,
.how-steps.is-ready .is-visible .how-steps__content {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.how-steps.is-ready .how-steps__number,
	.how-steps.is-ready .how-steps__content {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.how-steps.is-ready .how-steps__item::after {
		transform: none;
	}
}

@media (max-width: 1024px) {
	.how-it-works {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 40px;
	}

	.how-steps {
		--step-gap: 48px;
	}

	.how-steps__title {
		font-size: 20px;
	}
}

@media (max-width: 768px) {
	.section-how-it-works {
		padding: 56px 0;
	}

	.how-it-works {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
		margin-top: 32px;
	}

	.how-steps {
		--number-size: 44px;
		--step-gap: 32px;
	}

	.how-steps__item {
		gap: 16px;
	}

	.how-steps__number {
		font-size: 19px;
	}

	.how-steps__content {
		padding-top: 0;
	}

	.how-steps__title {
		font-size: 18px;
	}

	.how-steps__text {
		font-size: 15px;
	}
}
