/* ============================================================
   Interactive Cosmic Timeline
   A self-contained "observatory" module scoped to .cbt so its
   dark theme never leaks into the light WikiPress site chrome.
   ============================================================ */

.cbt {
	--cbt-bg: #0a0e1a;
	--cbt-bg-2: #111730;
	--cbt-panel: #131a30;
	--cbt-panel-2: #0e1426;
	--cbt-ink: #eef2fb;
	--cbt-muted: #9aa7c4;
	--cbt-faint: #66739a;
	--cbt-line: rgba(255, 255, 255, 0.10);
	--cbt-line-soft: rgba(255, 255, 255, 0.06);
	--cbt-accent: #6aa8ff;
	--cbt-accent-2: #9d7bff;
	--cbt-glow: rgba(106, 168, 255, 0.55);
	--cbt-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
	--cbt-ui: var(--wikipress-font-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);

	margin: 28px 0 8px;
	padding: clamp(18px, 3vw, 34px);
	background:
		radial-gradient(1200px 400px at 15% -10%, rgba(106, 168, 255, 0.10), transparent 60%),
		radial-gradient(900px 500px at 100% 0%, rgba(157, 123, 255, 0.10), transparent 55%),
		linear-gradient(180deg, var(--cbt-bg-2) 0%, var(--cbt-bg) 100%);
	border: 1px solid var(--cbt-line);
	border-radius: 16px;
	color: var(--cbt-ink);
	font-family: var(--cbt-ui);
	box-shadow: 0 30px 80px rgba(2, 6, 20, 0.45);
	overflow: hidden;
}

.cbt *,
.cbt *::before,
.cbt *::after {
	box-sizing: border-box;
}

/* ---- Live readout ---- */
.cbt-readout {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	margin-bottom: 26px;
}

.cbt-readout-item {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
	border: 1px solid var(--cbt-line-soft);
	border-radius: 10px;
	padding: 14px 16px;
	min-width: 0;
}

.cbt-readout-label {
	display: block;
	font-size: 0.72rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--cbt-faint);
	margin-bottom: 6px;
}

.cbt-readout-value {
	display: block;
	font-family: var(--cbt-mono);
	font-size: clamp(1.05rem, 2.4vw, 1.5rem);
	font-weight: 600;
	color: var(--cbt-ink);
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.cbt-readout-item--epoch .cbt-readout-value {
	font-family: var(--cbt-ui);
	color: var(--cbt-accent);
}

.cbt-readout-value sup {
	font-size: 0.62em;
}

/* ---- Track / axis / heat bar ---- */
.cbt-track-wrap {
	position: relative;
	height: 84px;
	margin: 6px 0 10px;
	padding: 0;
	border-radius: 8px;
}

.cbt-track-wrap:focus-within {
	outline: none;
}

.cbt-heatbar {
	position: absolute;
	left: 0;
	right: 0;
	top: 14px;
	height: 18px;
	border-radius: 6px;
	background: linear-gradient(90deg,
		#ffffff 0%,
		#ffe89a 6%,
		#ffb64d 15%,
		#ff7a3c 27%,
		#ef4056 42%,
		#c026a6 58%,
		#7b3ff2 72%,
		#324089 86%,
		#0a1330 100%);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* faint decade grid lines + labels injected by JS */
.cbt-axis {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	pointer-events: none;
}

.cbt-tick {
	position: absolute;
	top: 8px;
	transform: translateX(-50%);
	color: var(--cbt-faint);
}

.cbt-tick-line {
	position: absolute;
	top: 0;
	left: 50%;
	width: 1px;
	height: 30px;
	background: rgba(255, 255, 255, 0.14);
}

.cbt-tick-label {
	position: absolute;
	top: 34px;
	left: 50%;
	transform: translateX(-50%);
	font-family: var(--cbt-mono);
	font-size: 0.66rem;
	white-space: nowrap;
	color: var(--cbt-faint);
}

/* progress fill from start to the cursor */
.cbt-fill {
	position: absolute;
	left: 0;
	top: 14px;
	height: 18px;
	width: 0;
	border-radius: 6px 0 0 6px;
	background: linear-gradient(90deg, rgba(10, 14, 26, 0.0), rgba(10, 14, 26, 0.0));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
	pointer-events: none;
}

/* the moving position indicator */
.cbt-cursor {
	position: absolute;
	top: 4px;
	left: 0;
	width: 2px;
	height: 38px;
	margin-left: -1px;
	background: #fff;
	box-shadow: 0 0 10px 2px var(--cbt-glow);
	pointer-events: none;
	transition: left 0.08s linear;
	z-index: 4;
}

.cbt-cursor::before {
	content: "";
	position: absolute;
	top: -7px;
	left: 50%;
	width: 14px;
	height: 14px;
	transform: translateX(-50%);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 12px 3px var(--cbt-glow);
}

.cbt-track-wrap.is-scrubbing .cbt-cursor {
	transition: none;
}

/* markers */
.cbt-markers {
	position: absolute;
	left: 0;
	right: 0;
	top: 14px;
	height: 18px;
	pointer-events: none;
}

.cbt-marker {
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 3;
}

.cbt-marker-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: rgba(10, 14, 26, 0.85);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cbt-marker:hover .cbt-marker-dot,
.cbt-marker:focus-visible .cbt-marker-dot {
	transform: scale(1.35);
	background: #fff;
}

.cbt-marker:focus-visible {
	outline: none;
}

.cbt-marker:focus-visible .cbt-marker-dot {
	box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--cbt-glow);
}

.cbt-marker.is-active .cbt-marker-dot {
	background: var(--cbt-accent);
	box-shadow: 0 0 0 2px #fff, 0 0 14px 3px var(--cbt-glow);
	transform: scale(1.4);
}

/* the range input sits on top and is the real control */
.cbt-slider {
	position: absolute;
	left: 0;
	top: 6px;
	width: 100%;
	height: 34px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	z-index: 5;
}

.cbt-slider:focus {
	outline: none;
}

.cbt-slider::-webkit-slider-runnable-track {
	background: transparent;
	height: 34px;
}

.cbt-slider::-moz-range-track {
	background: transparent;
	height: 34px;
}

/* transparent, large hit-area thumb; the visible indicator is .cbt-cursor */
.cbt-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 26px;
	height: 34px;
	background: transparent;
	border: 0;
	cursor: grab;
}

.cbt-slider::-moz-range-thumb {
	width: 26px;
	height: 34px;
	background: transparent;
	border: 0;
	cursor: grab;
}

.cbt-slider:active::-webkit-slider-thumb {
	cursor: grabbing;
}

.cbt-track-wrap:focus-within .cbt-cursor::before {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 16px 4px var(--cbt-glow);
}

/* ---- Controls ---- */
.cbt-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 8px;
	flex-wrap: wrap;
}

