/* =============================================================================
   Acacia Center for Justice — Timeline styles
   All rules are scoped under .acj-timeline to avoid affecting the rest of
   the site. Loads only on Timeline page/single/shortcode (see inc/enqueue.php).

   Design tokens intentionally mirror acj-reda/assets/reda.css and
   acj-blog/assets/css/acj-blog.css (same brand green/orange, same Besley +
   Public Sans, same spacing/radius scale). Tokens live on .acj-timeline,
   not on :root.

   Visual thesis: a forest-green spine through warm paper; orange ticks like
   warning lights; Besley dates as the loudest type on the track; Public Sans
   for the record. Horizontal on a desk, a vertical ledger on a phone.
   ============================================================================= */

.acj-timeline {
	--acj-timeline-green:        #174337;
	--acj-timeline-green-dark:   #0B320C;
	--acj-timeline-green-hover:  #0f3530;
	--acj-timeline-green-light:  #e6eeeb;
	--acj-timeline-green-muted:  #c4d6cf;
	--acj-timeline-green-soft:   rgba(23, 67, 55, 0.08);

	--acj-timeline-orange:       #c2561a;
	--acj-timeline-orange-soft:  rgba(194, 86, 26, 0.12);

	--acj-timeline-black:        #0e0e0e;
	--acj-timeline-text:         #1a1a1a;
	--acj-timeline-text-muted:   #525250;
	--acj-timeline-text-light:   #888884;

	--acj-timeline-bg:           #ffffff;
	--acj-timeline-bg-subtle:    #f8f7f4;
	--acj-timeline-bg-muted:     #eeede8;
	--acj-timeline-border:       #dddbd5;

	--acj-timeline-font-serif: 'Besley', 'Source Serif 4', Georgia, 'Times New Roman', serif;
	--acj-timeline-font-sans:  'Public Sans', 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

	--acj-timeline-space-xs: 0.35rem;
	--acj-timeline-space-sm: 0.65rem;
	--acj-timeline-space-md: 1rem;
	--acj-timeline-space-lg: 1.5rem;
	--acj-timeline-space-xl: 2rem;
	--acj-timeline-space-2xl: 3rem;
	--acj-timeline-space-3xl: 4rem;

	--acj-timeline-measure: 40ch;
	--acj-timeline-radius: 2px;
	--acj-timeline-col: 22rem;
	--acj-timeline-fade: 5.5rem;
	--acj-timeline-end-pad: calc(var(--acj-timeline-fade) + 1.25rem);
	--acj-timeline-node: 16px;
	--acj-timeline-date-row: 4.75rem;
	--acj-timeline-node-row: 2.25rem;
	--acj-timeline-spine-top: calc(var(--acj-timeline-date-row) + (var(--acj-timeline-node-row) / 2) - 1px);

	/* Vertical clearance for the parent theme's fixed/sticky navbar.
	 * Sized to clear Impreza's header; override if header height differs. */
	--acj-timeline-nav-offset: 140px;

	color: var(--acj-timeline-text);
	font-family: var(--acj-timeline-font-sans);
	line-height: 1.6;
	overflow-wrap: break-word;
	background: var(--acj-timeline-bg-subtle);
	position: relative;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding-top: var(--acj-timeline-nav-offset);
	padding-bottom: var(--acj-timeline-space-2xl);
	overflow-x: clip;
}

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

.acj-timeline [hidden] {
	display: none !important;
}

.acj-timeline .acj-timeline-visually-hidden,
.acj-timeline .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.acj-timeline :focus-visible {
	outline: 2px solid var(--acj-timeline-orange);
	outline-offset: 2px;
}

.acj-timeline :focus:not(:focus-visible) {
	outline: none;
}

.acj-timeline-main {
	display: flex;
	flex-direction: column;
	min-height: calc(100svh - var(--acj-timeline-nav-offset));
	max-width: none;
}

/* -----------------------------------------------------------------------------
 * Hero — full-bleed warm ground, not a card
 * -------------------------------------------------------------------------- */

.acj-timeline-hero {
	flex: 0 0 auto;
	padding: var(--acj-timeline-space-lg) clamp(1.25rem, 4vw, 3rem) var(--acj-timeline-space-md);
	max-width: 44rem;
}

.acj-timeline-hero__eyebrow {
	margin: 0 0 var(--acj-timeline-space-sm);
	font-family: var(--acj-timeline-font-sans);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--acj-timeline-orange);
}

