/* Homepage social proof: stat strip + testimonial marquee. Tokens only.
   Spec: Vornin-Marketing "Files for context/briefs/spec-homepage-social-proof.md". */

/* Stat strip */
.hv2-stats {
    position: relative;
    padding: var(--space-9) 0;
    background: var(--bg);
}

/* Same type as every section H2, but the full container width: one sentence per line. */
.hv2-stats .hv2-section-head,
.hv2-stats .hv2-section-head h2 {
    max-width: none;
}

.hv2-stats h2 span {
    display: block;
    color: var(--ink-2);
}

.hv2-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
}

.hv2-stat-grid li {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-2) var(--space-6);
    border-left: 1px solid var(--border);
}

.hv2-stat-grid strong {
    font-family: var(--font-display);
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1;
    /* The primary CTA's fill (site.css :root). Colours only: sheen, grain and sweep stay on
       buttons so figures do not read as clickable. */
    background: var(--cta-fill);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

@supports (background: linear-gradient(in oklch, red, blue)) {
    /* background-image, not the shorthand: the shorthand would reset background-clip: text. */
    .hv2-stat-grid strong { background-image: var(--cta-fill-oklch); }
}

.hv2-stat-grid span {
    max-width: 24ch;
    color: var(--ink-2);
    font-size: 1rem;
    line-height: 1.45;
    text-wrap: balance;
}

.hv2-stats-note {
    padding-top: var(--space-6);
    color: var(--ink-3);
    font-size: 0.75rem;
    line-height: 1.5;
}

@media (max-width: 820px) {
    .hv2-stats {
        padding: var(--space-8) 0;
    }

    .hv2-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: var(--space-6);
    }

    .hv2-stat-grid li {
        padding: var(--space-1) var(--space-4);
    }

    .hv2-stat-grid span {
        font-size: 0.9375rem;
        text-wrap: wrap;
    }

    /* The longest quote sets the row height here; centring would strand short cards. */
    .hv2-quotes .hv2-quotes-track {
        align-items: flex-start;
    }
}

/* Testimonial marquee. Default state is the static list (no JS, reduced motion):
   a horizontally scrollable row. .is-marquee is added by home-testimonials.js. */
.hv2-quotes {
    --quote-gap: var(--space-5);
    --quote-speed: 150s;
    position: relative;
    isolation: isolate;
    margin-bottom: var(--space-6);
    padding: var(--space-9) 0 240px;
    background: var(--bg);
}

/* Optional backdrop: delete this element and these rules and the section still works.
   Photo: pexels.com/photo/6804068 (Pexels License), graded to the brand, with an ASCII layer baked in: it dissolves
   into characters toward the sides, centre clean. Punctuation only, the brand system bans binary and hex textures.
   home-testimonials.js adds .has-backdrop as the section nears the viewport, so it never competes with the hero. */
.hv2-quotes-backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
    max-width: 1760px;
    margin-inline: auto;
    background-position: center 8%;
    background-size: cover;
    /* Capped so wide screens don't upscale the photo; its own side fade means it
       ends softly into the page instead of stopping at a hard edge. */
    -webkit-mask-image:
        linear-gradient(180deg, transparent, var(--ink) 32%, var(--ink) 86%, transparent),
        linear-gradient(90deg, transparent, var(--ink) 14%, var(--ink) 86%, transparent);
    mask-image:
        linear-gradient(180deg, transparent, var(--ink) 32%, var(--ink) 86%, transparent),
        linear-gradient(90deg, transparent, var(--ink) 14%, var(--ink) 86%, transparent);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
    transition: opacity 1.8s ease-out, scale 2.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hv2-quotes.has-backdrop .hv2-quotes-backdrop {
    background-image: url("../img/home/quotes-backdrop-6804068-ascii.webp");
}

.home-v2.is-motion-ready .hv2-quotes:not(.is-revealed) .hv2-quotes-backdrop {
    opacity: 0;
    scale: 1.04;
}

/* Side fade over photo and cards alike. A mask on the row would stop the cards'
   backdrop-filter reaching the photo, so this is a scrim, not a mask. */
