/* ============================================================
   Services Grid Cards — CEW Plugin
   Scoped to .cew-services-grid — zero global side-effects
   ============================================================ */

/* ── CSS VAR FALLBACKS ────────────────────────────────────── */
.cew-services-grid {
    --sg-bg:       #f4f4f4;
    --sg-card-bg:  #ffffff;
    --sg-accent:   #111111;
    --sg-icon:     #cccccc;
    --sg-h-size:   44px;
    --sg-cols:     3;
}

/* ── RESET ────────────────────────────────────────────────── */
.cew-services-grid *,
.cew-services-grid *::before,
.cew-services-grid *::after {
    box-sizing: border-box;
}

/* ── SECTION WRAPPER ──────────────────────────────────────── */
.cew-services-grid {
    /*background: var(--sg-bg);*/
    width: 100%;
    padding: 72px 0px 80px;
}

/* ── HEADER ───────────────────────────────────────────────── */
.cew-services-grid .csg-header {
    text-align: center;
    margin: 0 auto 52px;
}

.cew-services-grid .csg-badge {
    display: inline-block;
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #444;
    background: transparent;
    letter-spacing: 0.01em;
    margin-bottom: 20px;
}

.cew-services-grid .csg-heading {
    font-size: var(--sg-h-size);
    font-weight: 700;
    color: #0d0d0d;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 18px !important;
    padding: 0;
}

.cew-services-grid .csg-sub {
    font-size: 16px;
    font-weight: 400;
    color: #858585;
    line-height: 1.65;
    margin: 0 !important;
    padding: 0;
}

/* ── GRID ─────────────────────────────────────────────────── */
.cew-services-grid .csg-grid {
    display: grid;
    grid-template-columns: repeat( var(--sg-cols), 1fr );
    gap: 16px;
    margin: 0 auto;
}

/* ── CARD ─────────────────────────────────────────────────── */
.cew-services-grid .csg-card {
    background: var(--sg-card-bg);
    border-radius: 16px;
    padding: 32px 28px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 260px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    /* subtle border matching reference */
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
}

.cew-services-grid .csg-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.11), 0 0 0 1px rgba(0,0,0,0.06);
    transform: translateY(-3px);
}

/* ── CARD BODY ────────────────────────────────────────────── */
.cew-services-grid .csg-card-body {
    flex: 1;
    margin-bottom: 24px;
}

.cew-services-grid .csg-card-title {
    font-size: 19px;
    font-weight: 700;
    color: #0d0d0d;
    line-height: 1.25;
    margin: 0 0 14px !important;
    padding: 0;
}

.cew-services-grid .csg-card-desc {
    font-size: 14.5px;
    font-weight: 400;
    color: #858585;
    line-height: 1.65;
    margin: 0 !important;
    padding: 0;
    /* Limit desc so cards stay uniform height */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── CARD FOOTER ──────────────────────────────────────────── */
.cew-services-grid .csg-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

/* Learn more link */
.cew-services-grid .csg-learn-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--sg-accent) !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    transition: gap 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.cew-services-grid .csg-learn-more:hover {
    gap: 9px;
    opacity: 0.75;
}

.cew-services-grid .csg-arrow {
    font-size: 15px;
    line-height: 1;
}

/* ── SVG ICON (bottom-right) ──────────────────────────────── */
.cew-services-grid .csg-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sg-icon);
    /* subtle tint behind icon */
    background: rgba(0,0,0,0.025);
    border-radius: 12px;
    padding: 8px;
    transition: color 0.25s ease;
}

.cew-services-grid .csg-card:hover .csg-icon {
    color: #999;
}

.cew-services-grid .csg-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    /* inherit currentColor so stroke/fill picks up --sg-icon */
    color: inherit;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */

/* Tablet: 2 cols regardless of setting */
@media (max-width: 900px) {
    .cew-services-grid .csg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cew-services-grid .csg-heading {
        font-size: clamp(28px, 6vw, 40px) !important;
    }
}

/* Mobile: 1 col */
@media (max-width: 560px) {
    .cew-services-grid {
        padding: 48px 0px 0px;
    }
    .cew-services-grid .csg-grid {
        grid-template-columns: 1fr;
    }
    .cew-services-grid .csg-header {
        margin-bottom: 36px;
    }
    .cew-services-grid .csg-heading {
        font-size: clamp(26px, 7vw, 36px) !important;
    }
    .cew-services-grid .csg-card {
        min-height: unset;
        padding: 24px 20px 20px;
    }
}
