/* Citra Journal | Card Alignment v1
   Deliberately limited to journal card families. Store/shop selectors are untouched.
   Loaded last in templates/blog/base.html to override older responsive declarations.
*/

/* Article cards: same outer height, same fixed image area, footer at the bottom. */
.cj-slider,
.cj-loop-slider,
.cj-category-post-slider {
    align-items: stretch !important;
}

.cj-slider > .cj-post-card,
.cj-loop-slider > .cj-post-card,
.cj-category-post-slider > .cj-post-card {
    align-self: stretch !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-width: 0;
    box-sizing: border-box;
}

.cj-post-card > .cj-post-image {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
}

.cj-post-card > .cj-post-body {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Prevent long article titles from changing the card's geometry. */
.cj-post-card .cj-post-title-row {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 146px;
}

.cj-post-card .cj-post-title-row h3 {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cj-post-card .cj-post-title-row h3 a {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.cj-post-card .cj-post-body > p {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.cj-post-card .cj-post-body > .cj-post-meta {
    flex: 0 0 auto;
    margin-top: auto !important;
    margin-bottom: 0 !important;
}

.cj-post-card .cj-post-body > .cj-read-more {
    flex: 0 0 auto;
    align-self: center !important;
    margin: 16px auto 0 !important;
}

/* Smaller cards in each category section need a compact, consistent footprint. */
.cj-category-post-slider > .cj-post-card-small {
    min-height: 0 !important;
}

.cj-post-card-small .cj-post-title-row {
    min-height: 89px;
}

.cj-post-card-small .cj-post-title-row h3 a {
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.cj-post-card-small .cj-post-body > p {
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/* Categories and informational/service tiles: preserve grid cell alignment. */
.cj-category-grid,
.cj-feature-grid,
.cj-feature-slider-track,
.feature-slider-track,
.stats-grid,
.mission-grid {
    align-items: stretch !important;
}

.cj-feature-grid > .cj-feature-card,
.cj-feature-slider-track > .cj-feature-card,
.feature-slider-track > .feature-card {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    height: auto;
    min-width: 0;
}

.cj-feature-card > .cj-feature-image,
.feature-card > .feature-card-image {
    flex: 0 0 auto;
}

.cj-feature-card > .cj-feature-body,
.feature-card > .feature-card-body {
    flex: 1 1 auto;
    min-width: 0;
}

.mission-grid > .mission-card,
.stats-grid > .stat-card {
    align-self: stretch;
    height: 100%;
    box-sizing: border-box;
}

/* Workshop cards: equally tall within their grid/slider, actions anchored below. */
.ws-grid,
.ws-slider {
    align-items: stretch !important;
}

.ws-grid > .ws-card,
.ws-slider > .ws-card {
    align-self: stretch !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-width: 0;
    box-sizing: border-box;
}

.ws-card > .ws-card-image {
    flex: 0 0 auto;
    width: 100%;
}

.ws-card > .ws-card-body {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column !important;
    min-width: 0;
}

.ws-card .ws-card-body h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.ws-card .ws-card-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.ws-card .ws-card-footer {
    flex: 0 0 auto;
    margin-top: auto !important;
}

/* Responsive values match the existing breakpoint structure. */
@media (max-width: 991px) {
    .cj-post-card:not(.cj-post-card-small) .cj-post-title-row {
        min-height: 118px;
    }
}

@media (max-width: 767px) {
    .cj-post-card:not(.cj-post-card-small) .cj-post-title-row {
        min-height: 84px;
    }
    .cj-post-card .cj-post-title-row h3 a {
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
    .cj-post-card .cj-post-body > p {
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
    .cj-post-card-small .cj-post-title-row {
        min-height: 84px;
    }
}

@media (max-width: 480px) {
    .cj-post-card .cj-post-title-row,
    .cj-post-card:not(.cj-post-card-small) .cj-post-title-row,
    .cj-post-card-small .cj-post-title-row {
        min-height: 77px;
    }
}
