@layer addon {

    .templateStackedCards {
        padding: 0;
        .container {
            /* Direct-child selectors below: .inner and .intro are also the
               class names used inside each card's own molecule markup, so a
               loose descendant selector here would incorrectly restyle the
               card content too. */
            > .inner {
                align-items: center;

                @media (min-width: 56em) {
                    position: relative;
                    min-height: 100vh;
                    align-self: start;
                }

                @media (--min-fablet) {
                    position: relative;
                    min-height: 100vh;
                    align-self: start;
                }

                > .intro {
                    @media (min-width: 56em) {
                        position: absolute;
                        inset: 0;
                        z-index: 0;
                        display: flex;
                        flex-direction: column;
                        align-items: center;
                        justify-content: center;
                    }
                    @media (--min-fablet) {
                        position: absolute;
                        inset: 0;
                        z-index: 0;
                        display: flex;
                        flex-direction: column;
                        align-items: center;
                        justify-content: center;
                    }
                    text-align: center;
                }
            }

            .grid {
                counter-reset: card;
                /* Below --min-fablet all cards share the same grid cell, so
                   they sit directly on top of one another (a vertical
                   stack) instead of side by side. */
                display: grid;
                
                @media (min-width: 56em) {
                    padding-top: calc(var(--section) * 0.75);
                    display: flex;
                    position: relative;
                    z-index: 1;
                    flex-direction: row;
                    align-items: stretch;
                    justify-content: center;
                }
                
                @media (--min-fablet) {
                    padding-top: calc(var(--section) * 0.75);
                    display: flex;
                    position: relative;
                    z-index: 1;
                    flex-direction: row;
                    align-items: stretch;
                    justify-content: center;
                }

                .item {
                    counter-increment: card;
                    grid-area: 1 / 1;
                    width: 100%;
                    will-change: transform, opacity;

                    @media (min-width: 56em) {
                        flex: 0 0 auto;
                        width: 400px;

                        &:not(:first-child) {
                            margin-left: -240px;
                        }

                        &:nth-child(odd) {
                            rotate: -2deg;
                        }
                        &:nth-child(even) {
                            rotate: 6deg;
                        }
                    }

                    @media (--min-fablet) {
                        flex: 0 0 auto;
                        width: 400px;

                        &:not(:first-child) {
                            margin-left: -240px;
                        }

                        &:nth-child(odd) {
                            rotate: -2deg;
                        }
                        &:nth-child(even) {
                            rotate: 6deg;
                        }
                    }

                    article, .block {
                        height: 100%;
                    }

                    &:nth-child(1) {
                        z-index: 1;
                    }

                    &:nth-child(2) {
                        z-index: 2;
                        .block {
                            background-color: #35112B;
                            &:before {
                                color: var(--color3);
                            }
                            .inner {
                                color: var(--color3);
                                .title {
                                    color: var(--color3);
                                }
                            }
                        }
                    }

                    &:nth-child(3) {
                        z-index: 3;
                        .block {
                            background-color: #86E0FF;
                            &:before {
                                color: #090EAD;
                            }
                            .inner {
                                color: #090EAD;
                                .title {
                                    color: #090EAD;
                                }
                            }
                        }
                    }

                    &:nth-child(4) {
                        z-index: 4;
                        .block {
                            background-color: #FA004C;
                            &:before {
                                color: var(--color3);
                            }
                            .inner {
                                color: var(--color3);
                                .title {
                                    color: var(--color3);
                                }
                            }
                        }
                    }

                    &:nth-child(5) {
                        z-index: 5;
                        .block {
                            background-color: var(--color3);
                            &:before {
                                color: #FA004C;
                            }
                            .inner {
                                color: #FA004C;
                                .title {
                                    color: #FA004C;
                                }
                            }
                        }
                    }

                    &:nth-child(6) {
                        z-index: 6;
                        .block {
                            background-color: var(--color4);
                            &:before {
                                color: #86E0FF;
                            }
                            .inner {
                                color: #86E0FF;
                                .title {
                                    color: #86E0FF;
                                }
                            }
                        }
                    }

                    .block {
                        background-color: var(--color2);
                        &:before {
                            content: counter(card, decimal-leading-zero);
                            padding-left: var(--padding);
                            color: var(--color4);
                            font-size: var(--l-fontsize);
                            font-weight: 700;
                            font-family: var(--font-sub);
                            @media (max-width: 56em) {
                                width: 96px; height: 96px;
                                min-width: 96px; min-height: 96px;
                            }
                            @media (--max-fablet) {
                                width: 96px; height: 96px;
                                min-width: 96px; min-height: 96px;
                            }
                        }

                        .inner {
                            justify-content: flex-end;
                            align-items: flex-start;
                            color: var(--color4);
                            padding-top: calc(var(--section) / 2);
                            .title {
                                color: var(--color4);
                                font-size: calc(var(--m-fontsize) * 2);
                            }
                            .footer {
                                svg.icon {
                                    width: 66px;
                                }
                            }
                        }
                    }

                }
            }
        }
    }
}
