/**
 * Tim Scott: Meet Tim (page-meet-tim.php): the year tabs and the vertical
 * timeline (template-parts/sections/timeline-nav.php, timeline-vertical.php).
 *
 * Route sheet: enqueued on /meet-tim/ only, after the shell chain
 * (inc/assets.php, tsc_route_stylesheet()).
 *
 * Lifted from components/_timeline.scss (the .meet-tim-timeline and
 * .timeline-nav parts) and the jQuery Timeline v1.2.0 library CSS
 * (libs/timeline/timeline.min.css), with the values as dream.css compiled
 * them: _reference/css-spec/dream-used.css, the rules matched on meet-tim.
 * The old class names are kept because the spec styles them; the rules are
 * scoped to .meet-tim-timeline and .timeline-nav-wrapper so that they do not
 * reach the home page timeline.
 *
 * The library laid the timeline out with classes it set from the window
 * width (Meet Tim: forceVerticalMode 768, verticalStartPosition 'right').
 * Media queries do that job now, so the page lays out without JS:
 * - Base: the library's mobile mode (.timeline--mobile, window width up to
 *   768px). The line is 10px from the left; each item is the full width,
 *   with the image above the text.
 * - 48em (768px): the lg rules of _timeline.scss. Each item becomes a row:
 *   image left, text right, dot and marker in the middle. At exactly 768px
 *   the old page combined this with mobile mode, and so does this file.
 * - 48.0625em (769px): past the library's mobile mode (its test was
 *   window.innerWidth <= 768, one pixel beyond lg). The line moves to the
 *   middle, and the even items (.timeline__item--right, from the first)
 *   put their image on the right.
 * The rules that made no difference in this layout are left out:
 * - the horizontal-mode rules;
 * - the content arrows (content: none in _timeline.scss);
 * - the library's wrappers (.timeline__item__inner > .timeline__content__wrap);
 * - right offsets that left + width override.
 * The timeline also no longer fades in half a second after load (the
 * library hid it while it measured).
 *
 * The scroll reveal is app.js (initTimelineReveal):
 * - Items below the trigger at load get .animated (opacity 0).
 * - They get .fadeIn as they scroll up into view.
 * The @keyframes (fadeIn, scale-fade, scale-fade-mobile, grow-fade,
 * fade-grow) are in animations.css.
 *
 * @package TSC
 */

/* ==========================================================================
   Year tabs (.timeline-nav-wrapper > … > ul#timelineNav.nav.timeline-nav)
   ==========================================================================
   A navy band that sticks to the top of the window while the timeline
   scrolls under it: a white rule across the middle, each year a white dot
   on it, the active year ringed (fade-grow). The list scrolls sideways
   when the years do not fit, with a 2px scrollbar that only shows on
   hover. */

.timeline-nav-wrapper {
	position: sticky;
	top: 0;
	right: 0;
	left: 0;
	z-index: 3;
	padding: 3.125rem 1.25rem;
	color: var(--white);
	background-color: var(--primary);
}

.timeline-nav-wrapper::before {
	position: absolute;
	top: 50%;
	right: 0;
	left: 0;
	z-index: 0;
	display: block;
	height: 0.125rem;
	content: "";
	background-color: var(--white);
	transform: translateY(-50%);
}

.timeline-nav-wrapper .timeline-nav {
	flex-flow: row nowrap;
	overflow-x: scroll;
}

.timeline-nav-wrapper .timeline-nav::-webkit-scrollbar {
	height: 0.125rem;
}

.timeline-nav-wrapper .timeline-nav::-webkit-scrollbar-track {
	background-color: transparent;
}

.timeline-nav-wrapper .timeline-nav::-webkit-scrollbar-thumb {
	border-radius: 0.0625rem;
}

.timeline-nav-wrapper .timeline-nav:hover::-webkit-scrollbar-thumb {
	background-color: hsla(0, 0%, 100%, 0.8);
}

.timeline-nav-wrapper .timeline-nav > .nav-item {
	position: relative;
}

.timeline-nav-wrapper .timeline-nav > .nav-item > .nav-link {
	position: relative;
	padding: 0 1.25rem 3.75rem;
	color: var(--white);
}

