/* ==========================================================================
   Stat Counter Block
   ========================================================================== */
/* ── Section ─────────────────────────────────────────────────────────────── */
.wp-block-pemfit-stat-counter.stat-counter-section {
    padding: var(--large-gutter) var(--medium-gutter);
    width: 100%;
    box-sizing: border-box;
}

/* ── Section title ───────────────────────────────────────────────────────── */
.wp-block-pemfit-stat-counter .stat-counter-title {
    font-family: var(--DM-Sans);
    color: var(--forest-green);
    text-align: center;
    font-size: clamp(2rem, 2.5vw, 3.5rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    text-transform: none;
    margin: 0 auto var(--thin-gutter);
    max-width: none;
}

/* ── Grid — 3 columns, 6 explicit pixel rows ─────────────────────────────── */
/* The grid's own box is now LOCKED to a fixed aspect ratio (derived from
   the column/row fr totals: 5 column units by 8 row units = 5:8 → 1.6
   height:width). Because every card's grid-row/grid-column span is a
   fraction of this now-fixed box, every card's pixel dimensions become
   fixed too — they no longer change size as the animated numbers grow
   from "0" to their target value. Content (numbers, headings) is simply
   centred within that fixed box rather than dictating its size. */
.wp-block-pemfit-stat-counter .stat-counter-grid {
    display: grid !important;
    grid-template-columns: 0.5fr 0.6fr 1.3fr 0.6fr 0.5fr !important;
    grid-template-rows: 3vw 3vw 6vw 6vw 3vw 3vw !important;
    max-width: 1600px;

    /* aspect-ratio: 3 / 1; */
    margin: 0 auto;
    width: 100%;
    gap: var(--thin-gutter);
}

/* ── Placement: left column — item 1 short/wide, item 2 small/square ─────── */
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(1) {
    grid-row: 1 / 4 !important;
    grid-column: 1 / 3 !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(2) {
    grid-row: 4 / 7 !important;
    grid-column: 2 / 3 !important;
}

/* ── Placement: centre spans rows 2–7, shorter than the side columns ────── */
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) {
    grid-row: 2 / 6 !important;
    grid-column: 3 !important;
}

/* ── Placement: right column — item 4 small/square, item 5 short/wide ────── */
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(4) {
    grid-row: 1 / 4 !important;
    grid-column: 4 / 5 !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(5) {
    grid-row: 4 / 7 !important;
    grid-column: 4 / 6 !important;
}

/* ── Card base ───────────────────────────────────────────────────────────── */
/* overflow: hidden is added as a safety net — even with the grid box now
   geometrically fixed, this guarantees that if any text content is ever
   wider/taller than its card (e.g. a very long custom heading), it clips
   rather than forcing the grid track to grow and shifting every other
   card's position. */
.wp-block-pemfit-stat-counter-item {
    font-family: var(--DM-Sans);
    background-color: var(--pf-item-bg, var(--pf-sc-item-bg, var(--beige))) !important;
    border-radius: var(--rounded-corners) !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: var(--thin-gutter) var(--medium-gutter) !important;
    gap: 0.4rem;
    overflow: hidden !important;

    /* stretch fills the full grid cell height */
    align-self: stretch !important;
}

.wp-block-pemfit-stat-counter-item::before,
.wp-block-pemfit-stat-counter-item::after {
    display: none !important;
}

/* ── Number wrap ─────────────────────────────────────────────────────────── */
.wp-block-pemfit-stat-counter-item .stat-number-wrap {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 0.05em;
    line-height: 1;
    color: var(--pf-sc-num-color, var(--forest-green)) !important;
    margin-bottom: 0.15rem;
}

/* ── Number ──────────────────────────────────────────────────────────────── */
/* Font sizes increased ~25% across the board (proportionally — every
   text element below keeps the same ratio to one another as before). */
.wp-block-pemfit-stat-counter-item .stat-number {
    font-family: var(--DM-Sans) !important;
    font-size: clamp(2rem, 3vw, 6rem) !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: -0.03em !important;
    color: var(--pf-leaf-color, var(--pf-sc-num-color, var(--forest-green))) !important;
    font-variant-numeric: tabular-nums;
}

/* ── Suffix / prefix ─────────────────────────────────────────────────────── */
.wp-block-pemfit-stat-counter-item .stat-suffix,
.wp-block-pemfit-stat-counter-item .stat-prefix {
    font-family: var(--DM-Sans) !important;
    font-size: clamp(2rem, 3vw, 6rem) !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: var(--pf-leaf-color, var(--pf-sc-num-color, var(--forest-green))) !important;

    /* margin-top: 0.18em; */
}

/* ── Heading ─────────────────────────────────────────────────────────────── */
.wp-block-pemfit-stat-counter-item .stat-heading {
    font-family: var(--DM-Sans) !important;
    color: var(--pf-leaf-color, var(--pf-sc-head-color, var(--forest-green))) !important;
    font-size: clamp(1.3rem, 2vw, 2rem) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    margin: 0 !important;
    line-height: 1.3 !important;
}

/* ── Description ─────────────────────────────────────────────────────────── */
.wp-block-pemfit-stat-counter-item .stat-counter-description {
    font-family: var(--DM-Sans) !important;
    color: var(--pf-leaf-color, var(--pf-sc-desc-color, var(--brown))) !important;
    font-size: clamp(1.4rem, 1.4vw, 1.6rem) !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
    margin: 0 !important;
    max-width: none !important;
    min-width: auto !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   CENTRE CARD — large number, vertically centred
   ══════════════════════════════════════════════════════════════════════════ */
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) {
    justify-content: center !important;
    align-items: center !important;
    padding: 15% 0 !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) .stat-number {
    font-size: clamp(3rem, 4vw, 11rem) !important;
    font-weight: 800 !important;
    letter-spacing: -0.04em !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) .stat-suffix,
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) .stat-prefix {
    font-size: clamp(3rem, 4vw, 11rem) !important;
    font-weight: 800 !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) .stat-heading {
    font-size: clamp(1.75rem, 2.5vw, 3.75rem) !important;
    margin-top: 0.5rem !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(3) .stat-counter-description {
    font-size: clamp(1.25rem, 1.6vw, 1.6rem) !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   HORIZONTAL CARDS — items 1 and 5 (the short landscape rectangles)
   Number on left, heading + description stacked as one centred unit right.
   Single grid row: .stat-number-wrap is one grid item (column 1),
   .stat-text-wrap is the other (column 2). Centring the row via
   align-items on the card means both items — including the heading+
   description stack inside .stat-text-wrap — sit vertically centred
   against each other, and the heading alone still centres correctly
   inside .stat-text-wrap when description is empty (PHP renders nothing
   for an empty description, so there's no leftover gap to offset against).
   ══════════════════════════════════════════════════════════════════════════ */
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(1),
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(5) {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    grid-template-rows: auto !important;
    -moz-column-gap: var(--thin-gutter) !important;
    column-gap: var(--thin-gutter) !important;
    align-items: center !important;
    text-align: left !important;
    padding: var(--thin-gutter) var(--medium-gutter) !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(1) .stat-number-wrap,
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(5) .stat-number-wrap {
    grid-row: 1 !important;
    grid-column: 1 !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    margin-bottom: 0 !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(1) .stat-text-wrap,
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(5) .stat-text-wrap {
    grid-row: 1 !important;
    grid-column: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 0.2rem !important;
    text-align: left !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(1) .stat-heading,
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(5) .stat-heading {
    text-align: left !important;
    margin: 0 !important;
}

.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(1) .stat-counter-description,
.wp-block-pemfit-stat-counter .stat-counter-grid > *:nth-child(5) .stat-counter-description {
    text-align: left !important;
    margin: 0 !important;
}

