.ec-catalogue-hero.ec-cpm-depth-active{
    position:relative;
    overflow:hidden;
    isolation:isolate;
}

.ec-cpm-depth-layer{
    position:absolute;
    inset:0;
    z-index:0;
    overflow:hidden;
    pointer-events:none;
}

.ec-cpm-depth-stage{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    overflow:hidden;
}

.ec-cpm-depth-fallback,
.ec-cpm-depth-stage .cpm-hero-depth-canvas{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    max-width:none;
    max-height:none;
    display:block;
}

.ec-cpm-depth-fallback{
    object-fit:cover;
    object-position:50% 50%;
    z-index:1;
    opacity:1;
    visibility:visible;
}

.ec-cpm-depth-stage .cpm-hero-depth-canvas{
    z-index:2;
    opacity:0;
    transition:opacity .16s ease;
}

.ec-cpm-depth-stage.is-depth-ready .cpm-hero-depth-canvas{
    opacity:1;
}

/*
 * CPM keeps the identical source underneath displaced WebGL
 * so transparent displaced edges never expose blank space.
 */
.ec-cpm-depth-stage.is-depth-ready .ec-cpm-depth-fallback{
    opacity:1;
}

.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-image{
    visibility:hidden !important;
}

.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
    position:relative;
    z-index:4;
}

.ec-catalogue-hero.ec-cpm-depth-active .ec-hf2-gradient,
.ec-catalogue-hero.ec-cpm-depth-active .ec-hf2-overlay{
    z-index:3;
}


/* =========================================================
   SPARKED OUT — DEPTH HERO COMPOSITION
   Depth = full background
   Fade = left to right
   Copy = left aligned over image
   ========================================================= */

.ec-catalogue-hero.ec-cpm-depth-active{
    display:block !important;
    position:relative !important;
    overflow:hidden !important;
    isolation:isolate !important;
}


/* Depth occupies the whole hero */
.ec-catalogue-hero.ec-cpm-depth-active .ec-cpm-depth-layer{
    position:absolute !important;
    inset:0 !important;
    width:100% !important;
    height:100% !important;
    z-index:0 !important;
}


/* Left -> right readability fade */
.ec-catalogue-hero.ec-cpm-depth-active .ec-cpm-depth-layer::after{
    content:"";
    position:absolute;
    inset:0;
    z-index:3;
    pointer-events:none;

    background:
        linear-gradient(
            90deg,
            var(--ec-depth-gradient-left, rgba(7,17,31,.90)) 0%,
            var(--ec-depth-gradient-left, rgba(7,17,31,.90)) 12%,
            var(--ec-depth-gradient-mid, rgba(7,17,31,.52)) 42%,
            var(--ec-depth-gradient-right, rgba(7,17,31,.08)) 72%,
            rgba(7,17,31,0) 100%
        );
}


/*
 * Disable old Header Factory overlay/gradient layers.
 * We now own the fade here so we don't get doubles.
 */
.ec-catalogue-hero.ec-cpm-depth-active > .ec-hf2-gradient,
.ec-catalogue-hero.ec-cpm-depth-active > .ec-hf2-overlay{
    display:none !important;
}


/* Existing native image must not take up layout space */
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-image{
    display:none !important;
}


/* Copy becomes overlay content */
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
    position:relative !important;
    z-index:5 !important;

    display:flex !important;
    flex-direction:column !important;
    justify-content:center !important;
    align-items:flex-start !important;

    width:min(
        var(--ec-depth-copy-width, 680px),
        calc(100% - 80px)
    ) !important;

    max-width:var(--ec-depth-copy-width,680px) !important;

    min-height:inherit;

    margin-left:
        clamp(
            24px,
            6vw,
            110px
        ) !important;

    margin-right:auto !important;

    padding-top:40px !important;
    padding-bottom:40px !important;

    text-align:left !important;
    color:var(--ec-depth-text-colour,#fff) !important;
}


/* Force all main hero text left */
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy h1,
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy h2,
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy p,
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy .woocommerce-products-header__title{
    text-align:left !important;
    margin-left:0 !important;
    margin-right:0 !important;
    color:inherit !important;
}


/* Hero heights continue to come from Theme Studio config */
.ec-catalogue-hero.ec-cpm-depth-active{
    min-height:var(--ec-depth-height-desktop,410px) !important;
}


/* Tablet */
@media(max-width:1024px){

    .ec-catalogue-hero.ec-cpm-depth-active{
        min-height:var(--ec-depth-height-tablet,360px) !important;
    }

    .ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
        margin-left:40px !important;
        width:min(
            var(--ec-depth-copy-width,680px),
            calc(100% - 80px)
        ) !important;
    }
}


/* Mobile */
@media(max-width:767px){

    .ec-catalogue-hero.ec-cpm-depth-active{
        min-height:var(--ec-depth-height-mobile,310px) !important;
    }

    .ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
        width:calc(100% - 40px) !important;
        margin-left:20px !important;
        margin-right:20px !important;
        padding-top:30px !important;
        padding-bottom:30px !important;
    }

    .ec-catalogue-hero.ec-cpm-depth-active .ec-cpm-depth-layer::after{
        background:
            linear-gradient(
                90deg,
                var(--ec-depth-gradient-left, rgba(7,17,31,.92)) 0%,
                rgba(7,17,31,.70) 55%,
                rgba(7,17,31,.18) 100%
            );
    }
}

/* Sparked Out — widen + left-align category hero copy */

.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
    margin-left:clamp(18px, 3.2vw, 56px) !important;
    width:min(820px, calc(100% - 70px)) !important;
    max-width:820px !important;
}

.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy h1,
.ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy .woocommerce-products-header__title{
    max-width:780px !important;
}

@media(max-width:1024px){
    .ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
        margin-left:28px !important;
        width:calc(100% - 56px) !important;
        max-width:760px !important;
    }
}

@media(max-width:767px){
    .ec-catalogue-hero.ec-cpm-depth-active .ec-catalogue-hero-copy{
        margin-left:18px !important;
        margin-right:18px !important;
        width:calc(100% - 36px) !important;
        max-width:none !important;
    }
}
