.ess-scroll-steps,
.ess-scroll-steps * {
    box-sizing: border-box;
}

.ess-scroll-steps {
    --ess-duration: 550ms;
    --ess-visual-width: 50%;
    --ess-first-step-offset: 18vh;
    direction: rtl;
}

.ess-scroll-steps__heading {
    margin: 0 0 35px;
}

.ess-scroll-steps__grid {
    display: grid;
    grid-template-columns: minmax(0, calc(100% - var(--ess-visual-width))) minmax(0, var(--ess-visual-width));
    align-items: start;
    gap: 70px;
    overflow: visible;
}

.ess-scroll-steps__content,
.ess-scroll-steps__visual {
    min-width: 0;
    overflow: visible;
}

/* Extra runway lets the final card reach the activation zone before
   the sticky visual is released at the bottom of the widget. */
.ess-scroll-steps__content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 30vh;
}

/*
 * The first card is moved visually rather than pushed down with margin-top.
 * This preserves the widget's starting position, so an external or internal
 * heading does not drift away when the first-card alignment is adjusted.
 * The matching margin-bottom reserves space after the moved card and avoids
 * overlap with the next step.
 */
.ess-scroll-steps__step:first-child {
    position: relative;
    top: var(--ess-first-step-offset);
    margin-bottom: var(--ess-first-step-offset);
}

.ess-scroll-steps__step {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 28vh;
    padding: 30px 86px 30px 28px;
    opacity: .22;
    transform: translateY(10px) scale(.985);
    transition: opacity .4s ease, transform .45s ease, background-color .4s ease, box-shadow .4s ease;
}

.ess-scroll-steps__step.is-active {
    opacity: 1 !important;
    transform: translateY(0) scale(1);
    background-color: #fff;
    box-shadow: 0 18px 50px rgba(37, 52, 58, .09);
}

.ess-scroll-steps__step.is-passed {
    opacity: .4;
}

.ess-scroll-steps__number {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #f1f2f2;
    color: #aeb5b8;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    transition: background-color .35s ease, color .35s ease, transform .35s ease, box-shadow .35s ease;
}

.ess-scroll-steps__step.is-active .ess-scroll-steps__number {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 12px 28px rgba(255, 196, 0, .28);
}

.ess-scroll-steps__copy {
    width: 100%;
}

.ess-scroll-steps__step-title {
    margin: 0 0 10px;
}

.ess-scroll-steps__step-text > :first-child {
    margin-top: 0;
}

.ess-scroll-steps__step-text > :last-child {
    margin-bottom: 0;
}

.ess-scroll-steps__visual {
    position: sticky;
    top: 100px;
    height: 650px;
    align-self: start;
}

.ess-scroll-steps__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--ess-duration) ease, transform var(--ess-duration) cubic-bezier(.2,.75,.25,1), filter var(--ess-duration) ease, visibility var(--ess-duration) ease;
}

.ess-scroll-steps__image.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 2;
}

.ess-effect-fade .ess-scroll-steps__image {
    transform: none;
}

.ess-effect-slide .ess-scroll-steps__image {
    transform: translateY(32px);
}

.ess-effect-slide .ess-scroll-steps__image.is-active {
    transform: translateY(0);
}

.ess-effect-fade-scale .ess-scroll-steps__image {
    transform: translateY(22px) scale(.975);
    filter: blur(3px);
}

.ess-effect-fade-scale .ess-scroll-steps__image.is-active {
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.ess-scroll-steps__image img,
.ess-scroll-steps__mobile-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ess-scroll-steps__mobile-image {
    display: none;
    margin: 22px 0 0;
}

/* Elementor editor: everything remains visible and easy to edit. */
body.elementor-editor-active .ess-editor-preview-expanded .ess-scroll-steps__grid {
    align-items: start;
}

body.elementor-editor-active .ess-editor-preview-expanded .ess-scroll-steps__step {
    min-height: auto !important;
    top: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    background: #fff;
    box-shadow: 0 8px 25px rgba(37,52,58,.08);
}

body.elementor-editor-active .ess-editor-preview-expanded .ess-scroll-steps__visual {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.elementor-editor-active .ess-editor-preview-expanded .ess-scroll-steps__image {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    filter: none !important;
}

body.elementor-editor-active .ess-editor-preview-expanded .ess-scroll-steps__image img {
    height: auto !important;
}

@media (max-width: 767px) {
    .ess-scroll-steps__grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .ess-scroll-steps__visual {
        order: 1;
        width: 100%;
        height: 38vh;
        min-height: 270px;
        position: sticky;
        top: 0;
        background: rgba(255,255,255,.97);
        z-index: 10;
    }

    .ess-scroll-steps__content {
        order: 2;
        width: 100%;
        padding-bottom: 0;
    }

    .ess-scroll-steps__step {
        min-height: 36vh;
    }

    .ess-scroll-steps__step:first-child {
        top: auto;
        margin-top: 0;
        margin-bottom: 0;
    }

    .ess-mobile-stacked .ess-scroll-steps__visual {
        display: none;
    }

    .ess-mobile-stacked .ess-scroll-steps__mobile-image {
        display: block;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .ess-mobile-stacked .ess-scroll-steps__step {
        display: block;
        min-height: auto !important;
        margin-bottom: 35px;
        opacity: 1 !important;
        transform: none !important;
    }

    .ess-mobile-stacked .ess-scroll-steps__number {
        top: 30px;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ess-scroll-steps__step,
    .ess-scroll-steps__number,
    .ess-scroll-steps__image {
        transition: none !important;
    }
}


/* In frontend preview mode the Elementor canvas uses the same sticky layout,
   spacing and active-card states as the live page. */
body.elementor-editor-active .ess-editor-preview-frontend {
    overflow: visible;
}

body.elementor-editor-active .ess-editor-preview-frontend .ess-scroll-steps__grid,
body.elementor-editor-active .ess-editor-preview-frontend .ess-scroll-steps__content,
body.elementor-editor-active .ess-editor-preview-frontend .ess-scroll-steps__visual {
    overflow: visible;
}
