/* ChronoFlow Timeline v2
 * Theme it by overriding the custom properties on .cft-wrapper, e.g.
 *   .cft-wrapper { --cft-accent: #0e9f8e; --cft-bg: transparent; }
 */

.cft-wrapper {
	--cft-accent: #0d5b7d;
	--cft-accent-hover: #20b2aa;
	--cft-line: #d7dde3;
	--cft-bg: transparent;
	--cft-card-bg: #fff;
	--cft-card-border: rgba(15, 23, 42, 0.08);
	--cft-text: #1e293b;
	--cft-muted: #64748b;
	--cft-radius: 14px;
	--cft-node-width: 220px;
	--cft-height: 460px;

	position: relative;
	width: 100%;
	background: var(--cft-bg);
}

@media (prefers-color-scheme: dark) {
	.cft-wrapper {
		--cft-line: #334155;
		--cft-card-bg: #111827;
		--cft-card-border: rgba(255, 255, 255, 0.08);
		--cft-text: #e2e8f0;
		--cft-muted: #94a3b8;
	}
}

/* Horizontal scroller, fades at the edges */
.cft-scroller {
	overflow-x: auto;
	overflow-y: hidden;
	height: var(--cft-height);
	display: flex;
	align-items: center;
	scroll-snap-type: x proximity;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
}

.cft-scroller:focus-visible {
	outline: 2px solid var(--cft-accent);
	outline-offset: 4px;
	border-radius: var(--cft-radius);
}

/* The line */
.cft-timeline {
	list-style: none;
	margin: 0;
	padding: 0 64px;
	display: flex;
	align-items: center;
	position: relative;
	height: 3px;
	min-width: max-content;
	background: linear-gradient(to right, transparent, var(--cft-line) 64px, var(--cft-line) calc(100% - 64px), transparent);
}

.cft-node {
	flex: 0 0 var(--cft-node-width);
	position: relative;
	display: flex;
	justify-content: center;
	scroll-snap-align: center;
}

.cft-node-link {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 20px;
	width: 100%;
	color: inherit;
	text-decoration: none;
}

/* Dot */
.cft-dot {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--cft-accent);
	border: 3px solid var(--cft-card-bg);
	box-shadow: 0 0 0 2px var(--cft-accent);
	position: relative;
	z-index: 2;
	transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.is-upcoming .cft-dot {
	background: var(--cft-card-bg);
	box-shadow: 0 0 0 2px var(--cft-accent), 0 0 0 6px color-mix(in srgb, var(--cft-accent) 20%, transparent);
}

.cft-node-link:hover .cft-dot,
.cft-node-link:focus-visible .cft-dot {
	background: var(--cft-accent-hover);
	box-shadow: 0 0 0 2px var(--cft-accent-hover);
	transform: scale(1.25);
}

/* Card */
.cft-content {
	position: absolute;
	width: calc(var(--cft-node-width) - 36px);
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px 10px 14px;
	text-align: center;
	background: var(--cft-card-bg);
	border: 1px solid var(--cft-card-border);
	border-radius: var(--cft-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	z-index: 10;
}

.cft-top .cft-content { bottom: 34px; }
.cft-bottom .cft-content { top: 34px; }

/* Connector stem */
.cft-content::after {
	content: "";
	position: absolute;
	left: 50%;
	width: 2px;
	height: 18px;
	background: var(--cft-line);
	transform: translateX(-50%);
}
.cft-top .cft-content::after { bottom: -19px; }
.cft-bottom .cft-content::after { top: -19px; }

.cft-node-link:hover .cft-content,
.cft-node-link:focus-visible .cft-content {
	box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08), 0 16px 40px rgba(15, 23, 42, 0.14);
}
.cft-top .cft-node-link:hover .cft-content,
.cft-top .cft-node-link:focus-visible .cft-content { transform: translateY(-4px); }
.cft-bottom .cft-node-link:hover .cft-content,
.cft-bottom .cft-node-link:focus-visible .cft-content { transform: translateY(4px); }

.cft-node-link:focus-visible { outline: none; }
.cft-node-link:focus-visible .cft-content { outline: 2px solid var(--cft-accent); outline-offset: 2px; }

.cft-img {
	width: 100%;
	aspect-ratio: 16 / 10;
	height: auto;
	object-fit: cover;
	border-radius: calc(var(--cft-radius) - 6px);
	margin-bottom: 6px;
}

.cft-date {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cft-muted);
}

.cft-badge {
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 0.65rem;
	letter-spacing: 0.04em;
	color: var(--cft-accent);
	background: color-mix(in srgb, var(--cft-accent) 12%, transparent);
}

.cft-title {
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cft-text);
}

/* Prev / next buttons (shown by JS when scrollable) */
.cft-nav {
	position: absolute;
	top: 50%;
	z-index: 20;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	border-radius: 50%;
	border: 1px solid var(--cft-card-border);
	background: var(--cft-card-bg);
	color: var(--cft-text);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.cft-nav:hover { transform: scale(1.06); }
.cft-nav:focus-visible { outline: 2px solid var(--cft-accent); outline-offset: 2px; }
.cft-nav[disabled] { opacity: 0; pointer-events: none; }
.cft-nav--prev { left: 4px; }
.cft-nav--next { right: 4px; }

@media (max-width: 600px) {
	.cft-wrapper { --cft-node-width: 180px; --cft-height: 420px; }
	.cft-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.cft-scroller { scroll-behavior: auto; }
	.cft-dot, .cft-content, .cft-nav { transition: none; }
}
