/**
 * SRD Milestone — front end.
 *
 * One markup for every design (see SRDM_Renderer); the modifier class decides
 * where each part sits.
 *
 * TOKENS, in three layers:
 *
 *   --srdm-line-bg …       the setting, written inline only when it is set
 *   --srdm-d-line-bg …     this design's default, overridable per modifier
 *   --srdm-c-line-bg …     what rules use: the setting, else the default
 *
 * The middle layer exists because designs disagree on defaults (Photo cards
 * draws white years on the dot colour; Minimal uses the text colour) and a
 * timeline nobody styled must still look right in each. Custom properties
 * resolve on the element they are declared on, so the modifier class on the
 * same wrapper can change a --srdm-d-* and every --srdm-c-* follows.
 *
 * Fonts and body text colour come from the theme.
 */

.srdm-timeline {
	/* Settings with one default for every design. */
	--srdm-max-width: 1100px;
	--srdm-item-width: 300px;
	--srdm-card-radius: 8px;
	--srdm-image-ratio: 16 / 9;

	/* Design defaults. */
	--srdm-d-line-bg: #dcdcde;
	--srdm-d-dot-bg: #2271b1;
	--srdm-d-year-color: #2271b1;
	--srdm-d-year-bg: transparent;
	--srdm-d-year-font-size: 1.5rem;
	--srdm-d-card-bg: #f6f7f7;
	--srdm-d-card-color: #1d2327;
	--srdm-d-card-border-width: 0px;
	--srdm-d-card-border-style: solid;
	--srdm-d-card-border-color: var( --srdm-c-line-bg );

	/* Resolved. */
	--srdm-c-line-bg: var( --srdm-line-bg, var( --srdm-d-line-bg ) );
	--srdm-c-dot-bg: var( --srdm-dot-bg, var( --srdm-d-dot-bg ) );
	--srdm-c-year-color: var( --srdm-year-color, var( --srdm-d-year-color ) );
	--srdm-c-year-bg: var( --srdm-year-bg, var( --srdm-d-year-bg ) );
	--srdm-c-year-font-size: var( --srdm-year-font-size, var( --srdm-d-year-font-size ) );
	--srdm-c-card-bg: var( --srdm-card-bg, var( --srdm-d-card-bg ) );
	--srdm-c-card-color: var( --srdm-card-color, var( --srdm-d-card-color ) );
	--srdm-c-card-border-width: var( --srdm-card-border-width, var( --srdm-d-card-border-width ) );
	--srdm-c-card-border-style: var( --srdm-card-border-style, var( --srdm-d-card-border-style ) );
	--srdm-c-card-border-color: var( --srdm-card-border-color, var( --srdm-d-card-border-color ) );

	/* Internal geometry: not settings. */
	--srdm-line-width: 3px;
	--srdm-dot-size: 14px;
	--srdm-rail: 2rem;
	--srdm-gap: 2.5rem;
	--srdm-pad: 1.25rem;
	/* Where the dot sits, from the item's top: half of the year's 1.2 line. */
	--srdm-dot-top: calc( var( --srdm-c-year-font-size ) * 0.6 );

	box-sizing: border-box;
	max-width: var( --srdm-max-width );
	margin-inline: auto;
}

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

.srdm-timeline .srdm-timeline__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.srdm-timeline .srdm-timeline__item {
	/* Stagger moves an item's content (and its dot) down by this much. */
	--srdm-shift: 0px;
	--srdm-dot-y: calc( var( --srdm-dot-top ) + var( --srdm-shift ) );

	position: relative;
	margin: 0;
	padding: 0;
}

/* ==== Parts =============================================================== */

.srdm-timeline__marker {
	grid-area: marker;
	position: relative;
}

/* ::before is the line; ::after is the scroll fill laid over it. */
.srdm-timeline__marker::before,
.srdm-timeline__marker::after {
	content: "";
	position: absolute;
}

.srdm-timeline__marker::before {
	background: var( --srdm-c-line-bg );
}

.srdm-timeline__marker::after {
	display: none;
	background: var( --srdm-c-dot-bg );
	transform-origin: top;
	transform: scaleY( var( --srdm-fill, 0 ) );
}

.srdm-timeline__dot {
	position: absolute;
	z-index: 1;
	width: var( --srdm-dot-size );
	height: var( --srdm-dot-size );
	border-radius: 50%;
	background: var( --srdm-c-dot-bg );
	box-shadow: 0 0 0 4px color-mix( in srgb, var( --srdm-c-dot-bg ) 20%, transparent );
	transition: background-color 0.3s ease, width 0.2s ease, height 0.2s ease;
}

.srdm-timeline .srdm-timeline__year {
	grid-area: year;
	margin: 0;
	font-size: var( --srdm-c-year-font-size );
	font-weight: 700;
	line-height: 1.2;
	color: var( --srdm-c-year-color );
	overflow-wrap: anywhere;
}

