/* =============================================================================
   Related Posts — CPT Detail Pages
   File: subsidy-child/assets/css/related-posts.css
   ============================================================================= */

/* --------------------------------------------------
   Section Wrapper
   -------------------------------------------------- */
.related-posts-wrapper {
    margin-top: 50px;
    clear: both;
}

/* --------------------------------------------------
   Section Title
   -------------------------------------------------- */
.related-posts-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 12px;
}

/* Underline accent — matches common Subsidy theme heading style */
.related-posts-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: #0d6d5b; /* swap to your theme's primary color */
    position: absolute;
    bottom: 0;
    left: 0;
}

/* --------------------------------------------------
   Grid: 3 columns on desktop, responsive below
   Uses flexbox — consistent with Bootstrap 3/4 flow
   -------------------------------------------------- */
.related-posts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Each card takes 1/3 width minus the gap */
.related-post-card {
    flex: 1 1 calc(33.333% - 16px);
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #ebebeb;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    overflow: hidden;
}

.related-post-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    transform: translateY(-3px);
}

/* --------------------------------------------------
   Thumbnail
   -------------------------------------------------- */
.related-post-card a img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: opacity 0.25s ease;
}

.related-post-card a:hover img {
    opacity: 0.88;
}

/* --------------------------------------------------
   Card Body
   -------------------------------------------------- */
.related-post-info {
    padding: 16px 18px 20px;
}

.related-post-info h4 {
    font-size: 18px !important;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-post-info p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-post-info h4 a {
    color: #222222;
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-post-info h4 a:hover {
    color: #ffb649; /* match your theme primary */
}

.related-story .related-post-card img,
.related-resource .related-post-card img {
    height: 210px;
    object-fit: cover;
    width: 100%;
}

/* --------------------------------------------------
   Taxonomy Term Badges
   -------------------------------------------------- */
.related-post-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.term-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 3px;
    background-color: #f4f4f4;
    color: #555555;
    border: 1px solid #e0e0e0;
}

aside .widget.widget_tag_cloud.msh-tag-cloud-meta {
    margin-bottom: 0;
}
aside.widget-area .widget_search input.form-control {
    color:#343434 !important;
}

/* Related Posts — Sidebar Widget (MSH_Related_Posts_Widget)
   Selectors scoped under .msh-related-posts-widget (the widget's own
   classname) with !important on the properties that were losing to
   the parent Subsidy theme's own, higher-specificity sidebar rules. */
.msh-related-posts-widget .msh-related-posts-list { list-style: none; margin: 0; padding: 0; }

.msh-related-posts-widget .msh-related-posts-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding:0 0 20px 0;
    align-items: center;
}
.msh-related-posts-widget .msh-related-posts-item:first-child { padding-top: 0; }
.msh-related-posts-widget .msh-related-posts-item:last-child { padding-bottom: 0; }

.msh-related-posts-widget .msh-related-posts-thumb {
    flex: 0 0 70px !important;
    width: 70px !important;
    height: 70px !important;
    display: block;
    /* border-radius: 6px; */
    overflow: hidden;
}
.msh-related-posts-widget .msh-related-posts-thumb img {
    width: 70px !important;
    height: 70px !important;
    max-width: none !important;
    object-fit: cover !important;
    display: block;
}

.msh-related-posts-widget .msh-related-posts-info { flex: 1 1 auto; min-width: 0; }

.msh-related-posts-widget .msh-related-posts-title {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
    font-weight: 700 !important;
    line-height: 1.4;
    color: #343434 !important;
    text-decoration: none !important;
    margin-bottom: 0;
}
.msh-related-posts-widget .msh-related-posts-title:hover { color: #0d6d5b !important; }
.msh-related-posts-widget .msh-related-posts-date { display: block; font-size: 12px; color: #737373; }

/* --------------------------------------------------
   Responsive
   -------------------------------------------------- */

/* Tablet: 2 columns */
@media ( max-width: 1199px ) {
    .related-post-card {
        flex: 0 0 calc(50% - 12px);
    }
    .related-story .related-post-card img,
    .related-resource .related-post-card img {
        height: 180px;
    }
}

@media ( max-width: 991px ){
    .subsidy-content-inner aside.widget-area {
        padding-top: 60px !important;
    }
}

/* Mobile: 1 column, no hover lift (touch devices) */
@media ( max-width: 640px ) {
    .related-posts-wrapper {
        margin-top: 36px;
        padding-top: 28px;
    }

    .related-post-card a img {
        height: auto;
    }

    .related-posts-grid {
        gap: 16px;
    }

    .related-post-card {
        flex: 1 1 100%;
    }

    .related-post-card:hover {
        transform: none;
    }

    .related-story .related-post-card img,
    .related-resource .related-post-card img {
        height: auto;
    }
}