/**
 * Services block styles (block-scoped; enqueued only when the block is present).
 * BEM only, prefixed with the block slug. Do not touch the theme's global style.css.
 *
 * The layout follows StartP's .services-details-area: rows of text beside a
 * picture, the sides swapping from one row to the next, on the tinted band of
 * the reference's alternating sections. The row's parts borrow the theme's own
 * vocabulary: the pill of the eyebrows, round badges like the Features icons
 * for the ticks, and a white callout for who the service suits.
 */

/*
 * The theme ships no global box-sizing, so a rail written as max-width plus
 * padding would hang that padding outside the rail. Scope border-box to the
 * block instead, as every other block here does.
 */
.sws-services,
.sws-services *,
.sws-services *::before,
.sws-services *::after {
	box-sizing: border-box;
}

/*
 * The tinted band is not only the reference's alternating section colour. The
 * illustrations are drawn on this same near-white, so on it the frame of each
 * picture disappears and the objects stand on the section itself.
 */
.sws-services {
	container: sws-services / inline-size;
	background: var(--wp--preset--color--surface-alt, #f7fafd);
	/*
	 * Full-bleed root. Keep responsive rules off it: an element cannot be styled
	 * by its own container query.
	 */
}

.sws-services__inner {
	/* Mobile-first base. Same rail formula as the header, so both stay flush. */
	max-width: min(var(--sws-content, 1116px), 100% - 2 * var(--sws-gutter, 0.75rem));
	margin-inline: auto;
	padding-block: 3.125rem;
}

/*--------------------------------------------------------------
# Section head
--------------------------------------------------------------*/

.sws-services__head {
	margin-bottom: 2.5rem;
	text-align: center;
}

.sws-services__heading {
	margin: 0;
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
}

/*
 * The travelling dot on its rule. Both sizes live here so the block can change
 * them together; --sws-bar-travel is what the shared keyframe in css/base.css
 * reads to know how far to go.
 */
.sws-services__bar {
	--sws-services-bar: 5.625rem;
	--sws-services-dot: 0.625rem;

	position: relative;
	width: var(--sws-services-bar);
	height: 0.3125rem;
	margin: 1.25rem auto;
	border-radius: 30px;
	background: var(--wp--preset--color--accent-soft, #cdf1d8);
}

.sws-services__bar::before {
	--sws-bar-travel: calc(var(--sws-services-bar) - var(--sws-services-dot));

	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: var(--sws-services-dot);
	height: var(--sws-services-dot);
	margin-top: calc(var(--sws-services-dot) / -2);
	border-radius: 50%;
	background: var(--wp--preset--color--accent, #44ce6f);
	animation: sws-bar-dot 3s linear infinite alternate;
}

.sws-services__text {
	max-width: 40rem;
	margin: 0 auto;
	color: var(--wp--preset--color--text, #4a6f8a);
	font-size: 0.9375rem;
	line-height: 1.9;
}

/*--------------------------------------------------------------
# Rows
--------------------------------------------------------------*/

.sws-services__list {
	display: grid;
	gap: 3.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * One column on a phone, picture first: the markup already puts it there, so
 * the narrow layout needs no reordering at all.
 */
.sws-services__item {
	display: grid;
	gap: 1.5rem;
	align-items: center;
}

/*
 * The frame holds the picture's own 4:3, so the row's height is known before
 * the bytes arrive. The cap keeps a tablet-width phone layout from blowing the
 * scene up past the size it has in two columns.
 */
.sws-services__media {
	width: 100%;
	max-width: 33rem;
	margin-inline: auto;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

/* Descendant, not child: the image optimizer may wrap the tag in <picture>. */
.sws-services__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/*
 * The text shares the picture's cap, so in one column the two form a single
 * centred column rather than a narrow picture over rail-wide lines.
 */
.sws-services__body {
	width: 100%;
	max-width: 33rem;
	margin-inline: auto;
}

/*
 * One rhythm down the row: every part keeps its own top margin and none has a
 * bottom one, so a service without a note or a stack closes up without gaps.
 */
.sws-services__body > * {
	margin: 1.5rem 0 0;
}

/*
 * The service's name, set as the same pill as an eyebrow: the heading colour
 * on the soft green, which keeps the shape and passes contrast.
 */
.sws-services__label {
	display: inline-block;
	padding: 0.3125rem 1.25rem 0.25rem;
	border-radius: 30px;
	background: var(--wp--preset--color--accent-soft, #cdf1d8);
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.6;
	text-transform: uppercase;
}

.sws-services__body > .sws-services__title {
	margin-top: 1rem;
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 1.375rem;
	font-weight: 600;
	line-height: 1.3;
}

.sws-services__body > .sws-services__content {
	margin-top: 1rem;
	color: var(--wp--preset--color--text, #4a6f8a);
	font-size: 0.9375rem;
	line-height: 1.9;
}

/* WYSIWYG output — markup the theme does not generate. */
.sws-services__content p {
	margin: 0;
}

.sws-services__content p + p {
	margin-top: 1rem;
}

/* The small uppercase line over the checklist and before the stack. */
.sws-services__caption {
	margin: 0 0 0.75rem;
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.6;
	text-transform: uppercase;
}

/*--------------------------------------------------------------
# Checklist
--------------------------------------------------------------*/

.sws-services__checklist {
	display: grid;
	gap: 0.625rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sws-services__check {
	display: grid;
	grid-template-columns: 1.375rem minmax(0, 1fr);
	gap: 0.75rem;
	align-items: start;
	color: var(--wp--preset--color--text, #4a6f8a);
	font-size: 0.9375rem;
	line-height: 1.6;
}

/*
 * A small cousin of the Features badge. The top offset centres the 22px disc on
 * the first line of a 24px line box, so a wrapped item keeps its tick up top.
 */
.sws-services__tick {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.375rem;
	height: 1.375rem;
	margin-top: 0.0625rem;
	border-radius: 50%;
	background: var(--wp--preset--color--accent-soft, #cdf1d8);
	color: var(--wp--preset--color--heading, #0e314c);
}

/*
 * Explicit size, not optional: the icons ship with a viewBox and no width or
 * height, and an unsized SVG in HTML falls back to 300x150. At this size the
 * usual stroke would thin out to a hairline, so it is drawn heavier.
 */
.sws-services__tick-icon {
	display: block;
	width: 0.75rem;
	height: 0.75rem;
	stroke-width: 8;
}

/*--------------------------------------------------------------
# Who it suits, the note and the stack
--------------------------------------------------------------*/

/*
 * White on the tinted band with a green edge: the one sentence a reader
 * checks against their own case, so it is the one that stands out.
 */
.sws-services__fit {
	padding: 0.875rem 1.125rem;
	border-left: 3px solid var(--wp--preset--color--accent, #44ce6f);
	border-radius: 0 var(--sws-radius-lg, 5px) var(--sws-radius-lg, 5px) 0;
	background: var(--wp--preset--color--surface, #ffffff);
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 0.9375rem;
	line-height: 1.7;
}

/* A green dot leads the note, the way a "live" marker leads a status line. */
.sws-services__body > .sws-services__note {
	position: relative;
	margin-top: 1rem;
	padding-left: 1.25rem;
	color: var(--wp--preset--color--text, #4a6f8a);
	font-size: 0.875rem;
	line-height: 1.7;
}

.sws-services__note::before {
	content: "";
	position: absolute;
	top: 0.5rem;
	left: 0.125rem;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: var(--wp--preset--color--accent, #44ce6f);
	box-shadow: 0 0 0 3px var(--wp--preset--color--accent-soft, #cdf1d8);
}

.sws-services__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sws-services__chip {
	padding: 0.25rem 0.75rem;
	border: 1px solid var(--wp--preset--color--line, #dbeefd);
	border-radius: 30px;
	background: var(--wp--preset--color--surface, #ffffff);
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.6;
}

/*--------------------------------------------------------------
# Link
--------------------------------------------------------------*/

/*
 * The heading colour with a soft-green underline that turns full green on
 * hover, and the theme's one arrow turned to point on.
 */
.sws-services__body > .sws-services__link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1.75rem;
	padding-bottom: 0.125rem;
	border-bottom: 2px solid var(--wp--preset--color--accent-soft, #cdf1d8);
	color: var(--wp--preset--color--heading, #0e314c);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
	transition:
		border-color var(--sws-transition, 0.3s ease),
		color var(--sws-transition, 0.3s ease);
}

.sws-services__link:hover,
.sws-services__link:focus-visible {
	border-bottom-color: var(--wp--preset--color--accent, #44ce6f);
	color: var(--wp--preset--color--accent, #44ce6f);
}

/*
 * Explicit size, not optional: the icons ship with a viewBox and no width or
 * height, and an unsized SVG in HTML falls back to 300x150.
 */
.sws-services__link-icon {
	display: block;
	flex: none;
	width: 1rem;
	height: 1rem;
	stroke-width: 6;
	transform: rotate(90deg);
	transition: translate var(--sws-transition, 0.3s ease);
}

.sws-services__link:hover .sws-services__link-icon,
.sws-services__link:focus-visible .sws-services__link-icon {
	translate: 0.25rem 0;
}

/*
 * Whatever opens the row sits flush with its top. Same weight as the per-part
 * margins above, so it has to come after them.
 */
.sws-services__body > :first-child {
	margin-top: 0;
}

/*--------------------------------------------------------------
# Desktop: two columns, alternating sides
--------------------------------------------------------------*/

@container sws-services (min-width: 782px) {

	.sws-services__inner {
		padding-block: 5rem;
	}

	.sws-services__head {
		margin-bottom: 3.75rem;
	}

	.sws-services__heading {
		font-size: 1.75rem;
	}

	.sws-services__list {
		gap: 5.625rem;
	}

	.sws-services__item {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 3.75rem;
		align-items: start;
	}

	/*
	 * The first service opens with its text on the left, where the eye starts,
	 * so the picture goes right on every odd row and stays left on the even ones.
	 */
	.sws-services__item:nth-child(odd) .sws-services__media {
		order: 2;
	}

	.sws-services__media,
	.sws-services__body {
		max-width: none;
	}

	/*
	 * The picture follows the text down its row instead of waiting in the middle
	 * of it, where it only arrived once half the service was read. Both columns
	 * are sticky and the taller one sets the row's height, so that one has
	 * nowhere to travel and exactly one of them ever moves: the picture here,
	 * the text in a service that ever carries less of it.
	 *
	 * The height query is not decoration. The frame is half the rail at 4:3, so
	 * 396px at the widest, and parked under the header it wants some 520px of
	 * viewport. A phone on its side is wide enough for two columns and too short
	 * to show the bottom of the frame.
	 */
	@media (min-height: 600px) {

		.sws-services__media,
		.sws-services__body {
			position: sticky;
			top: var(--sws-header-offset);
		}
	}

	.sws-services__body > .sws-services__title {
		font-size: 1.625rem;
	}
}

/*
 * The editor canvas has no site header to clear, and a column stuck to the top
 * of the iframe would sit where the block toolbar is. The class never reaches
 * the front end, so the front-end rule above stands.
 */
.editor-styles-wrapper .sws-services__media,
.editor-styles-wrapper .sws-services__body {
	position: static;
}

/*--------------------------------------------------------------
# Reduced motion
--------------------------------------------------------------*/

/*
 * A preference query, not a width one — the block's breakpoints stay container
 * queries. base.css collapses --sws-duration, which reaches transitions only; a
 * keyframe animation has no such handle, so the component that starts one also
 * stops it.
 */
@media (prefers-reduced-motion: reduce) {

	.sws-services__bar::before {
		animation: none;
	}

	.sws-services__link:hover .sws-services__link-icon,
	.sws-services__link:focus-visible .sws-services__link-icon {
		translate: none;
	}

	/*
	 * A column moving at a different rate from the one beside it is the parallax
	 * pattern however it is built, so it goes off with the keyframes. The top
	 * alignment stays: that part is layout, not motion, and it is what brings
	 * the picture into view early.
	 */
	.sws-services__media,
	.sws-services__body {
		position: static;
	}
}