.srdm-timeline__card {
	grid-area: card;
	overflow: hidden;
	padding: var( --srdm-pad );
	border: var( --srdm-c-card-border-width ) var( --srdm-c-card-border-style ) var( --srdm-c-card-border-color );
	border-radius: var( --srdm-card-radius );
	color: var( --srdm-c-card-color );
	background: var( --srdm-c-card-bg );
}

.srdm-timeline .srdm-timeline__media {
	margin: calc( var( --srdm-pad ) * -1 ) calc( var( --srdm-pad ) * -1 ) var( --srdm-pad );
	padding: 0;
}

.srdm-timeline .srdm-timeline__image {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	aspect-ratio: var( --srdm-image-ratio );
	object-fit: cover;
	margin: 0;
	border-radius: 0;
}

/* ---- Activities ------------------------------------------------------------
 * A card holds one or more activities. The first one's image bleeds to the
 * card's edges as before; each later activity is set off by a rule, and its
 * image sits inside the padding with rounded corners. */

.srdm-timeline .srdm-timeline__activity + .srdm-timeline__activity {
	margin-top: var( --srdm-pad );
	border-top: 1px solid color-mix( in srgb, currentColor 15%, transparent );
}

.srdm-timeline .srdm-timeline__activity + .srdm-timeline__activity .srdm-timeline__media {
	margin: 0 0 var( --srdm-pad );
}

.srdm-timeline .srdm-timeline__activity + .srdm-timeline__activity .srdm-timeline__image {
	border-radius: calc( var( --srdm-card-radius ) / 2 );
}

/* ---- Image Max Width ---------------------------------------------------------
 * A single image only (.has-image-width is written when the setting is set):
 * it can't bleed to the card's edges once it is narrower than the card, so it
 * sits inside the padding, left-aligned, with rounded corners. Galleries
 * ignore it. Photo cards uses the setting as its image column instead (below). */

.srdm-timeline.has-image-width .srdm-timeline__media:not( .is-gallery ) {
	max-width: var( --srdm-image-max-width );
	margin: 0 0 var( --srdm-pad );
}

.srdm-timeline.has-image-width .srdm-timeline__media:not( .is-gallery ) .srdm-timeline__image {
	border-radius: calc( var( --srdm-card-radius ) / 2 );
}

/* Image Alignment: left is the rule above. Physical sides, as the control
   says Left / Right. Photo cards' image column (600px+) is a grid cell, and
   its own margin rule comes later at equal weight, so this doesn't move it. */
.srdm-timeline.has-image-width.is-image-center .srdm-timeline__media:not( .is-gallery ) {
	margin-left: auto;
	margin-right: auto;
}

.srdm-timeline.has-image-width.is-image-right .srdm-timeline__media:not( .is-gallery ) {
	margin-left: auto;
	margin-right: 0;
}

/* ---- Gallery ----------------------------------------------------------------
 * Every image is a link into the lightbox. Two or more visible images are
 * equal tiles: --srdm-gallery-cols is written per gallery by the renderer
 * (always Gallery Visible Images, so fewer images leave empty columns and
 * every gallery has the same tile size). Gap is Gallery Gap. */

.srdm-timeline .srdm-timeline__shot {
	position: relative;
	display: block;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
}

/* A theme's a { display: … } must not reveal the links behind "+N". */
.srdm-timeline .srdm-timeline__shot[hidden] {
	display: none;
}

.srdm-timeline .srdm-timeline__shot:focus-visible {
	outline: 3px solid var( --srdm-c-dot-bg );
	outline-offset: -3px;
}

.srdm-timeline .srdm-timeline__media.is-gallery {
	display: grid;
	grid-template-columns: repeat( var( --srdm-gallery-cols, 3 ), minmax( 0, 1fr ) );
	gap: var( --srdm-gallery-gap, 4px );
}

/* Gallery tiles are square whatever Image Aspect Ratio says; that setting
   is for a single image, which keeps its own shape. */
.srdm-timeline .is-gallery .srdm-timeline__image {
	aspect-ratio: 1 / 1;
}

/* "+N" on the last visible tile. */
.srdm-timeline .srdm-timeline__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	/* px, not rem: a theme that sets the root font size to 62.5% shrank 1.5rem to 15px. */
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	color: #ffffff;
	background: rgba( 0, 0, 0, 0.5 );
	transition: background-color 0.2s ease;
}

.srdm-timeline .srdm-timeline__shot:hover .srdm-timeline__more,
.srdm-timeline .srdm-timeline__shot:focus-visible .srdm-timeline__more {
	background: rgba( 0, 0, 0, 0.62 );
}

.srdm-timeline .srdm-timeline__title {
	margin: 0 0 0.5rem;
	font-size: 1.125rem;
	line-height: 1.3;
	color: inherit;
}

.srdm-timeline .srdm-timeline__text {
	font-size: 0.975rem;
	line-height: 1.6;
}

.srdm-timeline .srdm-timeline__text p {
	margin: 0 0 0.75em;
}

.srdm-timeline .srdm-timeline__text > :last-child {
	margin-bottom: 0;
}

