/* ==========================================================================
   Vulcan Timeline
   --------------------------------------------------------------------------
   The track is a CSS grid. Each .vtl__item is display:contents, so its
   marker and card are placed straight onto the track grid using --vtl-i
   (1-based item index, set inline). Side "a" = left/top, "b" = right/bottom.
   Vertical:   columns [a] [line] [b], one row per item.
   Horizontal: rows    [a] [line] [b], one column per item.
   ========================================================================== */

.vtl {
	--vtl-line-color: #d5d8dc;
	--vtl-line-width: 3px;
	--vtl-marker-size: 18px;
	--vtl-marker-color: #ffffff;
	--vtl-marker-border-color: #6ec1e4;
	--vtl-marker-border-width: 3px;
	--vtl-marker-radius: 50%;
	--vtl-card-bg: #f4f5f7;
	--vtl-card-width: 300px;
	--vtl-gap: 40px;
	--vtl-offset: 30px;
	--vtl-arrow-size: 10px;
	--vtl-arrow-pos: calc(var(--vtl-marker-size) / 2);
	position: relative;
}

.vtl--marker-center { --vtl-arrow-pos: 50%; }
.vtl--marker-end    { --vtl-arrow-pos: calc(100% - var(--vtl-marker-size) / 2); }

.vtl__track {
	position: relative;
	display: grid;
}

/* the line */
.vtl__track::before {
	content: "";
	position: absolute;
	background: var(--vtl-line-color);
}

.vtl__item {
	display: contents;
}

.vtl__marker {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	width: var(--vtl-marker-size);
	height: var(--vtl-marker-size);
	background: var(--vtl-marker-color);
	border: var(--vtl-marker-border-width) solid var(--vtl-marker-border-color);
	border-radius: var(--vtl-marker-radius);
}

.vtl__card {
	position: relative;
	box-sizing: border-box;
	min-width: 0;
	padding: 24px;
	background: var(--vtl-card-bg);
	border-radius: 6px;
}

.vtl__image {
	margin-bottom: 16px;
}

.vtl__image img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
}

.vtl__label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.04em;
	opacity: 0.75;
}

.vtl__title {
	margin: 0 0 8px;
}

.vtl__body > :last-child,
.vtl__desc > :last-child {
	margin-bottom: 0;
}

.vtl--arrows .vtl__card::before {
	content: "";
	position: absolute;
	width: 0;
	height: 0;
	border: var(--vtl-arrow-size) solid transparent;
}

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

.vtl--vertical .vtl__track {
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	row-gap: var(--vtl-gap);
}

.vtl--v-side-a .vtl__track { grid-template-columns: minmax(0, 1fr) auto 0; }
.vtl--v-side-b .vtl__track { grid-template-columns: 0 auto minmax(0, 1fr); }

.vtl--vertical .vtl__track::before {
	grid-column: 2 / 3;
	top: 0;
	bottom: 0;
	left: 50%;
	width: var(--vtl-line-width);
	transform: translateX(-50%);
}

.vtl--vertical .vtl__marker {
	grid-column: 2;
	grid-row: var(--vtl-i);
	align-self: start;
}
.vtl--vertical.vtl--marker-center .vtl__marker { align-self: center; }
.vtl--vertical.vtl--marker-end .vtl__marker    { align-self: end; }

.vtl--vertical .vtl__card {
	grid-row: var(--vtl-i);
}
.vtl--vertical .vtl__item--a .vtl__card {
	grid-column: 1;
	margin-right: var(--vtl-offset);
}
.vtl--vertical .vtl__item--b .vtl__card {
	grid-column: 3;
	margin-left: var(--vtl-offset);
}

.vtl--vertical.vtl--arrows .vtl__card::before {
	top: var(--vtl-arrow-pos);
	transform: translateY(-50%);
}
.vtl--vertical.vtl--arrows .vtl__item--a .vtl__card::before {
	left: 100%;
	border-right-width: 0;
	border-left-color: var(--vtl-card-bg);
}
.vtl--vertical.vtl--arrows .vtl__item--b .vtl__card::before {
	right: 100%;
	border-left-width: 0;
	border-right-color: var(--vtl-card-bg);
}

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

