/**
 * Race Position Timelapse (#783)
 *
 * Styles for the animated SVG position chart, controls, and legend.
 */

/* ── Container ── */

.ne-timelapse {
	background: var(--ne-surface);
	border-radius: var(--ne-radius-md);
	padding: var(--ne-space-5);
	margin-bottom: var(--ne-space-5);
}

.ne-timelapse__header {
	margin-bottom: var(--ne-space-4);
}

/* ── Chart wrapper ── */

.ne-timelapse__chart-wrap {
	position: relative;
	aspect-ratio: 16 / 9;
	min-height: 300px;
}

.ne-timelapse__chart {
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}

/* ── Loading / empty / error states ── */

.ne-timelapse__loading,
.ne-timelapse__empty,
.ne-timelapse__error {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--ne-space-2);
	height: 100%;
	min-height: 200px;
	color: var(--ne-text-muted);
	font-size: var(--ne-fs-sm);
}

.ne-timelapse__loading .ne-spinner {
	width: 18px;
	height: 18px;
	border: 2px solid var(--ne-border);
	border-top-color: var(--ne-accent);
	border-radius: 50%;
	animation: ne-timelapse-spin 0.6s linear infinite;
	flex-shrink: 0;
}

@keyframes ne-timelapse-spin {
	to { transform: rotate(360deg); }
}

/* ── Controls ── */

.ne-timelapse__controls {
	display: flex;
	gap: var(--ne-space-3);
	align-items: center;
	padding: var(--ne-space-3) 0;
}

.ne-timelapse__play-btn {
	width: 36px;
	height: 36px;
	background: var(--ne-accent);
	color: white;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 14px;
	transition: opacity 0.15s;
}

.ne-timelapse__play-btn:hover {
	opacity: 0.85;
}

/* ── Speed selector ── */

.ne-timelapse__speed {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.ne-timelapse__speed-btn {
	background: var(--ne-elevated);
	color: var(--ne-text-muted);
	border: 1px solid var(--ne-border);
	border-radius: var(--ne-radius-pill);
	padding: 2px 10px;
	font-size: var(--ne-fs-sm);
	cursor: pointer;
	transition: all 0.15s;
	font-family: var(--ne-font-mono);
	line-height: 1.5;
}

.ne-timelapse__speed-btn:hover {
	color: var(--ne-text);
}

.ne-timelapse__speed-btn.is-active {
	background: var(--ne-accent-glow);
	color: var(--ne-accent);
	border-color: var(--ne-accent);
}

/* ── Scrubber ── */

.ne-timelapse__scrubber-wrap {
	display: flex;
	flex: 1;
	gap: var(--ne-space-2);
	align-items: center;
}

.ne-timelapse__scrubber {
	flex: 1;
	accent-color: var(--ne-accent);
	cursor: pointer;
}

.ne-timelapse__lap-label {
	font-family: var(--ne-font-mono);
	font-size: var(--ne-fs-sm);
	color: var(--ne-text-muted);
	white-space: nowrap;
	min-width: 100px;
}

/* ── Legend ── */

.ne-timelapse__legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ne-space-2) var(--ne-space-4);
	padding-top: var(--ne-space-3);
}

.ne-timelapse__legend-item {
	display: inline-flex;
	align-items: center;
	gap: var(--ne-space-1);
	font-size: var(--ne-fs-sm);
	color: var(--ne-text-muted);
}

.ne-timelapse__legend-swatch {
	width: 12px;
	height: 3px;
	border-radius: 1px;
	display: inline-block;
	flex-shrink: 0;
}

/* ── SVG internal styles ── */

.ne-timelapse__grid line {
	stroke: var(--ne-border);
	stroke-width: 1;
}

.ne-timelapse__y-axis text,
.ne-timelapse__x-axis text {
	fill: var(--ne-text-subtle);
	font-family: var(--ne-font-mono);
	font-size: 11px;
}

.ne-timelapse__path {
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: none;
}

.ne-timelapse__dot {
	transition: opacity 0.3s;
}

.ne-timelapse__dot.is-dnf {
	opacity: 0.3;
}

.ne-timelapse__label {
	font-family: var(--ne-font-mono);
	font-size: 10px;
	dominant-baseline: middle;
}

.ne-timelapse__dnf-marker line {
	stroke-width: 1.5;
}

/* ── Responsive: tablet ── */

@media (max-width: 768px) {
	.ne-timelapse__chart-wrap {
		aspect-ratio: 4 / 3;
	}

	.ne-timelapse__controls {
		flex-wrap: wrap;
	}

	.ne-timelapse__scrubber-wrap {
		flex-basis: 100%;
		order: 1;
	}

	.ne-timelapse__legend-item {
		font-size: 11px;
	}
}

/* ── Responsive: mobile ── */

@media (max-width: 480px) {
	.ne-timelapse {
		padding: var(--ne-space-3);
	}

	.ne-timelapse__chart-wrap {
		min-height: 240px;
	}

	.ne-timelapse__label {
		display: none;
	}

	.ne-timelapse__dot {
		r: 3;
	}

	.ne-timelapse__path {
		stroke-width: 1.5;
	}

	.ne-timelapse__lap-label {
		min-width: 80px;
		font-size: 11px;
	}
}
