/**
 * Branwell Reviews — plugin styles
 * Handle: bw-styles-reviews
 *
 * Auto-scrolling marquee of latest customer reviews. White outer
 * surface, palette-tinted cards. Scoped under #bw-reviews-panel so
 * nothing leaks. Plugin owns:
 *   - card layout + visual style
 *   - marquee motion + edge fades
 *   - helpful button styling
 *
 * Plugin does NOT own:
 *   - body font, body colour, container width  (theme owns)
 *   - heading defaults                          (theme owns)
 *   - the section header at the top             (theme partial)
 *
 * Palette: every colour via var(--color-*) tokens defined by the theme
 * customizer. The card tint uses --color-background-info so it picks
 * up whatever palette the customer has set.
 */

#bw-reviews-panel {
    box-sizing: border-box;
    width: 100%;
    /* No horizontal padding or margin on root — theme content wrapper
       controls width. The marquee handles its own bleed via negative
       margin below. */
    margin: 0;
    padding: 0;
    background: transparent;
}
#bw-reviews-panel *,
#bw-reviews-panel *::before,
#bw-reviews-panel *::after {
    box-sizing: border-box;
}

/* ============================================================
   Marquee container
   ============================================================ */
#bw-reviews-panel .bw-reviews__marquee {
    position: relative;
    overflow: hidden;
    margin-top: 12px;
}

#bw-reviews-panel .bw-reviews__track {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: bw-reviews-marquee 90s linear infinite;
    will-change: transform;
}

/* Pause when the visitor hovers — gives them time to read a card. */
#bw-reviews-panel .bw-reviews__marquee:hover .bw-reviews__track {
    animation-play-state: paused;
}

@keyframes bw-reviews-marquee {
    from { transform: translateX(0); }
    /* -50% works because we render the cards twice; when set 1 has fully
       left the screen, set 2 sits exactly where set 1 started. */
    to   { transform: translateX(-50%); }
}

/* Soft fade at the edges so cards enter/exit gently rather than
   clipping. Width is intentionally generous (~80px) so the fade is
   noticeable but not heavy. Pointer-events: none so the fades don't
   eat clicks near the edges. */
#bw-reviews-panel .bw-reviews__fade {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    pointer-events: none;
    z-index: 2;
}
#bw-reviews-panel .bw-reviews__fade--l {
    left: 0;
    background: linear-gradient(to right, var(--color-background-primary, #ffffff), transparent);
}
#bw-reviews-panel .bw-reviews__fade--r {
    right: 0;
    background: linear-gradient(to left, var(--color-background-primary, #ffffff), transparent);
}

/* Honor prefers-reduced-motion — stop the marquee for users who've
   opted out. Cards stay visible (the second pass is still there but
   off-screen, that's fine — the first pass fills the viewport). */
@media (prefers-reduced-motion: reduce) {
    #bw-reviews-panel .bw-reviews__track {
        animation: none;
    }
}

/* ============================================================
   Card
   ============================================================ */
#bw-reviews-panel .bw-reviews__card {
    flex: 0 0 320px;
    padding: 24px 22px;
    background: var(--color-background-info, #ebf0f8);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}

#bw-reviews-panel .bw-reviews__quote {
    font-size: 0.95rem;
    line-height: 1.55;
    color: inherit;
    margin: 0 0 18px;
    /* Limit to 5 lines to keep card heights even across the strip.
       Past 5 lines, ellipsis. Webkit-only, but the major browsers
       support it. Graceful degradation: long quotes just stretch. */
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#bw-reviews-panel .bw-reviews__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#bw-reviews-panel .bw-reviews__caller {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;     /* allow ellipsis inside flex */
    flex: 1;
}

#bw-reviews-panel .bw-reviews__caller-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-background-primary, #ffffff);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

#bw-reviews-panel .bw-reviews__caller-meta {
    font-size: 0.78rem;
    line-height: 1.35;
    color: inherit;
    opacity: 0.7;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#bw-reviews-panel .bw-reviews__reader-link {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}
#bw-reviews-panel .bw-reviews__reader-link:hover,
#bw-reviews-panel .bw-reviews__reader-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
    outline: none;
}

#bw-reviews-panel .bw-reviews__sep {
    margin: 0 4px;
    opacity: 0.5;
}

#bw-reviews-panel .bw-reviews__date {
    white-space: nowrap;
}

/* ============================================================
   Helpful button — preserved from legacy plugin functionally,
   restyled to match the palette.
   ============================================================ */
#bw-reviews-panel .bw-reviews__helpful {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--color-background-primary, #ffffff);
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}
#bw-reviews-panel .bw-reviews__helpful:hover {
    border-color: var(--color-primary);
}
#bw-reviews-panel .bw-reviews__helpful.is-voted {
    /* Once they've voted, the button reads as "thanks recorded" rather
       than clickable. Slight de-emphasis via opacity. */
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}
#bw-reviews-panel .bw-reviews__helpful svg {
    flex-shrink: 0;
}

/* ============================================================
   Empty state
   ============================================================ */
#bw-reviews-panel .bw-reviews__empty {
    margin: 1.5rem 0;
    padding: 2rem;
    text-align: center;
    color: inherit;
    opacity: 0.6;
    font-size: 0.95rem;
    background: var(--color-background-info);
    border-radius: 12px;
}

/* ============================================================
   Responsive — smaller cards on mobile, faster animation since
   there's less width to traverse.
   ============================================================ */
@media (max-width: 768px) {
    #bw-reviews-panel .bw-reviews__card {
        flex: 0 0 260px;
        padding: 20px 18px;
        min-height: 180px;
    }
    #bw-reviews-panel .bw-reviews__quote {
        font-size: 0.88rem;
    }
    #bw-reviews-panel .bw-reviews__track {
        animation-duration: 70s;
    }
}
@media (max-width: 480px) {
    #bw-reviews-panel .bw-reviews__card {
        flex: 0 0 230px;
    }
    #bw-reviews-panel .bw-reviews__fade {
        width: 40px;
    }
}
