/* Event timeline block. Interactivity is CSS-only: a radio group switches views and :hover / :focus-visible reveal each event's preview, so there is no script to load or build. */

.icm-timeline {
	--icm-timeline-marker-size: 16px;
	--icm-timeline-marker-border: 3px;
	--icm-timeline-indent: 40px;
	container-type: inline-size;
}

.icm-timeline__visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.icm-timeline__empty {
	margin: 0;
}

/* ---- Month / Season / Year switcher: a pill segmented control ---- */
.icm-timeline__switcher {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 0 var(--wp--preset--spacing--60);
	padding: 4px;
	border: 1px solid var(--wp--preset--color--neutral-200);
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--preset--shadow--xs);
}

/* The radios stay in the layout (not display: none) so they remain focusable and arrow-key navigable. */
.icm-timeline__switch-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.icm-timeline .icm-timeline__switch-label {
	padding: 9px 18px 5px;
	border-radius: 999px;
	color: var(--wp--preset--color--neutral-700);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	cursor: pointer;
	transition: background-color var(--icm-base) var(--icm-ease), color var(--icm-base) var(--icm-ease);
}

.icm-timeline .icm-timeline__switch-label:hover {
	background: var(--wp--preset--color--neutral-200);
	color: var(--wp--preset--color--neutral-900);
}

.icm-timeline__switch-input:checked + .icm-timeline__switch-label {
	background: var(--wp--preset--color--orange);
	color: var(--wp--preset--color--neutral-900);
}

.icm-timeline__switch-input:focus-visible + .icm-timeline__switch-label {
	box-shadow: var(--icm-focus-ring);
}

.icm-timeline:has(.icm-timeline__switch-input[value="month"]:checked) .icm-timeline__view:not(.icm-timeline__view--month),
.icm-timeline:has(.icm-timeline__switch-input[value="season"]:checked) .icm-timeline__view:not(.icm-timeline__view--season),
.icm-timeline:has(.icm-timeline__switch-input[value="year"]:checked) .icm-timeline__view:not(.icm-timeline__view--year) {
	display: none;
}

/* ---- Rail and group markers; markers alternate orange and green because the brand alternates accents section to section ---- */
.icm-timeline__group {
	position: relative;
	padding: 0 0 var(--wp--preset--spacing--60) var(--icm-timeline-indent);
}

.icm-timeline__group::before {
	content: "";
	position: absolute;
	top: 4px;
	bottom: -4px;
	left: calc(var(--icm-timeline-marker-size) / 2 - 1px);
	width: 2px;
	background: var(--wp--preset--color--neutral-300);
}

.icm-timeline__group:last-child {
	padding-bottom: 0;
}

/* The rail fades out after the last group rather than stopping on a hard edge. */
.icm-timeline__group:last-child::before {
	background: linear-gradient(to bottom, var(--wp--preset--color--neutral-300) 60%, transparent);
}

.icm-timeline .icm-timeline__group-title {
	margin: 0 0 var(--wp--preset--spacing--40);
	color: var(--wp--preset--color--neutral-800);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 700;
	letter-spacing: .12em;
	line-height: 1.4;
	text-transform: uppercase;
}

.icm-timeline__group-title::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	box-sizing: border-box;
	width: var(--icm-timeline-marker-size);
	height: var(--icm-timeline-marker-size);
	border: var(--icm-timeline-marker-border) solid var(--wp--preset--color--orange);
	border-radius: 50%;
	background: var(--wp--preset--color--white);
}

.icm-timeline__group:nth-child(even) .icm-timeline__group-title::before {
	border-color: var(--wp--preset--color--green);
}

.icm-timeline__group-count {
	margin-left: 8px;
	color: var(--wp--preset--color--neutral-500);
}

/* ---- Event cards ---- */
.icm-timeline__events {
	display: grid;
	gap: var(--wp--preset--spacing--30);
	margin: 0;
	padding: 0;
	list-style: none;
}

.icm-timeline__event {
	position: relative;
	max-width: 28rem;
}