/* The year's dot on the rule. */
.timeline-nav-wrapper .timeline-nav > .nav-item > .nav-link::after {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	display: block;
	width: 0.875rem;
	height: 0.875rem;
	content: "";
	background-color: var(--white);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

/* The active year: two rings that grow out of its dot and fade. */
.timeline-nav-wrapper .timeline-nav > .nav-item.active::before,
.timeline-nav-wrapper .timeline-nav > .nav-item.active::after {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	display: block;
	width: 0.875rem;
	height: 0.875rem;
	content: "";
	border: 0.0625rem double var(--white);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	animation-name: fade-grow;
	animation-duration: 4s;
	animation-iteration-count: infinite;
}

/* ==========================================================================
   Timeline (.timeline--wrapper.meet-tim-timeline)
   ========================================================================== */

.meet-tim-timeline {
	background-color: var(--secondary);
}

.meet-tim-timeline .timeline {
	position: relative;
}

/* The line the items hang from. */
.meet-tim-timeline .timeline::before {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 10px;
	z-index: 1;
	width: 2px;
	margin: 0;
	content: "";
	background-color: var(--primary);
}

.meet-tim-timeline .timeline__wrap {
	position: relative;
	z-index: 2;
	overflow: visible;
}

.meet-tim-timeline .timeline__items {
	position: relative;
}

.meet-tim-timeline .timeline__item {
	position: relative;
	z-index: 2;
	width: 100%;
	padding: 0.625rem 0 0.625rem 2.5rem;
	margin-bottom: 2.5rem;
	font-size: 1rem;
}

.meet-tim-timeline .timeline__item:last-child {
	margin-bottom: 0;
}

/* The navy dot on the line, level with the middle of the item. */
.meet-tim-timeline .timeline__item::after {
	position: absolute;
	top: 50%;
	left: 0.0625rem;
	z-index: 1;
	width: 20px;
	height: 20px;
	content: "";
	background-color: var(--primary);
	border: none;
	border-radius: 50%;
	transform: translateY(-50%);
}

/* The ringed marker over the dot; it and its two rings pulse (scale-fade, grow-fade). */
.meet-tim-timeline .timeline__marker {
	position: absolute;
	top: 50%;
	left: 0.0625rem;
	z-index: 2;
	display: block;
	width: 1.25rem;
	height: 1.25rem;
	border: 0.25rem double var(--primary);
	border-radius: 50%;
	transform: translateY(-50%);
	animation-name: scale-fade-mobile;
	animation-duration: 4s;
	animation-delay: 0.1875s;
	animation-iteration-count: infinite;
}

.meet-tim-timeline .timeline__marker::before,
.meet-tim-timeline .timeline__marker::after {
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 100%;
	height: 100%;
	content: "";
	border: 0.0625rem double var(--primary);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	animation-name: grow-fade;
	animation-duration: 4s;
	animation-iteration-count: infinite;
}

.meet-tim-timeline .timeline__marker::before {
	border-width: 0.125rem;
}

.meet-tim-timeline .timeline__marker::after {
	animation-delay: 0.0625s;
}

/* The library's text colour (--tsc-timeline-text, tokens.css). */
.meet-tim-timeline .timeline__content {
	position: relative;
	display: block;
	padding: 1.25rem 0;
	color: var(--tsc-timeline-text);
	background-color: transparent;
	border: none;
}

.meet-tim-timeline .timeline__content p {
	margin-bottom: 10px;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.meet-tim-timeline .timeline__link {
	display: block;
}

.meet-tim-timeline .timeline__link:focus,
.meet-tim-timeline .timeline__link:hover {
	text-decoration: none;
}

.meet-tim-timeline .timeline__image-wrapper {
	text-align: center;
}

.meet-tim-timeline .timeline__image {
	width: 100%;
	margin-bottom: 1rem;
}

.meet-tim-timeline .timeline__body-wrapper {
	position: relative;
}

.meet-tim-timeline .timeline__date {
	font-family: var(--tsc-font-heading);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1;
	color: var(--primary);
	text-transform: uppercase;
}

.meet-tim-timeline .timeline__title {
	position: relative;
	padding-bottom: 1.25rem;
	margin-bottom: 1.25rem;
	font-size: 2.6875rem;
	line-height: 1.1860465116;
	color: var(--tertiary);
}

/* The short coral bar under the title. */
.meet-tim-timeline .timeline__title::after {
	position: absolute;
	bottom: 0;
	left: 0;
	display: block;
	width: 4.75rem;
	height: 0.4375rem;
	content: "";
	background-color: var(--tertiary);
}

.meet-tim-timeline .timeline__title:last-child {
	margin-bottom: 0;
}

/* "Small text" items (the 2019 lynching bill): a smaller title at every width. */
.meet-tim-timeline .timeline__item.small .timeline__title {
	font-size: 2.1875rem;
	line-height: 1.2;
}

.meet-tim-timeline .timeline__text ul {
	padding-left: 1rem;
}

.meet-tim-timeline .timeline__text p:last-child {
	margin-bottom: 0;
}

/*
 * Scroll reveal (app.js). .animated waits at opacity 0; .fadeIn plays
 * fadeIn (opacity up from 0, top up from 70px) for 1s and keeps its end.
 * Without JS, or for readers who ask for less motion, no item gets
 * .animated.
 */
.meet-tim-timeline .timeline__item.animated {
	opacity: 0;
	animation-duration: 1s;
	animation-fill-mode: both;
}

.meet-tim-timeline .timeline__item.fadeIn {
	animation-name: fadeIn;
}

/* ==========================================================================
   lg (48em, 768px): each item becomes a row
   ========================================================================== */

@media (min-width: 48em) {
	.timeline-nav-wrapper .timeline-nav > .nav-item > .nav-link {
		font-size: 1.3125rem;
		line-height: 1;
	}

	.timeline-nav-wrapper .timeline-nav > .nav-item > .nav-link::after,
	.timeline-nav-wrapper .timeline-nav > .nav-item.active::before,
	.timeline-nav-wrapper .timeline-nav > .nav-item.active::after {
		width: 1.25rem;
		height: 1.25rem;
	}

	/* Dot and marker move to the middle of the item. */
	.meet-tim-timeline .timeline__item::after,
	.meet-tim-timeline .timeline__marker {
		left: 50%;
		transform: translate(-50%, -50%);
	}

	.meet-tim-timeline .timeline__content,
	.meet-tim-timeline .timeline__link {
		display: flex;
		flex-flow: row nowrap;
		justify-content: space-between;
	}

	.meet-tim-timeline .timeline__link {
		flex: 0 0 100%;
	}

	.meet-tim-timeline .timeline__image-wrapper,
	.meet-tim-timeline .timeline__body-wrapper {
		flex: 0 0 calc(50% - 40px);
	}

	.meet-tim-timeline .timeline__image {
		margin-bottom: 0;
	}

	/* The text is centred on the image's height (it does not add to the item's height). */
	.meet-tim-timeline .timeline__body {
		position: absolute;
		top: 50%;
		display: block;
		width: 100%;
		transform: translateY(-50%);
	}
}

/* ==========================================================================
   Past the library's mobile mode (48.0625em, 769px): the line in the middle,
   images alternating right / left
   ========================================================================== */

@media (min-width: 48.0625em) {
	.meet-tim-timeline .timeline::before {
		left: 50%;
		margin-left: -0.0625rem;
	}

	.meet-tim-timeline .timeline__wrap {
		overflow: hidden;
	}

	.meet-tim-timeline .timeline__item {
		padding-right: 2.5rem;
	}

	.meet-tim-timeline .timeline__marker {
		animation-name: scale-fade;
	}

	.meet-tim-timeline .timeline__item--right .timeline__image-wrapper {
		order: 1;
	}
}

/* ==========================================================================
   xl (64em, 1024px) · xxl (90em, 1440px) · xxxl (111.25em, 1780px)
   ========================================================================== */

@media (min-width: 64em) {
	.meet-tim-timeline .timeline__item::after,
	.meet-tim-timeline .timeline__marker {
		width: 1.75rem;
		height: 1.75rem;
	}

	.meet-tim-timeline .timeline__date {
		font-size: 2.6875rem;
		line-height: 1;
	}

	.meet-tim-timeline .timeline__title {
		font-size: 3.4375rem;
		line-height: 1.2;
	}
}

@media (min-width: 90em) {
	.timeline-nav-wrapper .timeline-nav {
		justify-content: center;
	}
}

@media (min-width: 111.25em) {
	.meet-tim-timeline .timeline__item::after,
	.meet-tim-timeline .timeline__marker {
		width: 2.5rem;
		height: 2.5rem;
	}
}

/* A printout shows every item, scrolled to or not (the old page printed the unrevealed ones blank). */
@media print {
	.meet-tim-timeline .timeline__item.animated {
		opacity: 1;
		animation: none;
	}
}
