/* A continuous timeline with alternating image and prose columns. */

.story-timeline {
    --timeline-inset: clamp(1rem, 3vw, 2rem);
    --timeline-date-width: 5rem;
    margin: 2.5rem 0 0;
    padding: 0 0 2rem var(--timeline-inset);
    list-style: none;
    border-left: 1px solid var(--color-grass);
}

.timeline-entry + .timeline-entry {
    margin-top: clamp(3rem, 7vw, 5rem);
}

.timeline-header {
    position: relative;
    display: grid;
    grid-template-columns: var(--timeline-date-width) minmax(0, 1fr);
    align-items: center;
    gap: clamp(1rem, 3vw, 2rem);
    margin-bottom: 1.5rem;
}

/* The branch crosses between the year and month and meets the spine. */
.timeline-header::before {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(-1 * var(--timeline-inset));
    width: calc(var(--timeline-inset) + var(--timeline-date-width));
    border-top: 1px solid var(--color-grass);
}

.timeline-header::after {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(-1 * var(--timeline-inset) - 0.5px);
    width: 0.6rem;
    height: 0.6rem;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--color-grass);
}

.timeline-header time {
    display: grid;
    gap: 0.6rem;
    text-align: center;
    font-size: 1.25rem;
    line-height: 1.25;
    color: var(--color-soft-ink);
}

.timeline-header h2 {
    margin: 0;
    font-size: clamp(1.75rem, 3.5vw, 3rem);
    line-height: 1.25;
    text-transform: uppercase;
}

.timeline-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: clamp(1.5rem, 4vw, 3rem);
}

.timeline-content > img {
    display: block;
    width: 100%;
    height: auto;
    grid-column: 1;
    grid-row: 1;
}

.timeline-text {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.timeline-text p:last-child {
    margin-bottom: 0;
}

.timeline-entry:nth-child(even) .timeline-content > img {
    grid-column: 2;
}

.timeline-entry:nth-child(even) .timeline-text {
    grid-column: 1;
}

@media (min-width: 1024px) {
    body.story-page {
        padding-inline: clamp(1.5rem, 6vw, 9rem);
    }

    main.story-page {
        width: min(100%, 64rem);
    }
}

@media (max-width: 700px) {
    .story-timeline {
        --timeline-date-width: 3.5rem;
    }

    .timeline-header time {
        font-size: 1rem;
    }

    .timeline-header h2 {
        font-size: 1.5rem;
    }

    .timeline-content {
        grid-template-columns: minmax(0, 1fr);
    }

    .timeline-entry:nth-child(n) .timeline-content > img,
    .timeline-entry:nth-child(n) .timeline-text {
        grid-column: 1;
        grid-row: auto;
    }
}