/* Cards are dark photo cards: the event image fills the card under a near-black wash, and the text sits at the bottom where the wash is deepest. Isolation keeps the image and wash (negative z-index) inside the card, above its background. */
/* Clip rather than hidden: hidden makes the card a scroll container, which fixes its height at the ratio and cuts the top off long titles, while clip leaves the ratio as a minimum the card can grow past. */
.icm-timeline .icm-timeline__event-link {
	position: relative;
	isolation: isolate;
	display: flex;
	align-items: flex-end;
	gap: 14px;
	overflow: clip;
	aspect-ratio: 2 / 1;
	padding: 16px;
	border-radius: 20px;
	background: var(--wp--preset--gradient--dark);
	box-shadow: var(--wp--preset--shadow--sm);
	color: var(--wp--preset--color--neutral-200);
	text-decoration: none;
	transition: box-shadow var(--icm-base) var(--icm-ease), transform var(--icm-base) var(--icm-ease);
}

.icm-timeline .icm-timeline__event-link:hover {
	box-shadow: var(--wp--preset--shadow--md);
	color: var(--wp--preset--color--neutral-200);
	transform: translateY(-2px);
}

.icm-timeline .icm-timeline__event-image {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border-radius: 0;
	object-fit: cover;
}

/* The wash is the brand's near-black alpha overlay, strongest at the bottom for text contrast; hovering deepens it, in line with the brand's hover-deepens-fills rule. */
.icm-timeline .icm-timeline__event-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	transition: background-color var(--icm-base) var(--icm-ease);
}

/* Each shade is the Neutral 900 token mixed with transparent, so the wash follows the palette if the token changes. */
.icm-timeline .has-image .icm-timeline__event-link::after {
	background-color: transparent;
	background-image: linear-gradient(
		to top,
		color-mix(in srgb, var(--wp--preset--color--neutral-900) 86%, transparent) 0%,
		color-mix(in srgb, var(--wp--preset--color--neutral-900) 55%, transparent) 35%,
		color-mix(in srgb, var(--wp--preset--color--neutral-900) 12%, transparent) 75%,
		color-mix(in srgb, var(--wp--preset--color--neutral-900) 5%, transparent) 100%
	);
}

.icm-timeline .has-image .icm-timeline__event-link:hover::after {
	background-color: color-mix(in srgb, var(--wp--preset--color--neutral-900) 14%, transparent);
}

