/* ==========================================================================
   Legkopay "How It Works" Section Stylesheet
   ========================================================================== */

.how-it-works-section {
    width: 100%;
    position: relative;
    z-index: 2; /* Fix overlap with parallax footer */
    background-color: var(--color-white);
    /* Large scrolling depth track for desktop/mobile pinning */
    min-height: 350vh;
}

/* Centered static header preceding/above the steps flow */
.how-it-works-header {
    padding-top: 90px;
    padding-bottom: 40px;
    position: relative;
    z-index: 10;
    background-color: var(--color-white);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--color-text-main);
    letter-spacing: -0.02em;
    margin-bottom: 0.8rem;
}

.fw-extrabold {
    font-weight: 800;
}

.section-subtitle {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--color-text-muted);
    max-width: 580px;
    line-height: 1.6;
}

/* ==========================================================================
   Desktop & Mobile Pinning & Transitions Engine
   ========================================================================== */

.sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    background-color: var(--color-white);
    z-index: 5;
}

/* Individual step wrappers layered absolutely on top of each other */
.step-container {
    position: absolute;
    top: 54%;
    /* Slipped slightly to clear header on desktop */
    left: 0;
    transform: translateY(-50%) scale(0.96);
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
        transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Sub-column coordinate transition timings */
.step-image-col,
.step-text-col {
    transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.9s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --------------------------------------------------------------------------
   Interactive States driven by Scroll JS
   -------------------------------------------------------------------------- */

/* Active State: Centered and fully solid */
.step-container.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(-50%) scale(1);
    z-index: 20;
}

.step-container.active .step-image-col,
.step-container.active .step-text-col {
    transform: translateX(0) !important;
    opacity: 1 !important;
}

/* Hidden State */
.step-container.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Exit State: Slide outwards into page borders */
.step-container.exit {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.96);
}

.step-1.exit .step-image-col,
.step-3.exit .step-image-col {
    transform: translateX(-120px);
}

.step-1.exit .step-text-col,
.step-3.exit .step-text-col {
    transform: translateX(120px);
}

.step-2.exit .step-image-col {
    transform: translateX(120px);
}

.step-2.exit .step-text-col {
    transform: translateX(-120px);
}

/* Enter State: Readying slide-in coordinates */
.step-container.enter {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.96);
}

.step-1.enter .step-image-col,
.step-3.enter .step-image-col {
    transform: translateX(-100px);
}

.step-1.enter .step-text-col,
.step-3.enter .step-text-col {
    transform: translateX(100px);
}

.step-2.enter .step-image-col {
    transform: translateX(100px);
}

.step-2.enter .step-text-col {
    transform: translateX(-100px);
}

/* ==========================================================================
   Visual Styling Details
   ========================================================================== */

.phone-mockup-wrapper {
    position: relative;
    display: inline-block;
    transition: var(--transition-smooth);
}

.phone-mockup-wrapper:hover {
    transform: translateY(-4px);
}

.phone-mockup {
    max-width: 100%;
    height: 580px;
    /* Highly balanced height for PC screen fits */
    object-fit: contain;
    display: block;
}

.step-text-content {
    padding-left: 1.5rem;
    /* Shaved padding for premium stretch */
    padding-right: 1.5rem;
}

.step-title {
    font-family: var(--font-heading);
    font-size: 2.3rem;
    /* Expanded step title size */
    font-weight: 700;
    color: var(--color-text-main);
    line-height: 1.25;
    margin-bottom: 1.2rem;
    letter-spacing: -0.02em;
}

.step-desc {
    font-family: var(--font-body);
    font-size: 1.1rem;
    /* Highly legible and modern */
    color: var(--color-text-muted);
    line-height: 1.65;
    margin-bottom: 1.8rem;
}

/* --------------------------------------------------------------------------
   Premium High-Contrast Step Indicators & Spacers
   -------------------------------------------------------------------------- */
.step-footer {
    border-top: none;
    padding-top: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.step-link {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-main);
    position: relative;
    padding-bottom: 0.2rem;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.step-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: var(--color-text-main);
    transition: var(--transition-smooth);
}

.step-link:hover {
    color: var(--color-primary);
}

.step-link:hover::after {
    background-color: var(--color-primary);
    width: 60%;
}

.step-line-spacer {
    flex: 1;
    height: 1px;
    background-color: rgba(var(--color-dark-rgb), 0.12);
    /* Clean horizontal layout line */
    margin-left: 1.5rem;
    margin-right: 1.5rem;
}

.step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(var(--color-dark-rgb), 0.8);
    /* High contrast border circle */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(var(--color-dark-rgb), 0.8);
    /* Highly visible number styling */
    background-color: transparent;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

/* Lights up in brand primary blue when step is active */
.step-container.active .step-number {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: rgba(var(--color-primary-rgb), 0.03);
    box-shadow: 0 4px 10px rgba(var(--color-primary-rgb), 0.08);
}

/* ==========================================================================
   Premium 2K Viewports Adaptive Scaling
   ========================================================================== */
