/**
 * Ripple Effect Timeline
 *
 * Geometry (from the 1728px comp): years sit on a 90px column grid, each card is
 * centered under its year's dot and hangs from a thin stem. ripple-timeline.js only
 * decides which row (--row) each card sits on and how tall the area must be.
 */

.pi-ripple {
	--col-w: clamp(64px, 5.2vw, 90px);
	--card-w: clamp(184px, 13.8vw, 248px);
	--card-h: clamp(52px, 3.7vw, 64px);
	--row-gap: clamp(12px, 1.16vw, 20px);
	--pitch: calc(var(--card-h) + var(--row-gap));
	--stem-gap: clamp(14px, 1.4vw, 24px);
	--pad: max(var(--pi-gutter), calc(var(--pi-gutter) + var(--card-w) / 2 - var(--col-w) / 2));
	--stem: var(--pi-mist);
}

.pi-ripple__heading {
	margin-bottom: clamp(18px, 1.6vw, 28px);
	text-align: center;
}

/* ---- Scroll viewport ---- */
.pi-ripple__viewport {
	--fade-l: 0px;
	--fade-r: 0px;
	position: relative;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	cursor: grab;
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
}

.pi-ripple__viewport::-webkit-scrollbar {
	display: none;
}

.pi-ripple__viewport.can-left { --fade-l: clamp(40px, 5vw, 90px); }
.pi-ripple__viewport.can-right { --fade-r: clamp(40px, 5vw, 90px); }

.pi-ripple__viewport.is-dragging {
	cursor: grabbing;
	user-select: none;
}

.pi-ripple__viewport.is-dragging .pi-ripple__card {
	pointer-events: none;
}

.pi-ripple__viewport:focus-visible {
	outline-offset: -2px;
}

.pi-ripple__track {
	box-sizing: content-box;
	width: calc(var(--years) * var(--col-w));
	padding-inline: var(--pad);
	margin-inline: auto;
}

/* ---- Year axis ---- */
.pi-ripple__axis {
	display: grid;
	grid-template-columns: repeat(var(--years), var(--col-w));
	margin: 0;
	padding: 10px 0 0; /* room for the active year inside the clipped scroll area */
	list-style: none;
}

.pi-ripple__year {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(6px, .6vw, 10px);
	font-family: var(--pi-font-sans);
	font-weight: var(--pi-fw-sans);
	font-size: clamp(12px, .8vw, 14px);
	line-height: 1.2;
	color: var(--pi-navy);
	transition: color .3s;
}

.pi-ripple__dot {
	position: relative;
	display: block;
	width: 9px;
	height: 9px;
}

.pi-ripple__dot > span {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--pi-navy);
	transition: transform .45s var(--pi-ease-spring), background-color .3s;
}

.pi-ripple__year.is-active .pi-ripple__dot > span {
	transform: scale(1.45);
}

