.at-stepCompactContainer {
    &.--green {
        background-color: var(--tertiaryColor100);
    }

    &.--yellow {
        background-color: var(--secondaryColor100);
    }

    &.--blue {
        background-color: var(--primaryColor100);
    }
}

.at-stepCompactContainer .at-stepCompactContainer__steps .Article {
    margin-block: 0;
}

.at-stepCompactContainer__inner {
    container: stepCompactContainer / inline-size;
}

.at-stepCompactContainer__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: var(--marginSmall);
}

/* On a colored container background the cards stand out already, so they do not need the border */
.at-stepCompactContainer.--hasBackground .at-stepCompactContainer__steps .at-stepCompact__card {
    border-color: transparent;
}

.at-stepCompactContainer__subtitle {
    font-size: var(--smallerSize);
}

.at-stepCompactContainer .u-buttonWrapper {
    margin-top: var(--marginMedium);
    justify-content: flex-start;
}

/*
 * Where round() is supported, the cards are spread evenly over the rows (6 cards where 4 fit: 3 + 3, not 4 + 2).
 * --maxCols is the number of columns that fit, set by the container queries below.
 * --count is the number of cards, set in the template.
 */
@supports (width: round(up, 1px, 1px)) {
    .at-stepCompactContainer__steps {
        --maxCols: 1;
        --rows: round(up, calc(var(--count) / var(--maxCols)), 1);
        --cols: round(up, calc(var(--count) / var(--rows)), 1);

        grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    }
}

@container stepCompactContainer (min-width: 25rem) {
    .at-stepCompactContainer__steps {
        --maxCols: 2;
    }
}

@container stepCompactContainer (min-width: 38rem) {
    .at-stepCompactContainer__steps {
        --maxCols: 3;
    }
}

@container stepCompactContainer (min-width: 51rem) {
    .at-stepCompactContainer__steps {
        --maxCols: 4;
    }
}

@container stepCompactContainer (min-width: 64rem) {
    .at-stepCompactContainer__steps {
        --maxCols: 5;
    }
}

@container stepCompactContainer (min-width: 77rem) {
    .at-stepCompactContainer__steps {
        --maxCols: 6;
    }
}
