/* Global module - Timeline ("Our story so far"): year tabs, then text and an image */
.el-timeline-head {
    max-width: 760px;
    margin-bottom: clamp(36px, calc(36px + 20 * (100vw - 1280px) / 640), 56px);
}

.el-timeline-title {
    margin: 0 0 16px;
}

.el-timeline-text {
    margin: 0;
    font-size: clamp(17px, 1.1vw, 19px);
    line-height: 1.65;
    color: var(--el-color-muted);
}

.el-timeline-grid {
    display: grid;
    grid-template-columns: clamp(260px, calc(260px + 175 * (100vw - 1280px) / 640), 435px) minmax(0, 1fr);
    align-items: stretch; /* the panel is as tall as the year list */
}

/* Tabs: a list of years with a divider on the right. */
.el-timeline-tabs {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(20px, calc(20px + 24 * (100vw - 1280px) / 640), 44px);
    padding-block: 8px;
    border-right: 1px solid #dde3e9;
}

.el-timeline-tab {
    --el-tl-progress: 0;
    position: relative;
    padding: 0 0 12px;
    border: 0;
    background: none;
    font: inherit;
    font-size: clamp(22px, calc(22px + 6 * (100vw - 1280px) / 640), 28px);
    line-height: 1.2;
    text-align: left;
    color: #a3adb7;
    cursor: pointer;
    transition: color var(--el-transition);
}

.el-timeline-tab:hover,
.el-timeline-tab:focus-visible {
    color: var(--el-color-heading);
}

.el-timeline-tab.is-active {
    color: var(--el-color-heading);
}

/* Active tab: a grey line to the divider, with the orange progress line on it. */
.el-timeline-tab.is-active::before,
.el-timeline-tab.is-active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
}

.el-timeline-tab.is-active::before {
    right: 0;
    background: #dde3e9;
}

.el-timeline-tab.is-active::after {
    width: 100%;
    background: var(--el-color-orange);
    transform-origin: left;
}

/* While the timeline plays, the orange line fills over the time each moment shows. */
.el-timeline.is-playing .el-timeline-tab.is-active::after {
    animation: el-timeline-fill var(--el-tl-time, 6s) linear forwards;
}

.el-timeline.is-paused .el-timeline-tab.is-active::after,
.el-timeline.is-focused .el-timeline-tab.is-active::after,
.el-timeline.is-tap-paused .el-timeline-tab.is-active::after,
.el-timeline.is-held .el-timeline-tab.is-active::after {
    animation-play-state: paused;
}

@keyframes el-timeline-fill {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

/* Panels: text at the top, image on the right. Without JS every panel shows, one under another. */
.el-timeline-panels {
    display: grid;
    gap: 40px;
}

.el-timeline.is-ready .el-timeline-panel:not(.is-active) {
    display: none;
}

.el-timeline-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr);
    align-items: start; /* text top-aligned, level with the image and the first year */
    gap: clamp(24px, calc(24px + 56 * (100vw - 1280px) / 640), 80px);
    padding-left: clamp(16px, 1.2vw, 24px);
}

.el-timeline.is-ready .el-timeline-panel.is-active {
    animation: el-timeline-in 0.4s ease;
}

@keyframes el-timeline-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.el-timeline-panel-title {
    margin: 0 0 16px;
}

.el-timeline-panel-text {
    margin: 0;
    font-size: clamp(17px, calc(17px + 4 * (100vw - 1280px) / 640), 21px);
    line-height: 1.5;
    color: var(--el-color-muted);
}

.el-timeline-panel-media {
    align-self: start; /* image top level with the first year, as in the design */
    overflow: hidden;
    aspect-ratio: 575 / 423;
    border-radius: clamp(20px, 1.6vw, 28px);
}

.el-timeline-panel-media.is-empty {
    background: #e5eaee;
}

.el-timeline-panel-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Tablet and phone: the tabs become a row that scrolls sideways, the panel stacks below. */
@media (max-width: 991px) {
    .el-timeline-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .el-timeline-tabs {
        position: relative; /* offsetLeft of each year is measured from here (global_timeline.js) */
        flex-direction: row;
        gap: 28px;
        margin-inline: calc(-1 * var(--el-gutter));
        padding: 0 var(--el-gutter);
        overflow-x: auto;
        overflow-y: hidden; /* sideways only */
        overscroll-behavior-x: contain;
        border-right: 0;
        border-bottom: 1px solid #dde3e9;
        scrollbar-width: none;
    }

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

    .el-timeline-tab {
        flex: none;
        font-size: 20px;
        white-space: nowrap;
    }

    .el-timeline-tab.is-active::before {
        display: none;
    }

    .el-timeline-panel {
        grid-template-columns: 1fr;
        padding-left: 0;
    }
}

/* Touch: press and hold pauses, so no text selection or long-press menu on the timeline. */
@media (hover: none) {
    .el-timeline-grid {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

