/* Home "Our Students Timeline" section (template-parts/home/timeline.php). Fonts and --amh-* colours: home-hero.css. */

.amj-section {
    --amj-navy: #021a62;
    --amj-blue: #0f7ff5;
    --amj-done: #1784f5;
    --amj-pink: #fd2a71;
    --amj-grey: #e1e8f2;
    --amj-grey-icon: #8a9fbd;
    --amj-text: #1d3263;
    --amj-gap: clamp(14px, 1.2vw, 22px);
    --amj-arrow: 46px;
    --amj-per-view: 4;
    position: relative;
    overflow: hidden;
    padding: clamp(56px, 4.4vw, 84px) 0 clamp(56px, 4.4vw, 84px);
    background:
        radial-gradient(40% 70% at 100% 0%, rgba(214, 232, 252, .85), rgba(214, 232, 252, 0) 70%),
        radial-gradient(35% 60% at 0% 100%, rgba(221, 236, 253, .8), rgba(221, 236, 253, 0) 70%),
        linear-gradient(180deg, #f5f9fe 0%, #eff6fd 100%);
    color: var(--amj-text);
}

/* Elements with a display of their own still hide with the attribute. */
.amj-section [hidden] {
    display: none !important;
}

.amj-inner {
    width: min(100% - 64px, 1510px);
    margin-inline: auto;
}

/* Heading */
.amj-eyebrow {
    margin: 0 0 clamp(8px, .7vw, 12px);
    color: var(--amj-blue);
    font-size: clamp(14px, 1.05vw, 19px);
    font-weight: 800;
    letter-spacing: .1em;
    line-height: 1.3;
    text-transform: uppercase;
}

.amj-title {
    margin: 0;
    padding: 0;
    color: var(--amj-navy);
    font-family: inherit;
    font-size: clamp(32px, 3.1vw, 60px);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.1;
}

.amj-description {
    max-width: 1000px;
    margin: clamp(10px, .9vw, 16px) 0 0;
    font-size: clamp(16px, 1.2vw, 23px);
    line-height: 1.4;
}

/* Cards row: the list scrolls sideways; arrows and dots under it, or beside it where the page margin allows. */
.amj-carousel {
    display: grid;
    grid-template-areas:
        "track track track track track"
        ". prev dots next .";
    grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(16px, 1.4vw, 26px) 14px;
    margin-top: clamp(28px, 2.4vw, 46px);
}

.amj-track {
    display: grid;
    grid-area: track;
    grid-auto-columns: calc((100% - (var(--amj-per-view) - 1) * var(--amj-gap)) / var(--amj-per-view));
    grid-auto-flow: column;
    gap: var(--amj-gap);
    /* Room for the card shadows inside the scrolling box. */
    margin: -14px -10px -30px;
    padding: 14px 10px 30px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    list-style: none;
    scroll-padding-inline: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.amj-track::-webkit-scrollbar {
    display: none;
}

.amj-track:focus-visible {
    border-radius: 18px;
    outline: 3px solid var(--amj-blue);
    outline-offset: -6px;
}

/* Card. It is the size container of its content: the photo, texts and stages scale with the card (cqi), not the
   window; the card's own padding cannot use cqi (it would refer to an outer container), hence fixed values. */
.amj-card {
    --amj-icon: clamp(28px, 11cqi, 44px);
    --amj-step-gap: 4px;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 22px;
    margin: 0;
    padding: 22px 22px 26px;
    border: 1px solid #e6eef8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(2, 26, 98, .06);
    container-type: inline-size;
    scroll-snap-align: start;
}

.amj-person {
    display: grid;
    grid-template-columns: 34cqi minmax(0, 1fr);
    align-items: start;
    gap: clamp(12px, 6cqi, 26px);
}

.amj-photo {
    overflow: hidden;
    aspect-ratio: 1.13;
    border-radius: 10px;
    background: linear-gradient(135deg, #d9e9fd 0%, #f9dbe7 100%);
}

.amj-photo-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.amj-initials {
    display: grid;
    height: 100%;
    place-items: center;
    color: var(--amj-navy);
    font-size: clamp(20px, 9cqi, 34px);
    font-weight: 800;
    letter-spacing: .02em;
}

.amj-about {
    min-width: 0;
    padding-top: clamp(2px, 1.6cqi, 8px);
}

.amj-name {
    margin: 0;
    padding: 0;
    overflow-wrap: anywhere;
    color: var(--amj-navy);
    font-family: inherit;
    font-size: clamp(17px, 5.8cqi, 23px);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.amj-meta {
    margin: clamp(4px, 1.6cqi, 8px) 0 0;
    padding: 0;
    color: #26396a;
    font-size: clamp(14px, 5cqi, 19px);
    line-height: 1.35;
}

.amj-separator {
    margin-inline: .25em;
    color: #8193b4;
}

.amj-flag {
    display: block;
    width: 40px;
    height: 26px;
    margin-top: clamp(10px, 5cqi, 24px);
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(2, 26, 98, .2);
    object-fit: cover;
}

/* Stages: an icon above its label, a line from each icon to the next one. The last column ("Departure USA", the long
   label in every language) is wider, as in the design; the steps sit at the bottom of the card, so they line up across
   cards whose texts take more lines. */
.amj-steps {
    display: flex;
    gap: var(--amj-step-gap);
    margin: auto -8px 0;
    padding: 0;
    list-style: none;
}

.amj-step {
    --amj-share: 1;
    --amj-next-share: 1;
    position: relative;
    display: flex;
    min-width: 0;
    flex: var(--amj-share) 1 0;
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 3.4cqi, 14px);
    margin: 0;
}

.amj-step:last-child {
    --amj-share: 1.45;
}

.amj-step:nth-last-child(2) {
    --amj-next-share: 1.45;
}

.amj-step-icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: var(--amj-icon);
    height: var(--amj-icon);
    place-items: center;
    border-radius: 50%;
    background: var(--amj-grey);
    color: var(--amj-grey-icon);
}

.amj-step-icon svg {
    width: 54%;
    height: 54%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.amj-step-icon .amj-fill {
    fill: currentColor;
    stroke: none;
}

.amj-step.is-done .amj-step-icon {
    background: var(--amj-done);
    box-shadow: 0 0 0 4px rgba(23, 132, 245, .12);
    color: #fff;
}

.amj-step.is-current .amj-step-icon {
    background: var(--amj-pink);
    box-shadow: 0 0 0 5px rgba(253, 42, 113, .13), 0 6px 14px rgba(253, 42, 113, .28);
    color: #fff;
}

/* The label may reach a little into the gaps; longer ones wrap. */
.amj-step-label {
    margin-inline: -4px;
    color: var(--amj-text);
    font-size: clamp(11.5px, 4.1cqi, 16px);
    line-height: 1.25;
    text-align: center;
}

/* From this icon's edge to the next icon's edge: half of this column, the gap and half of the next column
   (its width relative to this one is the ratio of their shares). */
.amj-step:not(:last-child)::after {
    position: absolute;
    top: calc(var(--amj-icon) / 2 - 1.5px);
    left: calc(50% + var(--amj-icon) / 2);
    width: calc(50% + var(--amj-step-gap) + 50% * var(--amj-next-share) / var(--amj-share) - var(--amj-icon));
    height: 3px;
    border-radius: 3px;
    background: var(--amj-grey);
    content: '';
}

.amj-step.to-done::after {
    background: var(--amj-done);
}

.amj-step.is-done.to-current::after {
    background: linear-gradient(90deg, var(--amj-done) 0%, #9cc6f3 45%, var(--amj-pink) 75%);
}

.amj-step.is-current.to-next::after {
    background: linear-gradient(90deg, var(--amj-pink) 0%, rgba(253, 42, 113, .35) 40%, var(--amj-grey) 85%);
}

/* Arrows and dots (assets/js/home-timeline.js shows them when the cards do not all fit). */
.amj-arrow {
    display: grid;
    width: var(--amj-arrow);
    height: var(--amj-arrow);
    margin: 0;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 10px 26px rgba(2, 26, 98, .1);
    color: var(--amj-blue);
    cursor: pointer;
    transition: box-shadow .2s ease, opacity .2s ease, transform .2s ease;
}

.amj-arrow svg {
    width: 44%;
    height: 44%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.8;
}

.amj-arrow:hover:not(:disabled) {
    box-shadow: 0 12px 30px rgba(2, 26, 98, .16);
    transform: translateY(-1px);
}

.amj-arrow:disabled {
    cursor: default;
    opacity: .4;
    box-shadow: none;
}

.amj-prev {
    grid-area: prev;
}

.amj-next {
    grid-area: next;
}

.amj-dots {
    display: flex;
    grid-area: dots;
    justify-content: center;
    gap: 2px;
}

/* A 24px target around a 10px dot. */
.amj-dot {
    display: grid;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.amj-dot::before {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d3dfee;
    content: '';
    transition: background-color .2s ease, transform .2s ease;
}

.amj-dot[aria-current="true"]::before {
    background: var(--amj-blue);
    transform: scale(1.15);
}

.amj-arrow:focus-visible,
.amj-dot:focus-visible {
    outline: 3px solid var(--amj-blue);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .amj-arrow,
    .amj-dot::before {
        transition: none;
    }
}

/* With a page margin wide enough, the arrows sit beside the cards as in the design. */
@media (min-width: 1720px) {
    .amj-section {
        --amj-arrow: 64px;
    }

    .amj-carousel {
        grid-template-areas:
            "prev track next"
            ". dots .";
        grid-template-columns: var(--amj-arrow) minmax(0, 1fr) var(--amj-arrow);
        column-gap: 22px;
        margin-inline: calc(-1 * (var(--amj-arrow) + 22px));
    }
}

@media (max-width: 1439px) {
    .amj-section {
        --amj-per-view: 3;
    }
}

@media (max-width: 1023px) {
    .amj-section {
        --amj-per-view: 2;
    }
}

@media (max-width: 780px) {
    .amj-inner {
        width: min(100% - 36px, 660px);
    }
}

/* One card and the edge of the next, moved by swiping; the dots (one per card here, up to 12) stay, the arrows would
   not fit next to them. */
@media (max-width: 699px) {
    .amj-track {
        grid-auto-columns: 86%;
    }

    .amj-arrow {
        display: none;
    }

    .amj-dots {
        flex-wrap: wrap;
    }
}
