:root {
    --timeline-item-height: 500px; 
    --waypoint-width: 120px;
    --content-max-width: 1200px;
    --primary-color: #e74c3c;
    --text-color: #43292C;
    --border-color: #43292C;
}

.timeline-container {
    display: flex;
    max-width: calc(var(--content-max-width) + var(--waypoint-width) + 40px);
    margin: 0 auto;
    padding: 60px 20px;
    position: relative;
}

.waypoint-nav {
    position: sticky;
    top: 100px;
    width: var(--waypoint-width);
    height: calc(100vh - 200px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    margin-right: 40px;
    flex-shrink: 0;
}

.waypoint-year {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    z-index: 2;
    position: absolute;
    right: 0;
    transform: translateY(-50%);
}

.waypoint-year.start-year {
    top: 10px;
}

.waypoint-year.end-year {
    bottom: 10px;
    transform: translateY(50%);
}

.waypoint-track {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    margin: 10px 0;
}

.waypoint-track::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(100% - 50px);
    background-image: repeating-linear-gradient(
        to bottom,
        var(--border-color) 0px,
        var(--border-color) 2px,
        transparent 2px,
        transparent 30px
    );
    background-position: 0 0;
    pointer-events: none;
}

.waypoint-track::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: calc(100% - 50px);
    height: 2px;
    background: var(--border-color);
    pointer-events: none;
}

.waypoint-needle {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(100% - 40px);
    height: 2px;
    background: var(--border-color);
    transition: top 0.3s ease-out;
    z-index: 3;
}

.waypoint-needle::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}


.timeline-content {
    flex: 1;
    position: relative;
}

.timeline-item {
    display: flex;
    gap: 40px;
    margin-bottom: 80px;
    height: var(--timeline-item-height);
    opacity: 0.3;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.active {
    opacity: 1;
    transform: translateY(0);
}

.timeline-image {
    flex: 0 0 500px;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.timeline-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.timeline-year {
    font-size: 48px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.timeline-subtitle {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #538388;
    text-transform: uppercase;
}

.timeline-title {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.2;
}

.timeline-description {
    font-size: 16px;
    color: var(--border-color);
}

.timeline-description p {
    margin-bottom: 15px;
}

.timeline-description p:last-child {
    margin-bottom: 0;
}

.timeline-description strong {
    color: var(--text-color);
}

@media (max-width: 968px) {
    :root {
        --waypoint-width: 80px;
        --timeline-item-height: 600px;
    }

    .timeline-container {
        padding: 40px 15px;
    }

    .waypoint-nav {
        margin-right: 20px;
    }

    .timeline-item {
        gap: 30px;
    }

    .timeline-image {
        flex: 0 0 300px;
    }

    .timeline-year {
        font-size: 36px;
    }

    .timeline-title {
        font-size: 24px;
    }
}

@media (max-width: 640px) {
    :root {
        --waypoint-width: 60px;
        --timeline-item-height: 500px;
    }

    .waypoint-nav {
        margin-right: 15px;
    }

    .waypoint-year {
        font-size: 14px;
    }

    .waypoint-year::before {
        width: calc(100% - 40px);
    }

    .waypoint-track::before {
        width: calc(100% - 40px);
    }

    .waypoint-needle {
        width: calc(100% - 40px);
    }

    .timeline-item {
        gap: 20px;
    }

    .timeline-image {
        flex: 0 0 250px;
    }

    .timeline-year {
        font-size: 28px;
    }

    .timeline-title {
        font-size: 20px;
    }

    .timeline-description {
        font-size: 14px;
    }
}


@media (max-width: 600px) {
    .timeline-container {
        padding: 40px 5px;
    }
    .timeline-image {
        flex: 0 0 150px;
        box-shadow: none;
    }
    .timeline-image img {
        object-fit: contain
    }
}

@media (max-width: 480px) {
    .timeline-image {
        flex: 0 0 100px;
    }
    .waypoint-nav {
        margin-right: 5px;
    }    
}