/*
 * digiloom: history timeline.
 * Source: Figma Make `History.tsx`. Framer Motion drove the rail fill from
 * scroll progress through the container; here the fill height is a custom
 * property set by js/digiloom-motion.js. With no JS the rail reads as fully
 * drawn, so no milestone is ever hidden.
 *
 * Layout: single left-rail column on small screens; from 782px the cards
 * alternate either side of a centre rail.
 */

.digiloom-timeline {
	margin-inline: auto;
	max-width: 896px;
	padding-block: 40px;
	position: relative;
	z-index: 1;
}

/* The grey rail. */
.digiloom-timeline::before {
	background-color: var(--wp--preset--color--slate-line);
	border-radius: var(--wp--custom--radius--full);
	bottom: 0;
	content: "";
	left: 32px;
	position: absolute;
	top: 0;
	transform: translateX(-50%);
	width: 4px;
}

/* The gradient fill that tracks scroll. */
.digiloom-timeline::after {
	background-image: linear-gradient(180deg, #4f46e5 0%, #9333ea 50%, #ec4899 100%);
	border-radius: var(--wp--custom--radius--full);
	content: "";
	height: var(--digiloom-timeline-progress, 100%);
	left: 32px;
	position: absolute;
	top: 0;
	transform: translateX(-50%);
	transition: height 120ms linear;
	width: 4px;
}

@media (min-width: 782px) {

	.digiloom-timeline::before,
	.digiloom-timeline::after {
		left: 50%;
	}
}

/* Items -------------------------------------------------------------- */

.digiloom-timeline__item {
	position: relative;
}

.digiloom-timeline__item + .digiloom-timeline__item {
	margin-top: 80px;
}

/* Milestone node on the rail. */
.digiloom-timeline__item::before {
	background-color: var(--wp--preset--color--white);
	border: 4px solid var(--wp--preset--color--base);
	border-radius: var(--wp--custom--radius--full);
	box-shadow: var(--wp--preset--shadow--light);
	content: "";
	height: 48px;
	left: 32px;
	position: absolute;
	top: 24px;
	transform: translateX(-50%);
	width: 48px;
	z-index: 2;
	background-position: center;
	background-repeat: no-repeat;
	background-size: 20px 20px;
}

@media (min-width: 782px) {

	.digiloom-timeline__item::before {
		height: 56px;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		width: 56px;
	}
}

.digiloom-timeline__card {
	background-color: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--slate-line);
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--wp--preset--shadow--light);
	margin-left: 72px;
	overflow: hidden;
	padding: 24px;
	position: relative;
	transition: box-shadow var(--wp--custom--transition--slow), border-color var(--wp--custom--transition--slow);
}

.digiloom-timeline__card:hover {
	border-color: #cbd5e1;
	box-shadow: var(--wp--preset--shadow--card);
}

/* Era gradient bar across the card top. */
.digiloom-timeline__card::before {
	content: "";
	height: 6px;
	inset: 0 0 auto 0;
	opacity: 0.8;
	position: absolute;
}

@media (min-width: 782px) {

	.digiloom-timeline__card {
		margin-left: 0;
		padding: 32px;
		width: calc(50% - 48px);
	}

	/* Odd milestones sit left of the rail and read right-aligned. */
	.digiloom-timeline__item:nth-child(odd) .digiloom-timeline__card {
		text-align: right;
	}

	/* Even milestones sit right of the rail. */
	.digiloom-timeline__item:nth-child(even) .digiloom-timeline__card {
		margin-left: auto;
	}
}

.digiloom-timeline__year {
	background-color: var(--wp--preset--color--slate-tint);
	border-radius: var(--wp--custom--radius--full);
	display: inline-block;
	font-size: var(--wp--preset--font-size--xx-small);
	font-weight: var(--wp--custom--font-weight--bold);
	margin: 0 0 8px;
	padding: 6px 16px;
}

.digiloom-timeline__title {
	margin: 0;
}

.digiloom-timeline__text {
	color: var(--wp--preset--color--slate);
	font-size: var(--wp--preset--font-size--x-small);
	line-height: var(--wp--custom--line-height--body);
	margin: 0;
}

/* Per-era palettes --------------------------------------------------- */

/* 1998 — indigo, code glyph */
.digiloom-timeline__item:nth-child(1) .digiloom-timeline__card::before { background-image: linear-gradient(90deg, #6366f1, #3b82f6); }
.digiloom-timeline__item:nth-child(1) .digiloom-timeline__year { color: #4f46e5; }
.digiloom-timeline__item:nth-child(1)::before {
	background-color: var(--wp--preset--color--indigo-line);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 18 6-6-6-6'/%3E%3Cpath d='m8 6-6 6 6 6'/%3E%3C/svg%3E");
}

/* 2007 — blue, rocket glyph */
.digiloom-timeline__item:nth-child(2) .digiloom-timeline__card::before { background-image: linear-gradient(90deg, #3b82f6, #4f46e5); }
.digiloom-timeline__item:nth-child(2) .digiloom-timeline__year { color: #2563eb; }
.digiloom-timeline__item:nth-child(2)::before {
	background-color: #dbeafe;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91 0z'/%3E%3Cpath d='m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z'/%3E%3Cpath d='M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0'/%3E%3Cpath d='M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5'/%3E%3C/svg%3E");
}

/* 2014–2025 — purple, briefcase glyph */
.digiloom-timeline__item:nth-child(3) .digiloom-timeline__card::before { background-image: linear-gradient(90deg, #4f46e5, #9333ea); }
.digiloom-timeline__item:nth-child(3) .digiloom-timeline__year { color: #9333ea; }
.digiloom-timeline__item:nth-child(3)::before {
	background-color: #f3e8ff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239333ea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16'/%3E%3Crect width='20' height='14' x='2' y='6' rx='2'/%3E%3C/svg%3E");
}

/* 2026 — pink, sparkles glyph */
.digiloom-timeline__item:nth-child(4) .digiloom-timeline__card::before { background-image: linear-gradient(90deg, #9333ea, #ec4899); }
.digiloom-timeline__item:nth-child(4) .digiloom-timeline__year { color: #db2777; }
.digiloom-timeline__item:nth-child(4)::before {
	background-color: #fce7f3;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23db2777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z'/%3E%3C/svg%3E");
}
