Scrolling function not working in mobile browsers

I created a website (www.techieafrohead.com) and facing an issue on testimonial cards horizontal scrolling. It is smoothly working in desktop browsers but when seen on samsung browsers(Chrome) or in any phone’s (android) browser , scrolling is not smooth or just not scrolling.

i tried making .card-wrapper class overflow-y to auto from hidden, but it creates a scrollbar on the right which makes it look odd because i’m expecting to do that through scroll button. Also, in javascript added a line to control the max scroll amount let scrollAmount = window.innerWidth < 768 ? 50 : 100; // Also finally tried btnScrollUp.addEventListener(‘click’, () => scrollVertically(1));
btnScrollUp.addEventListener(‘touchstart’, () => scrollVertically(1));
btnScrollDown.addEventListener(‘click’, () => scrollVertically(-1));
btnScrollDown.addEventListener(‘touchstart’, () => scrollVertically(-1));
….,but all my attempts failed.Let me know how can i fix this issue.

<div class="testimonial-container-right">
                    <div class="vertical-scroll">
                        <button class="btn-scroll" id="btn-scroll-up" onclick="scrollVertically(1)">
                            <i class="fas fa-chevron-up"></i>
                        </button>
                    </div>
                    <div class="card-wrapper">
                        <?php 
                            $testi_query = "SELECT * FROM testimonial WHERE status = 'verified' ORDER BY id DESC";
                            $testi_run = mysqli_query($conn, $testi_query);
                            if (mysqli_num_rows($testi_run) > 0) {
                                while ($row = mysqli_fetch_array($testi_run)) {
                                    $id = htmlspecialchars($row['id']);
                                    $name = htmlspecialchars($row['name']);
                                    $image = htmlspecialchars($row['profile_picture']);
                                    $review = htmlspecialchars($row['review']);
                                    $service = htmlspecialchars($row['service']);
                                    $country = htmlspecialchars($row['country']);
                                    $college = htmlspecialchars($row['college']);
                                    $rating = htmlspecialchars($row['rating_value']);
                        ?>
                                    <div class="card">
                                        <div class="testi-image">
                                            <img src="image/testimonial/<?php echo $image; ?>" alt="client-photo">
                                        </div>
                                        <div class="card__content">
                                            <span><i class="fas fa-quote-left"></i></span>
                                            <div class="card__details">
                                                <p class="card-text"><?php echo nl2br($review); ?></p>
                                                <button class="view-more-btn">View More</button><br>
                                                <div class="rating-stars_in_card">
                                                    <div class="grey-stars"></div>
                                                    <div class="filled-stars" style="width:<?php echo $rating * 20; ?>%"></div>
                                                </div>
                                                <h4>~ <?php echo $name; ?></h4>
                                                <h5><?php echo $country; 
                                                    if (!empty($college)) {
                                                        echo " ($college)"; 
                                                    }
                                                ?></h5>
                                                <h6><?php echo $service; ?></h6>
                                            </div>
                                        </div>
                                    </div>
                        <?php 
                                } // End of while loop
                            } else {
                                echo "<center><h2 style='color:var(--text-dark);'>No testimonial recorded!<h2></center>";
                            }
                        ?>
                    </div><!--card-wrapper-->
                    <div class="vertical-scroll">
                        <button class="btn-scroll" id="btn-scroll-down" onclick="scrollVertically(-1)">
                            <i class="fas fa-chevron-down"></i>
                        </button>
                    </div>
                </div><!--testimonial-container-right-->
