#myCarousel { --carousel-transition-duration: .6s; }
#myCarousel .carousel-item { padding: 0; overflow: hidden; transition: transform var(--carousel-transition-duration) ease-in-out; }
#myCarousel .carousel-item > .container { padding: 0 72px; }
#myCarousel .carousel-indicators { align-items: center; bottom: 20px; margin-bottom: 0; }

#myCarousel .carousel-control-prev,
#myCarousel .carousel-control-next {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    margin: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(0, 0, 0, .3);
    opacity: 1;
    z-index: 2;
    transition: background-color .25s;
}

#myCarousel .carousel-control-prev { left: 10px; }
#myCarousel .carousel-control-next { right: 10px; }
#myCarousel .carousel-control-prev:hover,
#myCarousel .carousel-control-next:hover { background: rgba(0, 0, 0, .5); }
#myCarousel .carousel-control-prev-icon,
#myCarousel .carousel-control-next-icon { width: 24px; height: 24px; }
#myCarousel button:focus-visible,
#myCarousel a:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

#myCarousel .ecosystem-slide { background: #072844; isolation: isolate; }
/* All service scenes share the first slide's painted world and left-hand copy. */
#myCarousel .carousel-item.service-slide { background: #072844; animation: none; }
#myCarousel .software-scene { --scene-image: url('/img/slider/software-studio-wide-v3.avif'); }
#myCarousel .electronics-scene { --scene-image: url('/img/slider/electronics-lab-wide-v3.avif'); }
#myCarousel .blockchain-scene { --scene-image: url('/img/slider/blockchain-cavern-wide-v2.avif'); }
#myCarousel .ai-scene { --scene-image: url('/img/slider/ai-laboratory-wide-v1.avif'); }
#myCarousel .ecosystem-slide::before,
#myCarousel .ecosystem-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

#myCarousel .ecosystem-slide::before {
    background: var(--scene-image, url('/img/Asset/rc-hero-wide.avif')) center right / cover no-repeat;
    transform: scale(1.035);
}

#myCarousel .ecosystem-slide.active::before { animation: ecosystem-drift 24s ease-in-out infinite alternate; }
#myCarousel .ecosystem-slide::after {
    background: linear-gradient(90deg, rgba(3, 23, 43, .94) 0%, rgba(3, 23, 43, .84) 35%, rgba(3, 23, 43, .28) 68%, rgba(3, 23, 43, .06));
}
#myCarousel .service-slide::after {
    background: linear-gradient(90deg, rgba(3, 23, 43, .76) 0%, rgba(3, 23, 43, .64) 35%, rgba(3, 23, 43, .18) 68%, rgba(3, 23, 43, .03));
}

#myCarousel .ecosystem-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 78% 75%, rgba(68, 207, 255, .22), transparent 38%);
    pointer-events: none;
}
#myCarousel .ecosystem-slide.active .ecosystem-glow { animation: ecosystem-light 8s ease-in-out infinite alternate; }
#myCarousel .ecosystem-copy { max-width: 560px; }
#myCarousel .service-slide .ecosystem-copy { max-width: min(520px, 49%); }
#myCarousel .software-scene .ecosystem-eyebrow {
    letter-spacing: .04em;
    text-transform: none;
    font-size: 15px;
    line-height: 1.6;
}
#myCarousel .ecosystem-eyebrow {
    margin-bottom: 14px;
    color: #bceaff;
    font-family: 'ResearchCave Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}
#myCarousel .ecosystem-copy h1 {
    margin-bottom: 20px;
    font-size: clamp(32px, 3.2vw, 52px);
    line-height: 1.13;
    font-weight: 700;
    text-shadow: 0 2px 16px rgba(0, 0, 0, .2);
}
#myCarousel .ecosystem-copy h1 span { color: #d1f1ff; }
#myCarousel .ecosystem-description { max-width: 490px; font-size: 18px; line-height: 1.65; margin-bottom: 24px; }
#myCarousel .ecosystem-cta {
    padding: 12px 22px;
    border: 1px solid #fff;
    border-radius: 6px;
    background: #fff;
    color: #123a57;
    font-family: 'ResearchCave Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .14);
    transition: background-color .2s, box-shadow .2s;
}
#myCarousel .ecosystem-cta span { margin-left: 12px; }
#myCarousel .ecosystem-cta:hover { background: #dff5ff; box-shadow: 0 6px 24px rgba(0, 0, 0, .24); }

