/**
 * JezPress Elements - shared timeline styles (Vertical + Horizontal Timeline).
 *
 * Everything is driven by custom properties on .jpe-tl so the Elementor
 * style controls only ever set a variable. Default accent follows the
 * Elementor kit's global Accent colour when the site has one.
 *
 * @package JezPress\Elements
 * @since   1.5.0
 */

.jpe-tl {
	--jpe-tl-accent: var(--e-global-color-accent, #2563eb);
	--jpe-tl-line: #e2e8f0;
	--jpe-tl-line-active: var(--jpe-tl-accent);
	--jpe-tl-line-w: 2px;
	--jpe-tl-marker: 40px;
	--jpe-tl-marker-icon: 16px;
	--jpe-tl-marker-bw: 2px;
	--jpe-tl-marker-r: 50%;
	--jpe-tl-marker-bg: #ffffff;
	--jpe-tl-marker-color: #64748b;
	--jpe-tl-marker-border: #cbd5e1;
	--jpe-tl-marker-active-bg: var(--jpe-tl-accent);
	--jpe-tl-marker-active-color: #ffffff;
	--jpe-tl-marker-active-border: var(--jpe-tl-accent);
	--jpe-tl-done: #16a34a;
	--jpe-tl-current: var(--jpe-tl-accent);
	--jpe-tl-upcoming: #94a3b8;
	--jpe-tl-card-bg: #ffffff;
	--jpe-tl-card-pt: 24px;
	--jpe-tl-card-pr: 24px;
	--jpe-tl-card-pb: 24px;
	--jpe-tl-card-pl: 24px;
	--jpe-tl-card-r: 12px;
	--jpe-tl-arrow: 14px;
	--jpe-tl-img-r: 8px;
	position: relative;
	box-sizing: border-box;
}

.jpe-tl *,
.jpe-tl *::before,
.jpe-tl *::after {
	box-sizing: border-box;
}

/* ---- Card ---- */

.jpe-tl .jpe-tl__card {
	position: relative;
	isolation: isolate;
	min-width: 0;
	padding: var(--jpe-tl-card-pt) var(--jpe-tl-card-pr) var(--jpe-tl-card-pb) var(--jpe-tl-card-pl);
	border: 0;
	border-radius: var(--jpe-tl-card-r);
	background: var(--jpe-tl-card-bg);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px -10px rgba(15, 23, 42, 0.16);
	text-align: start;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.jpe-tl .jpe-tl__card:hover,
.jpe-tl .jpe-tl__card:focus-within {
	box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 18px 36px -12px rgba(15, 23, 42, 0.24);
}

.jpe-tl-lift-yes .jpe-tl .jpe-tl__card:hover,
.jpe-tl-lift-yes .jpe-tl .jpe-tl__card:focus-within {
	transform: translateY(-3px);
}

/* Arrow: a rotated square painted between the card's background and its
   content (z-index -1 inside the card's own stacking context), so the half
   inside the card is invisible and the half outside reads as a pointer. */
.jpe-tl .jpe-tl__card::before {
	content: "";
	position: absolute;
	z-index: -1;
	width: var(--jpe-tl-arrow);
	height: var(--jpe-tl-arrow);
	background: inherit;
	transform: rotate(45deg);
}

.jpe-tl.jpe-tl--no-arrow .jpe-tl__card::before {
	display: none;
}

.jpe-tl .jpe-tl__body > :last-child {
	margin-bottom: 0;
}

/* ---- Image ---- */

.jpe-tl .jpe-tl__media {
	margin: 0 0 16px;
	overflow: hidden;
	border-radius: var(--jpe-tl-img-r);
}

.jpe-tl-image-bleed .jpe-tl .jpe-tl__media {
	margin-top: calc(var(--jpe-tl-card-pt) * -1);
	margin-right: calc(var(--jpe-tl-card-pr) * -1);
	margin-left: calc(var(--jpe-tl-card-pl) * -1);
	border-radius: var(--jpe-tl-card-r) var(--jpe-tl-card-r) 0 0;
}

.jpe-tl .jpe-tl__media .jpe-tl__img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: var(--jpe-tl-img-h, auto);
	max-height: var(--jpe-tl-img-h, 360px);
	margin: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	box-shadow: none;
}

/* ---- Text ---- */

.jpe-tl .jpe-tl__date {
	color: var(--jpe-tl-accent);
	font-size: 0.875em;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.4;
}

.jpe-tl .jpe-tl__body > .jpe-tl__date {
	margin-bottom: 6px;
}

.jpe-tl .jpe-tl__title {
	margin: 0 0 8px;
	padding: 0;
	font-size: 1.2em;
	line-height: 1.3;
}

.jpe-tl .jpe-tl__desc {
	color: #475569;
	line-height: 1.6;
}

.jpe-tl .jpe-tl__desc > :first-child {
	margin-top: 0;
}

.jpe-tl .jpe-tl__desc > :last-child {
	margin-bottom: 0;
}

/* ---- Status badge ---- */

.jpe-tl .jpe-tl__badge {
	--jpe-tl-badge: var(--jpe-tl-upcoming);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 10px;
	padding: 5px 10px;
	border-radius: 999px;
	color: var(--jpe-tl-badge);
	background: rgba(100, 116, 139, 0.1);
	background: color-mix(in srgb, var(--jpe-tl-badge) 12%, transparent);
	font-size: 0.75em;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.02em;
}

.jpe-tl .jpe-tl__badge::before {
	content: "";
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

.jpe-tl .jpe-tl__badge--done {
	--jpe-tl-badge: var(--jpe-tl-done);
}

.jpe-tl .jpe-tl__badge--current {
	--jpe-tl-badge: var(--jpe-tl-current);
}

.jpe-tl .jpe-tl__badge--upcoming {
	--jpe-tl-badge: var(--jpe-tl-upcoming);
}

/* ---- Button ---- */

.jpe-tl .jpe-tl__actions {
	margin-top: 16px;
}

.jpe-tl .jpe-tl__button {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 10px 18px;
	border: 0;
	border-radius: 8px;
	background-color: var(--jpe-tl-accent);
	color: #ffffff;
	font-size: 0.875em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.jpe-tl .jpe-tl__button:hover,
.jpe-tl .jpe-tl__button:focus-visible {
	background-color: #0f172a;
	background-color: color-mix(in srgb, var(--jpe-tl-accent) 82%, #000000);
	color: #ffffff;
	text-decoration: none;
}

.jpe-tl .jpe-tl__button:focus-visible {
	outline: 2px solid var(--jpe-tl-accent);
	outline-offset: 2px;
}

/* ---- Marker ---- */

.jpe-tl .jpe-tl__marker {
	position: relative;
	z-index: 1;
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: var(--jpe-tl-marker);
	height: var(--jpe-tl-marker);
	border: var(--jpe-tl-marker-bw) solid var(--jpe-tl-marker-border);
	border-radius: var(--jpe-tl-marker-r);
	background: var(--jpe-tl-marker-bg);
	color: var(--jpe-tl-marker-color);
	font-size: var(--jpe-tl-marker-icon);
	line-height: 1;
	transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.jpe-tl .jpe-tl__marker-text {
	font-size: inherit;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
}

.jpe-tl .jpe-tl__marker-icon {
	display: inline-flex;
	line-height: 1;
}

.jpe-tl .jpe-tl__marker-icon i {
	font-size: inherit;
	line-height: 1;
}

.jpe-tl .jpe-tl__marker-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.jpe-tl .jpe-tl__marker--dot::after {
	content: "";
	width: 32%;
	height: 32%;
	border-radius: 50%;
	background: currentColor;
}

.jpe-tl .jpe-tl__check {
	flex: 0 0 auto;
	width: 55%;
	height: 55%;
}

/* Active: passed by the progress line (vertical) or hovered / focused.
   Items with a status keep their status colours. */
/* Items with a status or their own marker colour keep those colours. */
.jpe-tl .jpe-tl__item:not(.jpe-tl__item--has-status):not(.jpe-tl__item--colored).is-active .jpe-tl__marker,
.jpe-tl .jpe-tl__item:not(.jpe-tl__item--has-status):not(.jpe-tl__item--colored):hover .jpe-tl__marker,
.jpe-tl .jpe-tl__item:not(.jpe-tl__item--has-status):not(.jpe-tl__item--colored):focus-within .jpe-tl__marker {
	border-color: var(--jpe-tl-marker-active-border);
	background: var(--jpe-tl-marker-active-bg);
	color: var(--jpe-tl-marker-active-color);
}

.jpe-tl .jpe-tl__item--done .jpe-tl__marker {
	border-color: var(--jpe-tl-done);
	background: var(--jpe-tl-done);
	color: #ffffff;
}

.jpe-tl .jpe-tl__item--current .jpe-tl__marker {
	border-color: var(--jpe-tl-current);
	background: var(--jpe-tl-current);
	color: #ffffff;
	box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15);
	box-shadow: 0 0 0 5px color-mix(in srgb, var(--jpe-tl-current) 18%, transparent);
}

.jpe-tl .jpe-tl__item--upcoming .jpe-tl__marker {
	border-style: dashed;
	border-color: var(--jpe-tl-upcoming);
	background: var(--jpe-tl-marker-bg);
	color: var(--jpe-tl-upcoming);
}

/* A per-item marker colour wins over every state. */
.jpe-tl .jpe-tl__item--colored .jpe-tl__marker,
.jpe-tl .jpe-tl__item--colored:hover .jpe-tl__marker,
.jpe-tl .jpe-tl__item--colored.is-active .jpe-tl__marker {
	border-color: var(--jpe-tl-item-color);
	background: var(--jpe-tl-item-color);
	color: #ffffff;
}

.jpe-tl-pulse-yes .jpe-tl .jpe-tl__item--current .jpe-tl__marker::before {
	content: "";
	position: absolute;
	inset: calc(var(--jpe-tl-marker-bw) * -1);
	border: 2px solid var(--jpe-tl-current);
	border-radius: inherit;
	animation: jpe-tl-pulse 2.2s ease-out infinite;
	pointer-events: none;
}

@keyframes jpe-tl-pulse {
	0% {
		opacity: 0.7;
		transform: scale(1);
	}
	100% {
		opacity: 0;
		transform: scale(1.7);
	}
}

/* ---- Utilities ---- */

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

.jpe-tl.jpe-tl--empty {
	padding: 24px;
	border: 1px dashed #cbd5e1;
	border-radius: 8px;
	color: #64748b;
	text-align: center;
}

.jpe-tl.jpe-tl--empty p {
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {
	.jpe-tl .jpe-tl__card,
	.jpe-tl .jpe-tl__marker,
	.jpe-tl .jpe-tl__button {
		transition: none;
	}

	.jpe-tl-lift-yes .jpe-tl .jpe-tl__card:hover,
	.jpe-tl-lift-yes .jpe-tl .jpe-tl__card:focus-within {
		transform: none;
	}

	.jpe-tl-pulse-yes .jpe-tl .jpe-tl__item--current .jpe-tl__marker::before {
		display: none;
		animation: none;
	}
}
