/* -------------------------------------------------------

    HRdians custom styles
    Loaded last in inc/head.php, after the theme files
    (style.css, responsive.css, consulting.css), so rules here
    override the theme. Keep the theme files unchanged and add
    site-specific styling here, one section per page or component.

    Sections
    1. Blog list cards (blogs.php)

------------------------------------------------------- */


/* -------------------------------------------------------
    1. Blog list cards (blogs.php)

    Every card is the same size, whatever its content:
    - image area: fixed height, picture cropped to fit
      (no photo: HRdians logo with a thin grey line below)
    - title: always 4 lines tall, longer titles end with "..."
    - description: always 5 lines tall, longer text ends with "..."
    Scoped to .hr-blog-list so jobs.php (same theme classes)
    is not affected.
------------------------------------------------------- */
.hr-blog-list {
    --hr-blog-image-height: 220px;
    --hr-blog-title-lines: 4;
    --hr-blog-title-line-height: 30px;
    --hr-blog-desc-lines: 5;
    --hr-blog-desc-line-height: 30px;
}

/* image area */
.hr-blog-list .card .blog-image {
    height: var(--hr-blog-image-height);
    overflow: hidden;
}

.hr-blog-list .card .blog-image a,
.hr-blog-list .card .blog-image img {
    display: block;
    width: 100%;
    height: 100%;
}

.hr-blog-list .card .blog-image img {
    object-fit: cover;
}

/* no photo: HRdians logo centred in the blank area, thin grey line below
   (blogs.php adds .hr-blog-noimage when the photo file is missing) */
.hr-blog-list .card .blog-image.hr-blog-noimage {
    background-color: var(--white, #fff);
    border-bottom: 1px solid #e4e4e4;
}

/* !important: the link also has the theme's d-block class (display:block !important) */
.hr-blog-list .card .blog-image.hr-blog-noimage a {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.hr-blog-list .card .blog-image.hr-blog-noimage img {
    width: 200px;
    max-width: 70%;
    height: auto;
    object-fit: contain;
}

/* title: fixed 4 lines
   (!important: the title also has the theme's d-inline-block class,
   which forces display with !important and would cancel the "...") */
.hr-blog-list .card .card-body .card-title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--hr-blog-title-lines);
    line-clamp: var(--hr-blog-title-lines);
    overflow: hidden;
    line-height: var(--hr-blog-title-line-height);
    height: calc(var(--hr-blog-title-lines) * var(--hr-blog-title-line-height));
    margin-bottom: 15px !important;
}

/* description: fixed 5 lines */
.hr-blog-list .card .card-body p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--hr-blog-desc-lines);
    line-clamp: var(--hr-blog-desc-lines);
    overflow: hidden;
    line-height: var(--hr-blog-desc-line-height);
    height: calc(var(--hr-blog-desc-lines) * var(--hr-blog-desc-line-height));
    margin-bottom: 15px;
}