/* Without an image the card stays dark so the list reads as one set, with the graticule in white linework (the brand's motif treatment for dark blocks) fading off the top-right corner. */
.icm-timeline .icm-timeline__event:not(.has-image) .icm-timeline__event-link::after {
	background: url("../motifs/graticule-white.svg") no-repeat right -40px top -40px / 420px auto;
	opacity: .5;
	-webkit-mask-image: radial-gradient(ellipse at top right, #000 15%, transparent 70%);
	mask-image: radial-gradient(ellipse at top right, #000 15%, transparent 70%);
}

.icm-timeline__event-date {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 8px;
	background: var(--wp--preset--color--pale-gold);
	color: var(--wp--preset--color--neutral-900);
	line-height: 1;
}

.icm-timeline__group:nth-child(even) .icm-timeline__event-date {
	background: var(--wp--preset--color--pale-sage);
}

.icm-timeline__event-day {
	padding-top: 3px;
	font-size: 22px;
	font-weight: 300;
	letter-spacing: -0.03em;
}

.icm-timeline__event-month {
	margin-top: 3px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.icm-timeline__event-title {
	display: block;
	color: var(--wp--preset--color--white);
	font-weight: 700;
	line-height: 1.3;
}

.icm-timeline__event-meta,
.icm-timeline__event-location {
	display: block;
	margin-top: 2px;
	color: var(--wp--preset--color--neutral-200);
	font-size: var(--wp--preset--font-size--small);
}

/* The compact card leaves the location to the preview; the Large style shows it. */
.icm-timeline__event-location {
	display: none;
}

/* Past events drop to greyscale and lose their lift so upcoming ones lead. */
.icm-timeline .is-past .icm-timeline__event-link {
	box-shadow: none;
}

.icm-timeline .is-past .icm-timeline__event-image {
	filter: grayscale(1);
}

.icm-timeline .is-past .icm-timeline__event-date {
	background: var(--wp--preset--color--neutral-200);
	color: var(--wp--preset--color--neutral-600);
}

.icm-timeline .is-past .icm-timeline__event-title {
	color: var(--wp--preset--color--neutral-200);
}

/* ---- Next up: the first event that hasn't finished gets the brand's thin orange rule across the top of the card and a pill ---- */
.icm-timeline .is-next .icm-timeline__event-link {
	box-shadow: var(--wp--preset--shadow--md);
}

.icm-timeline .is-next .icm-timeline__event-link::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	z-index: 1;
	height: 4px;
	background: var(--wp--preset--color--orange);
}

.icm-timeline .is-next .icm-timeline__event-date {
	background: var(--wp--preset--color--orange);
}

.icm-timeline__event-badge {
	display: inline-block;
	margin-bottom: 6px;
	padding: 5px 10px 2px;
	border-radius: 999px;
	background: var(--wp--preset--color--orange);
	color: var(--wp--preset--color--neutral-900);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .12em;
	line-height: 1.2;
	text-transform: uppercase;
}

/* ---- Preview card: below the card in narrow layouts, beside it when there is room ---- */
.icm-timeline__event-detail {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 30;
	width: min(22rem, 100%);
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--neutral-200);
	border-radius: 20px;
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--preset--shadow--lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	/* The preview never takes the pointer, so moving across it can't block clicks on the events beneath. */
	pointer-events: none;
	transition: opacity var(--icm-base) var(--icm-ease), transform var(--icm-base) var(--icm-ease), visibility 0s linear var(--icm-base);
}

@container (min-width: 52rem) {
	.icm-timeline__event-detail {
		top: 0;
		left: calc(100% + 16px);
		width: 22rem;
		transform: translateX(-4px);
	}
}

/* Hover previews only on devices that can hover; on touch screens a tap goes straight to the event. Keyboard focus shows it everywhere. */
@media (hover: hover) {
	.icm-timeline .icm-timeline__event:hover .icm-timeline__event-detail {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition-delay: 0s;
	}
}

/* The extra .icm-timeline keeps these reveal rules ahead of the Large style's placement rules further down. */
.icm-timeline .icm-timeline__event:has(.icm-timeline__event-link:focus-visible) .icm-timeline__event-detail {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.icm-timeline__detail-body {
	display: grid;
	gap: 8px;
	padding: 18px 20px 20px;
	color: var(--wp--preset--color--neutral-700);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

.icm-timeline .icm-timeline__detail-body p {
	margin: 0;
}

.icm-timeline .icm-timeline__detail-when {
	color: var(--wp--preset--color--neutral-900);
	font-weight: 700;
}

.icm-timeline .icm-timeline__detail-rsvp {
	color: var(--wp--preset--color--deep-moss);
	font-weight: 700;
}

.icm-timeline .icm-timeline__detail-cta {
	margin-top: 4px;
	color: var(--wp--preset--color--green-accessible);
	font-weight: 700;
}

/* ==== Large style (Styles → Large): a headline-sized timeline for feature placements such as the homepage ==== */
.icm-timeline.is-style-large {
	--icm-timeline-marker-size: 22px;
	--icm-timeline-marker-border: 4px;
	--icm-timeline-indent: 48px;
	--icm-timeline-label-column: 13rem;
	--icm-timeline-column-gap: 72px;
}

.icm-timeline.is-style-large .icm-timeline__group {
	padding-bottom: var(--wp--preset--spacing--80);
}

.icm-timeline.is-style-large .icm-timeline__group:last-child {
	padding-bottom: 0;
}

/* The marker's halo in the page colour breaks the rail around it, so it reads as a stop on the line. */
.icm-timeline.is-style-large .icm-timeline__group-title::before {
	top: 10px;
	box-shadow: 0 0 0 6px var(--wp--preset--color--neutral-100);
}

/* Thin headline for the month, season or year, with the period and count as a small label beneath, following the brand's thin-headline-plus-kicker pairing. */
.icm-timeline.is-style-large .icm-timeline__group-title {
	margin-bottom: var(--wp--preset--spacing--50);
}

.icm-timeline.is-style-large .icm-timeline__group-name {
	display: block;
	margin-bottom: 8px;
	color: var(--wp--preset--color--neutral-900);
	font-size: var(--wp--preset--font-size--heading-1);
	font-weight: 300;
	letter-spacing: -0.03em;
	line-height: 1.05;
	text-transform: none;
}

.icm-timeline.is-style-large .icm-timeline__group-period {
	color: var(--wp--preset--color--neutral-700);
}

.icm-timeline.is-style-large .icm-timeline__group-count {
	margin-left: 4px;
}

/* The separator only makes sense after a period; year groups have none. */
.icm-timeline.is-style-large .icm-timeline__group-period + .icm-timeline__group-count::before {
	content: "· ";
}

.icm-timeline.is-style-large .icm-timeline__events {
	gap: var(--wp--preset--spacing--40);
}

.icm-timeline.is-style-large .icm-timeline__event {
	max-width: 40rem;
}

.icm-timeline.is-style-large .icm-timeline__event-link {
	gap: 20px;
	padding: 24px;
}

.icm-timeline.is-style-large .icm-timeline__event-date {
	width: 76px;
	height: 76px;
	border-radius: 12px;
}

.icm-timeline.is-style-large .icm-timeline__event-day {
	font-size: 34px;
}

.icm-timeline.is-style-large .icm-timeline__event-month {
	font-size: 12px;
}

.icm-timeline.is-style-large .icm-timeline__event-title {
	font-size: var(--wp--preset--font-size--heading-4);
	line-height: 1.25;
}

.icm-timeline.is-style-large .icm-timeline__event-location {
	display: block;
}

/* Phones: keep the Large style's headlines but scale the cards back so titles have room. */
@container (max-width: 36rem) {
	.icm-timeline.is-style-large .icm-timeline__group-name {
		font-size: var(--wp--preset--font-size--heading-2);
	}

	/* A taller ratio on phones leaves the photo room above the date and title. */
	.icm-timeline.is-style-large .icm-timeline__event-link {
		gap: 14px;
		aspect-ratio: 3 / 2;
		padding: 16px;
	}

	.icm-timeline.is-style-large .icm-timeline__event-date {
		width: 60px;
		height: 60px;
	}

	.icm-timeline.is-style-large .icm-timeline__event-day {
		font-size: 26px;
	}

	.icm-timeline.is-style-large .icm-timeline__event-month {
		font-size: 11px;
	}

	.icm-timeline.is-style-large .icm-timeline__event-title {
		font-size: var(--wp--preset--font-size--large);
	}
}

/* Wide placements: the headline moves into a left column beside the rail and stays in view while its events scroll past. */
@container (min-width: 56rem) {
	.icm-timeline.is-style-large .icm-timeline__group {
		display: grid;
		grid-template-columns: var(--icm-timeline-label-column) minmax(0, 1fr);
		column-gap: var(--icm-timeline-column-gap);
		padding-left: 0;
	}

	.icm-timeline.is-style-large .icm-timeline__group::before {
		left: calc(var(--icm-timeline-label-column) + var(--icm-timeline-column-gap) / 2 - 1px);
	}

	.icm-timeline.is-style-large .icm-timeline__group-title {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 112px);
		align-self: start;
		margin: 0;
		text-align: right;
	}

	/* The title is sticky, so it is the marker's positioning box; the marker travels down the rail with it. */
	.icm-timeline.is-style-large .icm-timeline__group-title::before {
		left: calc(100% + var(--icm-timeline-column-gap) / 2 - var(--icm-timeline-marker-size) / 2);
	}

	.icm-timeline.is-style-large .icm-timeline__events {
		grid-column: 2;
	}

	/* Until there is room for the preview beside the card, it opens below it. */
	.icm-timeline.is-style-large .icm-timeline__event-detail {
		top: calc(100% + 8px);
		left: 0;
		width: min(22rem, 100%);
		transform: translateY(4px);
	}
}

@container (min-width: 70rem) {
	/* Leaves exactly enough room for the 22rem preview and its gap, so it never pushes the page sideways. */
	.icm-timeline.is-style-large .icm-timeline__event {
		max-width: min(40rem, calc(100% - 23rem));
	}

	.icm-timeline.is-style-large .icm-timeline__event-detail {
		top: 0;
		left: calc(100% + 16px);
		width: 22rem;
		transform: translateX(-4px);
	}
}
