/* =========================================
   TIMELINE SECTION
   ========================================= */

.timeline-section {
    padding: 60px 20px;
    background-color: var(--bg-body);
    overflow-x: hidden; /* Prevents scrollbar issues with animations */
}

.timeline-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

/* THE CENTRAL LINE */
.timeline-container::after {
    content: "";
    position: absolute;
    width: 4px;
    background-color: #e0e0e0; /* Light grey line */
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
    border-radius: 2px;
    z-index: 0;
}

/* TIMELINE ITEM WRAPPER */
.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    box-sizing: border-box;
    margin-bottom: 40px;
}

/* Left vs Right positioning */
.timeline-item.left {
    left: 0;
    text-align: right; /* Text aligns towards center */
}

.timeline-item.right {
    left: 50%;
    text-align: left;
}

/* THE YELLOW DOTS (MARKERS) */
.timeline-dot {
    height: 24px;
    width: 24px;
    background-color: var(--primary);
    border: 4px solid var(--white);
    border-radius: 50%;
    position: absolute;
    top: 20px;
    right: -12px;
    z-index: 10;
    box-shadow: 0 0 0 3px rgba(51, 254, 0, 0.3); /* Soft glow */
}

.timeline-item.right .timeline-dot {
    left: -12px;
}

/* THE DATE (Floating next to dot) */
.timeline-date {
    position: absolute;
    top: 18px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary); /* Jade color for the year */
    z-index: 10;
}

.timeline-item.left .timeline-date {
    right: -90px; /* Position year on the right side of the line */
    text-align: left;
}

.timeline-item.right .timeline-date {
    left: -90px; /* Position year on the left side of the line */
    text-align: right;
}

/* THE CONTENT CARD (White & Clean) */
.timeline-content {
    background-color: #1a283b;
    border-radius: 20px; /* Softer corners */
    position: relative;
    box-shadow: 0 10px 30px -10px rgba(0, 37, 82, 0.1); /* Sophisticated shadow */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden; /* Clips image */

    /* ensure we don't keep old padding from earlier rules */
    padding: 0;
}

/* Hover Effect: Lift & Sharpen Shadow */
.timeline-content:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -12px rgba(0, 168, 107, 0.2); /* Jade glow on hover */
}

/* Remove the "Speech Bubble" Triangle */
.timeline-content::after {
    display: none;
}

/* IMAGE STYLING */
.timeline-image {
    width: 100%;
    height: 310px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    border-bottom: 4px solid var(--primary); /* keep your existing separator */
}

/* Zoom Image on Hover */
.timeline-content:hover .timeline-image {
    transform: scale(1.05);
}

/* TEXT WRAPPER */
.timeline-body {
    padding: 30px;
    text-align: left !important; /* Force left align text even on left cards */
}

.timeline-body h3 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.timeline-body p {
    font-size: 1rem;
    line-height: 1.7;
    color: white;
    margin: 0;
}

/* =========================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================= */
@media screen and (max-width: 768px) {
    /* 1. Move the vertical line closer to the left edge */
    .timeline-container::after {
        left: 20px; /* Was 31px */
    }

    /* 2. Give the card more width by reducing left padding */
    .timeline-item {
        width: 100%;
        padding-left: 50px; /* Reduced from 70px to give image more space */
        padding-right: 10px; /* Reduced right padding */
        margin-bottom: 30px;
    }

    /* 3. FIX FOR SQUISHED IMAGES */
    .timeline-image {
        /* Reduce height on mobile so it maintains a nice landscape ratio */
        height: 200px;
    }

    /* Reset positioning for Right items */
    .timeline-item.right {
        left: 0;
    }

    /* Align all text left */
    .timeline-item.left,
    .timeline-item.right {
        text-align: left;
    }

    /* 4. Re-align the Dots to the new line position */
    .timeline-dot,
    .timeline-item.right .timeline-dot {
        left: 8px; /* (Line Left 20px) - (Dot Center 12px) = 8px */
        right: auto;
    }

    /* 5. Date Styling adjustments */
    .timeline-date {
        position: relative;
        top: -5px;
        left: 0 !important;
        right: auto !important;
        margin-bottom: 5px;
        display: block;
        text-align: left !important;
        font-size: 1rem;
    }

    /* 6. Fix the "Speech Bubble" triangle (Optional: or hide it) */
    .timeline-item.left .timeline-content::after,
    .timeline-item.right .timeline-content::after {
        right: auto;
        left: -10px;
        border-width: 10px 10px 10px 0;
        border-color: transparent #1a283b transparent transparent; /* Match card bg */
    }
}
