/* timeline.css - Full viewport timeline experience */

/* Body scroll lock utility */
body.timeline-scroll-locked {
	overflow: hidden;
	height: 100vh;
}

.timeline-experience {
	position: relative;
	height: 100vh; /* Full viewport height */
	padding-block: clamp(2rem, 12vh, 4rem);
	padding-top: clamp(6rem, 20vh, 8rem); /* Additional top padding to account for navigation bar */
	/* background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%); */
	scroll-snap-align: start; /* Snap to this section */
	overflow: hidden; /* Prevent internal scrolling */
}

.timeline-experience__container {
	width: 100vw;
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	gap: 3rem;
	position: relative; /* anchor absolute children like card swiper */
}

.timeline-experience__header {
	max-width: 700px;
	display: grid;
	gap: 1rem;
}

.timeline-experience__tag {
	font-size: 0.9rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: #008080;
	font-weight: 600;
}

.timeline-experience__header h2 {
	font-size: clamp(2.25rem, 3.8vw, 3.5rem);
	letter-spacing: -0.035em;
	line-height: 1.1;
	color: #282828;
}

.timeline-experience__header p {
	color: #6b7280;
	font-size: clamp(1rem, 1.15vw, 1.1875rem);
	line-height: 1.7;
}

/* Main layout - full height container */
.timeline-experience__layout {
	position: relative;
	height: 100%;
	display: grid;
	grid-template-columns: 1fr 120px;
	gap: 3rem;
	align-items: center;
	overflow: hidden; /* Prevent card overflow */
}

/* Mobile responsive layout */
@media (max-width: 768px) {
	.timeline-experience__layout {
		grid-template-columns: 1fr;
		gap: 1rem;
		padding: 0 1rem;
	}
}

.timeline-experience__visual {
	position: relative;
	width: 100%;
	height: 600px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1; /* Establish stacking context for years */
}

/* Year Swiper - Large vertical scrolling years */
.timeline-year-swiper {
	width: 100%;
	height: 100%;
	mask-image: linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0) 0%,
		white 30%,
		white 70%,
		rgba(255, 255, 255, 0) 100%
	);
	-webkit-mask-image: linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0) 0%,
		white 30%,
		white 70%,
		rgba(255, 255, 255, 0) 100%
	);
	overflow: hidden;
	position: relative;
	z-index: 1; /* Below cards */
}

.timeline-year-slide {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: clamp(3rem, 9vw, 10rem);
	font-weight: 800;
	color: #374151;
	line-height: 1;
	user-select: none;
	height: 600px;
	opacity: 0;
	transform: scale(1);
	margin-left: 50px;
	transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1), opacity 3s 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-year-slide.timeline-slide-active {
	opacity: 1;
	transform: scale(3) translateY(-10%);
	transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1), opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile responsive year scaling */
@media (max-width: 768px) {
	.timeline-year-slide {
		font-size: clamp(3rem, 10vw, 6rem);
		height: 400px;
		margin-left: 0;
	}

	.timeline-year-slide.timeline-slide-active {
		transform: scale(2) translateY(-30%);
	}
}

