.timeline {
    --timeline-line-color: rgba(255, 255, 255, 0.72);
    --timeline-dot-color: #f0008c;
    --timeline-card-bg: #fff;
    --timeline-card-border: rgba(255, 255, 255, 0.2);
    --timeline-text-color: #000;
    --timeline-meta-color: #000;
    --timeline-link-hover: #f0008c;
    --timeline-gap: 24px;
    --timeline-card-offset: 20px;
    --timeline-items-per-view: 4;
    --timeline-items-per-view-tablet: 2;
    --timeline-items-per-view-mobile: 1;
    --timeline-item-height: 392px;
    --timeline-track-height: 440px;
    position: relative;
    width: 100%;
    color: var(--timeline-text-color);
}

.timeline__viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
}

.timeline__viewport::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--theme-color);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 0;
}

.timeline__viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.timeline__track {
    position: relative;
    display: flex;
    gap: var(--timeline-gap);
    align-items: stretch;
    min-height: var(--timeline-track-height);
    padding: 48px 0;
    will-change: transform;
}

.timeline__item {
    position: relative;
    z-index: 1;
    flex: 0 0 calc((100% - (var(--timeline-gap) * (var(--timeline-items-per-view) - 1))) / var(--timeline-items-per-view));
    min-width: calc((100% - (var(--timeline-gap) * (var(--timeline-items-per-view) - 1))) / var(--timeline-items-per-view));
    height: var(--timeline-item-height);
}

.timeline__content {
    position: absolute;
    left: 50%;
    width: min(260px, calc(100% - 20px));
    padding: 18px 20px;
    border: 1px solid var(--timeline-card-border);
    border-radius: 18px;
    background: var(--timeline-card-bg);
    backdrop-filter: blur(6px);
    transform: translateX(-50%);
    transition: transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.timeline__item--top .timeline__content {
    bottom: calc(50% + var(--timeline-card-offset));
}

.timeline__item--bottom .timeline__content {
    top: calc(50% + var(--timeline-card-offset));
}

.timeline__item:hover .timeline__content {
    transform: translateX(-50%) translateY(-4px);
    border-color: var(--timeline-link-hover);
}

.timeline__connector {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1px;
    height: var(--timeline-card-offset);
    background: var(--theme-color);
    transform: translate(-50%, -50%);
}

.timeline__item--top .timeline__connector {
    margin-top: -5px;
}

.timeline__item--bottom .timeline__connector {
    margin-top: 5px;
}

.timeline__dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: var(--timeline-dot-color);
    box-shadow: 0 0 0 8px rgba(168, 45 , 49, 0.14);
    transform: translate(-50%, -50%);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.timeline__item:hover .timeline__dot {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 0 10px rgba(168, 45 , 49 , 0.2);
}

.timeline__meta {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--timeline-meta-color);
}

.timeline__title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    text-transform: uppercase;
}

.timeline__link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.timeline__link:hover,
.timeline__link:focus-visible {
    color: var(--timeline-link-hover);
}

.timeline__description {
    margin: 10px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--timeline-meta-color);
}

.timeline__item--clone .timeline__link {
    pointer-events: none;
}

@media (max-width: 1024px) {
    .timeline {
        --timeline-item-height: 376px;
        --timeline-track-height: 420px;
    }

    .timeline__track {
        min-height: var(--timeline-track-height);
    }

    .timeline__item {
        flex-basis: calc((100% - (var(--timeline-gap) * (var(--timeline-items-per-view-tablet) - 1))) / var(--timeline-items-per-view-tablet));
        min-width: calc((100% - (var(--timeline-gap) * (var(--timeline-items-per-view-tablet) - 1))) / var(--timeline-items-per-view-tablet));
        height: var(--timeline-item-height);
    }

    .timeline__content {
        width: min(220px, calc(100% - 12px));
        padding: 16px;
    }

    .timeline__title {
        font-size: 20px;
    }
}

@media (max-width: 767px) {
    .timeline {
        --timeline-item-height: 336px;
        --timeline-track-height: 360px;
    }

    .timeline__track {
        min-height: var(--timeline-track-height);
    }

    .timeline__item {
        flex-basis: calc((90% - (var(--timeline-gap) * (var(--timeline-items-per-view-mobile) - 1))) / var(--timeline-items-per-view-mobile));
        min-width: calc((90% - (var(--timeline-gap) * (var(--timeline-items-per-view-mobile) - 1))) / var(--timeline-items-per-view-mobile));
        height: var(--timeline-item-height);
    }

    .timeline__content {
        width: calc(100% - 8px);
    }

    .timeline__title {
        font-size: 18px;
    }

    .timeline__description {
        font-size: 14px;
    }
}
