/* ==========================================================================
   Counter Cards Gutenberg Block
   Layout + containment - Bricks handles text styling
   ========================================================================== */

/* ==========================================================================
   Utility: Center text on mobile
   Add class "text-center-mobile" to any Gutenberg block
   ========================================================================== */
@media (max-width: 782px) {
    .text-center-mobile,
    .text-center-mobile p,
    .text-center-mobile h1,
    .text-center-mobile h2,
    .text-center-mobile h3,
    .text-center-mobile h4,
    .text-center-mobile h5,
    .text-center-mobile h6 {
        text-align: center !important;
    }
}

/* ==========================================================================
   Section Title
   ========================================================================== */

.counter-cards__section-title {
    font-size: var(--text-2xl, 1.75rem);
    text-align: center;
    margin: 0 0 var(--space-xl, 40px) 0;
}

.counter-cards__section-title--primary {
    color: var(--primary, #633368);
}

.counter-cards__section-title--secondary {
    color: var(--secondary, #0D7377);
}

.counter-cards__section-title--tertiary {
    color: var(--tertiary, #14919B);
}

.counter-cards__section-title--white {
    color: #fff;
}

.counter-cards__section-title--black {
    color: var(--black, #000000);
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.counter-cards__grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-m, 24px);
    justify-content: flex-start;
}

/* Alignment variants */
.counter-cards--align-start .counter-cards__grid {
    justify-content: flex-start;
}

.counter-cards--align-center .counter-cards__grid {
    justify-content: center;
}

.counter-cards--align-end .counter-cards__grid {
    justify-content: flex-end;
}

/* Card - force square and center content */
.counter-cards .counter-card {
    width: 200px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius-m);
}

/* Content wrapper - center */
.counter-cards .card-data__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    width: 100%;
}

/* Label - prevent overflow */
.counter-cards .card-data__heading {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 14px !important;
}

/* Suffix styling */
.counter-cards .suffix {
    font-size: 0.5em;
    font-weight: 700;
    margin-left: 2px;
}

/* Responsive */
@media (max-width: 782px) {
    /* Force center alignment on smaller screens */
    .counter-cards__grid {
        justify-content: center !important;
    }

    .counter-cards .counter-card {
        width: 150px;
    }

    .counter-cards .card-data__heading {
        font-size: 11px !important;
    }
}

/* Gutenberg columns spacing */
.wp-block-columns:has(.counter-cards) {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

/* Fix Gutenberg columns gap on mobile */
.wp-block-columns .counter-cards {
    margin-top: var(--space-m, 24px);
}

@media (max-width: 782px) {
    .wp-block-columns:has(.counter-cards) {
        margin-top: 0;
        margin-bottom: var(--space-l);
    }

    .wp-block-columns .counter-cards:first-child {
        margin-top: 0;
    }

    .wp-block-column + .wp-block-column .counter-cards {
        margin-top: var(--space-l, 32px);
    }
}
