.custom-services-grid-wrapper {
    display: grid;
    /* الافتراضي للـ 3 أو الـ 5 كروت (هيعمل 3 فوق وينزل الباقي تحت) */
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* التعديل الديناميكي: لو عددهم 4 (أو 2) خليهم عمودين */
.custom-services-grid-wrapper.has-4-cards,
.custom-services-grid-wrapper.has-2-cards {
    grid-template-columns: repeat(2, 1fr);
}

.custom-grid-card {
    background: #f9f9fa;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
    height: 100%;
    direction: rtl;
}

.custom-grid-img {
    width: 100%;
    height: 220px;
    border-radius: 12px !important;
    object-fit: cover;
    display: block;
}

.custom-grid-text {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-top: 24px;
    margin-bottom: 120px;
}

.custom-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.custom-grid-title {
    margin-bottom: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    width: 65%;
}

.custom-grid-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 18px;
    flex-shrink: 0;
}

/* التنسيقات الخاصة بكل Layout */
.custom-grid-card.layout-image_top .custom-grid-icon {
    background-color: #709fb5;
    color: #ffffff;
}

.custom-grid-card.layout-image_bottom .custom-grid-icon {
    background-color: #f2efe9;
    color: #c9a473;
}

/* دعم اتجاه اللغة (RTL) لو الموقع بالعربي */
html[dir="rtl"] .custom-grid-card {
    text-align: right;
}

/* -------------------------------------- */
/* التجاوب (Responsive) مع التابلت والموبايل */
/* -------------------------------------- */

/* تابلت: نخليهم 2 في الصف بغض النظر عن العدد */
@media (max-width: 1024px) {

    .custom-services-grid-wrapper,
    .custom-services-grid-wrapper.has-4-cards,
    .custom-services-grid-wrapper.has-2-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* موبايل: نخليهم كارت واحد في الصف */
@media (max-width: 767px) {

    .custom-services-grid-wrapper,
    .custom-services-grid-wrapper.has-4-cards,
    .custom-services-grid-wrapper.has-2-cards {
        grid-template-columns: 1fr;
    }
}