/* ============================================
   PROGRESS TIMELINE — One view, many dates
   A fixed camera view that crossfades between photo
   dates, driven by one sliding pill under the photo.
   Behaviour in progress-timeline.js.
   ============================================ */

.progress-timeline {
    background: var(--color-black);
    color: var(--color-pure-white);
    padding: clamp(60px, 8vw, 120px) 0;
}

.progress-timeline__inner {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
}

.progress-timeline__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6) var(--space-12);
    margin-bottom: clamp(28px, 3.5vw, 48px);
}

.progress-timeline__heading {
    font-family: var(--font-heading);
    font-size: clamp(2.125rem, 4vw, 3.5rem);
    font-weight: var(--font-medium);
    color: var(--color-pure-white);
    letter-spacing: var(--tracking-tighter);
    line-height: 1.05;
    margin: 0 0 var(--space-4);
}

.progress-timeline__intro {
    font-family: var(--font-body);
    font-size: 20px;
    line-height: 28px;
    color: var(--color-pure-white);
    max-width: 58ch;
    margin: 0;
}

/* ---- Play button ---- */
.progress-timeline__play {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 26px 0 22px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--color-pure-white);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: var(--font-bold);
    line-height: 1;
    cursor: pointer;
}

.progress-timeline__play svg {
    width: 20px;
    height: 20px;
    display: block;
}

.progress-timeline__play:hover {
    background: var(--color-gray-100);
}

.progress-timeline__play-state {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.progress-timeline__play-state--pause {
    display: none;
}

.progress-timeline--playing .progress-timeline__play-state--play {
    display: none;
}

.progress-timeline--playing .progress-timeline__play-state--pause {
    display: inline-flex;
}

/* ---- Stage ---- */
.progress-timeline__viewer {
    position: relative;
}

.progress-timeline__stage {
    position: relative;
    aspect-ratio: 16 / 9;
    /* Photo and date track stay on screen together on short laptops. */
    max-height: max(420px, calc(100vh - 200px));
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #262423;
    cursor: ew-resize;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.progress-timeline__frame {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 15%;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 620ms linear;
}

/* The outgoing photo stays solid underneath while the new one fades in,
   so the crossfade never dips to the background. */
.progress-timeline__frame--previous {
    z-index: 1;
    opacity: 1;
    transition: none;
}

.progress-timeline__frame--active {
    z-index: 2;
    opacity: 1;
}

.progress-timeline--scrubbing .progress-timeline__frame {
    transition-duration: 180ms;
}

/* ---- Caption ---- */
.progress-timeline__captions {
    position: absolute;
    left: clamp(12px, 1.8vw, 24px);
    bottom: clamp(12px, 1.8vw, 24px);
    z-index: 3;
    pointer-events: none;
}

.progress-timeline__caption {
    display: none;
    margin: 0;
    padding: 14px 20px 15px;
    border-radius: var(--radius-lg);
    background: var(--color-black);
    color: var(--color-pure-white);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 24px;
}

.progress-timeline__caption--active {
    display: block;
}

.progress-timeline__caption-date,
.progress-timeline__caption-text {
    margin: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.progress-timeline__caption-date {
    font-weight: var(--font-bold);
}

/* ---- Date track: one sliding pill ---- */
.progress-timeline__dates {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: var(--space-5);
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-pill);
}

.progress-timeline__indicator {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    z-index: 0;
    width: 0;
    border-radius: var(--radius-pill);
    background: var(--color-pure-white);
    transform: translateX(0);
    transition: transform 520ms cubic-bezier(0.4, 0, 0.1, 1),
                width 520ms cubic-bezier(0.4, 0, 0.1, 1);
    pointer-events: none;
}

.progress-timeline__date {
    position: relative;
    z-index: 1;
    flex: 1 1 0;
    min-height: 44px;
    padding: 0 6px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-pure-white);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: var(--font-bold);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color 520ms cubic-bezier(0.4, 0, 0.1, 1);
}

.progress-timeline__date--active {
    color: var(--color-text-primary);
}

.progress-timeline__date:focus-visible,
.progress-timeline__play:focus-visible {
    outline: 2px solid var(--color-pure-white);
    outline-offset: 3px;
}

/* ---- Narrow: the track scrolls sideways under the photo ---- */
@media (max-width: 1100px) {
    .progress-timeline__dates {
        overflow-x: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
    }

    .progress-timeline__dates::-webkit-scrollbar {
        display: none;
    }

    .progress-timeline__date {
        flex: 0 0 auto;
        padding: 0 18px;
    }
}

@media (max-width: 768px) {
    .progress-timeline__stage {
        aspect-ratio: 4 / 3;
    }

    .progress-timeline__captions {
        position: static;
    }

    .progress-timeline__caption {
        padding: 0;
        margin-top: var(--space-4);
        background: none;
        border-radius: 0;
    }

    .progress-timeline__play {
        width: 100%;
        justify-content: center;
    }

    /* Let the track run to the screen edges so it reads as scrollable. */
    .progress-timeline__dates {
        margin-left: calc(-1 * clamp(24px, 4vw, 64px));
        margin-right: calc(-1 * clamp(24px, 4vw, 64px));
        padding-left: 24px;
        padding-right: 24px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .progress-timeline__frame,
    .progress-timeline__indicator,
    .progress-timeline__date {
        transition: none;
    }
}