/* ==== Left-rail family ======================================================
 * Vertical single-side, Photo cards, Minimal, Collapsible, Vertical
 * alternating below 768px and Column grid below 600px (each re-laid out
 * further down).
 */

.srdm-timeline--vertical-single .srdm-timeline__item,
.srdm-timeline--vertical-alternating .srdm-timeline__item,
.srdm-timeline--photo .srdm-timeline__item,
.srdm-timeline--minimal .srdm-timeline__item,
.srdm-timeline--collapsible .srdm-timeline__item,
.srdm-timeline--columns .srdm-timeline__item {
	display: grid;
	grid-template-columns: var( --srdm-rail ) minmax( 0, 1fr );
	grid-template-areas:
		"marker year"
		"marker card";
	column-gap: 1rem;
	row-gap: 0.75rem;
	/* Spacing is padding, not gap, so each marker's line meets the next. */
	padding-bottom: var( --srdm-gap );
}

.srdm-timeline--vertical-single .srdm-timeline__item:last-child,
.srdm-timeline--vertical-alternating .srdm-timeline__item:last-child,
.srdm-timeline--photo .srdm-timeline__item:last-child,
.srdm-timeline--minimal .srdm-timeline__item:last-child,
.srdm-timeline--collapsible .srdm-timeline__item:last-child,
.srdm-timeline--columns .srdm-timeline__item:last-child {
	padding-bottom: 0;
}

.srdm-timeline--vertical-single .srdm-timeline__marker::before,
.srdm-timeline--vertical-single .srdm-timeline__marker::after,
.srdm-timeline--vertical-alternating .srdm-timeline__marker::before,
.srdm-timeline--vertical-alternating .srdm-timeline__marker::after,
.srdm-timeline--photo .srdm-timeline__marker::before,
.srdm-timeline--photo .srdm-timeline__marker::after,
.srdm-timeline--minimal .srdm-timeline__marker::before,
.srdm-timeline--minimal .srdm-timeline__marker::after,
.srdm-timeline--collapsible .srdm-timeline__marker::before,
.srdm-timeline--collapsible .srdm-timeline__marker::after,
.srdm-timeline--columns .srdm-timeline__marker::before,
.srdm-timeline--columns .srdm-timeline__marker::after {
	top: 0;
	bottom: calc( var( --srdm-gap ) * -1 );
	left: 50%;
	width: var( --srdm-line-width );
	margin-left: calc( var( --srdm-line-width ) / -2 );
}

/* The line starts at the first dot and stops at the last. */
.srdm-timeline--vertical-single .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--vertical-single .srdm-timeline__item:first-child .srdm-timeline__marker::after,
.srdm-timeline--vertical-alternating .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--vertical-alternating .srdm-timeline__item:first-child .srdm-timeline__marker::after,
.srdm-timeline--photo .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--photo .srdm-timeline__item:first-child .srdm-timeline__marker::after,
.srdm-timeline--minimal .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--minimal .srdm-timeline__item:first-child .srdm-timeline__marker::after,
.srdm-timeline--collapsible .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--collapsible .srdm-timeline__item:first-child .srdm-timeline__marker::after,
.srdm-timeline--columns .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--columns .srdm-timeline__item:first-child .srdm-timeline__marker::after {
	top: var( --srdm-dot-y );
}

.srdm-timeline--vertical-single .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--vertical-single .srdm-timeline__item:last-child .srdm-timeline__marker::after,
.srdm-timeline--vertical-alternating .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--vertical-alternating .srdm-timeline__item:last-child .srdm-timeline__marker::after,
.srdm-timeline--photo .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--photo .srdm-timeline__item:last-child .srdm-timeline__marker::after,
.srdm-timeline--minimal .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--minimal .srdm-timeline__item:last-child .srdm-timeline__marker::after,
.srdm-timeline--collapsible .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--collapsible .srdm-timeline__item:last-child .srdm-timeline__marker::after,
.srdm-timeline--columns .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--columns .srdm-timeline__item:last-child .srdm-timeline__marker::after {
	bottom: auto;
	height: var( --srdm-dot-y );
}

.srdm-timeline .srdm-timeline__item:only-child .srdm-timeline__marker::before,
.srdm-timeline .srdm-timeline__item:only-child .srdm-timeline__marker::after {
	display: none;
}

.srdm-timeline--vertical-single .srdm-timeline__dot,
.srdm-timeline--vertical-alternating .srdm-timeline__dot,
.srdm-timeline--collapsible .srdm-timeline__dot,
.srdm-timeline--columns .srdm-timeline__dot {
	top: var( --srdm-dot-y );
	left: 50%;
	transform: translate( -50%, -50% );
}

/* ==== Vertical alternating: two sides from 768px ========================= */

