/* Scoped Variables */
.timeline-wrapper {
    --timeline-bg: #f8fafc;
    --timeline-card-bg: var(--card-bg);
    --timeline-text: var(--text-color);
    --timeline-text-sub: var(--text-color);
    --timeline-accent: #3b82f6;
    --timeline-line: #64748b; /* Darker Slate */
    --timeline-spacing: 3rem;
}

/* Main Container */
.timeline-container {
    position: relative;
    max-width: 1000px;
    margin: 2rem auto;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.timeline-container * {
    box-sizing: border-box;
}

/* The Central Line (Spine) */
.timeline-spine {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, var(--timeline-line) 3%, var(--timeline-line) 95%, transparent 100%);
    border-radius: 2px;
    z-index: 0;
}

/* Origin Dot */

/* Columns */
.timeline-col {
    flex: 1 1 0px; /* Forces equal width regardless of content */
    width: 50%;    /* Fallback/Reinforcement */
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.timeline-col.left {
    padding-right: var(--timeline-spacing);
    text-align: right;
    align-items: stretch;
}

.timeline-col.right {
    padding-left: var(--timeline-spacing);
    text-align: left;
    align-items: stretch;
}

/* Event Wrapper */
.timeline-event {
    position: relative;
    margin-bottom: 1rem;
    width: 100%;
}

/* Connector Line */
.timeline-event::before {
    content: '';
    position: absolute;
    top: 32px;
    transform: translateY(-50%);
    height: 4px; /* Matches spine width */
    width: var(--timeline-spacing);
    background-color: var(--timeline-line);
}

/* Left Side Connectors */
.timeline-col.left .timeline-event::before {
    right: calc(var(--timeline-spacing) * -1);
}
.timeline-col.left .timeline-event::after {
    right: calc(var(--timeline-spacing) * -1);
    transform: translate(50%, -50%);
}

/* Right Side Connectors */
.timeline-col.right .timeline-event::before {
    left: calc(var(--timeline-spacing) * -1);
}
.timeline-col.right .timeline-event::after {
    left: calc(var(--timeline-spacing) * -1);
    transform: translate(-50%, -50%);
}

/* Card Visuals */
.timeline-card {
    position: absolute;
    /*top: var(--top-offset, 0);;*/
    width: 100%;
    background: var(--timeline-card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    text-align: left; /* Reset text align inside card for readability */
}
/* Ensure Left col text is also left-aligned inside the card if preferred, or keep inherited */
.timeline-col.left .timeline-card {
    text-align: left; /* Optional: Makes reading easier even on left side */
}

.timeline-img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 0.7rem;
}

.timeline-body { padding: 0.5rem 1.5rem 1rem 1.5rem; }

.timeline-date {
    display: inline-block;
    font-family: var(--font-playful);
    font-size: 2rem;
    font-weight: 600;
    color: var(--timeline-text);
    text-transform: uppercase;
}

/* Junction Dot */
.timeline-event::after {
    content: '';
    position: absolute;
    top: 32px;
    width: 12px;
    height: 12px;
    background-color: var(--timeline-line);
    border-radius: 50%;
    z-index: 2;
}

.timeline-title {
    font-size: 1.5rem;
    line-height: 2.0rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    margin-top: 0;
    color: var(--timeline-text);
}

.timeline-desc {
    font-size: 1.2rem;
    color: var(--text-color-muted);
}

/* Mobile Responsive */
@media (max-width: 575px) {
    .timeline-container {
        flex-direction: column;
    }

    /* Hide spacers on mobile to avoid large gaps in single column */
    .timeline-spacer {
        display: none;
    }

    .timeline-spine {
        left: 0px;
        transform: translateX(-50%); /* CENTER THE SPINE ON THE AXIS */
    }

    .timeline-container .timeline-event {
        padding-left: 30px;
    }

    .timeline-card {
        position: relative;
    }

    .timeline-col {
        display: contents;
        flex: auto;
        width: 100%;
    }

    .timeline-col.left, .timeline-col.right {
        text-align: left;
    }

    /* Reset connectors for mobile stack */
    .timeline-col.left .timeline-event::before,
    .timeline-col.right .timeline-event::before {
        left: 0px;
        right: auto;
        width: 30px;
    }

    .timeline-col.left .timeline-event::after,
    .timeline-col.right .timeline-event::after {
        left: 0px;
        right: auto;
        transform: translate(-50%, -50%);
    }
}

@media (min-width: 576px) {
    .timeline-card {
        top: var(--top-offset, 0);
    }

    .timeline-event::after,
    .timeline-event::before {
        top: calc(var(--top-offset, 0) + 32px);
    }

    .timeline-col.right .timeline-event::before,
    .timeline-col.right .timeline-event::after {
        top: calc(var(--top-offset, 0) + 38px);
    }

    .timeline-spine {
        height: var(--spine-height, 100px);
    }
}
