/*
 * Layout rules of CodyHouse "vertical-timeline" 2.0.0 (npm), adapted to Bootstrap 5.
 * The package's style.css is not loaded: it bundles the CodyHouse framework, whose
 * global reset and .container/.btn rules would override Bootstrap.
 * Its JS (assets/js/main.js, loaded from jsDelivr) handles the scroll animations.
 */

.cd-timeline {
    --cd-line-color: var(--bs-border-color);
    --cd-icon-bg: var(--bs-primary);
    overflow: hidden;
}

.cd-timeline__container {
    position: relative;
    padding: 1.5rem 0;
}

/* Vertical line */
.cd-timeline__container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    height: 100%;
    width: 4px;
    background: var(--cd-line-color);
}

.cd-timeline__block {
    display: flex;
    position: relative;
    z-index: 1;
    margin-bottom: 3rem;
}

.cd-timeline__block:last-child { margin-bottom: 0; }

.cd-timeline__img {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cd-icon-bg);
    color: #fff;
    box-shadow: 0 0 0 4px var(--bs-body-bg), inset 0 2px 0 rgba(0, 0, 0, .08), 0 3px 0 4px rgba(0, 0, 0, .05);
}

.cd-timeline__img svg { width: 20px; height: 20px; }

.cd-timeline__content {
    flex-grow: 1;
    position: relative;
    margin-left: 1.25rem;
    box-shadow: 6px 8px 16px rgba(108, 117, 125, .45); /* grey drop shadow */
}

/* Triangle pointing to the line */
.cd-timeline__content::before {
    content: '';
    position: absolute;
    top: 14px;
    right: 100%;
    border: 8px solid transparent;
    border-right-color: var(--bs-card-cap-bg, var(--bs-border-color));
}

.cd-timeline__content .card-img-top {
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.cd-timeline__date {
    color: var(--bs-secondary-color);
    font-weight: 700;
}

@media (min-width: 992px) {
    .cd-timeline__container::before {
        left: 50%;
        transform: translateX(-50%);
    }

    .cd-timeline__block:nth-child(even) { flex-direction: row-reverse; }

    .cd-timeline__img {
        width: 60px;
        height: 60px;
        order: 1;
        margin-left: calc(5% - 30px);
        will-change: transform;
    }

    .cd-timeline__img svg { width: 26px; height: 26px; }

    .cd-timeline__block:nth-child(even) .cd-timeline__img { margin-right: calc(5% - 30px); }

    .cd-timeline__content {
        width: 45%;
        flex-grow: 0;
        margin: 0;
        will-change: transform;
    }

    .cd-timeline__content::before { top: 22px; }

    .cd-timeline__block:nth-child(odd) .cd-timeline__content::before {
        right: auto;
        left: 100%;
        border-right-color: transparent;
        border-left-color: var(--bs-card-cap-bg, var(--bs-border-color));
    }

    /* Date displayed on the other side of the line, like the original */
    .cd-timeline__content .cd-timeline__date {
        position: absolute;
        top: 12px;
        left: 122%;
        width: 100%;
        background: none;
        border: 0;
        font-size: 1.05rem;
    }

    .cd-timeline__block:nth-child(even) .cd-timeline__date {
        left: auto;
        right: 122%;
        text-align: right;
    }

    /* Animations triggered by main.js */
    .cd-timeline__img--hidden,
    .cd-timeline__content--hidden { visibility: hidden; }

    .cd-timeline__img--bounce-in { animation: cd-bounce-1 .6s; }
    .cd-timeline__content--bounce-in { animation: cd-bounce-2 .6s; }
    .cd-timeline__block:nth-child(even) .cd-timeline__content--bounce-in { animation-name: cd-bounce-2-inverse; }
}

@keyframes cd-bounce-1 {
    0% { opacity: 0; transform: scale(.5); }
    60% { opacity: 1; transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes cd-bounce-2 {
    0% { opacity: 0; transform: translateX(-100px); }
    60% { opacity: 1; transform: translateX(20px); }
    100% { transform: translateX(0); }
}

@keyframes cd-bounce-2-inverse {
    0% { opacity: 0; transform: translateX(100px); }
    60% { opacity: 1; transform: translateX(-20px); }
    100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cd-timeline__img--bounce-in,
    .cd-timeline__content--bounce-in { animation: none !important; }
}
