/* H3X Trustpilot Reviews block */

.h3x-tp-reviews {
    --h3x-tp-cols: 3;
    --h3x-tp-card-w: 320px;
    --h3x-tp-per-slide: 4;
    --h3x-tp-gap: 16px;
    --h3x-tp-green: #1b873f;
    max-width: 100%;
    --h3x-tp-orange: #f06502;
}

/* Summary header --------------------------------------------------------- */
/* Top row of {score} {label} {stars}, with the review count beneath. */
.h3x-tp-reviews__summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-bottom: 16px;
    font-size: 15px;
}

/* Full width so align-items centres within the row rather than centring a
   shrink-to-content link that can overflow (and shift right) on mobile. */
.h3x-tp-reviews__summary>a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.h3x-tp-summary__top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 100%;
}

.h3x-tp-summary__score {
    font-weight: 700;
    font-size: 18px;
}

.h3x-tp-summary__stars {
    height: 22px;
    width: auto;
    max-width: 100%;
}

.h3x-tp-summary__count {
    color: #4b4b4b;
}

/* Summary alignment (left / center / right) */
.h3x-tp-reviews__summary.is-align-left,
.h3x-tp-reviews__summary.is-align-left>a {
    align-items: flex-start;
}

.h3x-tp-reviews__summary.is-align-center,
.h3x-tp-reviews__summary.is-align-center>a {
    align-items: center;
}

.h3x-tp-reviews__summary.is-align-right,
.h3x-tp-reviews__summary.is-align-right>a {
    align-items: flex-end;
}

/* Card ------------------------------------------------------------------- */
.h3x-tp-reviews__card {
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 18px 20px;
    text-align: left;
}

.h3x-tp-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.h3x-tp-card__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 40px;
    background: #ececec;
    display: flex;
    align-items: center;
    justify-content: center;
}

.h3x-tp-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.h3x-tp-card__initials {
    font-weight: 700;
    color: #555;
    font-size: 15px;
}

.h3x-tp-card__who {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.h3x-tp-card__name {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.h3x-tp-card__name:hover {
    text-decoration: underline;
}

.h3x-tp-card__meta {
    font-size: 12px;
    color: #777;
}

.h3x-tp-card__stars {
    height: 20px;
    width: auto;
    display: block;
    margin-bottom: 10px;
}

.h3x-tp-card__title {
    font-size: 16px;
    margin: 0 0 6px;
}

.h3x-tp-card__text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 5;
    display: -webkit-box;
    text-overflow: ellipsis;
}

.h3x-tp-card__date {
    font-size: 12px;
    color: #888;
    margin: 10px 0 0;
}

/* Moderation badges ------------------------------------------------------ */
.h3x-tp-card__badges {
    margin: 0 0 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.h3x-tp-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1.6;
}

.h3x-tp-badge--verified {
    background: var(--h3x-tp-green);
}

.h3x-tp-badge--customisation {
    background: var(--h3x-tp-orange);
}

/* Business reply --------------------------------------------------------- */
.h3x-tp-card__reply {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f6f6f6;
    border-radius: 6px;
}

.h3x-tp-card__reply-head {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #444;
}

.h3x-tp-card__reply-body {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
}

/* Carousel layout -------------------------------------------------------- */
/* Native horizontal scroll: how many cards are visible follows the screen
   width, capped by "per slide" and targeting "max card width". */
.h3x-tp-reviews.is-layout-carousel .h3x-tp-reviews__viewport {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.h3x-tp-reviews.is-layout-carousel .h3x-tp-reviews__track {
    display: flex;
    gap: var(--h3x-tp-gap);
    padding-bottom: 6px;
}

.h3x-tp-reviews.is-layout-carousel .h3x-tp-reviews__card {
    flex: 0 0 clamp(calc((100% - (var(--h3x-tp-per-slide) - 1) * var(--h3x-tp-gap)) / var(--h3x-tp-per-slide)),
            min(var(--h3x-tp-card-w), 100%),
            100%);
    scroll-snap-align: start;
}

/* Unset overflow: strip the block's own scroll so the cards overflow off the
   page, letting a parent row / wrapper own the horizontal scrolling. */
.h3x-tp-reviews.is-layout-carousel.is-overflow-unset .h3x-tp-reviews__viewport {
    overflow: visible;
    scroll-snap-type: none;
}

/* Row / grid layout ------------------------------------------------------ */
.h3x-tp-reviews.is-layout-row .h3x-tp-reviews__track {
    display: grid;
    grid-template-columns: repeat(var(--h3x-tp-cols), minmax(0, 1fr));
    gap: var(--h3x-tp-gap);
}

/* Mobile: row stacks to one column by default… */
@media (max-width: 781.98px) {
    .h3x-tp-reviews.is-layout-row .h3x-tp-reviews__track {
        grid-template-columns: 1fr;
    }

    /* …unless "Carousel on mobile" is enabled — then swipe through cards. */
    .h3x-tp-reviews.is-layout-row.has-mobile-carousel .h3x-tp-reviews__viewport {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .h3x-tp-reviews.is-layout-row.has-mobile-carousel .h3x-tp-reviews__track {
        display: flex;
        grid-template-columns: none;
        gap: var(--h3x-tp-gap);
        padding-bottom: 6px;
    }

    .h3x-tp-reviews.is-layout-row.has-mobile-carousel .h3x-tp-reviews__card {
        flex: 0 0 min(var(--h3x-tp-card-w), 85%);
        scroll-snap-align: start;
    }
}

/* Editor placeholder ----------------------------------------------------- */
.h3x-tp-reviews-editor-placeholder {
    border: 1px dashed #c3c4c7;
    border-radius: 6px;
    padding: 16px 20px;
    background: #fafafa;
}

.h3x-tp-reviews-editor-placeholder strong {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
}

.h3x-tp-reviews-editor-hint {
    color: #777;
    font-size: 13px;
}

.h3x-tp-reviews__card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 10px 24px rgba(0, 0, 0, 0.18);
}

/* Lift on hover — desktop / mouse only, so mobile doesn't need a tap */
@media (hover: hover) {
    .h3x-tp-reviews__card {
        transition: transform .2s ease, box-shadow .2s ease;
    }

    .h3x-tp-reviews__card:hover {
        transform: translateY(-4px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 16px 32px rgba(0, 0, 0, 0.24);
    }
}