/* SX-Plugin — History Timeline

   Light by default, because this site never uses a dark ground. The reference is
   dark, and the whole thing inverts by setting --sxs-canvas and the palette in
   the widget's own Palette section — no separate dark stylesheet. */

.sxs--history .sxht {
	--sxht-year: 18px;
	--sxht-panel-year: 42px;
	--sxht-rail: var(--sxs-hairline);
	--sxht-panel-bg: var(--sxs-canvas);
	--sxht-era: var(--sxs-brand-600);
}

/* -------------------------------------------------------------------- head */

.sxs--history .sxht__eyebrow {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--sxs-brand-600);
}

/* The short rule the reference sets before the label. */
.sxs--history .sxht__dash {
	display: block;
	width: 26px;
	height: 2px;
	background: currentColor;
}

.sxs--history .sxht__heading {
	margin: 0;
	font-size: clamp(30px, 4.4vw, 52px);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--sxs-ink-900);
	text-wrap: balance;
}

.sxs--history .sxht__sub {
	margin: 18px 0 0;
	max-width: 62ch;
	font-size: 16px;
	line-height: 1.65;
	color: var(--sxs-ink-700);
}

/* ------------------------------------------------------------------ legend */

.sxs--history .sxht__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 28px;
	margin: 30px 0 0;
	padding: 0;
	list-style: none;
}

.sxs--history .sxht__legend-item {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--sxs-ink-900);
}

.sxs--history .sxht__swatch {
	width: 9px;
	height: 9px;
	border-radius: 50%;
}

.sxs--history .sxht__range {
	font-weight: 600;
	color: var(--sxs-ink-600);
}

/* -------------------------------------------------------------------- rail */

.sxs--history .sxht__rail {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	margin-top: 26px;
	/* overflow-x alone makes the other axis auto as well, and the dots that
	   hang 4px below the buttons were enough to raise a stray vertical
	   scrollbar. The padding gives them room inside the box; the hairline
	   is pulled back up by the same amount so nothing moves. */
	padding-bottom: 6px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;

	/* The hairline the year markers sit on. */
	background-image: linear-gradient(var(--sxht-rail), var(--sxht-rail));
	background-size: 100% 1px;
	background-position: 0 calc(100% - 4px);
	background-repeat: no-repeat;
}

.sxs--history .sxht__year {
	position: relative;
	flex: 1 0 auto;
	min-width: 84px;
	padding: 10px 8px 22px;
	border: 0;
	background: none;
	font-family: inherit;
	font-size: var(--sxht-year);
	font-weight: 500;
	line-height: 1.2;
	color: var(--sxs-ink-600);
	text-align: center;
	cursor: pointer;
	transition: color 200ms ease;
}

.sxs--history .sxht__year:hover {
	color: var(--sxs-ink-900);
}

.sxs--history .sxht__year.is-active {
	font-weight: 700;
	color: var(--sxs-ink-900);
}

/* The active year is underscored in its own era colour. */
.sxs--history .sxht__year.is-active::after {
	content: "";
	position: absolute;
	inset-inline: 8px;
	bottom: 0;
	height: 2px;
	background: var(--sxht-era);
}

.sxs--history .sxht__year-num {
	display: block;
}

.sxs--history .sxht__year-era {
	display: block;
	margin-top: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--sxs-ink-600);
	opacity: 0;
	transition: opacity 200ms ease;
}

.sxs--history .sxht__year.is-active .sxht__year-era {
	opacity: 1;
}

/* The marker on the hairline. */
.sxs--history .sxht__dot {
	position: absolute;
	left: 50%;
	bottom: -4px;
	width: 7px;
	height: 7px;
	border: 1px solid var(--sxht-rail);
	border-radius: 50%;
	background: var(--sxs-canvas);
	transform: translateX(-50%);
	transition: background-color 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.sxs--history .sxht__year.is-active .sxht__dot {
	border-color: var(--sxht-era);
	background: var(--sxht-era);
	transform: translateX(-50%) scale(1.35);
}

.sxs--history .sxht__year:focus-visible {
	outline: 2px solid var(--sxs-brand-600);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ------------------------------------------------------------------- panel */

.sxs--history .sxht__panel {
	margin-top: 28px;
	border: 1px solid var(--sxs-hairline);
	border-top: 2px solid var(--sxht-era);
	background: var(--sxht-panel-bg);
}

.sxs--history .sxht__panel[hidden] {
	display: none;
}

.sxs--history .sxht__panel-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 12px;
	padding: 22px 28px;
	border-bottom: 1px solid var(--sxs-hairline);
}

.sxs--history .sxht__panel-year {
	font-size: var(--sxht-panel-year);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.02em;
	color: var(--sxht-era);
	font-variant-numeric: tabular-nums;
}

.sxs--history .sxht__panel-era {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--sxs-ink-600);
}

/* Pushed to the far side, as in the reference. */
.sxs--history .sxht__panel-note {
	margin-inline-start: auto;
	font-size: 14px;
	color: var(--sxs-ink-600);
}

.sxs--history .sxht__panel-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
	gap: 20px 40px;
	padding: 24px 28px 28px;
}

.sxs--history .sxht__panel-title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--sxs-ink-900);
}

.sxs--history .sxht__panel-text {
	margin: 0;
	font-size: 15px;
	line-height: 1.75;
	color: var(--sxs-ink-700);
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 768px) {
	.sxs--history .sxht__panel-body {
		grid-template-columns: minmax(0, 1fr);
		gap: 10px;
	}

	.sxs--history .sxht__panel-head,
	.sxs--history .sxht__panel-body {
		padding-inline: 18px;
	}

	.sxs--history .sxht__panel-note {
		margin-inline-start: 0;
		flex-basis: 100%;
	}

	.sxs--history .sxht__year {
		min-width: 72px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sxs--history .sxht__year,
	.sxs--history .sxht__dot,
	.sxs--history .sxht__year-era {
		transition: none;
	}
}

/* The rail scrolls horizontally; in RTL it must start from the right. */
[dir="rtl"] .sxs--history .sxht__rail {
	direction: rtl;
}