.cbt-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--cbt-ui);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--cbt-ink);
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--cbt-line);
	border-radius: 8px;
	padding: 9px 16px;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.cbt-btn:hover {
	background: rgba(255, 255, 255, 0.10);
	border-color: rgba(255, 255, 255, 0.25);
}

.cbt-btn:focus-visible {
	outline: 2px solid var(--cbt-accent);
	outline-offset: 2px;
}

.cbt-btn:active {
	transform: translateY(1px);
}

.cbt-btn--play {
	background: linear-gradient(180deg, rgba(106, 168, 255, 0.22), rgba(106, 168, 255, 0.10));
	border-color: rgba(106, 168, 255, 0.45);
	color: #fff;
	min-width: 108px;
	justify-content: center;
}

.cbt-btn--play:hover {
	background: linear-gradient(180deg, rgba(106, 168, 255, 0.32), rgba(106, 168, 255, 0.16));
}

.cbt-play-icon {
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 0 6px 10px;
	border-color: transparent transparent transparent currentColor;
}

.cbt-btn--play.is-playing .cbt-play-icon {
	width: 10px;
	height: 12px;
	border: 0;
	background:
		linear-gradient(currentColor, currentColor) left / 3px 100% no-repeat,
		linear-gradient(currentColor, currentColor) right / 3px 100% no-repeat;
}

/* ---- Detail panels ---- */
.cbt-detail {
	margin-top: 26px;
	background: linear-gradient(180deg, var(--cbt-panel), var(--cbt-panel-2));
	border: 1px solid var(--cbt-line);
	border-radius: 14px;
	padding: clamp(18px, 2.6vw, 30px);
	min-height: 260px;
}

.cbt-panel[hidden] {
	display: none;
}

.cbt-panel {
	animation: cbt-fade 0.35s ease;
}

@keyframes cbt-fade {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.cbt-eyebrow {
	display: inline-block;
	font-family: var(--cbt-mono);
	font-size: 0.72rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cbt-faint);
	margin-bottom: 6px;
}

.cbt-panel-title {
	font-family: var(--cbt-ui);
	font-size: clamp(1.5rem, 3.4vw, 2.1rem);
	font-weight: 700;
	line-height: 1.15;
	margin: 0 0 6px;
	color: #fff;
	border: 0;
	padding: 0;
}

.cbt-panel-tagline {
	color: var(--cbt-muted);
	font-size: 1.02rem;
	margin: 0 0 20px;
	max-width: 60ch;
}

.cbt-panel-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 28px;
	align-items: start;
}

.cbt-panel-body p {
	font-family: var(--wikipress-font-content, Georgia, serif);
	font-size: 1.06rem;
	line-height: 1.75;
	color: #d9e0f2;
	margin: 0;
}