.acj-timeline-hero__title {
	margin: 0 0 var(--acj-timeline-space-sm);
	font-family: var(--acj-timeline-font-serif);
	font-weight: 600;
	font-size: clamp(1.85rem, 3.2vw, 2.65rem);
	line-height: 1.15;
	color: var(--acj-timeline-text);
}

.acj-timeline-hero__lede {
	margin: 0;
	font-family: var(--acj-timeline-font-sans);
	font-size: 1.05rem;
	line-height: 1.6;
	color: var(--acj-timeline-text-muted);
	max-width: 40rem;
}

.acj-timeline-hero__lede p {
	margin: 0 0 var(--acj-timeline-space-sm);
}

.acj-timeline-hero__lede p:last-child {
	margin-bottom: 0;
}

/* -----------------------------------------------------------------------------
 * Stage + arrows
 * -------------------------------------------------------------------------- */

.acj-timeline-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 28rem;
	min-width: 0;
	width: 100%;
	max-width: 100%;
	display: flex;
	flex-direction: column;
}

.acj-timeline-viewport {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	min-width: 0;
	width: 100%;
	overflow: hidden;
	overscroll-behavior-x: none;
	overscroll-behavior-y: auto;
}

.acj-timeline-viewport::before,
.acj-timeline-viewport::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: var(--acj-timeline-fade, 5.5rem);
	z-index: 3;
	pointer-events: none;
	display: none;
}

.acj-timeline-viewport::before {
	left: 0;
	background: linear-gradient(to right, var(--acj-timeline-bg-subtle) 0%, rgba(248, 247, 244, 0.92) 42%, rgba(248, 247, 244, 0) 100%);
}

.acj-timeline-viewport::after {
	right: 0;
	background: linear-gradient(to left, var(--acj-timeline-bg-subtle) 0%, rgba(248, 247, 244, 0.92) 42%, rgba(248, 247, 244, 0) 100%);
}

.acj-timeline button.acj-timeline-arrow {
	display: none;
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	z-index: 5;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--acj-timeline-radius);
	background: var(--acj-timeline-green);
	color: #ffffff;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	transition: background-color 0.18s ease, opacity 0.18s ease;
	pointer-events: auto;
}

.acj-timeline button.acj-timeline-arrow:hover,
.acj-timeline button.acj-timeline-arrow:focus-visible {
	background: var(--acj-timeline-green-hover);
}

.acj-timeline button.acj-timeline-arrow[aria-disabled="true"] {
	background: var(--acj-timeline-green-muted);
	color: #ffffff;
	cursor: default;
	opacity: 0.45;
}

.acj-timeline-arrow__icon {
	display: block;
	pointer-events: none;
}

.acj-timeline-era-pin {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
	margin: 0;
	padding: var(--acj-timeline-space-sm) var(--acj-timeline-space-xl) var(--acj-timeline-space-sm) var(--acj-timeline-space-md);
	max-width: min(36rem, 70%);
	font-family: var(--acj-timeline-font-sans);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--acj-timeline-orange);
	background: linear-gradient(to right, var(--acj-timeline-bg-subtle) 62%, rgba(248, 247, 244, 0) 100%);
	pointer-events: none;
}

/* -----------------------------------------------------------------------------
 * Track — desktop scrolling is JS-only (arrows). No native wheel/trackpad.
 * -------------------------------------------------------------------------- */

.acj-timeline-track {
	height: 100%;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow-x: hidden;
	overflow-y: hidden;
	overscroll-behavior-x: none;
	overscroll-behavior-y: auto;
	touch-action: pan-y;
	scrollbar-width: none;
	padding-top: 2.75rem;
}

.acj-timeline-track::-webkit-scrollbar {
	display: none;
}

.acj-timeline-track:focus-visible {
	outline: 2px solid var(--acj-timeline-orange);
	outline-offset: 2px;
}

.acj-timeline-list {
	position: relative;
	display: flex;
	flex-direction: row;
	list-style: none;
	margin: 0;
	padding: 0 var(--acj-timeline-end-pad) var(--acj-timeline-space-xl);
	min-width: max-content;
	min-height: 100%;
}

.acj-timeline-list::before {
	content: "";
	position: absolute;
	left: var(--acj-timeline-end-pad);
	right: var(--acj-timeline-end-pad);
	top: var(--acj-timeline-spine-top);
	height: 2px;
	background: var(--acj-timeline-green);
	pointer-events: none;
}

