#testimonials {
    /*background-attachment: scroll, scroll, scroll, fixed;*/
    /*background-color: #645862;*/
    /*background-image: url("{% static 'images/light-tl.svg' %}"), url("{% static 'images/light-tr.svg' %}"), url("{% static 'images/overlay.png' %}"), url("{% static 'images/curtain-header-3.jpg' %}");*/
    /*background-position: top left, top right, top left, bottom center;*/
    /*background-repeat: no-repeat, no-repeat, repeat, no-repeat;*/
    /*background-size: 25em, 25em, auto, cover;*/
    color: #fff;
    padding: 1em;
    padding-top: 2em;
    text-align: center;
}


.testimonial-carousel {
    position: relative;
    overflow: hidden;
    min-height: 200px;
    max-height: 400px; /* Maximum height before truncation kicks in */
    height: auto;
    margin: 2rem 0;
    display: flex;
    align-items: center; /* Center content vertically */
}

.testimonial-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: testimonialCycle 15s infinite;
    transition: opacity 0.5s ease-in-out;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.testimonial-slide blockquote {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    max-width: 100%;
}

/* Stagger the animation delays for each slide */
.testimonial-slide:nth-child(1) { animation-delay: 0s; }
.testimonial-slide:nth-child(2) { animation-delay: 3s; }
.testimonial-slide:nth-child(3) { animation-delay: 6s; }
.testimonial-slide:nth-child(4) { animation-delay: 9s; }
.testimonial-slide:nth-child(5) { animation-delay: 12s; }

@keyframes testimonialCycle {
    0%, 20% { opacity: 1; }
    25%, 100% { opacity: 0; }
}

/* Pause animation on hover */
.testimonial-carousel:hover .testimonial-slide {
    animation-play-state: paused;
}

.testimonial-slide p {
    font-style: italic;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #ffffff;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 8; /* Limit to 6 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: calc(1.4em * 8); /* 6 lines max */
    background: linear-gradient(to bottom, #bfbebe 0%, #bfbebe 70%, transparent 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.testimonial-slide cite {
    display: block;
    font-size: 1rem;
    color: #bfbebe;
    margin-top: auto; /* Push to bottom */
    text-align: right;
    flex-shrink: 0; /* Prevent cite from shrinking */
    padding-top: 0.5rem;
}

.testimonial-slide cite strong {
    color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .testimonial-carousel {
        max-height: 300px;
        min-height: 150px;
    }

    .testimonial-slide {
        padding: 0.5rem;
    }

    .testimonial-slide p {
        font-size: 1.2rem;
        -webkit-line-clamp: 4; /* Fewer lines on mobile */
        max-height: calc(1.4em * 4);
        margin-bottom: 0.75rem;
    }

    .testimonial-slide cite {
        font-size: 0.9rem;
        text-align: center; /* Center on mobile for better readability */
    }
}

@media (max-width: 480px) {
    .testimonial-carousel {
        max-height: 250px;
        min-height: 120px;
    }

    .testimonial-slide p {
        font-size: 1rem;
        -webkit-line-clamp: 3; /* Even fewer lines on small mobile */
        max-height: calc(1.4em * 3);
    }

    .testimonial-slide cite {
        font-size: 0.8rem;
    }
}

/* Optional: Add fade transition indicators */
.testimonial-carousel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 1;
}

.testimonial-carousel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 1;
}