/**
 * ACF timeline — scrollytelling memories.
 * Mobile-first vertical list with sticky year headings; desktop swaps to
 * horizontal Swiper rails per year.
 */

.timeline-page {
	padding-block: var(--wp--preset--spacing--60);
}

.timeline-intro {
	max-width: 720px;
	margin-inline: auto;
	margin-block-end: var(--wp--preset--spacing--60);
}

.timeline-intro .eyebrow {
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--wp--preset--color--sage);
	margin-block-end: var(--wp--preset--spacing--20);
}

.timeline-intro .display {
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: 1.1;
	margin-block-end: var(--wp--preset--spacing--30);
}

.timeline-intro .lede {
	font-size: var(--wp--preset--font-size--large);
	color: color-mix(in srgb, var(--wp--preset--color--ink) 78%, transparent);
}

/* -------- filter bar -------- */

.timeline-filters {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
	align-items: end;
	padding-block: var(--wp--preset--spacing--30);
	margin-block-end: var(--wp--preset--spacing--40);
	background: var(--wp--preset--color--cream);
	border-block-end: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 10%, transparent);
}

.timeline-filter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 9rem;
}

.timeline-filter--tags {
	flex: 1 1 100%;
}

.timeline-filter__label {
	font-family: var(--wp--preset--font-family--inter);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--wp--preset--color--sage);
	font-weight: 600;
}

.timeline-filter select {
	font: inherit;
	padding: 0.5rem 0.75rem;
	border-radius: 8px;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 18%, transparent);
	background: #fff;
	color: var(--wp--preset--color--ink);
	min-height: 44px;
}

.timeline-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.timeline-tag {
	font: inherit;
	font-size: 0.875rem;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 18%, transparent);
	background: #fff;
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition: background 120ms, color 120ms, border-color 120ms;
}

.timeline-tag:hover {
	border-color: var(--wp--preset--color--terracotta);
}

.timeline-tag.is-active,
.timeline-tag[aria-pressed="true"] {
	background: var(--wp--preset--color--terracotta);
	border-color: var(--wp--preset--color--terracotta);
	color: var(--wp--preset--color--cream);
}

.timeline-filter__clear {
	font: inherit;
	font-size: 0.875rem;
	padding: 0.5rem 0.85rem;
	background: transparent;
	border: 1px solid transparent;
	color: var(--wp--preset--color--terracotta);
	cursor: pointer;
	border-radius: 8px;
}

.timeline-filter__clear:hover {
	border-color: var(--wp--preset--color--terracotta);
}

/* -------- timeline core -------- */

.timeline-year-group {
	margin-block-end: var(--wp--preset--spacing--60);
}

.timeline-year {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--wp--preset--color--cream);
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: clamp(2rem, 4vw, 3rem);
	font-weight: 400;
	color: var(--wp--preset--color--ink);
	margin: 0 0 var(--wp--preset--spacing--30);
	padding-block: var(--wp--preset--spacing--30);
	line-height: 1.1;
}

/* When filter bar is visible, push year heading below it. */
.timeline-filters:not([hidden]) ~ #acf-timeline-root .timeline-year {
	top: 4.5rem;
}

.timeline-cards {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	grid-template-columns: 1fr;
}

.timeline-card {
	background: #fff;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 10%, transparent);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.timeline-card__img,
.timeline-card img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	background: color-mix(in srgb, var(--wp--preset--color--ink) 5%, transparent);
}

.timeline-card__body {
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) var(--wp--preset--spacing--40);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.timeline-card__caption {
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
	margin: 0;
}

.timeline-card__date {
	margin: 0;
	color: var(--wp--preset--color--sage);
	font-size: 0.875rem;
}

.timeline-card__contributor {
	margin: 0;
	font-size: 0.875rem;
	color: color-mix(in srgb, var(--wp--preset--color--ink) 65%, transparent);
}

.timeline-card__tags {
	list-style: none;
	margin: 6px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.timeline-card__tags li {
	font-size: 0.75rem;
	padding: 2px 8px;
	background: color-mix(in srgb, var(--wp--preset--color--sage) 18%, transparent);
	color: var(--wp--preset--color--ink);
	border-radius: 999px;
}

.timeline-empty {
	padding: var(--wp--preset--spacing--60);
	text-align: center;
	color: color-mix(in srgb, var(--wp--preset--color--ink) 65%, transparent);
}

/* -------- desktop swiper -------- */

@media (min-width: 721px) {
	.timeline-cards {
		grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	}

	.timeline-swiper {
		position: relative;
		padding-inline: 0;
	}

	.timeline-swiper .swiper-slide {
		width: 320px;
		max-width: 80vw;
		height: auto;
	}

	.timeline-swiper .swiper-slide .timeline-card {
		height: 100%;
	}

	.swiper-button-prev,
	.swiper-button-next {
		--swiper-navigation-size: 28px;
		--swiper-navigation-color: var(--wp--preset--color--terracotta);
		background: var(--wp--preset--color--cream);
		border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 12%, transparent);
		border-radius: 999px;
		width: 44px;
		height: 44px;
		box-shadow: 0 4px 12px color-mix(in srgb, var(--wp--preset--color--ink) 10%, transparent);
	}
}

/* No-JS / fallback rendering keeps the same card style. */
.timeline-fallback .timeline-cards {
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

@media (min-width: 721px) {
	.timeline-fallback .timeline-cards {
		grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.swiper-wrapper {
		transition: none !important;
	}
}
