.gr-widget {
    --gr-star: #fdd663;
    --gr-star-darker: #c4a64d;
    --gr-star-bg: #d1d5db;
    --gr-text: rgb(19, 16, 15);
    --gr-subtext: #3b2300;
    --gr-bg: #ffffff;
    --gr-border: #e5e7eb;
    --gr-btn-bg: #4285f4;
    --gr-btn-text: #ffffff;
    --gr-radius: 10px;
    --gr-shadow: 0 2px 8px rgba(0, 0, 0, .06);

    color: var(--gr-text);
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
}

.gr-widget *,
.gr-widget *::before,
.gr-widget *::after {
    box-sizing: inherit;
}

.gr-widget[data-theme="dark"] {
    --gr-text: #f9fafb;
    --gr-subtext: #9ca3af;
    --gr-bg: #1f2937;
    --gr-border: #374151;
    --gr-star-bg: #4b5563;
    --gr-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

/* ── Header ──────────────────────────────────────── */

.gr-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 0 0 20px;
    margin-bottom: 16px;
}

.gr-rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gr-header .gr-stars {
    font-size: 2.0rem;
}

.gr-rating-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.gr-review-count {
    font-size: 1rem;
    color: var(--gr-subtext);
}

/* ── Stars ───────────────────────────────────────── */

.gr-stars {
    position: relative;
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 1px;
    vertical-align: middle;
}

.gr-stars-empty {
    color: var(--gr-star-bg);
}

.gr-stars-filled {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: var(--gr-star-darker);
}

.gr-header .gr-stars-filled {
    color: var(--gr-star);
}

/* ── Reviews grid / list ─────────────────────────── */

.gr-reviews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 400px));
    gap: 16px;
}

.gr-widget[data-layout="list"] .gr-reviews {
    grid-template-columns: 1fr;
}

.gr-widget[data-layout="grid"][data-columns="1"] .gr-reviews {
    grid-template-columns: minmax(0, 400px);
}

.gr-widget[data-layout="grid"][data-columns="2"] .gr-reviews {
    grid-template-columns: repeat(2, minmax(0, 400px));
}

.gr-widget[data-layout="grid"][data-columns="3"] .gr-reviews {
    grid-template-columns: repeat(3, minmax(0, 400px));
}

/* ── Individual review card ──────────────────────── */

.gr-review {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    background: var(--gr-bg);
    border: 1px solid var(--gr-border);
    border-radius: var(--gr-radius);
    box-shadow: var(--gr-shadow);
    max-width: 400px;
}

/* ── Review top row ──────────────────────────────── */

.gr-review-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gr-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.gr-avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gr-btn-bg);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.gr-reviewer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gr-reviewer-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gr-review-org {
    font-size: 0.8rem;
    color: var(--gr-subtext);
    font-style: italic;
}

.gr-review-date {
    font-size: 0.8rem;
    color: var(--gr-subtext);
}

/* ── Review text ─────────────────────────────────── */
.gr-review-text {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gr-review-text .gr-review-date {
    margin-left: auto;
}

.gr-review-text p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--gr-text);
}

.gr-review-text.is-clamped p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

.gr-read-more {
    background: none;
    border: none;
    padding: 0;
    margin-top: 2px;
    font-size: 0.85rem;
    color: var(--gr-btn-bg);
    cursor: pointer;
    font-family: inherit;
}

.gr-read-more:hover {
    text-decoration: underline;
}

/* ── Header right group (logo + write-a-review) ───── */

.gr-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.gr-google-logo {
    height: 35px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

/* ── Carousel layout ─────────────────────────────── */

.gr-carousel-viewport {
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
    border-radius: var(--gr-radius);
    width: 100%;
    touch-action: pan-x;
}

.gr-carousel-viewport::-webkit-scrollbar {
    display: none;
}

.gr-carousel-track {
    display: flex;
    align-items: stretch;
    width: 100%;
}

/* Slide widths are set by JS; these are the CSS fallbacks for initial paint */
.gr-carousel-slide {
    flex-shrink: 0;
    width: calc(100% / 3);
    padding: 4px 8px;
    display: flex;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.gr-carousel-slide:first-child {
    padding-left: 0;
}

.gr-carousel-slide:last-child {
    padding-right: 0;
}

/* Cards inside the carousel fill the slide height */
.gr-carousel-slide .gr-review {
    flex: 1;
}

/* ── Google source badge ─────────────────────────── */

/* Use img.gr-google-badge (specificity 0,2,1) so that when both this rule and
   a theme's img[src$=".svg"] (0,1,1) use !important, ours wins. */
.gr-widget img.gr-google-badge {
    margin-left: auto;
    flex-shrink: 0;
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    opacity: 0.75;
    display: block;
}

/* ── Carousel navigation ─────────────────────────── */

.gr-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 0 4px;
}

.gr-carousel-btn {
    flex-shrink: 0;
    background: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border-color: transparent;
    box-shadow: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
    transition: opacity .15s;
}

.gr-carousel-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.gr-carousel-dots {
    display: flex;
    gap: 12px;
    align-items: center;
}

.gr-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 6px;
    box-sizing: content-box;
    /* padding must extend outward for background-clip tap-target technique */
    background: var(--gr-border);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    /* Extend tap target to ~20×20px to meet WCAG 2.5.8 minimum */
    background-clip: content-box;
}

.gr-dot.is-active {
    background: var(--gr-btn-bg);
    background-clip: content-box;
    transform: scale(1.4);
}

/* ── Card entry animation ────────────────────────── */

@keyframes gr-fadein {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gr-widget:not([data-layout="carousel"]) .gr-review {
    animation: gr-fadein 0.35s ease both;
}

.gr-review:nth-child(1) {
    animation-delay: 0.04s;
}

.gr-review:nth-child(2) {
    animation-delay: 0.08s;
}

.gr-review:nth-child(3) {
    animation-delay: 0.12s;
}

.gr-review:nth-child(4) {
    animation-delay: 0.16s;
}

.gr-review:nth-child(5) {
    animation-delay: 0.20s;
}

.gr-review:nth-child(6) {
    animation-delay: 0.24s;
}

.gr-review:nth-child(7) {
    animation-delay: 0.28s;
}

.gr-review:nth-child(8) {
    animation-delay: 0.32s;
}

.gr-review:nth-child(9) {
    animation-delay: 0.36s;
}

.gr-review:nth-child(10) {
    animation-delay: 0.40s;
}

/* ── Misc ────────────────────────────────────────── */

.gr-notice {
    color: var(--gr-subtext);
    font-style: italic;
    margin: 0;
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 480px) {
    .gr-widget[data-layout="grid"] .gr-reviews {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gr-review {
        animation: none !important;
    }

    .gr-carousel-viewport {
        scroll-behavior: auto !important;
    }

    .gr-dot {
        transition: none !important;
    }
}