//scrolling of testimonial cards
document.addEventListener('DOMContentLoaded', function () {
    const cardWrapper = document.querySelector('.card-wrapper');
    const btnScrollUp = document.getElementById('btn-scroll-up');
    const btnScrollDown = document.getElementById('btn-scroll-down');

    let scrollAmount = window.innerWidth < 768 ? 50 : 100; // Adjust scroll amount based on screen size

function scrollVertically(direction) {
    const scrollHeight = cardWrapper.scrollHeight;
    const clientHeight = cardWrapper.clientHeight;
    const currentScrollPosition = cardWrapper.scrollTop;

    // Scroll up
    if (direction === 1) {
        cardWrapper.scrollBy({
            top: -scrollAmount,
            behavior: 'smooth'
        });
    } 
    // Scroll down
    else {
        cardWrapper.scrollBy({
            top: scrollAmount,
            behavior: 'smooth'
        });
    }

    // Update button visibility after scrolling
    setTimeout(updateScrollButtons, 300); // Delay to allow for smooth scrolling
}

    function updateScrollButtons() {
        const currentScrollPosition = cardWrapper.scrollTop;
        const maxScrollHeight = cardWrapper.scrollHeight - cardWrapper.clientHeight;

        if (currentScrollPosition <= 0) {
            btnScrollUp.style.display = 'none'; // Hide up button
        } else {
            btnScrollUp.style.display = 'flex'; // Show up button
        }

        if (currentScrollPosition >= maxScrollHeight) {
            btnScrollDown.style.display = 'none'; // Hide down button
        } else {
            btnScrollDown.style.display = 'flex'; // Show down button
        }
    }

    // Initialize scroll button visibility
    updateScrollButtons();

    // Event listeners for buttons
    btnScrollUp.addEventListener('click', () => scrollVertically(1));
btnScrollUp.addEventListener('touchstart', () => scrollVertically(1));
btnScrollDown.addEventListener('click', () => scrollVertically(-1));
btnScrollDown.addEventListener('touchstart', () => scrollVertically(-1));

    // Add scroll event listener to update button visibility when scrolling manually
    cardWrapper.addEventListener('scroll', updateScrollButtons);

    // Add event listeners for "View More" buttons
    const viewMoreButtons = document.querySelectorAll('.view-more-btn');
    viewMoreButtons.forEach(button => {
    button.addEventListener('click', function () {
        const cardDetails = this.parentElement.querySelector('.card-text');
        cardDetails.classList.toggle('expanded'); // Toggle the expanded class
        
        // Scroll to the bottom of the card wrapper if expanding the last card
        if (this.closest('.card') === cardWrapper.lastElementChild) {
            cardWrapper.scrollTo({
                top: cardWrapper.scrollHeight, // Scroll to the bottom of the card wrapper
                behavior: 'smooth' // Smooth scroll
            });
        }

        this.textContent = cardDetails.classList.contains('expanded') ? 'View Less' : 'View More'; // Change button text

        // Update scroll button visibility
        updateScrollButtons();
    });
});
});
.testimonial-container-right{
    grid-area:testimonial-container-right;
    display:flex;
    flex-direction: column;
}
.vertical-scroll {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* Change to relative for positioning */
}
.btn-scroll{
    font-size: 2rem;
    outline: none;
    border: none;
    color:var(--white);
    cursor: pointer;
    background: var(--primary-color);
    transition: .3s all ease;
}
#btn-scroll-up,
#btn-scroll-down {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex; /* Ensure it's displayed as a flex container */
    z-index: 1;
    padding: .5rem 1rem;
}
#btn-scroll-up{
    border-radius: 0 0 1rem 1rem;
    top:0;
}
#btn-scroll-down{
    border-radius: 1rem 1rem 0 0;
    bottom: 0;
}
.btn-scroll:hover,
.btn-scroll:focus{
    background-color: var(--secondary-color);
}
.card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    height: 650px;
    overflow-y: hidden;
    position: relative;
}
.card{
    padding:2rem;
    display:flex;
    flex-direction: row;
    align-items: flex-start;
    gap:1rem;
    background-color: var(--white);
    border-radius: 1rem;
    cursor:pointer;
    max-height: auto;
    border: 1px solid var(--secondary-color);
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */  
    max-width: 650px;
    /*word-break: break-all;*/
}   
.testi-image{
    display: flex;
    align-items: center;
    justify-content: center;
}
.card img {
    width: 75px; /* Set a max width for the preview */
    height: 75px; /* Set a max height for the preview */
    border-radius:50%;
    border: 1px solid #eee;
    float: none;
    pointer-events: none;
}
.card__content{
    display: flex;
    gap:1rem;
    flex: 1;
    max-width: 100%;
}
.card__content span i{
    font-size: 2rem;
    color:var(--primary-color);
}
.card__details {
    flex-grow: 1; /* Allow it to grow */
    flex-shrink: 1; /* Allow it to shrink */
    min-width: 0; /* Avoid forcing unnecessary width */
    max-width: 100%; /* Prevent overflow beyond container */
    overflow: hidden;
}
.card__details p {
    max-width: 100%;
    font-size: 1rem;
    font-style: italic;
    font-weight: 400;
    color: var(--text-dark);
    margin-right: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    -webkit-box-orient: vertical;
    transition: max-height 0.3s ease;
    max-height: 4.5em; /* Adjust based on line height */

}
.card__details p.expanded {
    -webkit-line-clamp: unset; /* Remove line limit */
    max-height: none; /* Allow full height */
}
.card__details h4{
    text-align: right;
    color:var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
}
.card__details h5{
    text-align: right;
    color:var(--primary-color);
    font-size: .8rem;
    font-weight: 400;
    margin-bottom: .1rem;
}
.card__details h6{
    text-align: right;
    color:var(--text-light);
    font-size: .7rem;
    font-weight: 400;
    display: flex; /* Use flexbox for better alignment */
    align-items: center; /* Center align items vertically */
    justify-content: flex-end; /* Align content to the right */
    margin-top: 0;
    margin-bottom: 0;
}
.rating-stars_in_card{
    height: 30px;
    position: absolute;
    vertical-align: baseline;
    color: #b9b9b9;
    line-height: 10px;
    float: left;
    margin:1rem 0;
}
.card__details button{
    padding: .5rem 1rem;
    outline:none;
    border: none;
    border-radius: 5px;
    background: linear-gradient(
        to right,#ff226f,
        #fe6769);
    color: var(--white);
    font-size: .8rem;
    cursor: pointer;
}