/**
 * Swell Reviews — front-end styles
 *
 * Neutral by default: text colour and font are inherited from the theme, and
 * the Elementor widgets' Style controls override the rest. To set a look for
 * the shortcodes and template tags too, define any of these in the theme:
 *
 *   --swell-reviews-primary  reviewer name, "Read more", score value, carousel arrows
 *   --swell-reviews-accent   platform chip text
 *   --swell-reviews-ink      body text of the grid, carousel and score
 *   --swell-reviews-font     font family of the grid, carousel and score
 *
 * Left undefined, each falls back to the inherited value.
 */

:root {
    --swell-reviews-mist: #f4f4f4;
    --swell-reviews-border: #e8e8e8;
    --swell-reviews-star-filled: #f2b84b;
    --swell-reviews-star-empty: #d8d8d8;
    --swell-reviews-chip-bg: rgba(0, 0, 0, 0.05);
    --swell-reviews-card-radius: 10px;
}

/* Grid layout */
.swell-reviews-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    font-family: var(--swell-reviews-font, inherit);
    color: var(--swell-reviews-ink, inherit);
}

@media (max-width: 900px) {
    .swell-reviews-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .swell-reviews-grid { grid-template-columns: 1fr; }
}

/* Card */
.swell-review-card {
    background: var(--swell-reviews-mist);
    border: 1px solid var(--swell-reviews-border);
    border-radius: var(--swell-reviews-card-radius);
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.swell-review-card__stars {
    font-size: 1.05rem;
    letter-spacing: 1px;
    line-height: 1;
}

.swell-star { display: inline-block; }
.swell-star--filled { color: var(--swell-reviews-star-filled); }
.swell-star--empty { color: var(--swell-reviews-star-empty); }

/* Half star (score block): the star in the empty color with its left half overlaid in the filled
   color. A clipped copy of the glyph, not a background, so it never depends on background images
   (page builders may hold those back until a section scrolls into view). The Score widget's star
   color controls set --swell-star-fill and --swell-star-rest on it. */
.swell-star--half {
    position: relative;
    color: var(--swell-star-rest, var(--swell-reviews-star-empty));
}
.swell-star--half::before {
    content: "\2605";
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    overflow: hidden;
    white-space: nowrap;
    color: var(--swell-star-fill, var(--swell-reviews-star-filled));
}
[dir="rtl"] .swell-star--half::before {
    left: auto;
    right: 0;
    direction: rtl;
}

.swell-review-card__reviewer {
    font-weight: 700;
    color: var(--swell-reviews-primary, inherit);
}

.swell-review-card__date {
    font-size: 0.8rem;
    color: #888;
}

.swell-review-card__body {
    margin: 0.25rem 0 0;
    font-style: italic;
}

a.swell-review-card__read-more,
a.swell-review-card__read-more:link,
a.swell-review-card__read-more:visited,
a.swell-review-card__read-more:hover,
a.swell-review-card__read-more:focus {
    /* !important defends against theme rules like `.elementor a { text-decoration: none }`
       which otherwise strip the underline and button styling. The colour is set in
       the next rule. */
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin-left: 0.25em;
    font: inherit;
    text-decoration: underline !important;
    cursor: pointer;
    box-shadow: none !important;
}

/* The link colour is set here, without !important, so the Reviews widget's
   "Read more" colour control ({{WRAPPER}} a.swell-review-card__read-more) can
   override it. */
a.swell-review-card__read-more {
    color: var(--swell-reviews-primary, inherit);
}

.swell-review-card__platform {
    align-self: flex-start;
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--swell-reviews-chip-bg);
    /* --swell-reviews-chip-fg still works as an override, as before. */
    color: var(--swell-reviews-chip-fg, var(--swell-reviews-accent, inherit));
    padding: 3px 10px;
    border-radius: 999px;
    margin-top: 0.25rem;
}

/* Score widget */
.swell-score {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--swell-reviews-font, inherit);
    color: var(--swell-reviews-ink, inherit);
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-radius: var(--swell-reviews-card-radius);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
}

.swell-score__value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--swell-reviews-primary, inherit);
    line-height: 1;
}

.swell-score__stars { font-size: 1.2rem; letter-spacing: 1px; line-height: 1; }

.swell-score__count { font-size: 0.8rem; color: #666; }

/* Carousel — buttons sit as flex siblings outside the clipped viewport,
   so they live in their own space rather than overlapping the cards. */
.swell-reviews-carousel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--swell-reviews-font, inherit);
}

.swell-reviews-carousel__viewport {
    flex: 1 1 auto;
    overflow: hidden;
    min-width: 0;
}

.swell-reviews-carousel__track {
    display: flex;
    gap: 1.25rem;
    transition: transform 400ms ease;
}

.swell-reviews-carousel .swell-review-card {
    flex: 0 0 calc((100% - 2.5rem) / 3);
    min-width: 0;
}

@media (max-width: 900px) {
    .swell-reviews-carousel .swell-review-card { flex: 0 0 calc((100% - 1.25rem) / 2); }
}

@media (max-width: 600px) {
    .swell-reviews-carousel .swell-review-card { flex: 0 0 100%; }
}

/* !important defends against Elementor's button defaults which otherwise
   strip background/color and add unwanted padding. */
.swell-reviews-carousel .swell-reviews-carousel__btn {
    flex: 0 0 auto !important;
    background: #fff !important;
    border: 1px solid var(--swell-reviews-border) !important;
    border-radius: 999px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    cursor: pointer !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    color: var(--swell-reviews-primary, inherit) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.swell-reviews-carousel .swell-reviews-carousel__btn:hover {
    background: var(--swell-reviews-mist) !important;
}

/* Sample mode: the "Sample reviews shown for layout review." label. Kept small
   and quiet; it inherits the block's text colour. */
.swell-sample-notice {
    margin: 0 !important;
    font-size: 0.75rem;
    font-style: italic;
    line-height: 1.4;
}

/* Grid: the label takes a full row above the cards. */
.swell-reviews-grid > .swell-sample-notice {
    grid-column: 1 / -1;
}

/* Carousel: the label sits in the viewport, above the sliding track. */
.swell-reviews-carousel__viewport > .swell-sample-notice {
    margin-bottom: 0.5rem !important;
}

/* Score: the label takes its own line above the value and stars. width: 0 plus
   min-width: 100% stops it from widening the inline box. */
.swell-score[data-swell-sample] {
    flex-wrap: wrap;
    row-gap: 0.35rem;
}

.swell-score > .swell-sample-notice {
    width: 0;
    min-width: 100%;
}
