.timeline-container {
    position: relative;
    max-width: 1000px;
    margin: auto;
    margin-top: 35px;
    margin-bottom: 35px;

    overflow: hidden;
}

.timeline-legend {
    position: absolute;
    top: 10px;
    right: 15px;
    z-index: 10;

    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0px;
    flex-wrap: wrap;
    font-size: 18px;

    padding: 10px 15px;
    margin: 0;

    background-color: var(--color-surface-secondary);
    border: solid 2px var(--color-border-subtle);
    border-radius: 5px;
}

.timeline-legend p {
    margin-bottom: 3px;
    font-weight: 700;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
}

.legend-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--event-color);
}

.legend-dot.square {
    border-radius: 0;
}

.legend-dot.triangle {
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.timeline {
    position: relative;
    margin: 25px;
}

.timeline:before {
    content: "";
    position: absolute;
    top: 20px;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: var(--color-support-lighter);
}

.timeline-month {
    display: flex;
    justify-content: center;
    align-content: center;
    position: relative;
    z-index: 2;
    width: max-content;
    min-width: 170px;
    margin: 10px auto 22px;
    padding: 7px 20px;
    border-radius: 14px;
    background: #3E3C53;
    color: white;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
}

.timeline-event {
    --event-color: var(--color-primary);
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0 0 18px;
    min-height: 100px;
    overflow: visible;
}

.timeline-event[data-type="empower"] {
    --event-color: var(--color-accent);
}

.timeline-event[data-type="protect"] {
    --event-color: var(--color-canada);
}

.timeline-card {
    position: relative;
    width: calc(100% - 66px);
    padding-top: 4px;
}

.timeline-event[data-side="left"] .timeline-card {
    grid-column: 1;
    justify-self: start;
    text-align: right;
}

.timeline-event[data-side="right"] .timeline-card {
    grid-column: 2;
    justify-self: end;
    text-align: left;
}

.timeline-card h4 {
    display: block;
    color: var(--event-color);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 22px;
    line-height: 22px;
}

.timeline-card p {
    margin: 0;
    color: var(--event-color);
}

.timeline-node {
    position: absolute;
    z-index: 1;
    top: 7px;
    left: 50%;
    width: 17px;
    height: 17px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: var(--event-color)
}

.timeline-connector {
    position: absolute;
    top: 15px;
    width: 40px;
    height: 2px;
    background: repeating-linear-gradient(to right, var(--event-color) 0 8px, transparent 8px 15px);
}

.timeline-event[data-side="left"] .timeline-connector {
    right: calc(50% + 8px);
}

.timeline-event[data-side="right"] .timeline-connector {
    left: calc(50% + 8px);
}

.timeline-outer-dot {
    position: absolute;
    top: 9px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--event-color);
}

.timeline-event[data-type="protect"] .timeline-outer-dot, .timeline-event[data-type="protect"] .timeline-node {
    border-radius: 0;
}

.timeline-event[data-type="build"] .timeline-outer-dot, .timeline-event[data-type="build"] .timeline-node {
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.timeline-event[data-type="build"][data-side="right"] .timeline-outer-dot {
    transform: rotate(90deg);
}

.timeline-event[data-type="build"][data-side="left"] .timeline-outer-dot {
    transform: rotate(-90deg);
}

.timeline-event[data-side="left"] .timeline-outer-dot {
    right: calc(50% + 41.5px);
}

.timeline-event[data-side="right"] .timeline-outer-dot {
    left: calc(50% + 41.5px);
}

@media(max-width:700px) {
    .timeline-legend {
        position: relative;
        width: 250px;
        left: 20px;
    }

    .timeline:before {
        left: 15px
    }

    .timeline-month {
        margin: 12px 0 24px 0;
        min-width: 145px
    }

    .timeline-event {
        display: block;
        margin-bottom: 30px;
        min-height: 0;
        padding-left: 80px
    }

    .timeline-event .timeline-card,
    .timeline-event[data-side="left"] .timeline-card,
    .timeline-event[data-side="right"] .timeline-card {
        width: 100%;
        margin: 0;
        text-align: left;
    }

    .timeline-node {
        left: 15px
    }

    .timeline-connector,
    .timeline-event[data-side="left"] .timeline-connector,
    .timeline-event[data-side="right"] .timeline-connector {
        left: 23px;
        right: auto;
        width: 40px;
    }

    .timeline-outer-dot,
    .timeline-event[data-side="left"] .timeline-outer-dot,
    .timeline-event[data-side="right"] .timeline-outer-dot {
        left: 56.5px;
        right: auto
    }
    
    .timeline-event[data-type="build"][data-side="left"] .timeline-outer-dot {
        transform: rotate(90deg);
    }
}