/* Posts Grid */

.ccb-posts-grid {
    position: relative;
    background-color: var(--ccb-pg-bg, transparent);
    background-image: var(--ccb-pg-bg-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    margin-top: var(--ccb-pg-mt-desktop, 0px);
    margin-bottom: var(--ccb-pg-mb-desktop, 0px);

    padding-top: var(--ccb-pg-pt-desktop, 0px);
    padding-bottom: var(--ccb-pg-pb-desktop, 0px);
}

.ccb-posts-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--ccb-pg-overlay-color, transparent);
    opacity: var(--ccb-pg-overlay-opacity, 0);
    pointer-events: none;
}

.ccb-posts-grid > .cgb-inner {
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: var(--cgb-inner-max, 1200px);
    margin-left: auto;
    margin-right: auto;

    padding-left: var(--cgb-inner-pad-x-desktop, 24px);
    padding-right: var(--cgb-inner-pad-x-desktop, 24px);
}

.ccb-posts-grid__section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: var(--ccb-pg-sec-title-mb-desktop, 24px);
}
.ccb-posts-grid__section-header .ccb-posts-grid__section-title {
    margin-bottom: 0;
}

.ccb-posts-grid__view-all {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.ccb-posts-grid__view-all:hover {
    text-decoration: underline;
}

.ccb-posts-grid__section-title {
    margin-left: 0;
    margin-right: 0;
    margin-top: var(--ccb-pg-sec-title-mt-desktop, 0px);
    margin-bottom: var(--ccb-pg-sec-title-mb-desktop, 24px);
    text-align: var(--ccb-pg-sec-title-align, left);
    color: var(--ccb-pg-sec-title-color-desktop, var(--cgb-text-main, #3c434a));
    font-size: var(--ccb-pg-sec-title-fs-desktop, 32px);
    line-height: var(--ccb-pg-sec-title-lh-desktop, 1.2);
    font-weight: var(--ccb-pg-sec-title-fw-desktop, 800);
    letter-spacing: var(--ccb-pg-sec-title-ls-desktop, 0em);
}

.ccb-posts-grid__grid {
    display: grid;
    grid-template-columns: repeat(var(--ccb-pg-cols-desktop, 3), minmax(0, 1fr));
    gap: var(--ccb-pg-gap-desktop, 24px);
}

.ccb-posts-grid__card {
    background: var(--ccb-pg-card-bg, var(--cgb-bg-card, #ffffff));
    color: var(--ccb-pg-card-text, var(--cgb-text-main, #3c434a));
    border: var(--ccb-pg-card-border-w, 0px) var(--ccb-pg-card-border-style, solid) var(--ccb-pg-card-border-color, transparent);
    border-radius: var(--ccb-pg-card-radius, var(--cgb-radius-card, 8px));
    box-shadow: var(--ccb-pg-card-shadow, var(--cgb-shadow-card, none));
    overflow: hidden;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.ccb-posts-grid__card:hover {
    box-shadow: var(
        --ccb-pg-card-shadow-hover,
        var(--cgb-shadow-hover, var(--ccb-pg-card-shadow, var(--cgb-shadow-card, none)))
    );
}

.ccb-posts-grid__image {
    display: block;
    line-height: 0;
    aspect-ratio: var(--ccb-pg-image-ar, auto);
    overflow: hidden;
}

.ccb-posts-grid__image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.ccb-posts-grid__content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ccb-posts-grid__meta {
    color: var(--ccb-pg-meta-color, var(--cgb-text-muted, #646970));
    font-size: 12px;
    line-height: 1.4;
}

.ccb-posts-grid__meta-sep {
    margin: 0 6px;
    opacity: 0.8;
}

.ccb-posts-grid__title {
    font-size: var(--ccb-pg-title-fs-desktop, 20px);
    line-height: 1.2;
    font-weight: var(--ccb-pg-title-fw-desktop, 700);
    color: var(--ccb-pg-title-color-desktop, inherit);
    margin-top: var(--ccb-pg-title-mt-desktop, 0px);
    margin-bottom: var(--ccb-pg-title-mb-desktop, 0px);
}

.ccb-posts-grid__title a {
    color: inherit;
    text-decoration: none;
}

.ccb-posts-grid__excerpt {
    font-size: var(--ccb-pg-excerpt-fs-desktop, 14px);
    line-height: 1.6;
    margin: 0;
}

.ccb-posts-grid__readmore {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    align-self: flex-start;
    text-decoration: none;
}

.ccb-posts-grid__readmore--link {
    color: var(--ccb-pg-link-color, var(--cgb-primary, #5e17eb));
}

.ccb-posts-grid__readmore--button {
    background: var(--ccb-pg-btn-bg, var(--cgb-primary, #5e17eb));
    color: var(--ccb-pg-btn-text, #ffffff);
    padding: 10px 14px;
    border-radius: var(--cgb-radius-pill, 999px);
}

/* Card types */
.ccb-posts-grid--card-minimal .ccb-posts-grid__image {
    display: none;
}

.ccb-posts-grid--card-minimal .ccb-posts-grid__excerpt {
    display: none;
}

.ccb-posts-grid--card-horizontal .ccb-posts-grid__card {
    display: grid;
    grid-template-columns: 40% 1fr;
    align-items: stretch;
}

.ccb-posts-grid--card-horizontal .ccb-posts-grid__image {
    height: 100%;
}

.ccb-posts-grid--card-horizontal .ccb-posts-grid__image img {
    height: 100%;
    object-fit: cover;
}

.ccb-posts-grid__empty {
    padding: 16px;
}

/* Tablet */
@media (max-width: 1024px) {
    .ccb-posts-grid {
        margin-top: var(--ccb-pg-mt-tablet, var(--ccb-pg-mt-desktop, 0px));
        margin-bottom: var(--ccb-pg-mb-tablet, var(--ccb-pg-mb-desktop, 0px));

        padding-top: var(--ccb-pg-pt-tablet, var(--ccb-pg-pt-desktop, 0px));
        padding-bottom: var(--ccb-pg-pb-tablet, var(--ccb-pg-pb-desktop, 0px));
    }

    .ccb-posts-grid > .cgb-inner {
        max-width: var(--cgb-inner-max-tablet, var(--cgb-inner-max, 1200px));
        padding-left: var(--cgb-inner-pad-x-tablet, var(--cgb-inner-pad-x-desktop, 24px));
        padding-right: var(--cgb-inner-pad-x-tablet, var(--cgb-inner-pad-x-desktop, 24px));
    }

    .ccb-posts-grid__grid {
        grid-template-columns: repeat(var(--ccb-pg-cols-tablet, var(--ccb-pg-cols-desktop, 3)), minmax(0, 1fr));
        gap: var(--ccb-pg-gap-tablet, var(--ccb-pg-gap-desktop, 24px));
    }

    .ccb-posts-grid__section-title {
        margin-top: var(--ccb-pg-sec-title-mt-tablet, var(--ccb-pg-sec-title-mt-desktop, 0px));
        margin-bottom: var(--ccb-pg-sec-title-mb-tablet, var(--ccb-pg-sec-title-mb-desktop, 24px));
        color: var(--ccb-pg-sec-title-color-tablet, var(--ccb-pg-sec-title-color-desktop, var(--cgb-text-main, #3c434a)));
        font-size: var(--ccb-pg-sec-title-fs-tablet, var(--ccb-pg-sec-title-fs-desktop, 32px));
        line-height: var(--ccb-pg-sec-title-lh-tablet, var(--ccb-pg-sec-title-lh-desktop, 1.2));
        font-weight: var(--ccb-pg-sec-title-fw-tablet, var(--ccb-pg-sec-title-fw-desktop, 800));
        letter-spacing: var(--ccb-pg-sec-title-ls-tablet, var(--ccb-pg-sec-title-ls-desktop, 0em));
    }

    .ccb-posts-grid__title {
        font-size: var(--ccb-pg-title-fs-tablet, var(--ccb-pg-title-fs-desktop, 20px));
        font-weight: var(--ccb-pg-title-fw-tablet, var(--ccb-pg-title-fw-desktop, 700));
        color: var(--ccb-pg-title-color-tablet, var(--ccb-pg-title-color-desktop, inherit));
        margin-top: var(--ccb-pg-title-mt-tablet, var(--ccb-pg-title-mt-desktop, 0px));
        margin-bottom: var(--ccb-pg-title-mb-tablet, var(--ccb-pg-title-mb-desktop, 0px));
    }

    .ccb-posts-grid__excerpt {
        font-size: var(--ccb-pg-excerpt-fs-tablet, var(--ccb-pg-excerpt-fs-desktop, 14px));
    }
}

/* Mobile */
@media (max-width: 768px) {
    .ccb-posts-grid {
        margin-top: var(--ccb-pg-mt-mobile, var(--ccb-pg-mt-tablet, var(--ccb-pg-mt-desktop, 0px)));
        margin-bottom: var(--ccb-pg-mb-mobile, var(--ccb-pg-mb-tablet, var(--ccb-pg-mb-desktop, 0px)));

        padding-top: var(--ccb-pg-pt-mobile, var(--ccb-pg-pt-tablet, var(--ccb-pg-pt-desktop, 0px)));
        padding-bottom: var(--ccb-pg-pb-mobile, var(--ccb-pg-pb-tablet, var(--ccb-pg-pb-desktop, 0px)));
    }

    .ccb-posts-grid > .cgb-inner {
        max-width: var(--cgb-inner-max-mobile, var(--cgb-inner-max-tablet, var(--cgb-inner-max, 1200px)));
        padding-left: var(--cgb-inner-pad-x-mobile, var(--cgb-inner-pad-x-tablet, var(--cgb-inner-pad-x-desktop, 24px)));
        padding-right: var(--cgb-inner-pad-x-mobile, var(--cgb-inner-pad-x-tablet, var(--cgb-inner-pad-x-desktop, 24px)));
    }

    .ccb-posts-grid__section-title {
        margin-top: var(--ccb-pg-sec-title-mt-mobile, var(--ccb-pg-sec-title-mt-tablet, var(--ccb-pg-sec-title-mt-desktop, 0px)));
        margin-bottom: var(--ccb-pg-sec-title-mb-mobile, var(--ccb-pg-sec-title-mb-tablet, var(--ccb-pg-sec-title-mb-desktop, 24px)));
    }

    .ccb-posts-grid__title {
        font-size: var(--ccb-pg-title-fs-mobile, var(--ccb-pg-title-fs-tablet, var(--ccb-pg-title-fs-desktop, 20px)));
        font-weight: var(--ccb-pg-title-fw-mobile, var(--ccb-pg-title-fw-tablet, var(--ccb-pg-title-fw-desktop, 700)));
        color: var(--ccb-pg-title-color-mobile, var(--ccb-pg-title-color-tablet, var(--ccb-pg-title-color-desktop, inherit)));
        margin-top: var(--ccb-pg-title-mt-mobile, var(--ccb-pg-title-mt-tablet, var(--ccb-pg-title-mt-desktop, 0px)));
        margin-bottom: var(--ccb-pg-title-mb-mobile, var(--ccb-pg-title-mb-tablet, var(--ccb-pg-title-mb-desktop, 0px)));
    }

    .ccb-posts-grid__grid {
        grid-template-columns: repeat(var(--ccb-pg-cols-mobile, 1), minmax(0, 1fr));
        gap: var(--ccb-pg-gap-mobile, var(--ccb-pg-gap-tablet, var(--ccb-pg-gap-desktop, 24px)));
    }

    .ccb-posts-grid__section-title {
        color: var(--ccb-pg-sec-title-color-mobile, var(--ccb-pg-sec-title-color-tablet, var(--ccb-pg-sec-title-color-desktop, var(--cgb-text-main, #3c434a))));
        font-size: var(--ccb-pg-sec-title-fs-mobile, var(--ccb-pg-sec-title-fs-tablet, var(--ccb-pg-sec-title-fs-desktop, 32px)));
        line-height: var(--ccb-pg-sec-title-lh-mobile, var(--ccb-pg-sec-title-lh-tablet, var(--ccb-pg-sec-title-lh-desktop, 1.2)));
        font-weight: var(--ccb-pg-sec-title-fw-mobile, var(--ccb-pg-sec-title-fw-tablet, var(--ccb-pg-sec-title-fw-desktop, 800)));
        letter-spacing: var(--ccb-pg-sec-title-ls-mobile, var(--ccb-pg-sec-title-ls-tablet, var(--ccb-pg-sec-title-ls-desktop, 0em)));
    }

    .ccb-posts-grid__title {
        font-size: var(--ccb-pg-title-fs-mobile, var(--ccb-pg-title-fs-tablet, var(--ccb-pg-title-fs-desktop, 20px)));
    }

    .ccb-posts-grid__excerpt {
        font-size: var(--ccb-pg-excerpt-fs-mobile, var(--ccb-pg-excerpt-fs-tablet, var(--ccb-pg-excerpt-fs-desktop, 14px)));
    }

    .ccb-posts-grid--card-horizontal .ccb-posts-grid__card {
        grid-template-columns: 1fr;
    }

    .ccb-posts-grid--card-horizontal .ccb-posts-grid__image img {
        height: auto;
    }
}

/* ── Pagination ── */

.ccb-posts-grid__pagination {
    margin: clamp(22px, 3vw, 34px) 0 0;
}

.ccb-posts-grid__pagination ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.ccb-posts-grid__pagination a,
.ccb-posts-grid__pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--cgb-border, #e2e8f0);
    border-radius: var(--cgb-radius-sm, 6px);
    text-decoration: none;
    color: var(--cgb-text, #334155);
    background: var(--cgb-bg, #fff);
    font-size: 14px;
    transition: border-color 0.2s, color 0.2s;
}

.ccb-posts-grid__pagination a:hover {
    border-color: var(--cgb-primary, #5182bb);
    color: var(--cgb-primary, #5182bb);
}

.ccb-posts-grid__pagination .current {
    border-color: var(--cgb-primary, #5182bb);
    color: var(--cgb-primary, #5182bb);
    font-weight: 600;
}
