.testimonials-section {
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 18%, rgba(147, 197, 253, 0.14), transparent 28%),
        #f8fafc;
}

.testimonials-desktop {
    display: grid;
    gap: 20px;
}

.testimonials-mobile {
    display: none;
}

.testimonials-marquee {
    --testimonial-gap: 18px;
    --testimonial-half-gap: 9px;
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 6px 0 12px;
}

.testimonials-marquee::before,
.testimonials-marquee::after {
    position: absolute;
    z-index: 4;
    top: 0;
    bottom: 0;
    width: clamp(28px, 7vw, 112px);
    content: '';
    pointer-events: none;
}

.testimonials-marquee::before {
    left: 0;
    background: linear-gradient(to right, #f8fafc 12%, rgba(248, 250, 252, 0));
}

.testimonials-marquee::after {
    right: 0;
    background: linear-gradient(to left, #f8fafc 12%, rgba(248, 250, 252, 0));
}

.testimonials-track {
    display: flex;
    width: max-content;
    align-items: stretch;
    gap: var(--testimonial-gap);
    will-change: transform;
}

.testimonials-marquee--right .testimonials-track {
    animation: testimonialsMarqueeRight 62s linear infinite;
}

.testimonials-marquee--left .testimonials-track {
    animation: testimonialsMarqueeLeft 58s linear infinite;
}

.testimonials-group {
    display: flex;
    flex: none;
    align-items: stretch;
    gap: var(--testimonial-gap);
}

.testimonial-card {
    display: flex;
    width: min(46vw, 500px);
    min-height: 220px;
    padding: 22px 24px;
    flex: 0 0 min(46vw, 500px);
    border: 1px solid #dbe5f1;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 18px 42px -30px rgba(15, 23, 42, 0.48);
    flex-direction: column;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.testimonials-marquee:nth-child(2) .testimonial-card {
    border-color: #cfe0f7;
    background: #eff6ff;
}

.testimonial-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 22px 46px -28px rgba(3, 48, 110, 0.4);
    transform: translateY(-2px);
}

.testimonial-card__header {
    display: grid;
    align-items: center;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
}

.testimonial-card__photo {
    width: 52px;
    height: 52px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #cbd5e1;
    box-shadow: 0 0 0 1px #cbd5e1, 0 8px 16px -12px rgba(15, 23, 42, 0.65);
    object-fit: cover;
}

.testimonial-card__identity {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.testimonial-card__identity cite {
    color: #0f172a;
    font-family: var(--font-heading);
    font-size: 15px;
    font-style: normal;
    font-weight: 800;
    line-height: 1.25;
}

.testimonial-card__identity span {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}

.testimonial-card__rating {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid #fde68a;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 9px 20px -16px rgba(15, 23, 42, 0.5);
}

.testimonial-card__rating span {
    color: #f59e0b;
    font-size: 15px;
    line-height: 1;
    letter-spacing: 0.08em;
}

.testimonial-card blockquote {
    margin: 20px 0 0;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.65;
}

.testimonial-source {
    display: flex;
    width: max-content;
    max-width: calc(100% - 32px);
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 28px auto 0;
    padding: 9px 14px;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px -22px rgba(15, 23, 42, 0.5);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.testimonial-source strong {
    color: #334155;
    font-weight: 800;
}

.testimonial-source__logo {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

@keyframes testimonialsMarqueeLeft {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(calc(-50% - var(--testimonial-half-gap)), 0, 0); }
}

@keyframes testimonialsMarqueeRight {
    from { transform: translate3d(calc(-50% - var(--testimonial-half-gap)), 0, 0); }
    to { transform: translate3d(0, 0, 0); }
}

@media (max-width: 639px) {
    .testimonials-section {
        background: #f8fafc;
    }

    .testimonials-desktop {
        display: none;
    }

    .testimonials-mobile {
        display: block;
        position: relative;
        padding-bottom: 12px;
    }

    .testimonials-mobile__stack {
        position: relative;
        width: 100%;
        max-width: 360px;
        height: 315px;
        margin: 0 auto;
        perspective: 1000px;
        user-select: none;
        -webkit-user-select: none;
        touch-action: pan-y;
    }

    .testimonial-stack-card {
        position: absolute;
        top: 0;
        left: 50%;
        width: calc(100% - 16px);
        max-width: 340px;
        height: 290px;
        padding: 20px;
        border-radius: 20px;
        border: 1px solid #dbe5f1;
        background: #ffffff;
        box-shadow: 0 16px 36px -18px rgba(15, 23, 42, 0.22), 0 4px 14px -4px rgba(3, 48, 110, 0.12);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        will-change: transform, opacity;
        touch-action: pan-y;
        overflow: hidden;
        transition: none !important;
    }

    .testimonial-stack-card:nth-child(even) {
        background: #f8fbff;
        border-color: #d1e2f7;
    }

    .testimonial-card__header {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        gap: 10px;
    }

    .testimonial-card__photo {
        width: 44px;
        height: 44px;
    }

    .testimonial-card__identity cite {
        font-size: 13.5px;
    }

    .testimonial-card__identity span {
        font-size: 10.5px;
    }

    .testimonial-card__rating {
        padding: 6px 8px;
    }

    .testimonial-card__rating span {
        font-size: 11px;
        letter-spacing: 0.04em;
    }

    .testimonial-stack-card blockquote {
        margin-top: 14px;
        font-size: 12.5px;
        line-height: 1.6;
        color: #334155;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .testimonial-stack-card blockquote::-webkit-scrollbar {
        display: none;
    }

    /* Fallback static list styling if JS disabled */
    .testimonials-mobile noscript .testimonial-card {
        width: 100%;
        min-height: 0;
        padding: 18px;
        border-radius: 18px;
        margin-bottom: 14px;
    }

    /* Hint Wobble Keyframes (Affordance prompt when scrolled into view) */
    @keyframes testimonialCardWobble {
        0%, 100% {
            transform: translate3d(-50%, 0, 0) rotate(0deg);
        }
        20% {
            transform: translate3d(calc(-50% - 12px), 0, 0) rotate(-3.5deg);
        }
        45% {
            transform: translate3d(calc(-50% + 12px), 0, 0) rotate(3deg);
        }
        70% {
            transform: translate3d(calc(-50% - 6px), 0, 0) rotate(-1.5deg);
        }
        85% {
            transform: translate3d(calc(-50% + 3px), 0, 0) rotate(1deg);
        }
    }

    .testimonial-stack-card--hint {
        animation: testimonialCardWobble 1.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
    }

    .testimonial-source {
        width: calc(100% - 32px);
        margin-top: 24px;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .testimonials-marquee {
        overflow-x: auto;
        padding-inline: 16px;
        scroll-snap-type: x mandatory;
    }

    .testimonials-marquee::before,
    .testimonials-marquee::after,
    .testimonials-group--duplicate {
        display: none;
    }

    .testimonials-track {
        animation: none;
        transform: none;
        will-change: auto;
    }

    .testimonial-card {
        scroll-snap-align: center;
    }
}
