/* =============================================================================
   InvestProp — phone slider (`data-mslider`)
   -----------------------------------------------------------------------------
   Below 768px any element marked `data-mslider` stops stacking its children
   and lays them out as one swipeable row: native CSS scroll-snap, so it is
   smooth on iOS and costs nothing on the main thread. m-slider.js only adds the
   dots / arrows and keeps them in step; without it the row still swipes.

   Why: on a phone the homepage was ~25,000px — sections like «about» (7 cards
   with art, ~5,000px), «platform» (5 cards) and the comparison table were
   each several screens of vertical scrolling.

   Hooks
     data-mslider              the track (its direct children are the slides)
     data-mslider-host         optional ancestor the controls go after
                               (e.g. the table wrapper when the track is <tbody>)
     --ms-slide                slide width (default 86%; the next one peeks in)
     --ms-gutter               how far the row bleeds to the screen edge (16px)

   Used by: about, bento (platform), compare (scorecard), roadmap.
   ========================================================================== */

.ms-ctrl { display: none; }

@media (max-width: 767.98px) {
    [data-mslider] {
        --ms-gap: 12px;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: stretch;
        gap: var(--ms-gap) !important;
        grid-template-columns: none !important;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* bleed to the screen edge so the next slide visibly peeks in */
        margin-inline: calc(-1 * var(--ms-gutter, 16px)) !important;
        padding-inline: var(--ms-gutter, 16px) !important;
        scroll-padding-inline: var(--ms-gutter, 16px);
        padding-block: 4px 6px;
        position: relative;
        list-style: none;
    }

    [data-mslider]::-webkit-scrollbar { display: none; }

    [data-mslider] > * {
        flex: 0 0 var(--ms-slide, 86%) !important;
        width: var(--ms-slide, 86%) !important;
        max-width: var(--ms-slide, 86%) !important;
        min-width: 0;
        margin: 0 !important;
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    /* ---- controls ------------------------------------------------------ */
    .ms-ctrl {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 14px;
        margin-top: 16px;
    }

    .ms-btn {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        flex: none;
        padding: 0;
        border: 1px solid rgba(141, 196, 255, .22);
        border-radius: 12px;
        background: rgba(10, 26, 47, .7);
        color: #EAF2FF;
        cursor: pointer;
        transition: border-color .2s ease, background-color .2s ease, opacity .2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .ms-btn svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    /* The chevron points right. «previous» sits on the start side and points
       to it: right in RTL, left in LTR; «next» the opposite. */
    .ms-ctrl[dir="rtl"] .ms-btn--next svg,
    .ms-ctrl[dir="ltr"] .ms-btn--prev svg { transform: scaleX(-1); }

    .ms-btn:active { background: rgba(0, 123, 255, .28); }
    .ms-btn[disabled] { opacity: .35; cursor: default; }

    .ms-dots {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .ms-dot {
        width: 7px;
        height: 7px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: rgba(141, 196, 255, .3);
        cursor: pointer;
        transition: width .25s ease, background-color .25s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .ms-dot.is-active {
        width: 22px;
        background: linear-gradient(94.98deg, #007BFF 4.01%, #1C8AFF 103.03%);
    }

    .ms-count {
        min-width: 42px;
        font-size: 12px;
        font-weight: 700;
        color: #8FA5C2;
        text-align: center;
        font-variant-numeric: tabular-nums;
    }

    html:not(.dark) .ms-btn {
        border-color: rgba(0, 72, 153, .18);
        background: #FFFFFF;
        color: #0A1A30;
        box-shadow: 0 6px 18px -12px rgba(10, 40, 80, .35);
    }

    html:not(.dark) .ms-dot { background: rgba(0, 72, 153, .2); }
    html:not(.dark) .ms-count { color: #5D7492; }
}

@media (max-width: 767.98px) and (prefers-reduced-motion: reduce) {
    [data-mslider] { scroll-behavior: auto; }
    .ms-dot { transition: none; }
}