@media ( min-width: 768px ) {
	.srdm-timeline--vertical-alternating .srdm-timeline__item {
		grid-template-columns: minmax( 0, 1fr ) var( --srdm-rail ) minmax( 0, 1fr );
		grid-template-areas: "card marker year";
		column-gap: 1.5rem;
		align-items: start;
	}

	.srdm-timeline--vertical-alternating .srdm-timeline__item:nth-child( even ) {
		grid-template-areas: "year marker card";
	}

	.srdm-timeline--vertical-alternating .srdm-timeline__item:nth-child( even ) .srdm-timeline__year {
		text-align: end;
	}

	/* Stagger Sides: every second milestone, with its dot, sits lower. */
	.srdm-timeline--vertical-alternating.is-staggered .srdm-timeline__item:nth-child( even ) {
		--srdm-shift: 3.5rem;
	}

	.srdm-timeline--vertical-alternating .srdm-timeline__year,
	.srdm-timeline--vertical-alternating .srdm-timeline__card {
		margin-top: var( --srdm-shift );
	}
}

/* ==== Photo cards ========================================================= */

.srdm-timeline--photo {
	--srdm-d-year-font-size: 1rem;
	--srdm-d-year-color: #ffffff;
	--srdm-d-year-bg: var( --srdm-c-dot-bg );
	--srdm-rail: 5.5rem;
	/* Badge centre: half a 1.2 line plus the badge's top padding. */
	--srdm-dot-top: calc( var( --srdm-c-year-font-size ) * 0.95 );
}

/* The badge is the marker: year and line share the rail column. */
.srdm-timeline--photo .srdm-timeline__item {
	grid-template-areas: "rail card";
	align-items: start;
}

.srdm-timeline--photo .srdm-timeline__marker {
	grid-area: rail;
	align-self: stretch;
}

.srdm-timeline--photo .srdm-timeline__marker::before {
	background: repeating-linear-gradient( to bottom, var( --srdm-c-line-bg ) 0 6px, transparent 6px 12px );
}

.srdm-timeline--photo .srdm-timeline__dot {
	display: none;
}

.srdm-timeline--photo .srdm-timeline__year,
.srdm-timeline--centered .srdm-timeline__year {
	position: relative;
	z-index: 1;
	min-width: 3.5em;
	padding: 0.35em 0.9em;
	border-radius: 999px;
	text-align: center;
	background: var( --srdm-c-year-bg );
}

.srdm-timeline--photo .srdm-timeline__year {
	grid-area: rail;
	justify-self: center;
	max-width: 100%;
}

/* The photo beside the text, per activity. A gallery is too narrow for the
   220px column, so an activity with several tiles keeps them on top. Only a
   card's sole activity bleeds to the edges; with several, each photo sits
   inside the padding so it doesn't run over the rule between them. */
@media ( min-width: 600px ) {
	.srdm-timeline--photo .srdm-timeline__activity.has-media:not( .has-gallery ) {
		display: grid;
		/* Image Max Width sets the image column; 220px when it is blank. */
		grid-template-columns: var( --srdm-image-max-width, 220px ) minmax( 0, 1fr );
		grid-template-rows: auto 1fr;
		column-gap: var( --srdm-pad );
		align-items: start;
	}

	.srdm-timeline--photo .srdm-timeline__activity.has-media:not( .has-gallery ) .srdm-timeline__media {
		grid-row: 1 / 3;
		align-self: stretch;
		margin: 0;
	}

	.srdm-timeline--photo .srdm-timeline__activity.has-media:only-child:not( .has-gallery ) .srdm-timeline__media {
		margin: calc( var( --srdm-pad ) * -1 ) 0 calc( var( --srdm-pad ) * -1 ) calc( var( --srdm-pad ) * -1 );
	}

	.srdm-timeline--photo .srdm-timeline__activity.has-media:not( :only-child ):not( .has-gallery ) .srdm-timeline__image {
		border-radius: calc( var( --srdm-card-radius ) / 2 );
	}

	.srdm-timeline--photo .srdm-timeline__activity.has-media:not( .has-gallery ) .srdm-timeline__shot,
	.srdm-timeline--photo .srdm-timeline__activity.has-media:not( .has-gallery ) .srdm-timeline__image {
		height: 100%;
		min-height: 160px;
	}
}

/* ==== Minimal text-only =================================================== */

.srdm-timeline--minimal {
	--srdm-d-line-bg: currentColor;
	--srdm-d-dot-bg: currentColor;
	--srdm-d-year-color: currentColor;
	--srdm-d-year-font-size: 1rem;
	--srdm-d-card-bg: transparent;
	/* color: currentColor is color: inherit — the theme's text colour. */
	--srdm-d-card-color: currentColor;
	--srdm-line-width: 1px;
	--srdm-rail: 1rem;
	--srdm-pad: 0;
	--srdm-gap: 2rem;
}

.srdm-timeline--minimal .srdm-timeline__marker::before {
	opacity: 0.6;
}

/* The dot is a tick off the rule. */
.srdm-timeline--minimal .srdm-timeline__dot {
	top: var( --srdm-dot-y );
	left: 50%;
	width: 12px;
	height: 1px;
	border-radius: 0;
	box-shadow: none;
	transform: translateY( -50% );
}

