/* ABOUT-2: timeline. A section head beside a list of milestones on a rail. */

.wprk-about-2 {
	--wprk-about-2-dot: 0.5rem;
	--wprk-about-2-gap: var(--wp--preset--spacing--60);
	--wprk-about-2-line: calc(var(--wp--preset--font-size--large) * 1.3);
	--wprk-about-2-year: 4.5rem;
}

.wprk-about-2 .wprk-about-2__cols {
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60);
}

/* The gap between the columns spaces the head, stacked or side by side. */
.wprk-about-2 .wprk-section__head {
	margin-block-end: 0;
}

/*
 * Phones: the rail runs down the left edge. Each milestone hangs from a dot,
 * with the year above its text. Milestones touch, so the rail is unbroken;
 * the space between them is padding.
 */
.wprk-about-2 .wprk-about-2__list > .wprk-about-2__item {
	margin-block: 0;
	padding-block-end: var(--wp--preset--spacing--50);
	padding-inline-start: var(--wp--preset--spacing--40);
	position: relative;
}

.wprk-about-2 .wprk-about-2__list > .wprk-about-2__item:last-child {
	padding-block-end: 0;
}

/* On a row of items the milestones still touch, so the rail is unbroken. */
.wprk-about-2 .wprk-about-2__list {
	gap: 0;
}

/* The rail: a hairline through the middle of the dots. */
.wprk-about-2 .wprk-about-2__item::before {
	border-inline-start: 1px solid var(--wprk-border);
	content: "";
	inset-block: 0;
	inset-inline-start: calc(var(--wprk-about-2-dot) / 2 - 0.5px);
	position: absolute;
}

/* It starts at the first dot and ends at the last one. */
.wprk-about-2 .wprk-about-2__item:first-child::before {
	inset-block-start: calc(var(--wprk-about-2-line) / 2);
}

.wprk-about-2 .wprk-about-2__item:last-child::before {
	block-size: calc(var(--wprk-about-2-line) / 2);
	inset-block-end: auto;
}

.wprk-about-2 .wprk-about-2__item:first-child:last-child::before {
	content: none;
}

.wprk-about-2 .wprk-about-2__item > * {
	margin-block: 0;
}

/* Year and title share one size and line height, so their first lines sit level. */
.wprk-about-2 .wprk-about-2__year {
	color: var(--wprk-accent-text);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-variant-numeric: lining-nums tabular-nums;
	font-weight: var(--wp--custom--heading--weight);
	letter-spacing: var(--wp--custom--heading--tracking);
	line-height: 1.3;
	overflow-wrap: anywhere;
	position: relative;
}

/* The dot belongs to the year. A ring in the background colour lifts it off the rail. */
.wprk-about-2 .wprk-about-2__year::before {
	background-color: var(--wprk-accent);
	border-radius: 50%;
	box-shadow: 0 0 0 0.25rem var(--wprk-bg);
	content: "";
	height: var(--wprk-about-2-dot);
	inset-block-start: calc((var(--wprk-about-2-line) - var(--wprk-about-2-dot)) / 2);
	inset-inline-start: calc(var(--wp--preset--spacing--40) * -1);
	position: absolute;
	width: var(--wprk-about-2-dot);
}

.wprk-about-2 .wprk-about-2__item :where(h3) {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
}

.wprk-about-2 .wprk-about-2__item > .wprk-about-2__year + * {
	margin-block-start: 0.125rem;
}

.wprk-about-2 .wprk-about-2__item > .wp-block-heading ~ * {
	margin-block-start: var(--wp--preset--spacing--10);
	max-width: 36rem;
}

/* From 600px: year in a left column, text in a right column, rail and dot between them. */
@media (min-width: 600px) {
	.wprk-about-2 .wprk-about-2__list > .wprk-about-2__item {
		column-gap: var(--wprk-about-2-gap);
		display: grid;
		grid-template-columns: var(--wprk-about-2-year) minmax(0, 1fr);
		padding-inline-start: 0;
	}

	.wprk-about-2 .wprk-about-2__item > * {
		grid-column: 2;
	}

	.wprk-about-2 .wprk-about-2__item > .wprk-about-2__year {
		grid-column: 1;
		grid-row: 1;
	}

	.wprk-about-2 .wprk-about-2__item > .wprk-about-2__year + * {
		margin-block-start: 0;
	}

	.wprk-about-2 .wprk-about-2__item::before {
		inset-inline-start: calc(var(--wprk-about-2-year) + var(--wprk-about-2-gap) / 2 - 0.5px);
	}

	.wprk-about-2 .wprk-about-2__year::before {
		inset-inline-end: calc((var(--wprk-about-2-gap) + var(--wprk-about-2-dot)) / -2);
		inset-inline-start: auto;
	}
}

/* In the editor the button that adds a milestone follows the last one, which still ends the rail. */
.wprk-about-2 .wprk-about-2__list > .wprk-about-2__item:has(+ .block-list-appender) {
	padding-block-end: 0;
}

.wprk-about-2 .wprk-about-2__item:has(+ .block-list-appender)::before {
	block-size: calc(var(--wprk-about-2-line) / 2);
	inset-block-end: auto;
}
