/*
 * Features Grid
 * Layout: template-parts/flex/features_grid.php
 * Auto-enqueued by functions.php after css/theme.css.
 *
 * Centred header, then a centred wrapping row of features: icon, title,
 * description, all centred. Items flex between 18rem and 22rem, so a row
 * holds four on a full-width container and any short final row is centred
 * beneath (seven items read as four over three).
 */

.features-grid {
    --section-pad: var(--space-3xl);
    background-color: var(--color-background);
}

/* --- Header -------------------------------------------------------------- */

.features-grid__header {
    max-width: 44rem;
    margin: 0 auto var(--space-2xl);
    text-align: center;
}

.features-grid__heading {
    margin: 0;
    color: var(--color-primary);
}

.features-grid__subheading {
    max-width: 38rem;
    margin: var(--space-md) auto 0;
    font-size: var(--text-1);
    font-weight: var(--font-regular);
}

/* --- Features ------------------------------------------------------------ */

.features-grid__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2xl) var(--space-lg);
}

.feature-item {
    /* Grows to share the row, capped so a short final row stays compact and centred. */
    flex: 1 1 18rem;
    max-width: 22rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    text-align: center;
}

/* Uploaded icons include their own pale rounded square, so nothing is added here. */
.feature-item__icon {
    display: block;
    width: 5rem;
    height: 5rem;
    margin-bottom: var(--space-xs);
    object-fit: contain;
}

.feature-item__title {
    margin: 0;
    font-size: var(--text-1);
    color: var(--color-primary);
}

.feature-item__description {
    margin: 0;
    font-weight: var(--font-light);
}

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

@media screen and (max-width: 768px) {

    .features-grid__header {
        margin-bottom: var(--space-xl);
    }

    .features-grid__list {
        gap: var(--space-xl) var(--space-md);
    }

    .feature-item {
        flex-basis: 100%;
        max-width: 24rem;
    }

}
