/* --- DESKTOP STYLES (Existing) --- */
.uae-sticky-wrapper {
    position: relative;
    width: 100%;
}

.uae-split-screen {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    overflow: hidden;
    width: 100%;
    background: #fff;
}

.uae-services-left {
    width: 50%;
    position: relative;
    z-index: 20;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 8%;
    background: #fff;
}

.uae-services-right {
    width: 50%;
    position: relative;
    height: 100%;
    overflow: hidden;
    background: #f0f0f0;
}

.uae-static-title {
    position: absolute;
    top: 60px;
    left: 8%;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #999;
    font-weight: 600;
}

.uae-service-title {
    position: absolute;
    left: 8%;
    right: 40px;
    bottom: 50px;
    opacity: 0;
    transition: all 0.5s ease;
    pointer-events: none;
}

.uae-service-title.active-title {
    opacity: 1;
    pointer-events: auto;
}

.uae-scroll-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transform: translateY(100%);
    will-change: transform;
    z-index: 1;
}

.uae-scroll-image:first-child {
    transform: translateY(0);
}


/* --- MOBILE GRID (THE FIX) --- */
@media (max-width: 768px) {

    /* 1. Reset Wrapper Height (Disable Scroll Spacer) */
    .uae-sticky-wrapper {
        height: auto !important;
        overflow: visible;
        padding-bottom: 60px;
    }

    /* 2. Reset Split Screen (Allow Flow) */
    .uae-split-screen {
        position: relative;
        height: auto;
        display: flex;
        flex-direction: column;
        /* Stack vertically */
        top: auto;
        overflow: visible;
    }

    /* 3. UNWRAP The Containers (Magic Trick!) */
    /* This makes children (Text & Images) direct flex items of .uae-split-screen */
    .uae-services-left,
    .uae-services-right {
        display: contents;
    }

    /* 4. STATIC TITLE */
    .uae-static-title {
        position: relative;
        top: auto;
        left: auto;
        order: -1;
        /* Always first */
        width: 100%;
    }

    /* 5. SERVICE TITLES (TEXT) */
    .uae-service-title {
        position: relative;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto;

        /* Layout */
        width: 100%;
        box-sizing: border-box;

        /* Ordering injected by PHP */
        order: var(--mobile-order);
    }



    /* 6. IMAGES (GRID CARDS) */
    .uae-scroll-image {
        position: relative;
        width: 100%;
        /* Full width minus padding */
        height: 300px;
        /* Spacing */
        border-radius: 8px;

        /* Reset Animation Props */
        transform: none !important;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        opacity: 1 !important;

        /* Ordering injected by PHP */
        order: var(--mobile-order);
    }
}



/* --- TRACK & STAGE --- */
.uae-process-track {
    width: 100%;
    position: relative;
    /* Height is set inline by PHP */
}

.uae-process-stage {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #fff;
    /* Main background */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.uae-process-main-title {
    position: absolute;
    top: 40px;
    left: 0%;
    font-size: 2.5rem;
    color: #000;
    z-index: 10;
}

.uae-process-container {
    display: flex;
    width: 100%;
    height: 80vh;
    align-items: flex-start;

    margin-top: 200px;
    /* Vertically Center Everything */
    position: relative;
}

/* --- LEFT: TEXT CARD (The Dark Box) --- */
.uae-process-card-wrapper {
    width: 40%;
    position: relative;
    z-index: 20;
    padding-left: 5%;
    height: 300px;
    /* Fixed height for the card area */
}

.uae-process-text-card {
    position: absolute;
    top: 0;
    left: 0%;
    width: 90%;
    background: #555555;
    /* Dark Grey like screenshot */
    color: #fff;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    /* Slide in effect */
    transition: all 0.3s ease-out;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.uae-process-text-card.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.uae-step-label {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.uae-process-text-card h3 {
    font-size: 2rem;
    color: #fff;
    margin: 0 0 20px 0;
}

.uae-process-text-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #ddd;
    margin: 0;
}

/* Optional Red Line decoration if desired */
.uae-process-text-card:after {
    content: '';
    position: absolute;
    right: -50%;
    top: 50%;
    width: 50%;
    height: 2px;
    background: #ff0000;
    opacity: 1;
    transition: opacity 0.3s;
}

.uae-process-text-card:before {
    content: '';
    position: absolute;
    background: red;
    width: 10px;
    height: 10px;
    border-radius: 50px;
    opacity: 1;
    top: calc(50% - 4px);
    right: -50%;
}


/* --- RIGHT: IMAGE --- */
.uae-process-image-wrapper {
    width: 60%;
    height: calc(100vh - 100px);
    /* 100vh - 50px top/bottom roughly */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uae-process-img-item {
    position: absolute;
    /* Center the image */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 90%;
    height: 90%;

    background-size: contain;
    /* Or cover, depending on wireframe vs photo */
    background-repeat: no-repeat;
    background-position: center;

    opacity: 0;
    transition: opacity 0.1s linear;
    /* Instant-ish swap */
}

.uae-process-img-item.active {
    opacity: 1;
}

.uae-news-ticker {
    overflow: hidden;
    width: 100%;
}

.uae-ticker-wrapper {
    overflow: hidden;
}

.uae-ticker-list {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 60px;
    animation: uaeTicker linear infinite;
}

.uae-ticker-list li {
    white-space: nowrap;
    font-weight: 500;
}

@keyframes uaeTicker {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* --- PROCESS WIDGET - MOBILE GRID --- */
@media (max-width: 768px) {

    /* 1. Disable Sticky Height */
    .uae-process-track {
        height: auto !important;
    }

    .uae-process-stage {
        position: relative;
        height: auto;
        top: auto;
        display: block;
        padding: 40px 0;
    }

    /* 2. Set Container to Flex Column */
    .uae-process-container {
        display: flex;
        flex-direction: column;
        height: auto;
        margin-top: 20px;
    }

    /* 3. UNWRAP The Parent Wrappers */
    /* This allows Text & Images to mix freely */
    .uae-process-card-wrapper,
    .uae-process-image-wrapper {
        display: contents;
    }

    /* 4. TEXT CARDS */
    .uae-process-text-card {
        position: relative;
        width: 100%;
        margin: 0;
        left: auto;
        top: auto;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: auto;

        /* ORDER */
        order: var(--mobile-order);
    }

    /* 5. IMAGES */
    .uae-process-img-item {
        position: relative;
        width: 100%;
        height: 300px;
        margin: 20px 0;
        /* Extra bottom space */

        transform: none;
        top: auto;
        left: auto;
        opacity: 1 !important;

        border-radius: 8px;

        /* ORDER */
        order: var(--mobile-order);
    }

    /* Hide the red line decoration on mobile if it looks messy */
    .uae-process-text-card::after {
        display: none;
    }

    .uae-services-right .uae-scroll-image:nth-child(odd) {
        margin-bottom: 20px;
    }

    .uae-process-main-title {
        position: initial;
    }
}