/* Fuel station deployment timeline — [fe_timeline] */

.fe-tl {
	/* Logo palette: lime #cadb2b and orange #f26722. Small text uses a
	   darkened lime, since the logo lime is unreadable on white. */
	--fe-tl-orange: var(--wd-alternative-color, #f26722);
	--fe-tl-lime: #cadb2b;
	--fe-tl-lime-ink: #6b7a0f;
	--fe-tl-ink: var(--wd-link-color, #333);
	--fe-tl-muted: #777;
	--fe-tl-line: #cfd8de;
	--fe-tl-brd: #e6e9ec;
	--fe-tl-head-font: var(--wd-entities-title-font, "hkgroteskpro", Arial, Helvetica, sans-serif);
	--fe-tl-body-font: var(--wd-text-font, "Lato", Arial, Helvetica, sans-serif);

	position: relative;
	padding: 72px 0 64px;
	background-color: #fff;
	background-image: radial-gradient(rgba(51, 51, 51, .07) 1px, transparent 1px);
	background-size: 22px 22px;
	color: var(--fe-tl-ink);
	font-family: var(--fe-tl-body-font);
}

/* Maldives atoll chain, sitting behind the route it describes. The chain runs
   north-south, so it follows whichever axis the timeline is laid out on. */
.fe-tl::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-image: url(../img/maldives-atolls-vertical.png);
	background-repeat: no-repeat;
	background-position: 78% center;
	background-size: auto 76%;
	opacity: .16;
	pointer-events: none;
}

/* No horizontal padding: the section is dropped inside a page container that
   already supplies the gutter, so padding here would inset the route relative
   to everything else on the page. */
.fe-tl__inner {
	position: relative;
	z-index: 1;
	max-width: var(--wd-container-width, 1222px);
	margin: 0 auto;
}

/* ---------- Heading ---------- */

.fe-tl__eyebrow {
	margin: 0 0 10px;
	color: var(--fe-tl-orange);
	font-family: var(--fe-tl-head-font);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .18em;
	text-transform: uppercase;
}

.fe-tl__title {
	margin: 0 0 14px;
	color: var(--fe-tl-ink);
	font-family: var(--fe-tl-head-font);
	font-size: clamp(28px, 4.6vw, 44px);
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -.01em;
	text-transform: uppercase;
}

.fe-tl__subtitle {
	max-width: 42ch;
	margin: 0;
	color: var(--fe-tl-muted);
	font-size: 16px;
	line-height: 1.55;
}

/* ---------- Shared station pieces ---------- */

.fe-tl__stations {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fe-tl__name {
	display: block;
	color: var(--fe-tl-ink);
	font-family: var(--fe-tl-head-font);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.28;
	letter-spacing: .03em;
	text-transform: uppercase;
}

.fe-tl__status {
	display: block;
	margin-top: 5px;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.fe-tl__station--completed .fe-tl__status { color: var(--fe-tl-lime-ink); }
.fe-tl__station--progress .fe-tl__status { color: var(--fe-tl-orange); }
.fe-tl__station--upcoming .fe-tl__status { color: var(--fe-tl-muted); }

.fe-tl__date {
	display: block;
	margin-top: 6px;
	color: var(--fe-tl-muted);
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
	letter-spacing: .06em;
	text-transform: uppercase;
	white-space: nowrap;
}

.fe-tl__pin svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.fe-tl__pin path { fill: var(--fe-tl-line); }
.fe-tl__pin circle { fill: #fff; }

.fe-tl__station--completed .fe-tl__pin path { fill: var(--fe-tl-lime); }
.fe-tl__station--progress .fe-tl__pin path { fill: var(--fe-tl-orange); }

/* Pulse marks the station currently being built. */
.fe-tl__station--progress .fe-tl__pin::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 34%;
	width: 26px;
	height: 26px;
	margin: -13px 0 0 -13px;
	border: 2px solid var(--fe-tl-orange);
	border-radius: 50%;
	opacity: 0;
	animation: fe-tl-pulse 2.4s ease-out infinite;
}

@keyframes fe-tl-pulse {
	0%   { transform: scale(.5); opacity: .7; }
	70%  { transform: scale(1.6); opacity: 0; }
	100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- Mobile: vertical route ---------- */

.fe-tl__route { display: none; }

.fe-tl__viz { position: relative; margin: 40px 0 0; }

.fe-tl__stations {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 22px;
	padding-left: 42px;
}

.fe-tl__stations::before {
	content: "";
	position: absolute;
	left: 12px;
	top: 10px;
	bottom: 10px;
	border-left: 2px dotted var(--fe-tl-line);
}

/* The date sits outside the card so the desktop layout can drop it below the
   route, so on mobile the box is drawn by the station instead.

   margin:0 because the theme gives every li a bottom margin. On desktop the
   station is absolute with both top and bottom pinned, so that margin would
   shrink the box and pull the pins off the route. */
.fe-tl__station {
	position: relative;
	margin: 0;
	background: #fff;
	border: 1px solid var(--fe-tl-brd);
	padding: 11px 13px;
}

.fe-tl__pin {
	position: absolute;
	left: -42px;
	top: 2px;
	width: 25px;
	height: 33px;
}

.fe-tl__stem { display: none; }

/* ---------- Desktop: horizontal route ---------- */

/* Breakpoint sits above the route's 1120px minimum, so tablets get the
   vertical layout instead of a cramped horizontal scroll. */
@media (min-width: 1200px) {
	/* The chain moves onto the viz so it shares the route's coordinate space:
	   spanning the pin range and centred on the route rather than on the
	   section, so the pins read as sitting on the atolls they name. */
	.fe-tl::before { display: none; }

	.fe-tl__viz::before {
		content: "";
		position: absolute;
		left: var(--fe-tl-inset);
		top: 50%;
		z-index: -1;
		width: calc(100% - 2 * var(--fe-tl-inset));
		aspect-ratio: 812 / 175;
		/* -52.5% rather than -50%: the chain's landmass sits below the middle of
		   its own bounding box, so centring the box leaves the route riding high. */
		transform: translateY(-52.5%);
		background: url(../img/maldives-atolls.png) center / 100% 100% no-repeat;
		opacity: .16;
		pointer-events: none;
	}

	.fe-tl {
		--fe-tl-stem: 46px;
		--fe-tl-card-h: 72px;
		--fe-tl-card-w: 124px;
		--fe-tl-date-gap: 30px;
	}

	/* overflow-y can't be visible once overflow-x is auto, so the cards hanging
	   off the route are clipped unless the viz margins reserve room for them. */
	.fe-tl__scroll {
		overflow-x: auto;
		overflow-y: hidden;
		scrollbar-width: thin;
	}

	.fe-tl__viz {
		position: relative;
		height: 120px;
		min-width: 1120px;
		margin: calc(var(--fe-tl-card-h) + var(--fe-tl-stem) + 40px) 0
			calc(var(--fe-tl-date-gap) + 56px);
	}

	.fe-tl__route {
		display: block;
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
	}

	/* No non-scaling-stroke: it evaluates dashes in screen space, which
	   breaks the pathLength="100" mapping the progress fill relies on. */
	.fe-tl__route-base,
	.fe-tl__route-fill {
		fill: none;
		stroke-linecap: round;
	}

	.fe-tl__route-base {
		stroke: var(--fe-tl-line);
		stroke-width: 2;
		stroke-dasharray: .7 1.5;
	}

	.fe-tl__route-fill {
		stroke: var(--fe-tl-orange);
		stroke-width: 2.5;
		stroke-dasharray: var(--fe-tl-progress) 100;
		stroke-dashoffset: 0;
		transition: stroke-dashoffset 1.7s cubic-bezier(.33, 1, .68, 1);
	}

	.fe-tl--animated:not(.is-visible) .fe-tl__route-fill {
		stroke-dashoffset: var(--fe-tl-progress);
	}

	.fe-tl__stations {
		position: absolute;
		inset: 0;
		display: block;
		gap: 0;
		padding: 0;
	}

	.fe-tl__stations::before { display: none; }

	/* Station spans the full route height so cards align on fixed rows
	   above and below it, while the pin rides the curve. */
	.fe-tl__station {
		position: absolute;
		left: var(--fe-tl-x);
		top: 0;
		bottom: 0;
		width: 0;
		padding: 0;
		background: none;
		border: 0;
		transition: opacity .5s ease, transform .5s ease;
		transition-delay: calc(var(--fe-tl-i) * 80ms + 260ms);
	}

	.fe-tl__name { font-size: 11.5px; letter-spacing: .02em; }

	.fe-tl--animated:not(.is-visible) .fe-tl__station {
		opacity: 0;
		transform: translateY(12px);
	}

	/* Cards all sit on one row above the route, so a name that wraps to a second
	   line would push that card taller than the rest. Reserving two lines' worth
	   of height and centring keeps the row square. */
	.fe-tl__card {
		position: absolute;
		left: 0;
		bottom: calc(100% + var(--fe-tl-stem));
		display: flex;
		flex-direction: column;
		justify-content: center;
		width: var(--fe-tl-card-w);
		min-height: var(--fe-tl-card-h);
		margin-left: calc(var(--fe-tl-card-w) / -2);
		padding: 10px;
		background: #fff;
		border: 1px solid var(--fe-tl-brd);
		text-align: center;
		transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
	}

	.fe-tl__station--progress .fe-tl__card {
		border-color: var(--fe-tl-orange);
		box-shadow: 0 6px 20px rgba(242, 103, 34, .16);
	}

	/* Dates leave the card and line up in a straight row under the route, so the
	   undulating pin heights don't make the row look ragged. */
	.fe-tl__date {
		position: absolute;
		left: 0;
		top: calc(100% + var(--fe-tl-date-gap));
		width: var(--fe-tl-card-w);
		margin: 0 0 0 calc(var(--fe-tl-card-w) / -2);
		text-align: center;
	}

	.fe-tl__stem {
		display: block;
		position: absolute;
		left: -1px;
		width: 0;
		top: calc(-1 * var(--fe-tl-stem));
		bottom: calc(100% - var(--fe-tl-y) + 34px);
		border-left: 2px dotted var(--fe-tl-line);
	}

	/* Pin tip meets the curve exactly at --fe-tl-y. */
	.fe-tl__pin {
		position: absolute;
		left: -13px;
		top: var(--fe-tl-y);
		width: 26px;
		height: 34px;
		margin-top: -34px;
		transition: transform .25s ease;
		transform-origin: 50% 100%;
	}

	.fe-tl__station:hover .fe-tl__pin { transform: scale(1.14); }

	.fe-tl__station:hover .fe-tl__card {
		border-color: var(--fe-tl-orange);
		transform: translateY(-3px);
		box-shadow: 0 8px 22px rgba(51, 51, 51, .1);
	}
}

/* ---------- Legend ---------- */

.fe-tl__legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 14px 34px;
	margin: 0;
	padding: 22px 0 0;
	border-top: 1px solid var(--fe-tl-brd);
	list-style: none;
}

/* margin:0 because the theme drops the bottom margin on the last li only, which
   would stretch it taller than its siblings and push its content off the row. */
.fe-tl__legend-item {
	display: flex;
	align-items: center;
	margin: 0;
	color: var(--fe-tl-muted);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.fe-tl__legend-pin {
	width: 12px;
	height: 16px;
	margin-right: 9px;
}

.fe-tl__legend-pin svg {
	display: block;
	width: 100%;
	height: 100%;
}

.fe-tl__legend-pin path { fill: var(--fe-tl-line); }
.fe-tl__legend-pin circle { fill: #fff; }

.fe-tl__legend-item--completed .fe-tl__legend-pin path { fill: var(--fe-tl-lime); }
.fe-tl__legend-item--progress .fe-tl__legend-pin path { fill: var(--fe-tl-orange); }

@media (prefers-reduced-motion: reduce) {
	.fe-tl .fe-tl__route-fill,
	.fe-tl--animated:not(.is-visible) .fe-tl__route-fill {
		transition: none;
		stroke-dashoffset: 0;
	}

	.fe-tl .fe-tl__station,
	.fe-tl--animated:not(.is-visible) .fe-tl__station {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.fe-tl__station--progress .fe-tl__pin::after { animation: none; }
}
