.timeline-section {
    padding-block: 70px 52px;
    text-align: center;
}

.timeline {
    --timeline-axis: 120px;
    --timeline-items: 4;
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    list-style: none;
    margin: 64px 0 0;
    padding: 0;
}

.timeline::-webkit-scrollbar { display: none; }

.timeline li {
    position: relative;
    flex: 0 0 calc(100% / var(--timeline-items));
    min-width: 0;
    height: 224px;
    scroll-snap-align: start;
    text-align: center;
}

.timeline li::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: var(--timeline-axis);
    height: 1px;
    background: var(--ink);
}

.timeline li::after {
    content: "";
    position: absolute;
    inset-inline-start: 50%;
    top: calc(var(--timeline-axis) + 15px);
    width: 1px;
    height: 22px;
    background: var(--ink);
}

.timeline-dot {
    position: absolute;
    z-index: 1;
    top: calc(var(--timeline-axis) - 9px);
    inset-inline-start: calc(50% - 9px);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 2px var(--paper);
}

.timeline-year {
    position: absolute;
    top: calc(var(--timeline-axis) - 42px);
    inset-inline: 0;
    color: var(--red);
    font-size: 21px;
    font-weight: 700;
    line-height: 26px;
}

.timeline-description {
    position: absolute;
    inset-inline: 8px;
    top: calc(var(--timeline-axis) + 40px);
}

.timeline-description .prose { margin: 0; }
.timeline li:nth-child(even) .timeline-year { top: calc(var(--timeline-axis) + 20px); }
.timeline li:nth-child(even)::after { top: calc(var(--timeline-axis) - 39px); }
.timeline li:nth-child(even) .timeline-description {
    top: auto;
    bottom: calc(100% - var(--timeline-axis) + 50px);
}

.timeline-controls {
    display: flex;
    justify-content: center;
    gap: 26px;
    margin-top: 12px;
}

.timeline-arrow {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
}

.timeline-arrow:hover:not(:disabled) { background: #d60005; }
.timeline-arrow:disabled { cursor: default; }
html[dir="rtl"] .timeline-arrow svg { transform: rotate(180deg); }

@media (min-width: 769px) and (max-width: 1279px) {
    .timeline { --timeline-items: 2; }
}

@media (max-width: 768px) {
    .timeline-section { padding: 30px 0 60px; }
    .timeline-section h2 { text-align: center; }
    .timeline {
        --timeline-axis: 42px;
        --timeline-items: 1;
        margin-top: 46px;
    }
    .timeline li { height: 170px; }
    .timeline-description { inset-inline: 24px; }
    .timeline li:nth-child(even) .timeline-year { top: calc(var(--timeline-axis) - 42px); }
    .timeline li:nth-child(even)::after { top: calc(var(--timeline-axis) + 15px); }
    .timeline li:nth-child(even) .timeline-description {
        top: calc(var(--timeline-axis) + 40px);
        bottom: auto;
    }
    .timeline-controls { margin-top: 16px; }
}
