/* Healthy EAT – Timeline v2.0.0 */

.he-tl {
	--he-primary: #50916a;
	--he-accent: #f18318;
	--he-text: #1c3325;
	--he-card: #ffffff;
	--he-line: color-mix(in srgb, var(--he-primary) 35%, transparent);
	--he-gap: 28px;
	--he-marker: 28px;
	--he-marker-x: 22px;
	--he-radius: 6px;
	--he-cols: 4;
	--he-ratio: 4/3;
	--he-font-heading: var(--h3_typography-font-family, inherit);
	--he-font-date: var(--h4_typography-font-family, var(--he-font-heading));

	position: relative;
	color: var(--he-text);
}

.he-tl *,
.he-tl *::before,
.he-tl *::after {
	box-sizing: border-box;
}

.he-tl .he-tl__track {
	list-style: none;
	margin: 0;
	padding: 0;
}

.he-tl .he-tl__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ---------- Marker ---------- */

.he-tl .he-tl__marker {
	position: absolute;
	z-index: 2;
	display: grid;
	place-items: center;
	width: var(--he-marker);
	height: var(--he-marker);
	border-radius: 50%;
	background: var(--he-card);
	border: 2px solid var(--he-primary);
	color: #fff;
}

.he-tl .he-tl__item--done .he-tl__marker {
	background: var(--he-primary);
}

.he-tl .he-tl__item--current .he-tl__marker {
	background: var(--he-accent);
	border-color: var(--he-accent);
	box-shadow: 0 0 0 6px color-mix(in srgb, var(--he-accent) 22%, transparent);
}

.he-tl .he-tl__item--current .he-tl__marker::after {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
}

.he-tl .he-tl__icon {
	width: 16px;
	height: 16px;
	flex: none;
}

/* ---------- Card ---------- */

.he-tl .he-tl__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	margin: 0;
	background: var(--he-card);
	border-radius: var(--he-radius);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(28, 51, 37, .06), 0 12px 28px -16px rgba(28, 51, 37, .22);
	transition: transform .25s ease, box-shadow .25s ease;
}

.he-tl .he-tl__card:hover {
	transform: translateY(-3px);
	box-shadow: 0 1px 2px rgba(28, 51, 37, .06), 0 18px 34px -16px rgba(28, 51, 37, .28);
}

.he-tl .he-tl__item--current .he-tl__card {
	box-shadow: 0 0 0 2px var(--he-accent), 0 12px 28px -16px rgba(28, 51, 37, .22);
}

.he-tl .he-tl__media {
	position: relative;
	aspect-ratio: var(--he-ratio);
	overflow: hidden;
	background: color-mix(in srgb, var(--he-primary) 12%, var(--he-card));
}

.he-tl .he-tl__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	margin: 0;
	transition: transform .6s ease;
}

.he-tl .he-tl__card:hover .he-tl__img {
	transform: scale(1.04);
}

.he-tl .he-tl__placeholder {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: color-mix(in srgb, var(--he-primary) 55%, transparent);
	background-image: radial-gradient(color-mix(in srgb, var(--he-primary) 22%, transparent) 1.2px, transparent 1.4px);
	background-size: 16px 16px;
}

.he-tl .he-tl__placeholder .he-tl__icon {
	width: 52px;
	height: 52px;
	stroke-width: 1.4;
	padding: 10px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--he-primary) 10%, var(--he-card));
	box-sizing: content-box;
}

.he-tl .he-tl__badge {
	position: absolute;
	top: 14px;
	left: 14px;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .02em;
	background: var(--he-card);
	color: var(--he-primary);
	box-shadow: 0 2px 8px rgba(28, 51, 37, .15);
}

.he-tl .he-tl__item--current .he-tl__badge {
	background: var(--he-accent);
	color: #fff;
}

.he-tl .he-tl__item--upcoming .he-tl__badge {
	color: var(--he-text);
}

.he-tl .he-tl__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 22px 24px 26px;
}

.he-tl .he-tl__date {
	margin: 0 0 6px;
	font-family: var(--he-font-date);
	font-size: 19px;
	line-height: 1.3;
	color: var(--he-primary);
}

.he-tl .he-tl__title {
	margin: 0 0 12px;
	padding: 0;
	font-family: var(--he-font-heading);
	font-size: 24px;
	font-weight: inherit;
	line-height: 1.2;
	color: var(--he-accent);
}

.he-tl .he-tl__text {
	font-size: 15px;
	line-height: 1.6;
	color: var(--he-text);
}

.he-tl .he-tl__text p {
	margin: 0 0 .8em;
}

.he-tl .he-tl__text p:last-child {
	margin-bottom: 0;
}

.he-tl .he-tl__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	align-self: flex-start;
	margin-top: auto;
	padding-top: 16px;
	font-size: 15px;
	font-weight: 600;
	color: var(--he-primary);
	text-decoration: none;
}

.he-tl .he-tl__link:hover,
.he-tl .he-tl__link:focus-visible {
	color: var(--he-accent);
}

.he-tl .he-tl__link .he-tl__icon {
	transition: transform .2s ease;
}

.he-tl .he-tl__link:hover .he-tl__icon {
	transform: translateX(3px);
}

.he-tl a:focus-visible,
.he-tl button:focus-visible {
	outline: 2px solid var(--he-accent);
	outline-offset: 3px;
	border-radius: 4px;
}

/* =========================================================
   Horizontal layout
   ========================================================= */