.vtl--horizontal {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scroll-snap-type: x proximity;
}

.vtl--horizontal .vtl__track {
	grid-template-rows: auto auto auto;
	grid-auto-columns: var(--vtl-card-width);
	column-gap: var(--vtl-gap);
	justify-content: center;
	box-sizing: border-box;
	width: max-content;
	min-width: 100%;
	padding: 12px 12px 16px;
}

.vtl--horizontal .vtl__track::before {
	grid-row: 2 / 3;
	left: 0;
	right: 0;
	top: 50%;
	height: var(--vtl-line-width);
	transform: translateY(-50%);
}

.vtl--horizontal .vtl__marker {
	grid-row: 2;
	grid-column: var(--vtl-i);
	justify-self: start;
}
.vtl--horizontal.vtl--marker-center .vtl__marker { justify-self: center; }
.vtl--horizontal.vtl--marker-end .vtl__marker    { justify-self: end; }

.vtl--horizontal .vtl__card {
	grid-column: var(--vtl-i);
	scroll-snap-align: start;
}
.vtl--horizontal .vtl__item--a .vtl__card {
	grid-row: 1;
	align-self: end;
	margin-bottom: var(--vtl-offset);
}
.vtl--horizontal .vtl__item--b .vtl__card {
	grid-row: 3;
	align-self: start;
	margin-top: var(--vtl-offset);
}

.vtl--horizontal.vtl--arrows .vtl__card::before {
	left: var(--vtl-arrow-pos);
	transform: translateX(-50%);
}
.vtl--horizontal.vtl--arrows .vtl__item--a .vtl__card::before {
	top: 100%;
	border-bottom-width: 0;
	border-top-color: var(--vtl-card-bg);
}
.vtl--horizontal.vtl--arrows .vtl__item--b .vtl__card::before {
	bottom: 100%;
	border-top-width: 0;
	border-bottom-color: var(--vtl-card-bg);
}

/* ==========================================================================
   Mobile: collapse everything to a single-sided vertical timeline
   (line on the left, cards on the right)
   ========================================================================== */

@media (max-width: 767px) {
	.vtl--mobile-stack {
		overflow: visible;
	}

	.vtl--mobile-stack .vtl__track {
		grid-template-columns: 0 auto minmax(0, 1fr);
		grid-template-rows: none;
		grid-auto-columns: auto;
		column-gap: 0;
		row-gap: var(--vtl-gap);
		justify-content: normal;
		width: auto;
		min-width: 0;
		padding: 0;
	}

	.vtl--mobile-stack .vtl__track::before {
		grid-column: 2 / 3;
		grid-row: auto;
		top: 0;
		bottom: 0;
		left: 50%;
		right: auto;
		width: var(--vtl-line-width);
		height: auto;
		transform: translateX(-50%);
	}

	.vtl--mobile-stack .vtl__marker {
		grid-column: 2;
		grid-row: var(--vtl-i);
		justify-self: auto;
		align-self: start;
	}
	.vtl--mobile-stack.vtl--marker-center .vtl__marker { align-self: center; }
	.vtl--mobile-stack.vtl--marker-end .vtl__marker    { align-self: end; }

	.vtl--mobile-stack .vtl__item .vtl__card {
		grid-column: 3;
		grid-row: var(--vtl-i);
		align-self: stretch;
		margin: 0 0 0 var(--vtl-offset);
	}

	.vtl--mobile-stack.vtl--arrows .vtl__item .vtl__card::before {
		top: var(--vtl-arrow-pos);
		bottom: auto;
		left: auto;
		right: 100%;
		transform: translateY(-50%);
		border: var(--vtl-arrow-size) solid transparent;
		border-left-width: 0;
		border-right-color: var(--vtl-card-bg);
	}
}
