/* ==========================================================================
   Testimonial blocks — grid (mosaic of customer quotes) and spotlight (one
   featured quote). Theme-aware via site CSS variables, fully responsive.
   ========================================================================== */

.testimonial-section {
    --tst-accent: var(--accent-gold, var(--accent-primary, #f5b335));
    --tst-surface: var(--surface-bg, #fff);
    --tst-tint: color-mix(in srgb, var(--tst-accent) 16%, var(--tst-surface));
    --tst-border: var(--border-color, rgba(148, 163, 184, 0.3));
    --tst-radius: var(--radius-md, 12px);
    width: 100%;
}

/* Older engines without color-mix still get a usable tint. */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .testimonial-section {
        --tst-tint: var(--surface-bg-hover, #efece4);
    }
}

.testimonial-align-center {
    text-align: center;
}

/* ==========================================================================
   Shared card pieces
   ========================================================================== */

.testimonial-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    height: 100%;
    padding: 1.35rem;
    border-radius: var(--tst-radius);
    background: var(--tst-surface);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.testimonial-cards-bordered .testimonial-card {
    border: 1px solid var(--tst-border);
}

.testimonial-cards-soft .testimonial-card {
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm, 0 4px 16px rgba(0, 0, 0, 0.08));
}

.testimonial-cards-flat .testimonial-card {
    border: 1px solid transparent;
    background: var(--surface-bg-hover, color-mix(in srgb, var(--tst-surface) 92%, var(--tst-border)));
}

.testimonial-card-accent {
    background: var(--tst-tint);
    border-color: color-mix(in srgb, var(--tst-accent) 30%, transparent);
}

.testimonial-card-link:hover,
.testimonial-card-link:focus-visible {
    box-shadow: var(--shadow-md, 0 12px 32px rgba(0, 0, 0, 0.14));
    transform: translateY(-2px);
}

.testimonial-card-link:focus-visible {
    outline: 2px solid var(--tst-accent);
    outline-offset: 3px;
}

/* ----- Company logo / wordmark ------------------------------------------- */

.testimonial-brand {
    display: flex;
    align-items: center;
    min-height: var(--testimonial-logo-height, 26px);
}

.testimonial-align-center .testimonial-brand {
    justify-content: center;
}

.testimonial-brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: var(--testimonial-logo-height, 26px);
    object-fit: contain;
    object-position: left center;
}

.testimonial-align-center .testimonial-brand-logo {
    object-position: center;
}

.testimonial-brand-name {
    font-family: var(--font-body, inherit);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--heading-color, var(--text-primary, inherit));
    margin: 0;
}

/* ----- Quote ------------------------------------------------------------- */

.testimonial-quote {
    margin: 0;
    color: var(--heading-color, var(--text-primary, inherit));
    font-weight: 600;
    line-height: 1.35;
}

.testimonial-quote > :last-child {
    margin-bottom: 0;
}

.testimonial-quote-sm .testimonial-quote { font-size: 1rem; }
.testimonial-quote-md .testimonial-quote { font-size: 1.12rem; }
.testimonial-quote-lg .testimonial-quote { font-size: 1.3rem; }

/* Decorative quotation mark sits behind the text. */
.testimonial-grid-quotemark .testimonial-card::before,
.testimonial-spotlight-quotemark .testimonial-spotlight-body::before {
    content: "\201C";
    position: absolute;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 0.8;
    color: color-mix(in srgb, var(--tst-accent) 24%, transparent);
    pointer-events: none;
}

.testimonial-grid-quotemark .testimonial-card::before {
    top: 0;
    right: 0.75rem;
    font-size: 5rem;
}

.testimonial-spotlight-quotemark .testimonial-spotlight-body::before {
    top: -1.25rem;
    left: -0.35rem;
    font-size: 4.5rem;
}

/* Keep card content in front of the decorative mark. */
.testimonial-grid-quotemark .testimonial-card > * {
    position: relative;
}

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

.testimonial-person {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
}

.testimonial-align-center .testimonial-person {
    justify-content: center;
}

.testimonial-person-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--tst-border);
}

.testimonial-person-name {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--heading-color, var(--text-primary, inherit));
    line-height: 1.25;
}

.testimonial-person-role {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.3;
}

/* Both hold rich text, so drop the trailing paragraph margin the editor wraps them in. */
.testimonial-person-name > :last-child,
.testimonial-person-role > :last-child {
    margin-bottom: 0;
}

/* ----- Read-story call to action ---------------------------------------- */

.testimonial-cta {
    margin-top: auto;
    align-self: flex-start;
}

.testimonial-align-center .testimonial-cta {
    align-self: center;
}

.testimonial-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--link-color, var(--accent-rust, #9a5c12));
    text-decoration: none;
}

.testimonial-cta-link:hover,
.testimonial-cta-link:focus-visible {
    color: var(--link-hover-color, var(--link-color));
    text-decoration: underline;
}

.testimonial-cta-link .testimonial-cta-arrow {
    transition: transform 0.18s ease;
}

.testimonial-card-link:hover .testimonial-cta-arrow,
.testimonial-cta-link:hover .testimonial-cta-arrow {
    transform: translateX(3px);
}

