/**
 * Timeline — looping milestone carousel.
 *
 * Buildings are grayscale; the slide in focus (Splide .is-active, centred) goes to colour,
 * scales up and reveals its name + location and a dotted guide line. A year + dot row sits
 * under every building, joined by a thin line. Arrows appear on hover; touch uses drag.
 */

.ki-timeline {
	--ki-timeline-dot: 26px;
	position: relative;
	overflow: hidden;
	padding: 90px 0 80px;
	background: #ffffff;
}

/* Optional photo behind the whole section: faint, grayscale, fading to white at top and bottom. */
.ki-timeline__bg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

.ki-timeline__bg img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.22;
	filter: grayscale(1);
}

.ki-timeline__bg::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0) 70%, #ffffff 100%);
}

/* Faint brand mark, top-right corner. */
.ki-timeline__mark {
	position: absolute;
	top: 40px;
	right: 0;
	z-index: 0;
	width: min(500px, 42vw);
	height: auto;
	opacity: 0.07;
	transform: translateX(35%);
	pointer-events: none;
}

.ki-timeline__head {
	position: relative;
	z-index: 1;
	max-width: 1240px;
	margin: 0 auto 36px;
	padding: 0 24px;
}

/* Eyebrow with a thin line under the text and a broad accent bar at its end. */
.ki-timeline__eyebrow {
	position: relative;
	display: inline-block;
	margin-bottom: 24px;
	padding-bottom: 14px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--ki-color-ink, #353535);
}

.ki-timeline__eyebrow::before {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 1px;
	background: var(--ki-color-accent, #7cb8ae);
	opacity: 0.6;
}

.ki-timeline__eyebrow::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: -1px;
	width: 52px;
	height: 4px;
	background: var(--ki-color-accent, #7cb8ae);
}

.ki-timeline__heading {
	margin: 0;
	font-size: clamp(2rem, 3.4vw, 3.1rem);
	font-weight: 300;
	line-height: 1.14;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: #1a1a1a;
}

.ki-timeline__heading strong {
	font-weight: 800;
}

.ki-timeline__subtitle {
	margin: 14px 0 0;
	max-width: 560px;
	font-size: 1.05rem;
	line-height: 1.8;
	color: #555555;
}

.ki-timeline__slider {
	position: relative;
	z-index: 1;
	max-width: 1500px;
	margin: 0 auto;
	cursor: grab;
}

.ki-timeline__slider:active {
	cursor: grabbing;
}

.ki-timeline__item {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	user-select: none;
}

.ki-timeline__figure {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 100%;
	margin-bottom: 36px;
}

.ki-timeline__tooltip {
	min-height: 64px;
	padding: 0 12px;
	text-align: center;
	opacity: 0;
	transition: opacity 0.3s linear;
}

.ki-timeline__name {
	margin: 0;
	font-size: 18px;
	font-style: italic;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ki-color-accent-deep, #146131);
}

.ki-timeline__place {
	display: block;
	margin-top: 2px;
	font-size: 15px;
	color: #777777;
}

.ki-timeline__img {
	position: relative;
	margin-top: 15px;
	padding-top: 60px;
	transform: scale(0.8);
	transform-origin: center bottom;
	transition: transform 0.3s linear;
}

/* Dotted guide line from the name down to the building. */
.ki-timeline__img::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 0;
	border-left: 1px dotted #000000;
	opacity: 0;
	transition: opacity 0.3s linear;
}

.ki-timeline__photo {
	display: block;
	width: auto;
	max-width: 100%;
	height: 270px;
	margin: 0 auto;
	object-fit: contain;
	object-position: center bottom;
	filter: grayscale(1);
	transition: filter 0.3s linear;
	-webkit-user-drag: none;
}

.ki-timeline__progress {
	position: relative;
	text-align: center;
	/* room under the dot so its 10px white halo is not clipped by the slide */
	padding-bottom: 12px;
}

.ki-timeline__year {
	display: block;
	margin-bottom: 22px;
	font-size: 20px;
	font-weight: 600;
	color: #252525;
}

/* Line through every dot; each dot carves its own gap with a white halo. */
.ki-timeline__progress::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: calc(var(--ki-timeline-dot) / 2 + 12px);
	left: 0;
	height: 1px;
	background: rgba(0, 0, 0, 0.12);
}

.ki-timeline__dot {
	position: relative;
	z-index: 1;
	display: block;
	width: var(--ki-timeline-dot);
	height: var(--ki-timeline-dot);
	margin: 0 auto;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 0 0 10px #ffffff;
}

.ki-timeline__dot small {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	margin: -5px 0 0 -5px;
	border-radius: 50%;
	background: #d4d4d4;
	transition: background-color 0.3s linear;
}

/* Focus state: the active (centre) slide. */
.ki-timeline .splide__slide.is-active .ki-timeline__img {
	transform: scale(1);
}

.ki-timeline .splide__slide.is-active .ki-timeline__photo {
	filter: grayscale(0);
}

.ki-timeline .splide__slide.is-active .ki-timeline__tooltip,
.ki-timeline .splide__slide.is-active .ki-timeline__img::before {
	opacity: 1;
}

.ki-timeline .splide__slide.is-active .ki-timeline__dot small {
	background: var(--ki-color-accent-deep, #146131);
}

/* Arrows: always visible (also on touch screens). */
.ki-timeline .splide__arrows {
	pointer-events: none;
}

.ki-timeline .ki-timeline__arrow {
	position: absolute;
	/* Vertically centred on the year row: dot + gap + half the year line. */
	bottom: calc(var(--ki-timeline-dot) + 22px + 14px - 26px + 12px);
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ki-color-accent-deep, #146131);
	color: #ffffff;
	opacity: 1;
	cursor: pointer;
	pointer-events: auto;
	transition: opacity 0.3s linear, background-color 0.3s linear;
}

.ki-timeline .ki-timeline__arrow--prev,
.ki-timeline .splide__arrow--prev {
	left: 20px;
}

.ki-timeline .splide__arrow--next {
	right: 20px;
}

.ki-timeline .splide__arrow--prev svg {
	transform: scaleX(-1);
}

.ki-timeline .ki-timeline__arrow:hover {
	background: var(--ki-color-accent, #7cb8ae);
}

.ki-timeline__slider:hover .ki-timeline__arrow,
.ki-timeline__slider:focus-within .ki-timeline__arrow {
	opacity: 1;
}

@media (max-width: 900px) {
	.ki-timeline {
		padding: 64px 0 56px;
	}

	.ki-timeline__head {
		text-align: center;
	}

	.ki-timeline__subtitle {
		margin-right: auto;
		margin-left: auto;
	}

	.ki-timeline__photo {
		height: 200px;
	}

	.ki-timeline__year {
		font-size: 16px;
	}

	.ki-timeline__name {
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ki-timeline__tooltip,
	.ki-timeline__img,
	.ki-timeline__img::before,
	.ki-timeline__photo,
	.ki-timeline__dot small,
	.ki-timeline .ki-timeline__arrow {
		transition: none;
	}
}
