/* Global styles for a clean look */
body {
font-family: 'Inter', sans-serif;
background-color: #f0f2f5;
color: #333;
margin: 0;
padding: 0;
}
/*
* Main container for the timeline.
* Uses a relative position to serve as the anchor for the absolute-positioned vertical line.
* The width is set to 90% and is centered for a clean layout on all screen sizes.
*/
.lessons-container {
position: relative;
margin: 0 auto;
max-width: 90%;
padding: 50px 0;
}
/*
* The vertical timeline line.
* It's a pseudo-element (`::before`) to create a single, elegant line down the center.
* Positioned absolutely to stay in place as you scroll.
*/
.lessons-container::before {
content: '';
position: absolute;
top: 0;
left: 50%;
width: 4px;
height: 100%;
background-color: #e0e0e0;
transform: translateX(-50%);
}
/*
* The base style for each individual lesson card.
* The cards are positioned to the left and right of the central line.
* 'opacity: 0' and 'transform' are the starting states for the animation.
*/
.lesson-card {
position: relative;
background-color: #fff;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
padding: 30px;
margin-bottom: 80px;
box-sizing: border-box;
transition: opacity 0.6s ease-out, transform 0.6s ease-out;
opacity: 0;
width: calc(50% - 40px); /* Adjusting width for the new layout */
z-index: 2; /* Ensures cards are above the timeline line */
}
/*
* Positioning for the left-side cards.
* The margin pushes them away from the center line.
*/
.lessons-container .lesson-card:nth-child(odd) {
margin-right: calc(50% + 40px);
transform: translateX(-20px);
}
/*
* Positioning for the right-side cards.
* The margin pushes them away from the center line.
*/
.lessons-container .lesson-card:nth-child(even) {
margin-left: calc(50% + 40px);
transform: translateX(20px);
}
/*
* The class added by JavaScript when a card enters the viewport.
* It makes the card visible and moves it into its final position.
*/
.lesson-card.show {
opacity: 1;
transform: translateX(0);
}
/*
* The class added by JavaScript to cards that have been scrolled past.
* It fades them out to create the "disappearing" effect.
*/
.lesson-card.hide {
opacity: 0;
transition: opacity 0.6s ease-out;
transform: translateX(0);
}
/*
* The number marker's base style.
* Positioned absolutely to sit on the central timeline line.
*/
.lesson-number {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #fff;
font-weight: bold;
font-size: 24px;
border-radius: 50%;
width: 50px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 3; /* Ensures numbers are on top of everything */
}
/* Styles for the content inside the card */
.lesson-card-content {
padding: 10px;
}
.lesson-title {
font-size: 28px;
font-weight: bold;
margin-bottom: 10px;
}
.lesson-description {
font-size: 16px;
color: #333;
line-height: 1.6;
margin-bottom: 15px;
}
.supportive-quote {
font-size: 14px;
font-style: italic;
color: #555;
border-left: 3px solid #ddd;
padding-left: 15px;
margin: 15px 0;
}
.lesson-resource {
display: inline-block;
margin-top: 10px;
font-weight: bold;
color: #0077B6;
text-decoration: none;
}
.lesson-footnote {
font-size: 12px;
color: #999;
margin-top: 10px;
}
/*
* Unique color themes for each card.
* The `.card-theme-X` class is applied to the main card container.
*/
.card-theme-1 .lesson-number { background-color: #00B8A1; }
.card-theme-1 .lesson-title { color: #00B8A1; }
.card-theme-2 .lesson-number { background-color: #008C9E; }
.card-theme-2 .lesson-title { color: #008C9E; }
.card-theme-3 .lesson-number { background-color: #0077B6; }
.card-theme-3 .lesson-title { color: #0077B6; }
.card-theme-4 .lesson-number { background-color: #0096C7; }
.card-theme-4 .lesson-title { color: #0096C7; }
.card-theme-5 .lesson-number { background-color: #00B4D8; }
.card-theme-5 .lesson-title { color: #00B4D8; }
.card-theme-6 .lesson-number { background-color: #2196C1; }
.card-theme-6 .lesson-title { color: #2196C1; }
.card-theme-7 .lesson-number { background-color: #5BC0DE; }
.card-theme-7 .lesson-title { color: #5BC0DE; }
.card-theme-8 .lesson-number { background-color: #007F5F; }
.card-theme-8 .lesson-title { color: #007F5F; }
.card-theme-9 .lesson-number { background-color: #023E8A; }
.card-theme-9 .lesson-title { color: #023E8A; }
.card-theme-10 .lesson-number { background-color: #03045E; }
.card-theme-10 .lesson-title { color: #03045E; }
.card-theme-11 .lesson-number { background-color: #4F98CA; }
.card-theme-11 .lesson-title { color: #4F98CA; }
.card-theme-12 .lesson-number { background-color: #1CA9C9; }
.card-theme-12 .lesson-title { color: #1CA9C9; }
/* Media queries for smaller screens */
@media (max-width: 768px) {
.lessons-container::before {
left: 20px;
transform: none;
}
.lesson-card {
width: calc(100% - 40px); /* Full width for mobile */
margin-left: 40px !important; /* Forces all cards to the right of the line */
margin-right: 0 !important;
}
/* Resetting the transforms for mobile to a single direction */
.lessons-container .lesson-card:nth-child(odd),
.lessons-container .lesson-card:nth-child(even) {
transform: translateX(0); /* All cards start at the same position */
}
/* Adjusting the scroll-in animation for mobile */
.lesson-card.show {
transform: translateX(0);
}
.lesson-card.hide {
transform: translateX(-20px); /* Hide to the left */
}
.lesson-number {
left: 20px;
transform: translateX(-50%);
}
}