/* ==========================================================================
   Testimonial grid
   ========================================================================== */

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(var(--tst-cols, 3), minmax(0, 1fr));
    gap: var(--tst-gap, 1rem);
}

.testimonial-grid-cols-1 { --tst-cols: 1; }
.testimonial-grid-cols-2 { --tst-cols: 2; }
.testimonial-grid-cols-3 { --tst-cols: 3; }
.testimonial-grid-cols-4 { --tst-cols: 4; }

.testimonial-grid-gap-sm { --tst-gap: 0.65rem; }
.testimonial-grid-gap-md { --tst-gap: 1rem; }
.testimonial-grid-gap-lg { --tst-gap: 1.75rem; }

/* Mosaic: dense packing plus row/column spans give the magazine look. */
.testimonial-grid-mosaic {
    grid-auto-rows: minmax(9rem, auto);
    grid-auto-flow: dense;
}

.testimonial-grid-mosaic .testimonial-card-span-tall { grid-row: span 2; }
.testimonial-grid-mosaic .testimonial-card-span-wide { grid-column: span 2; }

/* Uniform: every card the same height. */
.testimonial-grid-uniform {
    grid-auto-rows: 1fr;
}

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

.testimonial-card-photo {
    margin-top: auto;
    min-height: 0;
}

/* Fill: photo bleeds to the card edges and anchors to the bottom. */
.testimonial-photo-fill .testimonial-card-photo {
    margin: 0.35rem -1.35rem -1.35rem;
}

.testimonial-photo-fill .testimonial-card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 8rem;
    object-fit: cover;
    object-position: center bottom;
}

/* With a bleeding photo the photo takes the slack, so the CTA sits under the text. */
.testimonial-photo-fill .testimonial-card-has-photo .testimonial-cta {
    margin-top: 0;
}

.testimonial-grid-empty {
    color: var(--text-muted, #6b7280);
    margin: 0;
}

/* ----- Canvas editing --------------------------------------------------- */

/* Editing shows a plain, uniform grid so every card's toolbar stays reachable. */
.testimonial-grid-edit {
    grid-auto-rows: auto;
    grid-auto-flow: row;
}

.testimonial-grid-edit .testimonial-card-span-tall,
.testimonial-grid-edit .testimonial-card-span-wide {
    grid-row: auto;
    grid-column: auto;
}

.testimonial-card-edit {
    gap: 0.6rem;
}

.testimonial-card-edit .testimonial-card-photo,
.testimonial-card-edit .testimonial-card-photo img {
    margin: 0;
    height: auto;
}

.testimonial-edit-hint {
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
    margin: 0;
}

.testimonial-edit-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
}

.testimonial-add-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 10rem;
    padding: 1.25rem;
    border: 2px dashed var(--tst-border);
    border-radius: var(--tst-radius);
    background: transparent;
    color: var(--text-muted, #6b7280);
    font-weight: 600;
    cursor: pointer;
}

.testimonial-add-tile:hover {
    border-color: var(--tst-accent);
    color: var(--heading-color, var(--text-primary, inherit));
}

.testimonial-add-plus {
    font-size: 1.6rem;
    line-height: 1;
}

/* ==========================================================================
   Testimonial spotlight
   ========================================================================== */

.testimonial-spotlight {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2.5rem);
    align-items: center;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    border-radius: var(--radius-lg, 16px);
    border: 1px solid transparent;
    overflow: hidden;
}

.testimonial-spotlight-accent-tint {
    background: var(--tst-tint);
}

.testimonial-spotlight-accent-border {
    background: var(--tst-surface);
    border-color: var(--tst-border);
    border-left: 4px solid var(--tst-accent);
}

.testimonial-spotlight-accent-none {
    padding-left: 0;
    padding-right: 0;
}

.testimonial-spotlight-eyebrow {
    font-size: var(--text-size-eyebrow, 0.72rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tst-accent);
    margin: 0;
}

.testimonial-spotlight-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    width: 100%;
}

.testimonial-align-center .testimonial-spotlight-footer {
    align-items: center;
}

.testimonial-spotlight-body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    min-width: 0;
}

.testimonial-align-center .testimonial-spotlight-body {
    align-items: center;
}

.testimonial-spotlight-quote {
    margin: 0;
    font-family: var(--font-body, inherit);
    font-size: clamp(1.25rem, 2.4vw, 1.75rem);
    font-weight: 600;
    line-height: 1.4;
    color: var(--heading-color, var(--text-primary, inherit));
}

.testimonial-spotlight-quote > :last-child {
    margin-bottom: 0;
}

.testimonial-spotlight-media {
    position: relative;
    min-width: 0;
}

.testimonial-spotlight-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.testimonial-spotlight-photo-rounded .testimonial-spotlight-media img {
    border-radius: var(--radius-md, 12px);
    aspect-ratio: 4 / 5;
}

.testimonial-spotlight-photo-square .testimonial-spotlight-media img {
    border-radius: 0;
    aspect-ratio: 1 / 1;
}

.testimonial-spotlight-photo-circle .testimonial-spotlight-media img {
    border-radius: 50%;
    aspect-ratio: 1 / 1;
}