.srdm-timeline--minimal .srdm-timeline__year {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

.srdm-timeline--minimal .srdm-timeline__card {
	overflow: visible;
	border-radius: 0;
}

@media ( min-width: 600px ) {
	.srdm-timeline--minimal .srdm-timeline__item {
		grid-template-columns: var( --srdm-rail ) 9rem minmax( 0, 1fr );
		grid-template-areas: "marker year card";
		column-gap: 1.25rem;
	}
}

/* ==== Collapsible ========================================================= */

/* Compact rows on a left line. Each card is a <details> (see SRDM_Renderer):
   the summary holds the year and title, the body the image and text. A row's
   ring fills while it is open. The year lives inside the card here, so the
   item grid has no year area.

   Geometry is in px, not rem: a theme that sets html { font-size: 62.5% }
   would otherwise shrink the rail and the row height under the fixed-size
   dot, pushing the cards over the markers and the line out of sight. */
.srdm-timeline--collapsible {
	--srdm-max-width: 540px;
	--srdm-card-radius: 12px;
	--srdm-d-line-bg: #d9d4e8;
	--srdm-d-dot-bg: #6d4bd8;
	--srdm-d-year-color: #1d1b26;
	--srdm-d-year-font-size: 15px;
	--srdm-d-card-bg: #ffffff;
	--srdm-d-card-color: #3e3a4f;
	--srdm-d-card-border-width: 1px;
	--srdm-d-card-border-color: color-mix( in srgb, var( --srdm-c-line-bg ) 75%, #ffffff );
	--srdm-line-width: 2px;
	--srdm-dot-size: 16px;
	--srdm-rail: 20px;
	--srdm-gap: 10px;
	--srdm-pad: 14px;
	/* The summary row's height. The dot centres on it, inside the card border. */
	--srdm-head: 46px;
	--srdm-dot-top: calc( var( --srdm-head ) / 2 + var( --srdm-c-card-border-width ) );
}

.srdm-timeline--collapsible .srdm-timeline__item {
	grid-template-columns: var( --srdm-rail ) minmax( 0, 1fr );
	grid-template-areas: "marker card";
	column-gap: 14px;
	row-gap: 0;
}

/* A ring while closed, filled while open (or when there is nothing to open).
   The ring is a border, so the line never shows through it. */
.srdm-timeline--collapsible .srdm-timeline__dot {
	border: 3px solid var( --srdm-c-dot-bg );
	background: var( --srdm-c-card-bg );
	box-shadow: none;
}

.srdm-timeline--collapsible .srdm-timeline__item:has( > details[open] ) .srdm-timeline__dot,
.srdm-timeline--collapsible .srdm-timeline__item:has( > .is-static ) .srdm-timeline__dot {
	background: var( --srdm-c-dot-bg );
}

.srdm-timeline--collapsible .srdm-timeline__card {
	margin: 0;
	padding: 0;
}

.srdm-timeline--collapsible .srdm-timeline__summary {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	min-height: var( --srdm-head );
	margin: 0;
	padding: 10px var( --srdm-pad );
	list-style: none;
}

.srdm-timeline--collapsible summary.srdm-timeline__summary {
	padding-inline-end: 44px;
	cursor: pointer;
}

/* Hide the native triangle. Two rules: a browser that doesn't know one of
   these pseudo-elements would drop a combined rule. */
.srdm-timeline--collapsible .srdm-timeline__summary::-webkit-details-marker {
	display: none;
}

.srdm-timeline--collapsible .srdm-timeline__summary::marker {
	content: "";
}

/* The chevron: down while closed, up while open. On the first line, so a
   title that wraps doesn't move it. */
.srdm-timeline--collapsible summary.srdm-timeline__summary::after {
	content: "";
	position: absolute;
	top: calc( var( --srdm-head ) / 2 );
	inset-inline-end: 18px;
	width: 8px;
	height: 8px;
	border: solid color-mix( in srgb, var( --srdm-c-dot-bg ) 70%, #000000 );
	border-width: 0 2px 2px 0;
	transform: translateY( -75% ) rotate( 45deg );
}

.srdm-timeline--collapsible details[open] > summary.srdm-timeline__summary::after {
	transform: translateY( -25% ) rotate( 225deg );
}

/* Outside the card, as in the reference; the card stops clipping for it. */
.srdm-timeline--collapsible details.srdm-timeline__card {
	overflow: visible;
}

.srdm-timeline--collapsible summary.srdm-timeline__summary:focus-visible {
	outline: 3px solid var( --srdm-c-dot-bg );
	outline-offset: 2px;
	border-radius: var( --srdm-card-radius );
}

.srdm-timeline--collapsible .srdm-timeline__year {
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
	font-variant-numeric: tabular-nums;
}

/* The title reads as a caption to the year, like the reference's date. */
.srdm-timeline--collapsible .srdm-timeline__title {
	margin: 0;
	font-size: 13.5px;
	font-weight: 400;
	line-height: 1.35;
	color: color-mix( in srgb, var( --srdm-c-card-color ) 80%, transparent );
}

/* Later activities' titles, in the open body, read as headings. */
.srdm-timeline--collapsible .srdm-timeline__body .srdm-timeline__title {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 600;
	color: var( --srdm-c-card-color );
}

.srdm-timeline--collapsible .srdm-timeline__body {
	padding: 12px var( --srdm-pad ) 12px;
}

.srdm-timeline--collapsible .srdm-timeline__media {
	margin: 0 0 10px;
}

.srdm-timeline--collapsible .srdm-timeline__media:last-child {
	margin-bottom: 0;
}

.srdm-timeline--collapsible .srdm-timeline__image {
	border-radius: calc( var( --srdm-card-radius ) / 2 );
}

.srdm-timeline--collapsible .srdm-timeline__text {
	margin: 20px 0;
	font-size: 14px;
	line-height: 1.55;
}

.srdm-timeline--collapsible .srdm-timeline__text p {
	margin: 0 0 4px;
}

.srdm-timeline--collapsible .srdm-timeline__text strong {
	color: var( --srdm-c-year-color );
}

/* Opening and closing animate where the browser can animate to height:auto.
   Elsewhere the row simply opens. */
@media ( prefers-reduced-motion: no-preference ) {
	.srdm-timeline--collapsible summary.srdm-timeline__summary::after {
		transition: transform 0.25s ease;
	}

	@supports ( interpolate-size: allow-keywords ) and selector( ::details-content ) {
		.srdm-timeline--collapsible {
			interpolate-size: allow-keywords;
		}

		.srdm-timeline--collapsible details.srdm-timeline__card::details-content {
			height: 0;
			overflow: clip;
			transition: height 0.3s ease, content-visibility 0.3s allow-discrete;
		}

		.srdm-timeline--collapsible details.srdm-timeline__card[open]::details-content {
			height: auto;
		}
	}
}

/* ==== Centered year pills ================================================= */

/* Ink line and borders, yellow pills, white bordered cards. A highlighted
   year inverts to a yellow-on-ink pill. Settings still override every colour,
   the year size, Card Border Radius and Max Width. */
.srdm-timeline--centered {
	--srdm-max-width: 460px;
	--srdm-card-radius: 12px;
	--srdm-d-line-bg: #20233a;
	--srdm-d-dot-bg: #20233a;
	--srdm-d-year-color: #20233a;
	--srdm-d-year-bg: #f2c14e;
	--srdm-d-year-font-size: 0.9375rem;
	--srdm-d-card-bg: #ffffff;
	--srdm-d-card-color: #4a4e68;
	--srdm-d-card-border-width: 1px;
	--srdm-d-card-border-color: #d9dbe8;
	--srdm-gap: 22px;
	/* Pill centre: half a 1.2 line, the top padding and the 2px border. */
	--srdm-dot-top: calc( var( --srdm-c-year-font-size ) * 0.93 + 2px );
}

.srdm-timeline--centered .srdm-timeline__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding-bottom: var( --srdm-gap );
	text-align: center;
}

/* A row with the same year as the one before joins its group: no second
   pill, and 10px from the card above instead of the full gap. */
.srdm-timeline--centered .srdm-timeline__item.is-same-year {
	margin-top: calc( 10px - var( --srdm-gap ) );
}

.srdm-timeline--centered .srdm-timeline__item.is-same-year .srdm-timeline__year {
	display: none;
}

.srdm-timeline--centered .srdm-timeline__item:last-child {
	padding-bottom: 0;
}

/* The marker covers the whole item, padding included, so the line is
   continuous without reaching into the next item. */
.srdm-timeline--centered .srdm-timeline__marker {
	position: absolute;
	inset: 0;
}

.srdm-timeline--centered .srdm-timeline__marker::before,
.srdm-timeline--centered .srdm-timeline__marker::after {
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	margin-left: -1px;
}

.srdm-timeline--centered .srdm-timeline__item:first-child .srdm-timeline__marker::before,
.srdm-timeline--centered .srdm-timeline__item:first-child .srdm-timeline__marker::after {
	top: var( --srdm-dot-y );
}

.srdm-timeline--centered .srdm-timeline__item:last-child .srdm-timeline__marker::before,
.srdm-timeline--centered .srdm-timeline__item:last-child .srdm-timeline__marker::after {
	bottom: auto;
	height: var( --srdm-dot-y );
}

.srdm-timeline--centered .srdm-timeline__dot {
	display: none;
}

.srdm-timeline--centered .srdm-timeline__year {
	padding: 0.33em 1.07em;
	border: 2px solid var( --srdm-c-dot-bg );
	font-weight: 800;
	letter-spacing: 0.04em;
}

.srdm-timeline--centered .srdm-timeline__card {
	position: relative;
	z-index: 1;
	width: 100%;
	padding: 12px 16px;
}

.srdm-timeline--centered .srdm-timeline__media {
	margin: -12px -16px 12px;
}

/* The title is ink unless Card Color is set, then it follows that. */
.srdm-timeline--centered .srdm-timeline__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.5;
	color: var( --srdm-card-color, #20233a );
}

.srdm-timeline--centered .srdm-timeline__text {
	font-size: 0.90625rem;
	line-height: 1.5;
}

.srdm-timeline--centered .srdm-timeline__text p {
	margin-bottom: 0.5em;
}

/* ==== Horizontal family: Horizontal scroll, and Column grid from 600px ==== */

.srdm-timeline--horizontal .srdm-timeline__list {
	display: flex;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	padding-bottom: 1rem;
	scrollbar-width: thin;
	scrollbar-color: var( --srdm-c-line-bg ) transparent;
}

.srdm-timeline--horizontal .srdm-timeline__list:focus-visible {
	outline: 2px solid var( --srdm-c-dot-bg );
	outline-offset: 4px;
}

.srdm-timeline--horizontal .srdm-timeline__item {
	display: grid;
	flex: none;
	width: min( var( --srdm-item-width ), 85% );
	grid-template-rows: auto auto 1fr;
	grid-template-areas:
		"marker"
		"year"
		"card";
	row-gap: 0.75rem;
	padding-inline-end: 1.5rem;
	scroll-snap-align: start;
}

.srdm-timeline--horizontal .srdm-timeline__item:last-child {
	padding-inline-end: 0;
}

.srdm-timeline--horizontal .srdm-timeline__marker {
	height: calc( var( --srdm-dot-size ) + 12px );
	/* Reach across the item's end padding, so one line runs through. */
	margin-inline-end: -1.5rem;
}

.srdm-timeline--horizontal .srdm-timeline__item:last-child .srdm-timeline__marker {
	margin-inline-end: 0;
}

.srdm-timeline--horizontal .srdm-timeline__marker::before {
	top: 50%;
	inset-inline: 0;
	height: var( --srdm-line-width );
	transform: translateY( -50% );
}

.srdm-timeline--horizontal .srdm-timeline__item:first-child .srdm-timeline__marker::before {
	inset-inline-start: calc( var( --srdm-dot-size ) / 2 + 4px );
}

.srdm-timeline--horizontal .srdm-timeline__dot {
	top: 50%;
	inset-inline-start: 4px;
	transform: translateY( -50% );
}

/* Column grid: the left rail above stays below 600px; from 600px the items
   become fixed-width columns on a rail and wrap into rows. Each override
   below undoes a left-rail declaration, so keep the two in step. */
@media ( min-width: 600px ) {
	.srdm-timeline--columns .srdm-timeline__list {
		display: flex;
		flex-wrap: wrap;
		row-gap: var( --srdm-gap );
	}

	.srdm-timeline--columns .srdm-timeline__item,
	.srdm-timeline--columns .srdm-timeline__item:last-child {
		flex: none;
		width: min( var( --srdm-item-width ), 100% );
		grid-template-columns: minmax( 0, 1fr );
		grid-template-rows: auto auto 1fr;
		grid-template-areas:
			"marker"
			"year"
			"card";
		row-gap: 0.75rem;
		padding-bottom: 0;
		padding-inline-end: 1.5rem;
	}

	.srdm-timeline--columns .srdm-timeline__marker {
		height: calc( var( --srdm-dot-size ) + 12px );
		margin-inline-end: -1.5rem;
	}

	.srdm-timeline--columns .srdm-timeline__item .srdm-timeline__marker::before,
	.srdm-timeline--columns .srdm-timeline__item:first-child .srdm-timeline__marker::before,
	.srdm-timeline--columns .srdm-timeline__item:last-child .srdm-timeline__marker::before {
		top: 50%;
		bottom: auto;
		left: 0;
		right: 0;
		width: auto;
		height: var( --srdm-line-width );
		margin-left: 0;
		transform: translateY( -50% );
	}

	.srdm-timeline--columns .srdm-timeline__item:first-child .srdm-timeline__marker::before {
		inset-inline-start: calc( var( --srdm-dot-size ) / 2 + 4px );
	}

	.srdm-timeline--columns .srdm-timeline__item:last-child .srdm-timeline__marker {
		margin-inline-end: 0;
	}

	.srdm-timeline--columns .srdm-timeline__item:last-child .srdm-timeline__marker::before {
		inset-inline-end: calc( 100% - var( --srdm-dot-size ) / 2 - 4px );
	}

	.srdm-timeline--columns .srdm-timeline__item:only-child .srdm-timeline__marker::before {
		display: none;
	}

	.srdm-timeline--columns .srdm-timeline__dot {
		top: 50%;
		left: auto;
		inset-inline-start: 4px;
		transform: translateY( -50% );
	}
}

/* ==== Arrows (Horizontal scroll) =========================================
 * Drawn only once the script has wired them, and only if the track overflows.
 */

.srdm-timeline__nav {
	display: none;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.srdm-timeline.has-nav.is-scrollable .srdm-timeline__nav {
	display: flex;
}

.srdm-timeline .srdm-timeline__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid var( --srdm-c-line-bg );
	border-radius: 50%;
	color: inherit;
	background: transparent;
	box-shadow: none;
	line-height: 0;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.srdm-timeline .srdm-timeline__arrow:hover:not( :disabled ),
.srdm-timeline .srdm-timeline__arrow:focus-visible {
	border-color: var( --srdm-c-dot-bg );
	color: var( --srdm-c-dot-bg );
}

.srdm-timeline .srdm-timeline__arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.srdm-timeline .srdm-timeline__arrow svg {
	display: block;
}

/* Arrows point the reading direction. Not merged with a :dir() selector: a
   browser that doesn't know :dir() would drop the whole rule. */
[dir="rtl"] .srdm-timeline .srdm-timeline__arrow svg {
	transform: scaleX( -1 );
}

/* ==== Highlight =========================================================== */

.srdm-timeline .is-highlight .srdm-timeline__dot {
	width: calc( var( --srdm-dot-size ) * 1.5 );
	height: calc( var( --srdm-dot-size ) * 1.5 );
	box-shadow: 0 0 0 6px color-mix( in srgb, var( --srdm-c-dot-bg ) 25%, transparent );
}

.srdm-timeline .is-highlight .srdm-timeline__card {
	box-shadow: inset 0 0 0 2px var( --srdm-c-dot-bg );
}

/* Collapsible: the dot keeps its size (the rail is narrow) and gains a soft
   halo; the card's own border takes the dot colour instead of an outline. */
.srdm-timeline--collapsible .is-highlight .srdm-timeline__dot {
	width: var( --srdm-dot-size );
	height: var( --srdm-dot-size );
	box-shadow: 0 0 0 4px color-mix( in srgb, var( --srdm-c-dot-bg ) 20%, transparent );
}

.srdm-timeline--collapsible .is-highlight .srdm-timeline__card {
	border-color: var( --srdm-c-dot-bg );
	box-shadow: none;
}

/* Minimal has no card to outline: the year carries it instead. */
.srdm-timeline--minimal .is-highlight .srdm-timeline__card {
	box-shadow: none;
}

.srdm-timeline--minimal .is-highlight .srdm-timeline__dot {
	width: 20px;
	height: 3px;
	box-shadow: none;
}

.srdm-timeline--minimal .is-highlight .srdm-timeline__year {
	color: var( --srdm-dot-bg, #2271b1 );
}

/* The pill designs invert the highlighted year. Centered marks the year
   alone, as the reference's "now" pill does; the card stays plain. */
.srdm-timeline--centered .is-highlight .srdm-timeline__year {
	color: var( --srdm-c-year-bg );
	background: var( --srdm-c-dot-bg );
}

.srdm-timeline--centered .is-highlight .srdm-timeline__card {
	box-shadow: none;
}

.srdm-timeline--photo .is-highlight .srdm-timeline__year {
	box-shadow: 0 0 0 5px color-mix( in srgb, var( --srdm-c-year-bg ) 30%, transparent );
}

/* ==== Line Fills on Scroll ================================================
 * The script adds .is-filling and sets --srdm-fill (0–1) on each marker.
 * Until it does, the line and dots look exactly as without the option.
 */

.srdm-timeline.is-filling .srdm-timeline__marker::after {
	display: block;
}

.srdm-timeline.is-filling .srdm-timeline__item:not( .is-reached ) .srdm-timeline__dot {
	background: var( --srdm-c-line-bg );
	box-shadow: none;
}

.srdm-timeline--photo.is-filling .srdm-timeline__item:not( .is-reached ) .srdm-timeline__year {
	opacity: 0.55;
}

.srdm-timeline--centered.is-filling .srdm-timeline__item:not( .is-reached ) .srdm-timeline__year {
	border-color: var( --srdm-c-line-bg );
}

.srdm-timeline--photo .srdm-timeline__year,
.srdm-timeline--centered .srdm-timeline__year {
	transition: opacity 0.3s ease, border-color 0.3s ease;
}

/* ==== Reveal on scroll ==================================================== */

/* Nothing is hidden until the script adds .is-pending. */
.srdm-timeline[data-srdm-reveal] .srdm-timeline__item {
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.srdm-timeline[data-srdm-reveal] .srdm-timeline__item.is-pending {
	opacity: 0;
	transform: translateY( 24px );
}

.srdm-timeline--horizontal[data-srdm-reveal] .srdm-timeline__item.is-pending {
	transform: translateX( 24px );
}

@media ( prefers-reduced-motion: reduce ) {
	.srdm-timeline[data-srdm-reveal] .srdm-timeline__item,
	.srdm-timeline .srdm-timeline__arrow,
	.srdm-timeline .srdm-timeline__more,
	.srdm-timeline__dot,
	.srdm-timeline--photo .srdm-timeline__year,
	.srdm-timeline--centered .srdm-timeline__year {
		transition: none;
	}

	.srdm-timeline[data-srdm-reveal] .srdm-timeline__item.is-pending {
		opacity: 1;
		transform: none;
	}
}