.timeline-year-slide.timeline-slide-prev {
	opacity: 0;
	transform: scale(0.5) translateY(200%);
	transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-year-slide.timeline-slide-next {
	opacity: 0;
	transform: scale(0.5) translateY(-150%);
	transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card Swiper - Horizontal overlay spanning full width */
.timeline-card-swiper {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0; /* allow full width; rail will overlay above via higher z-index */
	transform: translateY(-50%);
	width: 100%;
	height: 300px;
	z-index: 10;
	pointer-events: auto; /* Ensure cards can receive pointer events */
}

.timeline-card-swiper.swiper {
	position: absolute !important;
	width: 100% !important;
}

/* Mobile responsive cards */
@media (max-width: 768px) {
	.timeline-card-swiper {
		width: 90% !important;
		height: 250px;
		top: 60%;
		right: 0; /* rail hidden on mobile, allow full width */
	}

	.timeline-card-swiper.swiper {
		width: 90% !important;
	}
}

.timeline-card-slide {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 1rem;
}

.timeline-card {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	text-align: center;
	transition: all 0.3s ease;
	border-radius: 17px;
	padding: 1rem 2rem;

	/* Default (inactive) styling */
	transform: scale(0.7);
	backdrop-filter: blur(10px);
	background: rgba(255, 255, 255, 0.184);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
	color: #008080;
	filter: blur(2px);
}

/* Active card styling (centered slide) */
.timeline-card-slide.swiper-slide-active .timeline-card {
	transform: scale(1);
	background: rgba(0, 128, 128, 0.63);
	backdrop-filter: blur(5px);
	color: #fff;
	filter: blur(0);
	box-shadow: unset !important;
}

.timeline-card h3 {
	font-size: 1.5rem;
	font-weight: 500;
	margin-bottom: 1rem;
	line-height: 1.2;
}

/* Card Navigation */
.timeline-card-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(10px);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #374151;
	z-index: 20;
}

.timeline-card-nav:hover {
	background: rgba(255, 255, 255, 1);
	transform: translateY(-50%) scale(1.1);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.timeline-card-nav--prev {
	left: -60px;
}

.timeline-card-nav--next {
	right: -60px;
}

/* Timeline Rail */
.timeline-experience__rail {
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 20; /* Above cards, below navigation */
	position: relative;
}

/* Mobile responsive - hide rail */
@media (max-width: 768px) {
	.timeline-experience__rail {
		display: none;
	}
}

/* Timeline Navigation Controls */
.timeline-navigation {
	position: absolute;
	top: 2rem;
	left: 2rem;
	z-index: 30;
	display: flex;
	gap: 1rem;
	pointer-events: none; /* Allow clicks to pass through container */
}

/* Mobile responsive navigation */
@media (max-width: 768px) {
	.timeline-navigation {
		top: 1rem;
		left: 1rem;
		right: 1rem;
		justify-content: space-between;
		gap: 0.5rem;
	}

	/* Create a pagination group */
	.timeline-nav-prev {
		order: 1;
	}

	.timeline-nav-next {
		order: 2;
		margin-right: auto;
	}

	.timeline-nav-skip {
		order: 3;
	}
}

.timeline-nav-btn {
	pointer-events: auto; /* Re-enable clicks on buttons */
	width: 48px;
	height: 48px;
	background: rgba(0, 128, 128, 0.9);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(0, 128, 128, 0.3);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	color: white;
	font-size: 14px;
	font-weight: 500;
}

/* Mobile responsive buttons */
@media (max-width: 768px) {
	.timeline-nav-btn {
		width: 44px;
		height: 44px;
		font-size: 12px;
	}
}

.timeline-nav-btn:hover {
	background: rgba(0, 128, 128, 1);
	transform: scale(1.1);
	box-shadow: 0 10px 20px rgba(0, 128, 128, 0.2);
}

.timeline-nav-btn:active {
	transform: scale(0.95);
}

.timeline-nav-btn:disabled,
.timeline-nav-btn.disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

.timeline-nav-btn:disabled:hover,
.timeline-nav-btn.disabled:hover {
	transform: none;
	box-shadow: none;
	background: rgba(0, 128, 128, 0.9);
}

.timeline-nav-skip {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 90px !important;
	padding: 0 1rem !important;
	border-radius: 24px !important;
	gap: 0.5rem;
	background: #ff6b6b !important;
	color: #ffffff !important;
	border: 2px solid #ff6b6b !important;
}

.timeline-nav-skip:hover {
	background: #ff8e8e !important;
	transform: scale(1.05) !important;
	box-shadow: 0 10px 20px rgba(255, 107, 107, 0.4) !important;
}

.timeline-nav-skip svg {
	width: 19px;
	height: 19px;
}

/* Mobile responsive skip button */
@media (max-width: 768px) {
	.timeline-nav-skip {
		padding: 0 0.75rem !important;
		font-size: 12px !important;
	}

	.timeline-nav-skip svg {
		width: 14px;
		height: 14px;
	}
}

.timeline-rail {
	position: relative;
	height: 100%;
	min-height: 500px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	padding-left: 1.5rem;
	backdrop-filter: blur(20px);
	border-radius: 12px;
	overflow: visible;
	transform: translateX(-20px);
}

.timeline-rail::before {
	content: '';
	position: absolute;
	left: 0.75rem;
	top: 0;
	bottom: 0;
	width: 3px;
	background: linear-gradient(
		180deg,
		rgba(255, 107, 107, 0.2) 0%,
		rgba(255, 107, 107, 0.8) 50%,
		rgba(255, 107, 107, 0.2) 100%
	);
	border-radius: 2px;
	box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
	z-index: 1;
	animation: railPulse 3s ease-in-out infinite;
}

.timeline-rail__item {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-left: 0.1rem;
}

.timeline-rail__circle {
	width: 12px;
	height: 12px;
	background: #fff;
	border: 2px solid #d14343;
	border-radius: 50%;
	position: absolute;
	left: calc(-1.5rem + 0.75rem - 6px);
	top: 50%;
	transform: translateY(-50%);
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	flex-shrink: 0;
}

.timeline-rail__item.active .timeline-rail__circle {
	background-color: #ff6b6b;
	width: 16px;
	height: 16px;
	left: calc(-1.5rem + 0.75rem - 8px);
	transform: translateY(-50%) scale(1.1);
	animation: activeCirclePulse 2s ease-in-out infinite;
}

.timeline-rail__item button {
	background: transparent;
	border: none;
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: #9ca3af;
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	text-align: left;
	border-radius: 8px;
	position: relative;
	overflow: hidden;
}

.timeline-rail__item.active button {
	color: #ff6b6b;
	font-weight: 600;
	background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 107, 107, 0.2) 100%);
}

.timeline-rail__item button:hover {
	color: #e55a5a;
	background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(255, 107, 107, 0.1) 100%);
	transform: translateX(2px);
}

/* Cool rail animations */
@keyframes railPulse {
	0%,
	100% {
		opacity: 1;
		box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
	}
	50% {
		opacity: 0.8;
		box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
	}
}

@keyframes activeCirclePulse {
	0%,
	100% {
		box-shadow: 0 0 20px rgba(255, 107, 107, 0.6), 0 4px 12px rgba(255, 107, 107, 0.3),
			inset 0 1px 0 rgba(255, 255, 255, 0.3);
	}
	50% {
		box-shadow: 0 0 30px rgba(255, 107, 107, 0.8), 0 6px 16px rgba(255, 107, 107, 0.4),
			inset 0 1px 0 rgba(255, 255, 255, 0.4);
	}
}
