.how-to {
    padding: var(--section-padding);
    width: 100%;
    text-align: left;

    --how-to-media-bg: color-mix(in srgb, var(--text) 4%, var(--background));

    .how-to-steps {
        display: grid;
        grid-template-columns: repeat(var(--how-to-cols, 3), minmax(0, 1fr));
        gap: clamp(20px, 2.5vw, 32px);
        margin-top: clamp(32px, 5vw, 56px);
        align-items: stretch;

        &[data-cols="1"] { --how-to-cols: 1; }
        &[data-cols="2"] { --how-to-cols: 2; }
        &[data-cols="3"] { --how-to-cols: 3; }
        &[data-cols="4"] { --how-to-cols: 4; }
    }

    .how-to-step {
        --how-to-step-fade: 1;
        --how-to-step-saturate: 1;
        --how-to-step-padding: clamp(20px, 2.4vw, 28px);
        --how-to-step-radius-initial: var(--border-radius-small);
        --how-to-step-radius: var(--how-to-step-radius-initial);
        --how-to-media-pad-inset: calc(var(--how-to-step-padding) / 2);
        --how-to-media-radius-top: max(0px, calc(var(--border-radius-small) - var(--how-to-step-padding) / 2));
        --how-to-media-radius-bottom: max(0px, calc(var(--how-to-step-radius) - var(--how-to-media-pad-inset)));

        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: var(--how-to-step-padding);
        background: var(--ncs-container-weak);
        border: 1px solid var(--ncs-container-strong);
        border-start-start-radius: var(--how-to-step-radius-initial);
        border-start-end-radius: var(--how-to-step-radius-initial);
        border-end-end-radius: var(--how-to-step-radius);
        border-end-start-radius: var(--how-to-step-radius);
        position: relative;
        transition:
            border-radius 0.3s cubic-bezier(0.2, 0, 0, 1),
            background-color 0.3s cubic-bezier(0.2, 0, 0, 1),
            border-color 0.3s cubic-bezier(0.2, 0, 0, 1),
            opacity 0.35s ease;

        &.is-active {
            --how-to-step-radius-initial: var(--border-radius-large);
            --how-to-step-radius: var(--border-radius-large);
            --how-to-media-pad-inset: var(--how-to-step-padding);
            border-color: var(--ncs-container-weak);
            background: var(--ncs-container-strong);
        }

        &.is-inactive {
            cursor: pointer;
        }

        &.is-inactive:hover {
            --how-to-step-radius: calc((var(--border-radius-small) + var(--border-radius-large)) / 2);
            --how-to-media-pad-inset: var(--how-to-step-padding);
        }

        &:focus-visible {
            outline: 2px solid var(--ncs-primary);
            outline-offset: 4px;
        }

        .how-to-step-number {
            font-size: var(--font-xs);
            font-weight: var(--font-weight-bold);
            text-transform: uppercase;
            letter-spacing: 1.5px;
            color: var(--text-faded);
            opacity: var(--how-to-step-fade);
            transition:
                transform 0.3s cubic-bezier(0.2, 0, 0, 1),
                opacity 0.35s ease,
                color 0.35s ease;
            margin-bottom: 4px;
            transform: translateX(0);
            width: fit-content;
        }

        .how-to-step-title {
            font-size: var(--font-md);
            font-weight: var(--font-weight-bold);
            line-height: 1.25;
            color: var(--text);
            opacity: var(--how-to-step-fade);
            transition: opacity 0.35s ease, color 0.35s ease;
            margin: 0;
        }

        .how-to-step-description {
            font-size: var(--font-sm);
            line-height: 1.6;
            color: var(--text-faded);
            opacity: var(--how-to-step-fade);
            transition: opacity 0.35s ease, color 0.35s ease;

            p {
                margin: 0 0 12px;

                &:last-child {
                    margin-bottom: 0;
                }
            }

            ul,
            ol {
                margin: 8px 0 12px 1.25em;
                padding: 0;
            }

            li {
                margin-bottom: 4px;
            }
        }

        .how-to-step-media {
            margin-top: auto;
            padding-top: 16px;
            display: flex;
            justify-content: center;
            border-radius: var(--how-to-media-radius-top) var(--how-to-media-radius-top)
                var(--how-to-media-radius-bottom) var(--how-to-media-radius-bottom);

            > .hmedia {
                width: 100%;
                max-width: 100%;
                height: auto;
                border-radius: var(--how-to-media-radius-top) var(--how-to-media-radius-top)
                    var(--how-to-media-radius-bottom) var(--how-to-media-radius-bottom);
                overflow: hidden;
                background: var(--how-to-media-bg);
                border: 1px solid var(--ncs-container-strong);
                display: block;
                transition:
                    filter 0.35s ease,
                    border-color 0.35s ease,
                    border-radius 0.3s cubic-bezier(0.2, 0, 0, 1);
                filter: saturate(var(--how-to-step-saturate));
            }

            img,
            video {
                width: 100%;
                height: auto;
                max-width: 100%;
                object-fit: contain;
                object-position: center;
                display: block;
                border-radius: inherit;
            }
        }

        &.is-inactive {
            --how-to-step-fade: 0.45;
            --how-to-step-saturate: 0;
        }

        &.is-active .how-to-step-media > .hmedia {
            border-color: var(--ncs-container-weak);
        }
    }

    &.is-static .how-to-step,
    &.is-static .how-to-step.is-active,
    &.is-static .how-to-step.is-inactive {
        --how-to-step-fade: 1;
        --how-to-step-saturate: 1;
        --how-to-step-radius-initial: var(--border-radius-small);
        --how-to-step-radius: var(--border-radius-small);

        background: var(--ncs-container-weak);
        border-color: var(--ncs-container-weak);
        cursor: default;
    }

    &.is-static .how-to-step .how-to-step-number,
    &.is-static .how-to-step.is-active .how-to-step-number {
        transform: translateX(0);
    }

    :where([dir="rtl"], .rtl) &.is-static .how-to-step.is-active .how-to-step-number {
        transform: translateX(0);
    }

    &.is-static .how-to-step .how-to-step-media > .hmedia {
        border-color: var(--ncs-container-weak);
    }

    @media (max-width: 991px) {
        .how-to-steps {
            grid-template-columns: 1fr;
            gap: 20px;
        }

        .how-to-step .how-to-step-media > .hmedia {
            max-width: 520px;
        }
    }

    @media (max-width: 767px) {
        padding: clamp(32px, 6vw, 56px) 0;

        .how-to-step {
            padding: 20px;
        }
    }

    &.is-blog {
        padding: 50px 0 100px 0;

        .container {
            margin-inline: 0 !important;
            width: 100% !important;
        }

        .how-to-steps {
            grid-template-columns: 1fr;
            gap: 28px;
            max-width: 800px;
            margin-inline: 0;
        }

        .how-to-step {
            padding: 24px;
            background: var(--ncs-container-weak);
            border-radius: var(--border-radius-small);
            gap: 14px;

            .how-to-step-number {
                align-self: flex-start;
                padding: 4px 12px;
                border-radius: 999px;
                background: var(--background);
                color: var(--text);
                letter-spacing: 1px;
                margin-bottom: 0;
            }

            .how-to-step-media {
                padding-top: 0;
                margin-top: 4px;

                > .hmedia {
                    max-width: 100%;
                }
            }

            &.is-inactive {
                --how-to-step-fade: 1;
                --how-to-step-saturate: 1;
            }
        }

        @media (max-width: 767px) {
            padding: 30px 0 60px 0;

            .how-to-step {
                padding: 20px;
            }
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .how-to-step,
        .how-to-step *,
        .how-to-step .how-to-step-media > .hmedia {
            transition: none !important;
        }
    }
}