/* ----- Spotlight layouts ------------------------------------------------- */

.testimonial-spotlight-split {
    grid-template-columns: minmax(0, var(--tst-media-col, 18rem)) minmax(0, 1fr);
}

.testimonial-spotlight-split.testimonial-spotlight-photo-size-sm { --tst-media-col: 12rem; }
.testimonial-spotlight-split.testimonial-spotlight-photo-size-md { --tst-media-col: 18rem; }
.testimonial-spotlight-split.testimonial-spotlight-photo-size-lg { --tst-media-col: 24rem; }

.testimonial-spotlight-media-right .testimonial-spotlight-media {
    order: 2;
}

/* Without a photo every layout is a single column. */
.testimonial-spotlight-nomedia {
    grid-template-columns: minmax(0, 1fr);
}

.testimonial-spotlight-centered {
    justify-items: center;
    text-align: center;
    max-width: 46rem;
    margin-inline: auto;
}

.testimonial-spotlight-centered .testimonial-spotlight-body {
    align-items: center;
}

.testimonial-spotlight-centered .testimonial-spotlight-media {
    order: 2;
    width: var(--tst-avatar, 7rem);
}

.testimonial-spotlight-centered.testimonial-spotlight-photo-size-sm { --tst-avatar: 5rem; }
.testimonial-spotlight-centered.testimonial-spotlight-photo-size-md { --tst-avatar: 7rem; }
.testimonial-spotlight-centered.testimonial-spotlight-photo-size-lg { --tst-avatar: 9.5rem; }

.testimonial-spotlight-centered .testimonial-spotlight-footer,
.testimonial-spotlight-card .testimonial-spotlight-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.testimonial-spotlight-card {
    grid-template-columns: minmax(0, 1fr);
    max-width: 34rem;
}

.testimonial-spotlight-card .testimonial-spotlight-media {
    order: 2;
    width: var(--tst-avatar, 4.5rem);
}

.testimonial-spotlight-card.testimonial-spotlight-photo-size-sm { --tst-avatar: 3.25rem; }
.testimonial-spotlight-card.testimonial-spotlight-photo-size-md { --tst-avatar: 4.5rem; }
.testimonial-spotlight-card.testimonial-spotlight-photo-size-lg { --tst-avatar: 6rem; }

.testimonial-spotlight-card .testimonial-spotlight-quote {
    font-size: 1.15rem;
}

.testimonial-spotlight-banner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
    background: var(--tst-tint);
    border-radius: var(--radius-lg, 16px);
    padding: clamp(2rem, 5vw, 3.75rem) clamp(1.25rem, 4vw, 3rem);
}

.testimonial-spotlight-banner .testimonial-spotlight-body {
    align-items: center;
    max-width: 52rem;
}

.testimonial-spotlight-banner .testimonial-spotlight-quote {
    font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.testimonial-spotlight-banner .testimonial-spotlight-media {
    order: 2;
    width: 5.5rem;
}

/* ----- Spotlight editing ------------------------------------------------- */

/* Editing always shows both image pickers, so the media column keeps a sane width even
   for layouts (card, banner) that shrink it to an avatar on the published page. */
.testimonial-spotlight-edit .testimonial-spotlight-media {
    order: 0;
    width: min(100%, 16rem);
}

.testimonial-spotlight-edit .testimonial-spotlight-footer {
    align-items: flex-start;
    gap: 0.75rem;
}

/* The logo label must stack above its picker — .testimonial-brand is a centred flex row
   for published logos, which pushed the label into the picker. */
.testimonial-spotlight-logo-edit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    width: min(100%, 14rem);
}

/* ----- Rating stars ----------------------------------------------------- */

.testimonial-stars {
    display: inline-flex;
    gap: 0.15rem;
    color: var(--tst-accent);
    font-size: 1.05rem;
    line-height: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
    .testimonial-grid-cols-4 { --tst-cols: 3; }
}

@media (max-width: 860px) {
    .testimonial-grid-cols-3,
    .testimonial-grid-cols-4 { --tst-cols: 2; }

    .testimonial-spotlight-split {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        text-align: center;
    }

    .testimonial-spotlight-split .testimonial-spotlight-body {
        align-items: center;
    }

    .testimonial-spotlight-split .testimonial-spotlight-media {
        order: 0;
        width: min(100%, 16rem);
    }

    .testimonial-spotlight-split .testimonial-spotlight-media img {
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 560px) {
    .testimonial-grid-cols-2,
    .testimonial-grid-cols-3,
    .testimonial-grid-cols-4 { --tst-cols: 1; }

    .testimonial-grid-mosaic .testimonial-card-span-tall,
    .testimonial-grid-mosaic .testimonial-card-span-wide {
        grid-row: auto;
        grid-column: auto;
    }

    .testimonial-card {
        padding: 1.1rem;
    }

    .testimonial-photo-fill .testimonial-card-photo {
        margin: 0.35rem -1.1rem -1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .testimonial-card,
    .testimonial-cta-arrow {
        transition: none;
    }

    .testimonial-card-link:hover {
        transform: none;
    }
}
