.ecbg-wrapper,
.ecbg-wrapper * {
    box-sizing: border-box;
}

.ecbg-section-title {
    margin: 0 0 30px;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
    color: #000;
}

.ecbg-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 52px 26px;
}

.ecbg-card {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ecbg-image-wrap {
    display: block;
    position: relative;
    width: 100%;
    height: 190px;
    overflow: hidden;
    background: #f5f5f5;
    text-decoration: none;
}

.ecbg-image-wrap:before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease, background-color .35s ease;
}

.ecbg-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .45s ease, filter .45s ease;
}

.ecbg-post-image {
    position: relative;
    z-index: 0;
}

.ecbg-no-image {
    position: relative;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #777;
    font-size: 14px;
}

.ecbg-card-content {
    position: relative;
    z-index: 2;
    width: 84%;
    margin: -65px auto 0;
    padding: 24px 26px;
    background: #fff;
    box-shadow: 0 12px 25px rgba(0, 0, 0, .06);
    transition: transform .35s ease, box-shadow .35s ease, background-color .35s ease, color .25s ease;
}

.ecbg-equal-height .ecbg-card-content {
    display: flex;
    flex-direction: column;
    height: auto;
}

/*
 * Keep content box height independent from image height.
 * Image height changes should affect only the image area, not stretch the white content box.
 */
.ecbg-equal-height .ecbg-card-content {
    align-self: center;
}

.ecbg-equal-height .ecbg-title {
    flex: 1 1 auto;
}

.ecbg-equal-height .ecbg-read-more-wrap {
    margin-top: auto;
    padding-top: 22px;
}

.ecbg-button-hover-only.ecbg-equal-height .ecbg-read-more-wrap {
    margin-top: 0;
    padding-top: 0;
}

.ecbg-equal-height .ecbg-card {
    height: auto;
}

.ecbg-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 14px;
    margin-bottom: 8px;
    color: #8d8d8d;
    font-size: 13px;
    line-height: 1.4;
}

.ecbg-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
}

.ecbg-meta i {
    font-size: 13px;
    line-height: 1;
    color: inherit;
}

.ecbg-title {
    margin: 0;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 600;
}

.ecbg-title a {
    color: #000;
    text-decoration: none;
    transition: color .25s ease;
}

.ecbg-title a:hover {
    color: #2db352;
}

.ecbg-read-more-wrap {
    margin-top: 22px;
    text-align: center;
}

.ecbg-read-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 30px;
    border: 1px solid rgba(45, 179, 82, .5);
    border-radius: 4px;
    color: #2db352;
    background: rgba(255, 255, 255, .75);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all .25s ease;
}

.ecbg-read-more:hover {
    color: #fff;
    background: #2db352;
    border-color: #2db352;
}

.ecbg-hover-overlay .ecbg-card:hover .ecbg-card-content {
    background: rgba(45, 179, 82, .82);
}

.ecbg-hover-overlay .ecbg-card:hover .ecbg-title a,
.ecbg-hover-overlay .ecbg-card:hover .ecbg-meta,
.ecbg-hover-overlay .ecbg-card:hover .ecbg-meta span,
.ecbg-hover-overlay .ecbg-card:hover .ecbg-meta i {
    color: #fff;
}

.ecbg-hover-overlay .ecbg-title a,
.ecbg-hover-overlay .ecbg-meta,
.ecbg-hover-overlay .ecbg-meta span,
.ecbg-hover-overlay .ecbg-meta i {
    transition: color .25s ease;
}

/*
 * Hover-only read more button
 * Keep the button out of normal document flow so the hovered card
 * does not force other cards in the same CSS grid row to grow.
 */

/* Compact content mode: remove the unwanted blank lower area under the title.
 * This also overrides any old Elementor-generated min-height from previous plugin versions.
 */
.ecbg-compact-content .ecbg-card-content {
    min-height: auto !important;
    height: auto !important;
}

.ecbg-compact-content.ecbg-equal-height .ecbg-title {
    flex: 0 0 auto !important;
}