/* Fact box */
.cbt-factbox {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid var(--cbt-line);
	border-radius: 12px;
	padding: 18px 18px 8px;
}

.cbt-factbox-title {
	font-family: var(--cbt-ui);
	font-size: 0.78rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cbt-accent);
	margin: 0 0 12px;
	padding: 0 0 10px;
	border-bottom: 1px solid var(--cbt-line);
	text-align: center;
}

.cbt-factbox-list {
	margin: 0;
}

.cbt-fact {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2px;
	padding: 9px 0;
	border-bottom: 1px solid var(--cbt-line-soft);
}

.cbt-fact:last-child {
	border-bottom: 0;
}

.cbt-fact dt {
	font-size: 0.72rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--cbt-faint);
}

.cbt-fact dd {
	margin: 0;
	font-family: var(--cbt-mono);
	font-size: 0.9rem;
	color: var(--cbt-ink);
	line-height: 1.45;
}

/* Status badges */
.cbt-status {
	display: inline-block;
	font-family: var(--cbt-ui);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	padding: 3px 10px;
	border-radius: 999px;
	border: 1px solid transparent;
	white-space: nowrap;
}

.cbt-status--est    { color: #4ade80; background: rgba(74, 222, 128, 0.12);  border-color: rgba(74, 222, 128, 0.4); }
.cbt-status--strong { color: #38bdf8; background: rgba(56, 189, 248, 0.12);  border-color: rgba(56, 189, 248, 0.4); }
.cbt-status--active { color: #c4b5fd; background: rgba(167, 139, 250, 0.14); border-color: rgba(167, 139, 250, 0.45); }
.cbt-status--model  { color: #fbbf24; background: rgba(251, 191, 36, 0.12);  border-color: rgba(251, 191, 36, 0.4); }
.cbt-status--open   { color: #fb923c; background: rgba(251, 146, 60, 0.12);  border-color: rgba(251, 146, 60, 0.4); }
.cbt-status--spec   { color: #fb7185; background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.4); }

/* ---- Epoch selector strip ---- */
.cbt-strip {
	display: flex;
	gap: 10px;
	margin-top: 22px;
	padding-bottom: 10px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
	scrollbar-color: var(--cbt-faint) transparent;
}

.cbt-strip::-webkit-scrollbar {
	height: 8px;
}

.cbt-strip::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.16);
	border-radius: 8px;
}

.cbt-chip {
	flex: 0 0 auto;
	width: 152px;
	text-align: left;
	scroll-snap-align: start;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid var(--cbt-line);
	border-radius: 10px;
	padding: 12px 14px;
	cursor: pointer;
	color: var(--cbt-ink);
	font-family: var(--cbt-ui);
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cbt-chip:hover {
	background: rgba(255, 255, 255, 0.07);
	border-color: rgba(255, 255, 255, 0.24);
	transform: translateY(-2px);
}

.cbt-chip:focus-visible {
	outline: 2px solid var(--cbt-accent);
	outline-offset: 2px;
}

.cbt-chip.is-active {
	background: linear-gradient(180deg, rgba(106, 168, 255, 0.20), rgba(106, 168, 255, 0.06));
	border-color: rgba(106, 168, 255, 0.55);
	box-shadow: 0 0 0 1px rgba(106, 168, 255, 0.25), 0 10px 26px rgba(3, 8, 24, 0.5);
}

.cbt-chip-num {
	font-family: var(--cbt-mono);
	font-size: 0.72rem;
	color: var(--cbt-faint);
}

.cbt-chip.is-active .cbt-chip-num {
	color: var(--cbt-accent);
}

.cbt-chip-name {
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.25;
}

.cbt-chip-time {
	font-family: var(--cbt-mono);
	font-size: 0.72rem;
	color: var(--cbt-muted);
}

/* ---- Legend ---- */
.cbt-legend {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--cbt-line-soft);
}

.cbt-legend-title {
	font-size: 0.72rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--cbt-faint);
	margin-right: 4px;
}

/* ---- Intro copy above the tool ---- */
.cbt-intro {
	max-width: 72ch;
	color: var(--wikipress-text, #202122);
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
	.cbt-panel-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	.cbt-factbox {
		order: -1;
	}
}

@media (max-width: 640px) {
	.cbt-readout {
		grid-template-columns: 1fr;
		gap: 8px;
	}
	.cbt-readout-item {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 12px;
	}
	.cbt-readout-label {
		margin-bottom: 0;
	}
	.cbt-readout-value {
		text-align: right;
		font-size: 1.05rem;
	}
	.cbt-controls {
		justify-content: stretch;
	}
	.cbt-btn {
		flex: 1;
		justify-content: center;
	}
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	.cbt-cursor,
	.cbt-marker-dot,
	.cbt-chip,
	.cbt-btn,
	.cbt-panel {
		transition: none;
		animation: none;
	}
}