.pi-ripple.has-active .pi-ripple__year:not(.is-active) {
	color: color-mix(in srgb, var(--pi-navy) 45%, #fff);
}

/* ---- Events ---- */
.pi-ripple__events {
	position: relative;
	height: var(--events-h, calc(4 * var(--pitch) + 140px));
	margin: var(--stem-gap) 0 0;
	padding: 0;
	list-style: none;
}

.pi-ripple__event {
	position: absolute;
	top: calc(var(--row, 0) * var(--pitch));
	left: calc(var(--col) * var(--col-w) + var(--col-w) / 2 - var(--card-w) / 2);
	width: var(--card-w);
}

.pi-ripple__stem {
	position: absolute;
	left: 50%;
	bottom: 100%;
	z-index: 0;
	width: 1px;
	height: calc(var(--row, 0) * var(--pitch) + var(--stem-gap) - 2px);
	background: var(--stem);
	transform-origin: top;
	transition: background-color .3s, width .3s, opacity .3s;
}

.pi-ripple__card {
	position: relative;
	z-index: 1;
	border-radius: var(--pi-radius);
	overflow: hidden;
	transition: transform .45s var(--pi-ease), box-shadow .45s var(--pi-ease), opacity .35s, filter .35s;
}

.pi-ripple__toggle {
	display: flex;
	align-items: center; /* year + arrow sit on the card's vertical center */
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	height: var(--card-h);
	padding: 0 clamp(10px, .9vw, 16px);
	border: 0;
	background: none;
	color: inherit;
	text-align: left;
	cursor: pointer;
}

.pi-ripple__card-year {
	font-family: var(--pi-font-sans);
	font-weight: var(--pi-fw-sans);
	font-size: clamp(2rem, 2.9vw, 3.15rem);
	line-height: 1;
	letter-spacing: -0.01em;
	padding-top: .07em; /* numerals have no descenders - nudge down to look optically centered */
}

.pi-ripple__arrow {
	flex: none;
	width: clamp(20px, 1.5vw, 26px);
	height: clamp(20px, 1.5vw, 26px);
	transition: transform .55s var(--pi-ease-spring);
}

.pi-ripple__body {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .5s var(--pi-ease);
}

.pi-ripple__body-inner {
	overflow: hidden;
	padding: 0 clamp(10px, .9vw, 16px);
	font-family: var(--pi-font-sans);
	font-weight: var(--pi-fw-sans);
}

.pi-ripple__body-inner > :last-child {
	margin-bottom: clamp(12px, 1vw, 16px);
}

.pi-ripple__body-inner > * {
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity .3s, transform .45s var(--pi-ease);
}

.pi-ripple__media {
	margin-bottom: 10px;
	aspect-ratio: 16 / 9;
	border-radius: calc(var(--pi-radius) - 3px);
	overflow: hidden;
}

.pi-ripple__media img,
.pi-ripple__media .pi-ph {
	width: 100%;
	height: 100%;
	object-fit: cover;
	min-height: 0;
}

.pi-ripple__title {
	margin-bottom: 4px;
	font-size: clamp(1rem, 1.1vw, 1.2rem);
	font-weight: 600;
	line-height: 1.15;
}

.pi-ripple__desc {
	margin: 0;
	font-size: clamp(.95rem, 1.1vw, 1.2rem);
	line-height: 1.12;
}

.pi-ripple__link {
	display: inline-block;
	margin-top: 8px;
	font-size: clamp(.9rem, .95vw, 1rem);
	font-weight: 600;
	color: inherit;
	text-decoration: underline;
}

/* ---- Active (hover / focus / tap) ---- */
.pi-ripple__event.is-active {
	z-index: 5;
}

.pi-ripple__event.is-active .pi-ripple__card {
	transform: translateY(-3px);
	box-shadow: 0 24px 44px -20px rgba(10, 37, 54, .55);
}

.pi-ripple__event.is-active .pi-ripple__body {
	grid-template-rows: 1fr;
}

.pi-ripple__event.is-active .pi-ripple__body-inner > * {
	opacity: 1;
	transform: none;
	transition-delay: .12s;
}

.pi-ripple__event.is-active .pi-ripple__arrow {
	transform: rotate(180deg);
}

.pi-ripple__event.is-active .pi-ripple__stem {
	width: 2px;
	background: var(--pi-navy);
}

.pi-ripple.has-active .pi-ripple__event:not(.is-active) .pi-ripple__card {
	opacity: .38;
	filter: saturate(.7);
}

.pi-ripple.has-active .pi-ripple__event:not(.is-active) .pi-ripple__stem {
	opacity: .5;
}

/* Same-year siblings stay readable */
.pi-ripple.has-active .pi-ripple__event.is-sibling .pi-ripple__card {
	opacity: .8;
}

/* ---- Controls ---- */
.pi-ripple__controls {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: -52px; /* the scroll area keeps 56px spare below the cards for their shadow */
}

.pi-ripple__progress {
	position: relative;
	flex: 1;
	height: 2px;
	margin-right: 10px;
	border-radius: 2px;
	background: var(--pi-mist);
	overflow: hidden;
}

.pi-ripple__progress span {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: var(--thumb-w, 30%);
	border-radius: 2px;
	background: var(--pi-navy);
	transform: translateX(var(--thumb-x, 0));
	transition: transform .15s linear;
}

.pi-ripple__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	padding: 14px;
	border: 0;
	border-radius: var(--pi-radius);
	background: var(--pi-navy);
	color: #fff;
	cursor: pointer;
	transition: opacity .25s;
}

