/*
 * Process Steps: heading column (sticky on desktop) and a numbered line of step cards.
 * Stacked under 1024px.
 */

.blk--process-steps {
    --ps-num: 36px;          /* number circle */
    --ps-row-gap: 12px;      /* between steps */
    --ps-col-gap: 32px;      /* number ↔ card */
    --ps-line: var(--neutral-300);
    --ps-stagger: var(--reveal-stagger);
}

.process-steps__layout {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
}

.process-steps__intro {
    position: sticky;
    top: calc(var(--header-pinned, var(--header-height)) + var(--step-7));
    flex: 0 1 380px;
}

.process-steps__heading .text-group__buttons,
.process-steps__controls {
    margin-top: var(--step-7);
}

.process-steps__list {
    display: flex;
    flex-direction: column;
    gap: var(--ps-row-gap);
    flex: 0 1 640px;
    padding: 0;
    list-style: none;
}

.process-steps__item {
    position: relative;
    display: grid;
    grid-template-columns: var(--ps-num) minmax(0, 1fr);
    gap: var(--ps-col-gap);
    margin: 0;
}

/* The line down to the next step's number */
.process-steps__item:not(:last-child)::before {
    content: '';
    position: absolute;
    top: calc(var(--ps-num) + 12px);
    bottom: calc(0px - var(--ps-row-gap));
    left: calc(var(--ps-num) / 2 - 1.5px);
    width: 3px;
    background: var(--ps-line);
}

.process-steps__num {
    position: relative;
    top: 6px;
    display: grid;
    place-items: center;
    width: var(--ps-num);
    height: var(--ps-num);
    border-radius: 50%;
    background: var(--theme-900);   /* the colour theme (Settings): darkest when closed */
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    transition: background-color .2s ease-in-out;
}

.process-steps__item.is-open .process-steps__num {
    background: var(--theme-600);   /* the theme's main shade when open */
}

.process-steps__item.has-details .process-steps__num,
.process-steps__item.has-details .process-steps__top {
    cursor: pointer;
}

.process-steps__card {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--neutral-200);
    background: var(--white);
}

.process-steps__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--step-6);
}

.process-steps__title {
    color: var(--black);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
}

.process-steps__summary {
    margin-top: var(--step-2);
    color: var(--neutral-700);
    font-size: 14px;
    line-height: 1.5;
}

/* The +/− button */
.process-steps__toggle {
    position: relative;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border-radius: 2px;
    background: var(--neutral-50);
    color: var(--theme-600);
}

.process-steps__toggle::before,
.process-steps__toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1.5px;
    background: currentColor;
    transform: translate(-50%, -50%);
    transition: transform .2s ease-in-out;
}

.process-steps__toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.process-steps__item.is-open .process-steps__toggle::after {
    transform: translate(-50%, -50%);
}

/* Details: the height animates through the grid row (0fr → 1fr) */
.process-steps__details {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s ease-in-out;
}

.process-steps__item.is-open .process-steps__details {
    grid-template-rows: 1fr;
}

.process-steps__details-clip {
    min-height: 0;
    overflow: hidden;
}

.process-steps__body {
    display: flex;
    flex-direction: column;
    gap: var(--step-3);
    margin-top: var(--step-5);
    padding-top: var(--step-5);
    border-top: 1px solid var(--neutral-300);
    color: var(--neutral-700);
    font-size: 14px;
    line-height: 1.6;
}

.process-steps__body > * {
    margin: 0;
}

@media (max-width: 1024px) {
    .process-steps__layout {
        flex-direction: column;
        align-items: stretch;
        gap: var(--step-8);
    }

    .process-steps__intro {
        position: static;
        flex-basis: auto;
    }

    .process-steps__list {
        flex-basis: auto;
    }
}

@media (max-width: 600px) {
    .blk--process-steps {
        --ps-num: 28px;
        --ps-row-gap: 16px;
        --ps-col-gap: 24px;
    }

    .process-steps__num {
        top: 4px;
        font-size: 10px;
    }

    .process-steps__controls .btn {
        flex: 1 1 auto;
    }
}

/* ---------- Entrance (script.js) ----------
   The heading comes in as a text group. Then, step by step: the number pops in, the card
   slides out from the line, the line draws down to the next number. Steps after the
   opening (open) ones come in as a quick stagger instead (--ps-i). */

.blk--process-steps.ps-anim .process-steps__card {
    opacity: 0;
    translate: calc(var(--reveal-shift) * -.6) 0;
}

.blk--process-steps.ps-anim .process-steps__num {
    scale: 0;
}

.blk--process-steps.ps-anim .process-steps__item::before {
    transform: scaleY(0);
    transform-origin: top;
}

.blk--process-steps.ps-armed .process-steps__card {
    transition: opacity var(--reveal-text) ease, translate var(--reveal-text) var(--reveal-ease);
}

.blk--process-steps.ps-armed .process-steps__item::before {
    transition: transform .6s cubic-bezier(.45, 0, .25, 1);
}

.blk--process-steps.ps-anim .process-steps__item.is-card-in .process-steps__card {
    opacity: 1;
    translate: none;
}

.blk--process-steps.ps-anim .process-steps__item.is-line-in::before {
    transform: none;
}

.blk--process-steps.ps-anim .process-steps__item.is-num-in .process-steps__num {
    scale: 1;
    animation: process-steps-pop .55s ease-out both;
}

/* The quick stagger: number (no bounce), card .2s later, line just after the number */
.blk--process-steps.ps-anim .process-steps__item.is-quick.is-num-in .process-steps__num {
    animation: none;
    transition: scale .3s cubic-bezier(.2, .8, .3, 1), background-color .2s ease-in-out;
    transition-delay: calc(var(--ps-i, 0) * var(--ps-stagger)), 0s;
}

.blk--process-steps.ps-armed .process-steps__item.is-quick .process-steps__card {
    transition-delay: calc(var(--ps-i, 0) * var(--ps-stagger) + .2s);
}

.blk--process-steps.ps-armed .process-steps__item.is-quick::before {
    transition-duration: .45s;
    transition-delay: calc(var(--ps-i, 0) * var(--ps-stagger) + .08s);
}

@keyframes process-steps-pop {
    0% { scale: 0; animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
    55% { scale: 1.25; animation-timing-function: ease-in-out; }
    80% { scale: .95; animation-timing-function: ease-in-out; }
    100% { scale: 1; }
}
