/* =====================================================================
 * components/timeline.css — curriculum stepper (6 levels).
 * Mobile: vertical with left line. Desktop: horizontal with center line.
 * Informational, not interactive. No hex literals.
 * ===================================================================== */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-6);
    position: relative;
}

.timeline__step {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: var(--space-4);
    position: relative;
}

.timeline__badge {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    font-weight: var(--fw-bold);
    font-size: var(--fs-md);
    border-radius: var(--radius-pill);
    z-index: var(--z-base);
    flex-shrink: 0;
}

.timeline__title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.timeline__desc {
    color: var(--color-text-muted);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
}

/* --- Mobile: vertical connector line --------------------------------- */
@media (max-width: 1023.98px) {
    .timeline::before {
        content: "";
        position: absolute;
        left: 1.5rem;
        top: 0;
        bottom: 0;
        width: 2px;
        background-color: var(--color-border);
        transform: translateX(-50%);
    }
}

/* --- Desktop: horizontal layout -------------------------------------- */
@media (min-width: 1024px) {
    .timeline {
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: var(--space-4);
    }

    .timeline__step {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }

    .timeline__badge { margin-bottom: var(--space-3); }

    .timeline::before {
        content: "";
        position: absolute;
        top: 1.5rem;
        left: 0;
        right: 0;
        height: 2px;
        background-color: var(--color-border);
        z-index: 0;
    }
}

/* =====================================================================
 * Vertical-at-all-widths override (formerly pages/programs.css §1,
 * scoped under .page-programs; de-scoped here so the curriculum
 * stepper is consistently vertical on every consumer).
 *
 * The six dense level focus lines are crushed by the horizontal
 * 6-column desktop layout above; this re-asserts the mobile vertical
 * layout (badge column on the left, content to the right, vertical
 * connector line) at desktop sizes too. Loaded after the horizontal
 * block above so it wins by source order. Consumed by the Programs
 * Overview and the country curriculum sections.
 * ===================================================================== */
@media (min-width: 1024px) {
    .timeline {
        grid-auto-flow: row;
        grid-auto-columns: auto;
        gap: var(--space-6);
    }

    .timeline__step {
        grid-template-columns: 3rem 1fr;
        text-align: left;
        justify-items: stretch;
    }

    .timeline__badge {
        margin-bottom: 0;
    }

    /* Restore the vertical connector line. */
    .timeline::before {
        top: 0;
        bottom: 0;
        left: 1.5rem;
        right: auto;
        height: auto;
        width: 2px;
    }
}

/* =====================================================================
 * Curriculum paired image (formerly pages/programs.css §3). The image
 * sits beside the timeline in a .grid--2-col block.
 *
 * Desktop (>=1024px): the figure becomes a positioned container that
 * claims the row's full height (align-self: stretch + min-height:100%)
 * and clips with overflow:hidden. The <img> is position:absolute;
 * inset:0, removing it from intrinsic sizing so its aspect ratio can no
 * longer push the figure taller than the row — image bottom always
 * aligns with the last timeline step. object-fit: cover crops
 * gracefully; border-radius + box-shadow move to the figure because the
 * absolutely-positioned img has nothing visible to attach them to.
 *
 * Tablet (768-1023.98px): the base rules give the figure
 * align-self: stretch and the img height:100% — adequate when the
 * intrinsic ratio fits the row, lightly imperfect when it doesn't.
 *
 * Mobile (<768px): single column. Image flips above the timeline via
 * order:-1 and gets a 4/3 aspect-ratio preview height.
 * ===================================================================== */
.programs-curriculum__image {
    margin: 0;
    align-self: stretch;
}

.programs-curriculum__image img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    display: block;
    border-radius: var(--radius-lg);
    background-color: var(--color-ice-mist);
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

@media (max-width: 767.98px) {
    .programs-curriculum__image {
        order: -1;
        align-self: auto;
    }
    .programs-curriculum__image img {
        height: auto;
        max-height: none;
        aspect-ratio: 4 / 3;
    }
}

@media (min-width: 1024px) {
    .programs-curriculum__image {
        position: relative;
        align-self: stretch;
        min-height: 100%;
        overflow: hidden;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
    }
    .programs-curriculum__image img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        /* Both moved to the figure above — on an absolutely-positioned
         * image inside an overflow:hidden parent they would be clipped
         * out anyway. Cleared explicitly so the cascade doesn't leave
         * paint work the browser then discards. */
        border-radius: 0;
        box-shadow: none;
    }
}
