/*
 * SERV-2: services rows.
 * Each service is one row across the section: its picture on one side; its
 * name, summary and link on the other. Rows change sides on wide screens.
 * On phones the picture always comes first.
 */

/* ---------- The list ---------- */

/* A hairline between rows, with the same room on both sides of it. */
.wprk-serv-2 .wprk-serv-2__rows > li {
	margin-block: 0;
}

.wprk-serv-2 .wprk-serv-2__rows > li + li {
	border-block-start: 1px solid var(--wprk-border);
	margin-block-start: var(--wp--preset--spacing--50);
	padding-block-start: var(--wp--preset--spacing--50);
}

/* ---------- One row ---------- */

.wprk-serv-2 .wprk-serv-2__row {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
}

.wprk-serv-2 .wprk-serv-2__row > * {
	margin: 0;
}

.wprk-serv-2 .wprk-serv-2__body {
	min-width: 0;
}

.wprk-serv-2 .wprk-serv-2__body > * {
	margin-block: 0;
}

.wprk-serv-2 .wprk-serv-2__body > * + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

.wprk-serv-2 .wprk-serv-2__body > .wp-block-post-title {
	overflow-wrap: break-word;
}

/*
 * The name links to the service. The padding gives the link a tap target of
 * full height. On an inline link it takes no room, so nothing moves.
 */
.wprk-serv-2 .wprk-serv-2__body > .wp-block-post-title a {
	color: var(--wprk-heading);
	display: inline;
	padding-block: 0.7rem;
	text-decoration: none;
}

.wprk-serv-2 .wprk-serv-2__body > .wp-block-post-title a:hover {
	text-decoration: underline;
}

/* A readable line length, also when a row has no picture beside the text. */
.wprk-serv-2 .wprk-serv-2__body > .wp-block-post-excerpt {
	max-width: 44rem;
	overflow-wrap: break-word;
}

.wprk-serv-2 .wprk-serv-2__body > .wp-block-post-excerpt > p {
	margin-block: 0;
}

/*
 * "Learn more". The padding makes a tap target of full height. The bottom
 * margin gives the extra height back, so the text stays level with the picture.
 */
.wprk-serv-2 .wprk-serv-2__body > .wp-block-read-more {
	color: var(--wprk-link);
	font-weight: 600;
	margin-block-end: -0.7em;
	padding-block: 0.7em;
	text-decoration: underline;
	text-decoration-thickness: 0.06em;
	text-underline-offset: 0.3em;
}

.wprk-serv-2 .wprk-serv-2__body > .wp-block-read-more:hover {
	text-decoration-thickness: 0.12em;
}

/* The arrow is decoration, so it has an empty text alternative. */
.wprk-serv-2 .wprk-serv-2__body > .wp-block-read-more::after {
	content: "\2192";
	content: "\2192" / "";
	display: inline-block;
	margin-inline-start: 0.4em;
}

/* ---------- Wide screens: two halves ---------- */

@media (min-width: 782px) {
	.wprk-serv-2 .wprk-serv-2__rows > li + li {
		margin-block-start: var(--wp--preset--spacing--60);
		padding-block-start: var(--wp--preset--spacing--60);
	}

	/* The text sits level with the middle of the picture. */
	.wprk-serv-2 .wprk-serv-2__row {
		align-items: center;
		flex-direction: row;
		gap: var(--wp--preset--spacing--60);
	}

	.wprk-serv-2 .wprk-serv-2__row > .wp-block-post-featured-image {
		flex: 0 0 calc(50% - var(--wp--preset--spacing--60) / 2);
	}

	.wprk-serv-2 .wprk-serv-2__body {
		flex: 1 1 0%;
	}

	/* Every second row has its picture on the right. */
	.wprk-serv-2 .wprk-serv-2__rows > li:nth-child(even) > .wprk-serv-2__row {
		flex-direction: row-reverse;
	}

	/*
	 * Editor only. The editor keeps a hidden copy of the row being edited inside
	 * the list, which would shift the count. These two rules leave hidden items
	 * out of it, so the editor shows the same sides as the front end.
	 */
	.wprk-serv-2 .wprk-serv-2__rows.block-editor-block-list__block > li:nth-child(n) > .wprk-serv-2__row {
		flex-direction: row;
	}

	.wprk-serv-2 .wprk-serv-2__rows.block-editor-block-list__block > li:nth-child(even of :not([style*="display: none"])) > .wprk-serv-2__row {
		flex-direction: row-reverse;
	}

	/*
	 * A service without a picture keeps the two halves: its name on one side,
	 * the summary and link on the other, with the first lines on one baseline.
	 * A browser that does not know :has() shows one column of text instead.
	 */
	.wprk-serv-2 .wprk-serv-2__row:not(:has(> .wp-block-post-featured-image)) > .wprk-serv-2__body {
		align-items: baseline;
		column-gap: var(--wp--preset--spacing--60);
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: auto 1fr;
	}

	.wprk-serv-2 .wprk-serv-2__row:not(:has(> .wp-block-post-featured-image)) > .wprk-serv-2__body > .wp-block-post-title {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.wprk-serv-2 .wprk-serv-2__row:not(:has(> .wp-block-post-featured-image)) > .wprk-serv-2__body > .wp-block-post-excerpt {
		grid-column: 2;
		grid-row: 1;
		margin-block-start: 0;
	}

	.wprk-serv-2 .wprk-serv-2__row:not(:has(> .wp-block-post-featured-image)) > .wprk-serv-2__body > .wp-block-read-more {
		grid-column: 2;
		grid-row: 2;
	}
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
	.wprk-serv-2 .wprk-serv-2__body > .wp-block-read-more::after {
		transition: transform 0.18s ease;
	}

	.wprk-serv-2 .wprk-serv-2__body > .wp-block-read-more:hover::after {
		transform: translateX(0.2em);
	}
}