.hv2-quotes::before,
.hv2-quotes::after {
    content: "";
    position: absolute;
    inset-block: 0;
    z-index: 2;
    width: clamp(28px, 9vw, 160px);
    pointer-events: none;
    transition: opacity var(--dur-quick) ease-out;
}

.hv2-quotes::before {
    left: 0;
    background: linear-gradient(90deg, var(--bg), transparent);
}

.hv2-quotes::after {
    right: 0;
    background: linear-gradient(270deg, var(--bg), transparent);
}

.hv2-quotes:has(figure:focus-visible)::before,
.hv2-quotes:has(figure:focus-visible)::after {
    opacity: 0;
}

/* Keeps the label readable where the photo runs bright behind it. */
.hv2-quotes .hv2-eyebrow {
    background: color-mix(in srgb, var(--bg) 62%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.hv2-quotes-viewport {
    max-width: 2400px;
    margin-inline: auto;
    padding-block: var(--space-2);
    overflow-x: auto;
    scroll-snap-type: x proximity;
}

.hv2-quotes-rail {
    position: relative;
    display: flex;
    width: max-content;
}

.hv2-quotes-track {
    display: flex;
    align-items: center;
    gap: var(--quote-gap);
    margin: 0;
    padding: 0 var(--quote-gap) 0 0;
    list-style: none;
}

.hv2-quote {
    display: flex;
    flex: none;
    width: min(340px, 84vw);
    scroll-snap-align: center;
}

.hv2-quote.is-mid {
    width: min(400px, 84vw);
}

.hv2-quote.is-long {
    width: min(500px, 84vw);
}

.hv2-quote figure {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-5);
    margin: 0;
    padding: var(--space-5) var(--space-6);
    border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
    border-radius: var(--r-md);
    background: color-mix(in srgb, var(--bg) 62%, transparent);
    -webkit-backdrop-filter: blur(20px) brightness(0.55) saturate(140%);
    backdrop-filter: blur(20px) brightness(0.55) saturate(140%);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, var(--ink) 10%, transparent),
        0 18px 40px color-mix(in srgb, var(--bg) 45%, transparent);
    transition: border-color var(--dur-quick) ease-out;
}

.hv2-quote figure:hover,
.hv2-quote figure:focus-visible {
    border-color: color-mix(in srgb, var(--teal) 45%, var(--border));
}

.hv2-quote figure:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.hv2-quote blockquote {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.6;
    quotes: '"' '"';
}

.hv2-quote blockquote::before {
    content: open-quote;
}

.hv2-quote blockquote::after {
    content: close-quote;
}

.hv2-quote figcaption {
    color: var(--ink-2);
    font-size: 0.875rem;
}

.hv2-quotes.is-marquee .hv2-quotes-viewport {
    overflow-x: clip;
    scroll-snap-type: none;
}

.hv2-quotes.is-marquee .hv2-quotes-rail {
    animation: hv2-quotes-drift var(--quote-speed) linear infinite;
    will-change: transform;
}

.hv2-quotes.is-marquee .hv2-quotes-viewport:hover .hv2-quotes-rail,
.hv2-quotes.is-marquee .hv2-quotes-viewport:focus-within .hv2-quotes-rail,
.hv2-quotes.is-marquee .hv2-quotes-rail.is-anim-paused {
    animation-play-state: paused;
}

/* Left to right: the rail holds two identical tracks, so -50% to 0 loops seamlessly. */
@keyframes hv2-quotes-drift {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

@media (max-width: 820px) {
    .hv2-quotes {
        padding: var(--space-9) 0 var(--space-9);
    }

    /* The row fills the middle here, so the photo sits under it with the people showing.
       The box, not the image, takes the lower 58%: cover then fills the width at every size. */
    .hv2-quotes-backdrop {
        top: auto;
        height: 58%;
        background-position: 66% 25%;
        -webkit-mask-image:
            linear-gradient(180deg, transparent, var(--ink) 31%, var(--ink) 83%, transparent),
            linear-gradient(90deg, transparent, var(--ink) 14%, var(--ink) 86%, transparent);
        mask-image:
            linear-gradient(180deg, transparent, var(--ink) 31%, var(--ink) 83%, transparent),
            linear-gradient(90deg, transparent, var(--ink) 14%, var(--ink) 86%, transparent);
    }
}