/* The site arrow turned to point straight back / ahead */
.pi-ripple__nav .pi-icon {
	width: 100%;
	height: 100%;
	transform: rotate(var(--turn));
	transition: transform .55s var(--pi-ease-spring);
}

.pi-ripple__nav--prev { --turn: 135deg; }
.pi-ripple__nav--next { --turn: -45deg; }

/* Hover styles only where hover exists (avoids "stuck" hover after a tap on iOS) */
@media (hover: hover) {
	.pi-ripple__nav:hover:not(:disabled) .pi-icon {
		transform: rotate(calc(var(--turn) + 360deg));
	}
}

.pi-ripple__nav:disabled {
	opacity: .3;
	cursor: default;
}

/* Everything fits - no need for controls */
.pi-ripple.is-static .pi-ripple__controls {
	display: none;
}

.pi-ripple.is-static .pi-ripple__viewport {
	cursor: default;
}

/* ==========================================================================
   Touch / tap mode (phones + tablets): cards open on tap, with tap feedback
   ========================================================================== */
.pi-ripple__hint {
	display: none;
}

/* Ripple wave that spreads from the tapped point (created by ripple-timeline.js) */
.pi-ripple__wave {
	position: absolute;
	z-index: 0;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, .18) 45%, rgba(255, 255, 255, 0) 70%);
	transform: scale(0);
	pointer-events: none;
	animation: pi-tap-wave .75s cubic-bezier(.2, .6, .35, 1) forwards;
}

@keyframes pi-tap-wave {
	0%   { transform: scale(0); opacity: 1; }
	100% { transform: scale(1); opacity: 0; }
}

/* Keep the card's text above the wave */
.pi-ripple__toggle,
.pi-ripple__body {
	position: relative;
	z-index: 1;
}

@media (hover: none), (max-width: 991.98px) {
	.pi-ripple__hint {
		display: block;
		margin: -10px 0 14px;
		font-family: var(--pi-font-sans);
		font-weight: var(--pi-fw-sans);
		font-size: .85rem;
		letter-spacing: .02em;
		color: var(--pi-slate);
		text-align: center;
		transition: opacity .4s, transform .4s var(--pi-ease);
	}

	.pi-ripple.has-tapped .pi-ripple__hint {
		opacity: 0;
		transform: translateY(-4px);
	}

	.pi-ripple__toggle {
		-webkit-tap-highlight-color: transparent;
		touch-action: manipulation;
	}

	/* Press feedback */
	.pi-ripple__event .pi-ripple__card:active {
		transform: scale(.965);
		transition-duration: .12s;
	}

	.pi-ripple__event.is-active .pi-ripple__card:active {
		transform: translateY(-3px) scale(.975);
	}

	/* Tapping a year on the axis */
	.pi-ripple__year.has-event {
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	/* One-time nudge on the first card: "I open" */
	.pi-ripple__card.is-nudge {
		animation: pi-tap-nudge 1.4s cubic-bezier(.34, 1.56, .64, 1);
	}

	.pi-ripple__card.is-nudge .pi-ripple__arrow {
		animation: pi-tap-nudge-arrow 1.4s cubic-bezier(.34, 1.56, .64, 1);
	}

	@keyframes pi-tap-nudge {
		0%, 100% { transform: none; }
		18%      { transform: translateY(-5px) scale(1.03); }
		36%      { transform: none; }
		54%      { transform: translateY(-3px) scale(1.015); }
		72%      { transform: none; }
	}

	@keyframes pi-tap-nudge-arrow {
		0%, 100% { transform: none; }
		18%, 54% { transform: rotate(180deg); }
		36%, 72% { transform: none; }
	}
}
