/*
 * SBN Developer Notes.
 * Scope: testimonial cards and carousel presentation.
 * Used by: [sbn_testimonials] on the homepage.
 * Edit risk: medium; JS expects carousel classes to remain stable.
 * QA: carousel controls, empty/missing image fallback, mobile cards.
 */

/* ============================================================
   SBN Testimonial Slider
   Enqueue or @import into your theme stylesheet.
   Assumes SBN CSS custom properties are declared globally.
   ============================================================ */

/* Section shell */
.sbn-testimonial-slider {
    background: var(--sbn-cream);
    padding: var(--sbn-section-desktop) var(--sbn-dynamic-edge);
    text-align: center;
    overflow: hidden;
}

/* Stars */
.sbn-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 12px;
}

.sbn-stars svg {
    width: 18px;
    height: 18px;
    fill: var(--sbn-gold);
}

/* Carousel wrapper */
.testimonial-carousel {
    position: relative;
    max-width: 860px;
    margin: 52px auto 0;
}

/* Track / slides */
.carousel-container {
    overflow: hidden;
    border-radius: var(--sbn-radius-card);
}

.carousel-track {
    display: flex;
    transition: transform 0.48s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.testimonial-slide {
    flex: 0 0 100%;
    padding: 52px 48px 44px;
    background: #fff;
    border-radius: var(--sbn-radius-card);
    box-shadow: var(--sbn-shadow-md);
    text-align: center;
    box-sizing: border-box;
    transition: opacity 0.4s ease, transform 0.48s cubic-bezier(0.4, 0, 0.2, 1);
}

.testimonial-slide.visible {
    opacity: 1;
}

/* Decorative gold rule above quote */
.testimonial-slide::before {
    content: '';
    display: block;
    width: 36px;
    height: 2px;
    background: var(--sbn-gold);
    margin: 0 auto 32px;
}

/* Quote text */
.sbn-quote-text {
    font-family: var(--sbn-serif);
    font-size: clamp(18px, 2.2vw, 24px);
    font-style: italic;
    color: var(--sbn-navy);
    line-height: 1.55;
    max-width: 640px;
    margin: 0 auto;
}

.sbn-quote-text p {
    margin: 0;
}

.sbn-quote-text p + p {
    margin-top: 0.85em;
}

.sbn-quote-text--clamped {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.testimonial-slide.is-quote-expanded .sbn-quote-text--clamped {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}

.sbn-quote-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    margin: 14px auto 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--sbn-gold);
    cursor: pointer;
    font-family: var(--sbn-sans);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sbn-quote-toggle:hover,
.sbn-quote-toggle:focus-visible {
    color: var(--sbn-navy);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sbn-quote-toggle:focus-visible {
    outline: 2px solid var(--sbn-gold);
    outline-offset: 4px;
}

/* Author row */
.testimonial-author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 36px;
}

.testimonial-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--sbn-paper);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--sbn-gold);
}

.testimonial-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
    box-sizing: border-box;
}

.author-initials {
    font-family: var(--sbn-sans);
    font-size: 15px;
    font-weight: 700;
    color: var(--sbn-navy);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.testimonial-info {
    text-align: left;
}

.testimonial-info strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--sbn-navy);
    letter-spacing: 0.01em;
}

.testimonial-info span {
    font-size: 13px;
    color: var(--sbn-ink);
    opacity: 0.6;
    margin-top: 2px;
    display: block;
}

.sbn-empty-state {
    color: var(--sbn-ink);
    margin: 32px auto 0;
    max-width: 520px;
    opacity: 0.72;
}

/* Nav buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sbn-navy);
    color: var(--sbn-cream);
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
    flex-shrink: 0;
}

.carousel-btn:hover {
    background: var(--sbn-gold);
    color: var(--sbn-navy);
}

.carousel-btn:focus-visible {
    outline: 3px solid var(--sbn-gold);
    outline-offset: 3px;
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.94);
}

.carousel-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.carousel-btn.prev { left: -23px; }
.carousel-btn.next { right: -23px; }

/* Dots */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sbn-mist);
    cursor: pointer;
    transition: background 0.2s, width 0.25s, border-radius 0.25s;
    border: none;
    padding: 0;
    box-shadow: 0 0 0 6px transparent; /* expanded touch target */
}

.dot.active {
    background: var(--sbn-gold);
    width: 24px;
    border-radius: 4px;
}

.dot:focus-visible {
    outline: 2px solid var(--sbn-gold);
    outline-offset: 3px;
}

/* Responsive */
@media (max-width: 900px) {
    .carousel-btn.prev { left: -14px; }
    .carousel-btn.next { right: -14px; }
}

@media (max-width: 640px) {
    .testimonial-slide {
        padding: 36px 24px 32px;
    }

    .testimonial-author {
        flex-direction: column;
        gap: 10px;
    }

    .testimonial-info {
        text-align: center;
    }

    .carousel-btn {
        width: 44px;
        height: 44px;
    }

    .carousel-btn.prev { left: -8px; }
    .carousel-btn.next { right: -8px; }
}

@media (max-width: 768px) {
    .sbn-quote-toggle {
        min-height: 44px;
        padding: 0 12px;
    }

    .dot {
        width: 12px;
        height: 12px;
        box-shadow: 0 0 0 10px transparent;
    }

    .testimonial-slide {
        padding: var(--sbn-space-md) var(--sbn-space-sm);
    }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-track,
    .testimonial-slide,
    .dot,
    .carousel-btn {
        transition: none;
    }
}