.he-tl--horizontal .he-tl__track {
	display: flex;
	gap: var(--he-gap);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	padding: 4px 4px 28px;
	margin: 0 -4px;
}

.he-tl--horizontal .he-tl__track::-webkit-scrollbar {
	display: none;
}

.he-tl--horizontal .he-tl__item {
	flex: 0 0 calc((100% - (var(--he-cols) - 1) * var(--he-gap)) / var(--he-cols));
	display: flex;
	flex-direction: column;
	padding-top: calc(var(--he-marker) + 22px);
	scroll-snap-align: start;
}

/* Line segment from this marker to the next one. */
.he-tl--horizontal .he-tl__item::before {
	content: "";
	position: absolute;
	top: calc(var(--he-marker) / 2 - 1px);
	left: calc(var(--he-marker-x) + var(--he-marker) / 2);
	right: calc((var(--he-gap) + var(--he-marker-x) + var(--he-marker) / 2) * -1);
	border-top: 2px dashed var(--he-line);
}

.he-tl--horizontal .he-tl__item--done::before {
	border-top-style: solid;
	border-top-color: var(--he-primary);
}

.he-tl--horizontal .he-tl__item:last-child::before {
	right: 0;
	-webkit-mask-image: linear-gradient(90deg, #000 40%, transparent);
	mask-image: linear-gradient(90deg, #000 40%, transparent);
}

.he-tl--horizontal .he-tl__marker {
	top: 0;
	left: var(--he-marker-x);
}

.he-tl--horizontal .he-tl__card {
	flex: 1;
}

.he-tl--horizontal .he-tl__nav {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 4px;
}

.he-tl--horizontal .he-tl__nav[hidden] {
	display: none;
}

.he-tl .he-tl__arrow {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 2px solid var(--he-primary);
	border-radius: 50%;
	background: transparent;
	color: var(--he-primary);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}

.he-tl .he-tl__arrow .he-tl__icon {
	width: 20px;
	height: 20px;
}

.he-tl .he-tl__arrow:hover:not(:disabled) {
	background: var(--he-primary);
	color: #fff;
}

.he-tl .he-tl__arrow:disabled {
	opacity: .35;
	cursor: default;
}

@media (max-width: 1024px) {
	.he-tl--horizontal .he-tl__item {
		flex-basis: calc((100% - var(--he-gap)) / 2);
	}
}

@media (max-width: 680px) {
	.he-tl {
		--he-gap: 18px;
	}

	.he-tl--horizontal .he-tl__item {
		flex-basis: 84%;
	}

	.he-tl .he-tl__title {
		font-size: 22px;
	}
}

/* =========================================================
   Vertical layout
   ========================================================= */

.he-tl--vertical .he-tl__track {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 36px;
	padding: 8px 0;
}

.he-tl--vertical .he-tl__track::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	border-left: 2px dashed var(--he-line);
	transform: translateX(-1px);
}

.he-tl--vertical .he-tl__item {
	width: 50%;
	padding-right: 56px;
}

.he-tl--vertical .he-tl__item:nth-child(even) {
	align-self: flex-end;
	padding-right: 0;
	padding-left: 56px;
}

.he-tl--vertical .he-tl__marker {
	top: 36px;
	right: calc(var(--he-marker) / -2);
}

.he-tl--vertical .he-tl__item:nth-child(even) .he-tl__marker {
	right: auto;
	left: calc(var(--he-marker) / -2);
}

/* Solid line behind completed events. */
.he-tl--vertical .he-tl__item--done::after {
	content: "";
	position: absolute;
	top: 36px;
	bottom: -72px;
	right: -1px;
	border-left: 2px solid var(--he-primary);
}

.he-tl--vertical .he-tl__item--done:last-child::after {
	display: none;
}

.he-tl--vertical .he-tl__item--done:nth-child(even)::after {
	right: auto;
	left: -1px;
}

/* Wide cards: image beside the text. */
@media (min-width: 1100px) {
	.he-tl--vertical .he-tl__card {
		flex-direction: row;
	}

	.he-tl--vertical .he-tl__media {
		flex: 0 0 42%;
		aspect-ratio: auto;
		min-height: 220px;
	}
}

@media (max-width: 800px) {
	.he-tl--vertical .he-tl__track::before {
		left: calc(var(--he-marker) / 2);
	}

	.he-tl--vertical .he-tl__item,
	.he-tl--vertical .he-tl__item:nth-child(even) {
		width: 100%;
		align-self: stretch;
		padding: 0 0 0 calc(var(--he-marker) + 22px);
	}

	.he-tl--vertical .he-tl__marker,
	.he-tl--vertical .he-tl__item:nth-child(even) .he-tl__marker {
		left: 0;
		right: auto;
		top: 24px;
	}

	.he-tl--vertical .he-tl__item--done::after,
	.he-tl--vertical .he-tl__item--done:nth-child(even)::after {
		left: calc(var(--he-marker) / 2 - 1px);
		right: auto;
		top: 24px;
		bottom: -60px;
	}
}

/* =========================================================
   Reveal animation (only once JS is running)
   ========================================================= */

.he-tl--animate.he-tl--js .he-tl__item {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
	transition-delay: calc(var(--he-i, 0) * 110ms);
}

.he-tl--animate.he-tl--js .he-tl__item.is-visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.he-tl *,
	.he-tl--animate.he-tl--js .he-tl__item {
		transition: none !important;
		animation: none !important;
		transform: none !important;
		opacity: 1 !important;
	}

	.he-tl--horizontal .he-tl__track {
		scroll-behavior: auto;
	}
}
