/**
 * PIC - Testimonials — frontend styles.
 *
 * Section layout: reviews column (2/3) + promo panel (1/3).
 * The reviews column is either .pic-tm__cards (manual) or .pic-gr (Google
 * Reviews widget, five templates). The promo panel is shared by both.
 */

.pic-tm {
    padding: 4rem 0;
}

.pic-tm__container {
    max-width: var(--wp--style--global--wide-size, 1520px);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ---- Layout ---- */

.pic-tm__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .pic-tm__layout {
        grid-template-columns: 2fr 1fr;
    }
}

/* ---- Testimonial cards grid (manual source) ---- */

.pic-tm__cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .pic-tm__cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Card ---- */

.pic-tm__card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    padding: 1.5rem;

    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--pic-reveal-delay, 0ms);
}

.pic-tm__card.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.pic-tm__stars {
    display: flex;
    gap: 2px;
    margin-bottom: 0.75rem;
}

.pic-tm__star {
    color: var(--wp--preset--color--primary, #056839);
}

.pic-tm__card-title {
    font-family: var(--wp--preset--font-family--primary-font, 'Roboto', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--wp--preset--color--text, #141611);
    margin: 0 0 0.25rem;
}

.pic-tm__card-text {
    font-family: var(--wp--preset--font-family--primary-font, 'Roboto', sans-serif);
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
    margin: 0 0 1rem;
}

.pic-tm__card-author {
    font-family: var(--wp--preset--font-family--primary-font, 'Roboto', sans-serif);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--wp--preset--color--text, #141611);
    margin: 0;
}

/* ==========================================================================
   Google Reviews widget (.pic-gr)
   Template is a class on this root: is-style-classic (default), -quote,
   -dark, -summary, -green. All five are styled below; the base rules are
   structural only.
   ========================================================================== */

.pic-gr {
    /* Brand tokens resolve from theme.json, with the mockup values as fallback. */
    --pic-gr-green: var(--wp--preset--color--primary, #056839);
    --pic-gr-green-bright: var(--wp--preset--color--primary-hover, #0B9444);
    --pic-gr-green-light: #8FD3A8;
    --pic-gr-green-dark: #034A28;
    /* Matches .pic-tm__promo so is-style-dark really does sit flush with it. */
    --pic-gr-dark: #141414;
    --pic-gr-ink: var(--wp--preset--color--text, #141611);
    --pic-gr-body: #3A3A38;
    --pic-gr-muted: #8A8A86;
    --pic-gr-line: #ECECEA;

    /* Both are overwritten inline by render.php from the block attributes. */
    --pic-gr-visible: 2;
    --pic-gr-gap: 1.5rem;

    --pic-gr-body-font: var(--wp--preset--font-family--primary-font, 'Roboto', sans-serif);
    /* The mockup specced Oswald; the theme ships Roboto Condensed. */
    --pic-gr-display-font: var(--wp--preset--font-family--secondary-font, 'Roboto Condensed', sans-serif);

    font-family: var(--pic-gr-body-font);
    display: flex;
    flex-direction: column;
    container-type: inline-size;

    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--pic-reveal-delay, 0ms);
}

.pic-gr.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.pic-gr * {
    box-sizing: border-box;
}

/* ---- Track + cards ---- */

.pic-gr__track {
    flex: 1;
    display: flex;
    gap: var(--pic-gr-gap);
    align-items: stretch;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.pic-gr.is-fading .pic-gr__track {
    opacity: 0;
}

.pic-gr__card {
    /*
     * Pinned to 1/visible rather than flex:1 so a short final page (5 reviews
     * at 2 per page leaves one) keeps its column width instead of stretching
     * the lone card across the whole row.
     */
    flex: 0 0 calc(
        (100% - (var(--pic-gr-gap) * (var(--pic-gr-visible) - 1)))
        / var(--pic-gr-visible)
    );
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pic-gr__card[hidden] {
    display: none;
}

/* ---- Card header ---- */

.pic-gr__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pic-gr__gbadge {
    display: inline-flex;
    flex: none;
}

.pic-gr__gbadge svg {
    width: 18px;
    height: 18px;
}

.pic-gr__quote {
    display: none;
    font-family: var(--pic-gr-display-font);
    font-weight: 700;
    font-size: 3.5rem;
    line-height: 0.55;
    color: var(--pic-gr-green);
    margin-top: 0.75rem;
}

/* ---- Stars ----
   Glyphs come from CSS and the fill is a gradient stop, so a 4.8 average
   renders as 4.8 rather than rounding up to five solid stars. */

.pic-gr__stars,
.pic-gr__meta-stars,
.pic-gr__summary-stars {
    --pic-gr-rating: 0;
    --pic-gr-star-on: var(--pic-gr-green);
    --pic-gr-star-off: #DBDBD6;
    --pic-gr-star-gap: 3px;
    display: inline-block;
    line-height: 1;
    letter-spacing: var(--pic-gr-star-gap);
    white-space: nowrap;
}

.pic-gr__stars::before,
.pic-gr__meta-stars::before,
.pic-gr__summary-stars::before {
    content: "\2605\2605\2605\2605\2605";
    background-image: linear-gradient(
        90deg,
        var(--pic-gr-star-on) calc(var(--pic-gr-rating) / 5 * 100%),
        var(--pic-gr-star-off) calc(var(--pic-gr-rating) / 5 * 100%)
    );
    /*
     * letter-spacing also adds a gap after the fifth star. Left in, that gap
     * counts toward 100% and drags the gradient stop right — a 4.8 would paint
     * the last star ~90% full instead of 80%. Span the glyphs only; the
     * leftover trailing gap is whitespace, so nothing renders there.
     */
    background-size: calc(100% - var(--pic-gr-star-gap)) 100%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.pic-gr__stars {
    font-size: 1.125rem;
}

.pic-gr__meta-stars {
    display: none;
    font-size: 0.8125rem;
    --pic-gr-star-gap: 2px;
}

/* ---- Review text + read more ---- */

.pic-gr__text {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--pic-gr-body);
    white-space: pre-line;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.pic-gr__card.is-expanded .pic-gr__text {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

.pic-gr__more {
    align-self: flex-start;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--pic-gr-green);
    font-family: var(--pic-gr-body-font);
    font-size: 0.8125rem;
    font-weight: 500;
}

.pic-gr__more:hover,
.pic-gr__more:focus-visible {
    text-decoration: underline;
}

.pic-gr__more[hidden] {
    display: none;
}

/* ---- Attribution ---- */

.pic-gr__meta {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.pic-gr__name {
    font-family: var(--pic-gr-body-font);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pic-gr-ink);
}

.pic-gr__time {
    font-size: 0.75rem;
    color: var(--pic-gr-muted);
}

/* ---- Pager dots ---- */

.pic-gr__dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.125rem;
}

.pic-gr__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: #DBDBD6;
    transition: background 0.2s ease;
}

.pic-gr__dot.is-active {
    background: var(--pic-gr-green);
}

.pic-gr__dot:focus-visible {
    outline: 2px solid var(--pic-gr-green);
    outline-offset: 3px;
}

/* ---- Rotation progress bar (quote template only) ---- */

.pic-gr__progress {
    display: none;
    height: 3px;
    background: #E9E9E5;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1.125rem;
}

.pic-gr__progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--pic-gr-green);
}

.pic-gr.is-running .pic-gr__progress span {
    animation: pic-gr-progress var(--pic-gr-rotate, 6s) linear infinite;
}

@keyframes pic-gr-progress {
    from { width: 0; }
    to   { width: 100%; }
}

/* ---- Summary strip (summary template only) ---- */

.pic-gr__summary {
    display: none;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--pic-gr-line);
    background: #FBFBF9;
}

.pic-gr__summary-mark {
    width: 20px;
    height: 20px;
    flex: none;
}

.pic-gr__summary-title {
    font-family: var(--pic-gr-display-font);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--pic-gr-ink);
}

.pic-gr__summary-score {
    font-family: var(--pic-gr-body-font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--pic-gr-green);
}

.pic-gr__summary-stars {
    font-size: 0.9375rem;
    --pic-gr-star-gap: 2px;
}

.pic-gr__summary-count {
    font-size: 0.8125rem;
    color: var(--pic-gr-muted);
}

.pic-gr__summary .pic-gr__dots {
    margin: 0 0 0 auto;
}

.pic-gr__summary .pic-gr__dot {
    width: 7px;
    height: 7px;
}

/* ---------- Template: classic (default) ---------- */

.pic-gr.is-style-classic .pic-gr__card {
    background: #fff;
    border: 1px solid var(--pic-gr-line);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ---------- Template: quote ---------- */

.pic-gr.is-style-quote .pic-gr__card {
    background: #FBFBF9;
    border: 0;
    box-shadow: none;
    border-radius: 0.5rem;
    padding: 1.5rem 1.625rem;
    gap: 0.625rem;
}

.pic-gr.is-style-quote .pic-gr__quote {
    display: block;
}

.pic-gr.is-style-quote .pic-gr__head .pic-gr__stars {
    display: none;
}

.pic-gr.is-style-quote .pic-gr__gbadge svg {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

.pic-gr.is-style-quote .pic-gr__name {
    font-family: var(--pic-gr-display-font);
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.pic-gr.is-style-quote .pic-gr__meta-stars {
    display: inline-block;
}

.pic-gr.is-style-quote .pic-gr__time {
    margin-left: auto;
}

/* Quote swaps the dot pager for the timed progress bar. */
.pic-gr.is-style-quote .pic-gr__dots {
    display: none;
}

.pic-gr.is-style-quote .pic-gr__progress {
    display: block;
}

/* ---------- Template: dark ---------- */

.pic-gr.is-style-dark .pic-gr__card {
    background: var(--pic-gr-dark);
    border: 0;
    border-radius: 0.625rem;
    box-shadow: none;
    padding: 1.5rem;
}

.pic-gr.is-style-dark .pic-gr__stars {
    --pic-gr-star-on: var(--pic-gr-green-bright);
    --pic-gr-star-off: rgba(255, 255, 255, 0.22);
}

.pic-gr.is-style-dark .pic-gr__text {
    color: #E4E4E1;
}

.pic-gr.is-style-dark .pic-gr__name {
    color: #fff;
}

.pic-gr.is-style-dark .pic-gr__time {
    color: #9A9A96;
}

.pic-gr.is-style-dark .pic-gr__more {
    color: var(--pic-gr-green-light);
}

.pic-gr.is-style-dark .pic-gr__gbadge,
.pic-gr.is-style-green .pic-gr__gbadge {
    background: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
}

.pic-gr.is-style-dark .pic-gr__gbadge svg,
.pic-gr.is-style-green .pic-gr__gbadge svg {
    width: 14px;
    height: 14px;
}

/* ---------- Template: summary ---------- */

.pic-gr.is-style-summary {
    border: 1px solid var(--pic-gr-line);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
}

.pic-gr.is-style-summary .pic-gr__summary {
    display: flex;
}

.pic-gr.is-style-summary {
    /* Cards butt together, divided by a border rather than a gap. */
    --pic-gr-gap: 0px;
}

.pic-gr.is-style-summary .pic-gr__card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 1.375rem 1.5rem;
    border-left: 1px solid var(--pic-gr-line);
    margin-left: -1px;
}

.pic-gr.is-style-summary .pic-gr__head {
    display: none;
}

/* Summary shows its pager inside the strip, so the bottom one is redundant —
   but only when the strip actually rendered. Without aggregate data there is
   no strip, and the bottom pager stays as the only way to page through. */
.pic-gr.is-style-summary.has-summary > .pic-gr__dots--bottom {
    display: none;
}

/* ---------- Template: green ---------- */

.pic-gr.is-style-green .pic-gr__card {
    background: var(--pic-gr-green-dark);
    border: 0;
    border-radius: 0.625rem;
    box-shadow: none;
    padding: 1.625rem;
}

.pic-gr.is-style-green .pic-gr__stars {
    --pic-gr-star-on: var(--pic-gr-green-light);
    --pic-gr-star-off: rgba(255, 255, 255, 0.25);
}

.pic-gr.is-style-green .pic-gr__text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    line-height: 1.6;
}

.pic-gr.is-style-green .pic-gr__more {
    color: var(--pic-gr-green-light);
}

.pic-gr.is-style-green .pic-gr__name {
    font-family: var(--pic-gr-display-font);
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #fff;
}

.pic-gr.is-style-green .pic-gr__time {
    color: rgba(255, 255, 255, 0.55);
    margin-left: auto;
}

.pic-gr.is-style-green.is-fading .pic-gr__track {
    transform: translateY(10px);
}

/* ---- Responsive: stack whenever the reviews column itself is narrow ---- */

@container (max-width: 640px) {
    .pic-gr__track {
        flex-direction: column;
    }
    /* Basis would set height once the axis flips. */
    .pic-gr__card {
        flex: 0 0 auto;
    }
    .pic-gr__summary {
        flex-wrap: wrap;
    }
    .pic-gr__summary .pic-gr__dots {
        margin-left: 0;
        flex-basis: 100%;
    }
    .pic-gr.is-style-summary .pic-gr__card {
        border-left: 0;
        border-top: 1px solid var(--pic-gr-line);
        margin: -1px 0 0;
    }
}

/* Viewport fallback for browsers without container query support. */
@supports not (container-type: inline-size) {
    @media (max-width: 720px) {
        .pic-gr__track {
            flex-direction: column;
        }
        .pic-gr__card {
            flex: 0 0 auto;
        }
        .pic-gr__summary {
            flex-wrap: wrap;
        }
        .pic-gr.is-style-summary .pic-gr__card {
            border-left: 0;
            border-top: 1px solid var(--pic-gr-line);
            margin: -1px 0 0;
        }
    }
}

/* ---- Promo panel ---- */

.pic-tm__promo {
    background: #141414;
    border-radius: 0.5rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;

    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--pic-reveal-delay, 0ms);
}

.pic-tm__promo.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.pic-tm__promo-heading {
    font-family: var(--wp--preset--font-family--secondary-font, 'Roboto Condensed', sans-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
}

.pic-tm__promo-subtitle {
    font-family: var(--wp--preset--font-family--primary-font, 'Roboto', sans-serif);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 1.5rem;
}

.pic-tm__promo-logo {
    max-height: 3.5rem;
    width: auto;
    margin-bottom: 1rem;
}

.pic-tm__promo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--wp--preset--color--primary, #056839);
    color: #fff;
    font-family: var(--wp--preset--font-family--primary-font, 'Roboto', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.2s ease;
}

.pic-tm__promo-btn:hover,
.pic-tm__promo-btn:focus-visible {
    background: var(--wp--preset--color--primary-hover, #0b9444);
    color: #fff;
}

.pic-tm__ext-icon {
    flex-shrink: 0;
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
    .pic-tm__card,
    .pic-tm__promo,
    .pic-tm__promo-btn,
    .pic-gr,
    .pic-gr__track {
        transition: none !important;
    }
    .pic-tm__card,
    .pic-tm__promo,
    .pic-gr {
        opacity: 1 !important;
        transform: none !important;
    }
    /* Rotation is disabled in JS; kill the timed progress bar to match. */
    .pic-gr.is-running .pic-gr__progress span {
        animation: none;
    }
    .pic-gr__progress {
        display: none !important;
    }
}

/* ---- No-JS fallback ----
   Nothing hydrates, so every review renders statically: unclamp the text
   (the Read more control never appears) and let the cards wrap. */

@media (scripting: none) {
    .pic-tm__card,
    .pic-tm__promo,
    .pic-gr {
        opacity: 1 !important;
        transform: none !important;
    }
    /* render.php pre-hides pages 2+ to avoid a flash; with no JS to page
       through them, put every review back. */
    .pic-gr__card[hidden] {
        display: flex !important;
    }
    .pic-gr__track {
        flex-wrap: wrap;
    }
    .pic-gr__card {
        flex: 1 1 17.5rem;
    }
    .pic-gr__text {
        display: block;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        overflow: visible;
    }
    .pic-gr__dots,
    .pic-gr__progress {
        display: none !important;
    }
}
