/* ==========================================================================
   Testimonials hub page
   Class prefix: tms-
   ========================================================================== */

.tms-page {
    background-color: var(--sd-color-background, #fff);
    padding-bottom: clamp(3rem, 7vw, 6rem);
}

.tms-page__inner {
    max-width: 1240px;
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 5vw, 3rem);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.tms-page__header {
    background: var(--sd-color-primary, #36452f);
    /* top padding clears the fixed nav, matching the gallery + explorer heroes */
    padding-block: clamp(6.5rem, 11vw, 9rem) clamp(2.5rem, 5vw, 3.5rem);
}

.tms-page__overline {
    display: inline-block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--sd-color-cta-hover, #8db35a);
    margin-bottom: 1rem;
}

.tms-page__heading {
    font-family: var(--sd-font-family-primary);
    font-size: clamp(2.25rem, 5vw, 4rem); /* unified hero title scale */
    font-weight: 500;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 1rem;
}

.tms-page__intro {
    max-width: 680px;
    font-size: clamp(1rem, 1.3vw, 1.125rem);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.82);
}

/* ── Theme chips ────────────────────────────────────────────────────────
   One chip per testimonial_theme term, in two groups. Each chip is a plain
   link (?theme=slug#tms-themes), so filtering works without JavaScript; the
   anchor lands back on this bar, clear of the fixed header. */
.tms-page__filters {
    border-bottom: 1px solid rgba(54, 69, 47, 0.12);
    padding-block: 1.5rem 1.375rem;
    margin-bottom: clamp(2rem, 4vw, 3rem);
    scroll-margin-top: calc(var(--sd-header-height-desktop, 88px) + 1rem);
}

/* Same box as .tms-page__inner (1240px including its gutter), so the chips
   line up with the heading and the card grid. */
.tms-themes {
    max-width: 1240px;
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 5vw, 3rem);
    box-sizing: border-box;
}

.tms-themes__heading {
    font-family: var(--sd-font-family-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    color: var(--sd-color-primary);
    margin: 0 0 0.875rem;
}

.tms-themes__group {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.5rem 1rem;
    align-items: start;
}

.tms-themes__group + .tms-themes__group {
    margin-top: 0.625rem;
}

.tms-themes__label {
    font-family: var(--sd-font-family-primary);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5b6355; /* green-biased grey, 6.7:1 on white */
    padding-top: 0.625rem;
}

.tms-themes__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tms-themes__chips li {
    margin: 0;
}

.tms-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    font-family: var(--sd-font-family-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--sd-color-primary);
    background-color: var(--sd-color-white);
    border: 1px solid rgba(54, 69, 47, 0.22);
    border-radius: 999px;
    padding: 0 0.95rem;
    text-decoration: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.tms-chip:hover {
    background-color: #eef2e8;
    border-color: rgba(54, 69, 47, 0.4);
}

.tms-chip:focus-visible {
    outline: 2px solid var(--sd-color-cta);
    outline-offset: 2px;
}

.tms-chip[aria-current="true"] {
    background-color: var(--sd-color-primary);
    border-color: var(--sd-color-primary);
    color: var(--sd-color-white);
}

.tms-themes__active {
    font-family: var(--sd-font-family-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--sd-color-primary-dark);
    margin: 1rem 0 0;
}

.tms-themes__active strong {
    font-weight: 600;
}

.tms-themes__active a {
    color: var(--sd-color-cta);
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-left: 0.35rem;
}

/* ── Empty state: a theme with no public testimonials ───────────────────── */
.tms-page__empty {
    font-family: var(--sd-font-family-primary);
    font-size: 1.0625rem;
    color: var(--sd-color-text);
    background: var(--sd-color-cream, #f8f6ee);
    border-radius: 6px;
    padding: 2rem;
    margin: 0 0 1.5rem;
    text-align: center;
}

.tms-page__empty a {
    color: var(--sd-color-cta, #5f7d3a);
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-left: 0.35rem;
}

/* ── Grid: a masonry wall of full-length quotes ─────────────────────────── */
.tms-grid {
    columns: 3 320px;
    column-gap: 1.5rem;
}

/* The shared .sp-tm-card (testimonial-cards.css), in full, on the masonry
   wall. Columns ignore row gaps, so each card carries its own bottom margin. */
.tms-grid .sp-tm-card {
    break-inside: avoid;
    margin: 0 0 1.5rem;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.tms-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: clamp(2rem, 4vw, 3rem);
    padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.tms-pagination .page-numbers {
    font-family: var(--sd-font-family-primary);
    font-size: 0.9rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid rgba(54, 69, 47, 0.15);
    border-radius: 4px;
    color: var(--sd-color-primary);
    text-decoration: none;
    background-color: var(--sd-color-white);
    transition: all 0.15s ease;
}

.tms-pagination .page-numbers:hover {
    background-color: rgba(95, 125, 58, 0.08);
    border-color: rgba(95, 125, 58, 0.4);
}

.tms-pagination .page-numbers.current {
    background-color: var(--sd-color-primary);
    color: var(--sd-color-white);
    border-color: var(--sd-color-primary);
}

.tms-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    padding: 0.5rem 0.25rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .tms-page__filters {
        scroll-margin-top: calc(var(--sd-header-height-mobile, 72px) + 0.75rem);
    }

    .tms-themes__group {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
    }

    .tms-themes__label {
        padding-top: 0;
    }

    /* Each group is one row that scrolls sideways, as on the case studies
       explorer. Wrapped, the rows re-wrapped when the web font arrived and
       pushed the cards down (Lighthouse CLS up to 0.095, 29 Sep). */
    .tms-themes__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        margin-inline: calc(clamp(1.25rem, 5vw, 3rem) * -1);
        padding-inline: clamp(1.25rem, 5vw, 3rem);
        scroll-padding-inline: clamp(1.25rem, 5vw, 3rem);
    }

    .tms-themes__chips::-webkit-scrollbar {
        display: none;
    }

    .tms-themes__chips li {
        flex: none;
    }

    .tms-chip {
        min-height: 44px;
        font-size: 0.875rem;
        padding: 0 0.85rem;
    }
}
