/**
 * Stats / Numbers — Leafy Market metric tiles
 */

.stats {
    --stats-card-radius: 20px;
}

.stats .block-intro {
    margin-block-end: 40px;
}

.stats .block-intro__heading {
    font-size: var(--h2-font-size);
}

/* -------------------------------------------------------------------------- */
/* Grid                                                                       */
/* -------------------------------------------------------------------------- */

.stats__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* -------------------------------------------------------------------------- */
/* Metric tile                                                                */
/* -------------------------------------------------------------------------- */

.stats__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 148px;
    padding: 28px 20px;
    text-align: center;
    color: var(--color-text);
    background-color: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--stats-card-radius);
    box-shadow: var(--shadow-md);
    /* Light tiles inside tinted sections — keep readable dark copy. */
    --body-text-color: var(--color-text-muted);
    --body-text-color-strong: var(--color-text);
    transition:
        transform 0.28s var(--anim-ease),
        box-shadow 0.28s var(--anim-ease),
        border-color 0.28s ease,
        opacity 0.55s var(--anim-ease);
}

/* Scroll entrance — set by stats.js before counting up. */
.stats__item.is-ready {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 0.55s var(--anim-ease) calc(var(--stats-i, 0) * 90ms),
        transform 0.55s var(--anim-ease) calc(var(--stats-i, 0) * 90ms),
        box-shadow 0.28s var(--anim-ease),
        border-color 0.28s ease;
}

.stats__item.is-inview {
    opacity: 1;
    transform: translateY(0);
}

.stats__item:hover {
    transform: translateY(-4px);
    border-color: rgba(55, 178, 14, 0.22);
    box-shadow: 0 12px 28px rgba(0, 112, 74, 0.14);
}

.stats__item.is-ready:hover {
    transform: translateY(18px);
}

.stats__item.is-inview:hover {
    transform: translateY(-4px);
}

.stats__value {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    margin: 0;
    font-family: var(--entities-font);
    font-size: clamp(2.25rem, 4.5vw, 3rem);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--color-primary);
}

.stats__prefix,
.stats__suffix {
    font-size: 0.55em;
    font-weight: var(--font-weight-bold);
    color: var(--header-green);
}

.stats__description {
    margin: 0;
    max-width: 18ch;
    font-family: var(--entities-font);
    font-size: var(--small-font-size);
    font-weight: var(--font-weight-semibold);
    line-height: 1.35;
    color: var(--color-text-muted);
}

/* -------------------------------------------------------------------------- */
/* Section CTA                                                                */
/* -------------------------------------------------------------------------- */

.stats__footer {
    display: flex;
    justify-content: flex-start;
    margin-block-start: 36px;
}

.stats--align-center .stats__footer {
    justify-content: center;
}

/* -------------------------------------------------------------------------- */
/* Soft surfaces — subtle mint wash on light backgrounds                      */
/* -------------------------------------------------------------------------- */

.stats--bg-surface .stats__item,
.stats--bg-elevated .stats__item,
.stats--bg-white .stats__item,
.stats:not([class*="--bg-"]) .stats__item {
    background-color: var(--green-99);
    border-color: var(--green-90);
}

.stats--bg-surface .stats__item:hover,
.stats--bg-elevated .stats__item:hover,
.stats--bg-white .stats__item:hover,
.stats:not([class*="--bg-"]) .stats__item:hover {
    background-color: var(--white);
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (min-width: 768px) {
    .stats__grid {
        gap: 20px;
    }

    .stats__item {
        min-height: 168px;
        padding: 32px 24px;
    }

    .stats--cols-2 .stats__grid,
    .stats--cols-3 .stats__grid,
    .stats--cols-4 .stats__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .stats--cols-3 .stats__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats--cols-4 .stats__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .stats__item,
    .stats__item.is-ready,
    .stats__item.is-inview {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .stats__item:hover,
    .stats__item.is-inview:hover {
        transform: none;
    }
}