.ecbg-compact-content.ecbg-equal-height .ecbg-read-more-wrap {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.ecbg-compact-content.ecbg-button-hover-only .ecbg-card-content {
    overflow: visible;
}

.ecbg-compact-content.ecbg-button-hover-only .ecbg-read-more-wrap {
    overflow: visible;
}

.ecbg-button-hover-only .ecbg-card-content {
    overflow: hidden;
}

.ecbg-button-hover-only .ecbg-read-more-wrap {
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: 24px;
    z-index: 5;
    margin: 0;
    padding: 0;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}

.ecbg-button-hover-only .ecbg-card:hover .ecbg-read-more-wrap {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.ecbg-button-hover-only.ecbg-equal-height .ecbg-title {
    flex: 0 1 auto;
}

.ecbg-hover-lift .ecbg-card:hover .ecbg-card-content,
.ecbg-hover-both .ecbg-card:hover .ecbg-card-content {
    transform: translateY(-8px);
    box-shadow: 0 18px 35px rgba(0, 0, 0, .12);
}

.ecbg-hover-zoom .ecbg-card:hover .ecbg-image-wrap img,
.ecbg-hover-both .ecbg-card:hover .ecbg-image-wrap img {
    transform: scale(1.08);
}

.ecbg-pagination {
    margin: 55px 0 0;
    text-align: center;
}

.ecbg-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 38px;
    margin: 0 4px 8px;
    padding: 0 12px;
    background: #eee;
    color: #111;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0;
    transition: all .25s ease;
}

.ecbg-pagination .page-numbers.current,
.ecbg-pagination .page-numbers:hover {
    background: #2db352;
    color: #fff;
}

.ecbg-no-posts {
    margin: 0;
    padding: 20px;
    background: #f7f7f7;
    color: #333;
}

@media (max-width: 1024px) {
    .ecbg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .ecbg-grid {
        grid-template-columns: 1fr;
        gap: 35px;
    }

    .ecbg-card-content {
        width: 90%;
        margin-top: -45px;
        padding: 20px;
    }

    .ecbg-title {
        font-size: 18px;
    }
}


/* Final compact override loaded after base hover CSS. */
.ecbg-wrapper.ecbg-compact-content.ecbg-button-hover-only .ecbg-card-content {
    min-height: auto !important;
    height: auto !important;
}

.ecbg-wrapper.ecbg-compact-content.ecbg-button-hover-only .ecbg-title {
    flex: 0 0 auto !important;
}

/*
 * Fix for Equal Height + Hover Button:
 * The Read More button is absolute, so it must be allowed to overflow the
 * content box. Otherwise, with equal-height/compact mode the lower part of
 * the button can be clipped under the content box. This keeps all cards at
 * the same height and shows the button fully only on the hovered card.
 */
.ecbg-wrapper.ecbg-button-hover-only .ecbg-card,
.ecbg-wrapper.ecbg-button-hover-only .ecbg-card-content {
    overflow: visible !important;
}

.ecbg-wrapper.ecbg-button-hover-only .ecbg-read-more-wrap {
    z-index: 20;
}

.ecbg-wrapper.ecbg-button-hover-only .ecbg-card:hover {
    z-index: 10;
}


/* v1.0.10 Equal height fix
 * - Equal Height Content Boxes now actually stretch all content boxes in a grid row.
 * - Content Box Min Height works again, even when Remove Extra Bottom Gap is enabled.
 * - Hover-only Read More remains absolute, so it does not reserve space or change card height.
 */
.ecbg-wrapper.ecbg-equal-height .ecbg-grid {
    align-items: stretch;
}

.ecbg-wrapper.ecbg-equal-height .ecbg-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.ecbg-wrapper.ecbg-equal-height .ecbg-image-wrap {
    flex: 0 0 auto;
}

.ecbg-wrapper.ecbg-equal-height .ecbg-card-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: auto !important;
    overflow: visible;
}

/* Do not allow compact mode to cancel the Elementor Content Box Min Height control. */
.ecbg-wrapper.ecbg-compact-content.ecbg-equal-height .ecbg-card-content,
.ecbg-wrapper.ecbg-compact-content.ecbg-button-hover-only.ecbg-equal-height .ecbg-card-content {
    height: auto !important;
}

.ecbg-wrapper.ecbg-equal-height .ecbg-meta,
.ecbg-wrapper.ecbg-equal-height .ecbg-title {
    flex: 0 0 auto;
}

.ecbg-wrapper.ecbg-button-hover-only.ecbg-equal-height .ecbg-read-more-wrap {
    position: absolute;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto;
}

/* When read-more is not hover-only, keep it at the bottom of equal-height boxes. */
.ecbg-wrapper.ecbg-equal-height:not(.ecbg-button-hover-only) .ecbg-read-more-wrap {
    margin-top: auto;
}