@keyframes ecosystem-drift { to { transform: scale(1.075) translateX(-.5%); } }
@keyframes ecosystem-light { from { opacity: .35; } to { opacity: 1; } }

@media (max-width: 991.98px) {
    #myCarousel .ecosystem-copy { max-width: 470px; }
    /* Every mobile slide uses the same viewport-based height, regardless of copy length. */
    #myCarousel .carousel-inner { display: grid; }
    #myCarousel .carousel-item {
        display: grid;
        grid-area: 1 / 1;
        align-content: center;
        float: none;
        margin-right: 0;
        height: clamp(560px, 75svh, 680px);
        min-height: 0;
        padding: 32px 0 76px;
        visibility: hidden;
        transition: none;
    }
    #myCarousel .carousel-item.active,
    #myCarousel .carousel-item-next,
    #myCarousel .carousel-item-prev { visibility: visible; }
    /* Park the incoming slide before reflow; animate only once its destination is set. */
    #myCarousel .carousel-item.active,
    #myCarousel .carousel-item-next.carousel-item-start,
    #myCarousel .carousel-item-prev.carousel-item-end {
        transition: transform var(--carousel-transition-duration) ease-in-out;
    }
    /* After measuring the shared height, use Bootstrap's native overlapping floats. */
    #myCarousel.carousel-ready .carousel-inner { display: block; }
    #myCarousel.carousel-ready .carousel-item {
        display: none;
        float: left;
        margin-right: -100%;
        height: var(--carousel-mobile-height);
        min-height: 0;
        transition: transform var(--carousel-transition-duration) ease-in-out;
    }
    #myCarousel.carousel-ready .carousel-item.active,
    #myCarousel.carousel-ready .carousel-item-next,
    #myCarousel.carousel-ready .carousel-item-prev { display: grid; }
    #myCarousel .carousel-item > .container {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
    }
    #myCarousel .service-slide .ecosystem-copy { max-width: 470px; }
    #myCarousel .service-slide h1 { margin-top: 0 !important; }
    #myCarousel .carousel-item h1 { font-size: 34px; }
}
@media (max-width: 767.98px) {
    #myCarousel .ai-scene { --scene-image: url('/img/slider/ai-laboratory-wide-v1-960.avif'); }
    #myCarousel .carousel-item > .container { padding: 0 28px; }
    #myCarousel .carousel-item h1 { font-size: 28px; }
    #myCarousel .carousel-item p { font-size: 16px; }
    #myCarousel .ecosystem-copy h1 { font-size: clamp(30px, 7vw, 40px); }
    #myCarousel .ecosystem-eyebrow { font-size: 11px; }
    #myCarousel .ecosystem-description { line-height: 1.6; }
    #myCarousel .ecosystem-slide::after {
        background: linear-gradient(90deg, rgba(3, 23, 43, .92), rgba(3, 23, 43, .64));
    }
    #myCarousel .service-slide .ecosystem-copy h1 {
        font-size: clamp(28px, 7vw, 36px);
        margin-bottom: 16px;
    }
    #myCarousel .service-slide .ecosystem-description {
        font-size: 15px;
        line-height: 1.5;
        margin-bottom: 16px;
    }
    #myCarousel .software-scene .ecosystem-eyebrow {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 12px;
    }
    #myCarousel .service-slide::before {
        background-size: auto 62%;
        background-position: 78% bottom;
        mask-image: linear-gradient(180deg, transparent 38%, #000 56%);
    }
    #myCarousel .ai-scene::before {
        background-size: auto 52%;
        background-position: 78% calc(100% + 72px);
    }
    #myCarousel .service-slide::after {
        background: linear-gradient(180deg, #072844 0%, rgba(7, 40, 68, .9) 36%, rgba(7, 40, 68, .7) 72%, rgba(7, 40, 68, .24));
    }
    #myCarousel .carousel-control-prev,
    #myCarousel .carousel-control-next {
        top: auto;
        bottom: 14px;
        transform: none;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 359.98px) {
    #myCarousel .service-slide .ecosystem-copy h1 { font-size: 26px; }
    #myCarousel .service-slide .ecosystem-description { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    #myCarousel .carousel-item { animation: none; }
    #myCarousel .ecosystem-slide.active::before,
    #myCarousel .ecosystem-slide.active .ecosystem-glow { animation: none; transition: none; }
}