.acj-timeline-item {
	position: relative;
	flex: 0 0 var(--acj-timeline-col);
	width: var(--acj-timeline-col);
	max-width: var(--acj-timeline-col);
	scroll-snap-align: start;
	padding-right: var(--acj-timeline-space-lg);
}

.acj-timeline-era {
	margin: 0 0 var(--acj-timeline-space-sm);
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	text-decoration: none;
	font-family: var(--acj-timeline-font-sans);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--acj-timeline-orange);
	line-height: 1.3;
}

.acj-timeline .acj-timeline-era::before,
.acj-timeline .acj-timeline-era::after {
	content: none;
	display: none;
}

.acj-timeline-event {
	display: grid;
	grid-template-rows: var(--acj-timeline-date-row) var(--acj-timeline-node-row) 1fr;
	grid-template-columns: 1fr;
	min-height: 100%;
}

.acj-timeline-event__header {
	grid-row: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding-bottom: var(--acj-timeline-space-xs);
}

.acj-timeline-event__date {
	margin: 0;
	font-family: var(--acj-timeline-font-serif);
	font-weight: 600;
	font-size: clamp(1.35rem, 2vw, 1.85rem);
	line-height: 1.2;
	color: var(--acj-timeline-text);
}

.acj-timeline-event__date time {
	font: inherit;
	color: inherit;
}

.acj-timeline-event__title {
	margin: var(--acj-timeline-space-xs) 0 0;
	font-family: var(--acj-timeline-font-sans);
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--acj-timeline-text);
}

.acj-timeline-node {
	grid-row: 2;
	align-self: center;
	justify-self: start;
	width: var(--acj-timeline-node);
	height: var(--acj-timeline-node);
	border: 2px solid var(--acj-timeline-orange);
	border-radius: 50%;
	background: var(--acj-timeline-bg);
	z-index: 1;
	transform: scale(1);
	transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.acj-timeline-event:hover .acj-timeline-node,
.acj-timeline-event:focus-within .acj-timeline-node {
	background: var(--acj-timeline-orange);
	transform: scale(1.28);
}

.acj-timeline-event__body {
	grid-row: 3;
	padding-top: var(--acj-timeline-space-md);
	max-width: var(--acj-timeline-measure);
}

.acj-timeline-event__body p {
	margin: 0 0 var(--acj-timeline-space-sm);
	font-family: var(--acj-timeline-font-sans);
	font-size: 0.98rem;
	line-height: 1.6;
	color: var(--acj-timeline-text);
}

.acj-timeline-event__body p:last-child {
	margin-bottom: 0;
}

.acj-timeline-sources {
	list-style: none;
	margin: var(--acj-timeline-space-md) 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--acj-timeline-space-xs);
}

.acj-timeline-sources__item {
	margin: 0;
}

.acj-timeline-source {
	font-family: var(--acj-timeline-font-sans);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--acj-timeline-green);
	text-decoration: none;
}

.acj-timeline-source:hover,
.acj-timeline-source:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

.acj-timeline-source--text {
	color: var(--acj-timeline-green);
}

.acj-timeline-footnote {
	margin: var(--acj-timeline-space-lg) clamp(1.25rem, 4vw, 3rem) 0;
	max-width: 46rem;
	font-size: 0.85rem;
	line-height: 1.5;
	color: var(--acj-timeline-text-muted);
}

.acj-timeline-empty {
	padding: var(--acj-timeline-space-2xl) clamp(1.25rem, 4vw, 3rem);
	max-width: 36rem;
}

.acj-timeline-empty__title {
	margin: 0 0 var(--acj-timeline-space-sm);
	font-family: var(--acj-timeline-font-serif);
	font-size: 1.35rem;
	font-weight: 600;
}

.acj-timeline-empty__hint {
	margin: 0;
	color: var(--acj-timeline-text-muted);
}

/* -----------------------------------------------------------------------------
 * Desktop: horizontal track + arrows + pinned era
 * -------------------------------------------------------------------------- */

