/*
 * Heidesee Bauphasen-Timeline widget — dotted center line with milestones
 * alternating left/right. Built for dark sections (light text via kalkstein).
 */

.hd-timeline {
	color: var(--c-kalkstein);
	max-width: var(--wrap-max);
	margin-inline: auto;
}

.hd-timeline__title {
	margin: 0 0 clamp(40px, 6vw, 90px);
	max-width: 26ch;
	font-family: var(--font-base);
	font-weight: var(--fw-normal);
	font-size: var(--fs-h2);
	line-height: 1.1;
}

/* When the "Planungsstand" note follows, the title hugs it and the note carries
   the gap down to the track. */
.hd-timeline__title:has(+ .hd-timeline__note) {
	margin-bottom: clamp(8px, 1vw, 14px);
}

.hd-timeline__note {
	margin: 0 0 clamp(40px, 6vw, 90px);
	max-width: 40ch;
	font-size: var(--fs-body);
	line-height: 1.4;
}

.hd-timeline__track {
	position: relative;
}

/* Dotted center line: fine 3px dots on a 14px rhythm (a dotted border would
   render much chunkier), matching the delicate line in the design. */
.hd-timeline__track::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 0;
	bottom: 0;
	width: 3px;
	transform: translateX(-50%);
	background-image: radial-gradient(circle, rgba(232, 233, 228, 0.8) 1.5px, transparent 1.6px);
	background-size: 3px 14px;
	background-repeat: repeat-y;
	background-position: center top;
}

.hd-timeline__arrow {
	position: absolute;
	left: 50%;
	top: -10px;
	transform: translateX(-50%);
	line-height: 0;
	color: var(--c-kalkstein);
}

.hd-timeline__item {
	display: grid;
	grid-template-columns: 1fr 1fr;
	padding: clamp(24px, 4vw, 56px) 0;
}

/* Thin rule above each milestone, docking at the center line and running to
   the outer edge; the content hangs below it, inset from the axis via
   padding (the border spans the padding, so the rule still touches). */
.hd-timeline__body {
	display: flex;
	gap: clamp(20px, 2.5vw, 40px);
	align-items: flex-start;
	border-top: 2px solid rgba(232, 233, 228, 0.7);
	padding-top: clamp(16px, 2.2vw, 32px);
}

/* Odd milestones sit on the right of the line, even on the left */
.hd-timeline__item:nth-of-type(odd) .hd-timeline__body {
	grid-column: 2;
	padding-left: clamp(20px, 3vw, 55px);
}

.hd-timeline__item:nth-of-type(even) .hd-timeline__body {
	grid-column: 1;
	flex-direction: row-reverse;
	text-align: right;
	padding-right: clamp(20px, 3vw, 55px);
}

/* Date and body text share the same size (design: one type size throughout);
   the date wraps into a narrow column ("ab Juli" / "2031"). */
.hd-timeline__date {
	flex: 0 0 auto;
	max-width: 9ch;
	font-family: var(--font-base);
	font-weight: var(--fw-normal);
	font-size: clamp(20px, 1.9vw, 30px);
	line-height: 1.3;
}

/* The date aligns toward its text: right-side items right-aligned,
   left-side items left-aligned. */
.hd-timeline__item:nth-of-type(odd) .hd-timeline__date {
	text-align: right;
}

.hd-timeline__item:nth-of-type(even) .hd-timeline__date {
	text-align: left;
}

.hd-timeline__text {
	margin: 0;
	max-width: 24ch;
	font-size: clamp(20px, 1.9vw, 30px);
	line-height: 1.3;
}

/* --- Scroll reveal (only when JS opts in via .hd-timeline--reveal) --- */
.hd-timeline--reveal .hd-timeline__item {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.hd-timeline--reveal .hd-timeline__item.is-in {
	opacity: 1;
	transform: none;
}

/* --- Mobile: single column, line on the left --- */
@media (max-width: 900px) {
	.hd-timeline__track::before,
	.hd-timeline__arrow {
		left: 15px;
	}

	.hd-timeline__title {
		font-size: 35px;
		line-height: 1.15;
	}

	/* Figma mobile frame: rule docks at the left line and runs to the right
	   edge; below it the date sits in a FIXED 59px column (so every text
	   column starts at the same x), date 24/29, body copy 16/26. */
	.hd-timeline__item {
		grid-template-columns: 1fr;
		padding: 0 0 48px 16px;
	}

	/* Let the arrow run: a stretch of dotted line between the chevron and
	   the first rule, so the first entry doesn't collide with the arrow. */
	.hd-timeline__item:first-of-type {
		padding-top: 24px;
	}

	.hd-timeline__item:nth-of-type(odd) .hd-timeline__body,
	.hd-timeline__item:nth-of-type(even) .hd-timeline__body {
		grid-column: 1;
		flex-direction: row;
		text-align: left;
		gap: 20px;
		padding-top: 14px;
		padding-left: 29px;
		padding-right: 0;
	}

	.hd-timeline__item:nth-of-type(odd) .hd-timeline__date,
	.hd-timeline__item:nth-of-type(even) .hd-timeline__date {
		text-align: left;
	}

	.hd-timeline__date {
		flex: 0 0 59px;
		max-width: none;
		font-size: 24px;
		line-height: 1.2;
	}

	.hd-timeline__text {
		max-width: none;
		min-width: 0; /* let the flex column shrink below its longest word */
		font-size: 16px;
		line-height: 1.625;
		overflow-wrap: break-word;
		hyphens: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hd-timeline--reveal .hd-timeline__item {
		opacity: 1;
		transform: none;
		transition: none;
	}
}