@media (min-width: 1920px) {
    .section-title {
        font-size: 3.2rem;
    }

    .section-subtitle {
        font-size: 1.25rem;
        max-width: 720px;
    }

    .step-title {
        font-size: 2.8rem;
        margin-bottom: 1.5rem;
    }

    .step-desc {
        font-size: 1.2rem;
        margin-bottom: 2.2rem;
    }

    .phone-mockup {
        height: 640px;
    }

    .step-link {
        font-size: 1.2rem;
    }

    .step-number {
        font-size: 1.35rem;
        width: 52px;
        height: 52px;
    }

    .phone-mockup-wrapper {
        border-radius: 48px;
    }
}

/* ==========================================================================
   Premium 4K Viewports Adaptive Scaling
   ========================================================================== */
@media (min-width: 2560px) {
    .section-title {
        font-size: 4.2rem;
    }

    .section-subtitle {
        font-size: 1.5rem;
        max-width: 900px;
    }

    .step-title {
        font-size: 3.6rem;
        margin-bottom: 2rem;
    }

    .step-desc {
        font-size: 1.45rem;
        margin-bottom: 3rem;
    }

    .phone-mockup {
        height: 820px;
    }

    .step-link {
        font-size: 1.4rem;
    }

    .step-number {
        font-size: 1.55rem;
        width: 60px;
        height: 60px;
    }

    .phone-mockup-wrapper {
        border-radius: 60px;
    }
}

/* ==========================================================================
   Mobile & Tablet Interactive Scroll-Pinning & Typography Centering Overrides
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Completely disable sticky pinning on mobile/tablets to prevent vertical collisions and overlaps! */
    .how-it-works-section {
        min-height: auto !important; /* Reset 350vh track */
        padding-top: 60px;
        padding-bottom: 60px;
        background-color: var(--color-white);
    }

    .sticky-wrapper {
        position: relative !important;
        top: auto !important;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
        background-color: var(--color-white) !important;
        z-index: 5;
    }

    /* Reset container to natural block flow, removing flex centering to prevent overlaps */
    .how-it-works-section .container-lg {
        display: block !important;
        height: auto !important;
    }

    /* Reset absolute header to normal static block */
    .how-it-works-header {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        padding-top: 0 !important;
        padding-bottom: 2.5rem !important;
        width: 100% !important;
        text-align: center !important;
        background: transparent !important;
    }

    .section-title {
        font-size: clamp(1.8rem, 4vw, 2.4rem) !important;
        margin-bottom: 0.5rem !important;
        text-align: center !important;
    }

    .section-subtitle {
        display: block !important; /* Show subtitle on tablet too! */
        margin: 0 auto !important;
        font-size: 1rem !important;
        max-width: 540px !important;
        text-align: center !important;
    }

    /* Reset absolute step containers to standard flowing Bootstrap rows */
    .step-container {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        opacity: 1 !important;
        pointer-events: all !important;
        margin-bottom: 4rem !important; /* Clean gap between steps */
        display: flex !important; /* Standard Bootstrap flex row layout */
    }

    .step-container:last-child {
        margin-bottom: 0 !important;
    }

    /* Hide the js-enter/exit transitions entirely on mobile/tablet */
    .step-container.hidden,
    .step-container.enter,
    .step-container.exit {
        opacity: 1 !important;
        pointer-events: all !important;
        transform: none !important;
    }

    .step-image-col,
    .step-text-col {
        transform: none !important;
        opacity: 1 !important;
    }

    /* Show the complete mockups beautifully instead of half-cropping them! */
    .phone-mockup-wrapper {
        height: auto !important;
        max-width: 320px !important;
        margin: 0 auto 1.5rem auto !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .phone-mockup {
        width: 100% !important;
        height: auto !important;
        max-height: 480px !important;
        object-fit: contain !important;
        display: block !important;
    }

    /* Center typography on mobile viewports */
    .step-text-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-top: 0 !important;
        text-align: center !important;
    }

    .step-title {
        font-size: clamp(1.4rem, 3vw, 1.85rem) !important;
        text-align: center !important;
        margin-bottom: 0.75rem !important;
        line-height: 1.3 !important;
    }

    .step-desc {
        font-size: clamp(0.92rem, 1.5vw, 1.05rem) !important;
        text-align: center !important;
        margin-bottom: 1.25rem !important;
        line-height: 1.6 !important;
        max-width: 500px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .step-footer {
        padding-top: 1rem !important;
        border-top: 1px solid rgba(var(--color-dark-rgb), 0.08) !important;
        max-width: 500px !important;
        margin: 0 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .step-link {
        font-size: 1rem !important;
    }

    .step-number {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.1rem !important;
        border-color: var(--color-primary) !important;
        color: var(--color-primary) !important;
        background-color: rgba(var(--color-primary-rgb), 0.03) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .step-line-spacer {
        margin-left: 1rem !important;
        margin-right: 1rem !important;
    }
}