@media (min-width: 768px) {
	.acj-timeline-stage {
		display: grid;
		grid-template-columns: 4rem minmax(0, 1fr) 4rem;
		grid-template-rows: 1fr;
		align-items: stretch;
		column-gap: 0;
		min-height: calc(100svh - var(--acj-timeline-nav-offset) - 9.5rem);
	}

	.acj-timeline-viewport {
		grid-column: 2;
		grid-row: 1;
	}

	.acj-timeline-viewport::before,
	.acj-timeline-viewport::after {
		display: block;
	}

	.acj-timeline button.acj-timeline-arrow {
		display: inline-flex;
		grid-row: 1;
		align-self: start;
		justify-self: center;
		margin-top: calc(2.75rem + var(--acj-timeline-spine-top) - 1.375rem);
	}

	.acj-timeline button.acj-timeline-arrow--prev {
		grid-column: 1;
	}

	.acj-timeline button.acj-timeline-arrow--next {
		grid-column: 3;
	}

	.acj-timeline-era-pin:not([hidden]) {
		display: block;
	}

	.acj-timeline-era {
		position: absolute !important;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
}

/* -----------------------------------------------------------------------------
 * Mobile: vertical ledger, no arrows
 * -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.acj-timeline {
		--acj-timeline-nav-offset: 120px;
		--acj-timeline-mobile-gutter: 1.35rem;
		--acj-timeline-mobile-inset: 2.25rem;
		overflow-x: visible;
		padding-bottom: var(--acj-timeline-space-3xl);
	}

	.acj-timeline-hero {
		padding-bottom: var(--acj-timeline-space-xl);
	}

	.acj-timeline-main {
		min-height: 0;
	}

	.acj-timeline-stage {
		min-height: 0;
		padding-top: var(--acj-timeline-space-lg);
	}

	.acj-timeline-viewport {
		overflow: visible;
	}

	.acj-timeline-viewport::before,
	.acj-timeline-viewport::after {
		display: none;
	}

	.acj-timeline button.acj-timeline-arrow {
		display: none;
	}

	.acj-timeline-era-pin {
		display: none !important;
	}

	.acj-timeline-track {
		overflow: visible;
		scroll-snap-type: none;
		scroll-padding-inline: 0;
		padding-top: 0;
		height: auto;
		outline: none;
	}

	.acj-timeline-list {
		flex-direction: column;
		min-width: 0;
		padding: 0 var(--acj-timeline-mobile-gutter);
		gap: 0;
	}

	.acj-timeline-list::before {
		left: calc(var(--acj-timeline-mobile-gutter) + (var(--acj-timeline-node) / 2) - 1px);
		right: auto;
		top: 3.35rem;
		bottom: 0.5rem;
		width: 2px;
		max-width: 2px;
		height: auto;
		background: var(--acj-timeline-green);
	}

	.acj-timeline-item {
		flex: 0 0 auto;
		width: 100%;
		max-width: none;
		padding: 0 0 var(--acj-timeline-space-2xl) var(--acj-timeline-mobile-inset);
		scroll-snap-align: none;
	}

	.acj-timeline-item:last-child {
		padding-bottom: 0;
	}

	.acj-timeline-era {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip: auto;
		white-space: normal;
		margin: 0 0 var(--acj-timeline-space-md) 0;
		padding: 0;
		border: 0;
		background: var(--acj-timeline-bg-subtle);
		display: inline-block;
		max-width: 100%;
	}

	.acj-timeline-item--era {
		padding-top: var(--acj-timeline-space-xl);
	}

	.acj-timeline-item--era:first-child {
		padding-top: 0;
		margin-top: 0;
	}

	.acj-timeline-item--era .acj-timeline-event {
		padding-top: var(--acj-timeline-space-sm);
	}

	.acj-timeline-event {
		display: block;
		position: relative;
		grid-template-rows: none;
	}

	.acj-timeline-event__header {
		display: block;
		min-height: 0;
		padding: 0 0 var(--acj-timeline-space-xs);
	}

	.acj-timeline-node {
		position: absolute;
		left: calc(-1 * var(--acj-timeline-mobile-inset));
		top: 0.45rem;
		margin: 0;
	}

	.acj-timeline-event__body {
		padding-top: var(--acj-timeline-space-xs);
		max-width: none;
	}

	.acj-timeline-event__date {
		font-size: clamp(1.35rem, 5vw, 1.7rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.acj-timeline-node,
	.acj-timeline-arrow {
		transition: none;
	}

	.acj-timeline-event:hover .acj-timeline-node,
	.acj-timeline-event:focus-within .acj-timeline-node {
		transform: none;
	}

	.acj-timeline-track {
		scroll-behavior: auto;
	}
}
