/**
 * IMC Schema — Related Articles card styles (v1.4.0, phase 3 redesign + layout hotfix).
 * Card design reproduces design_draft/image 108: image (16:9, 6px radius, no
 * border) → orange category tagline → clickable title → orange "อ่านเพิ่มเติม"
 * text link. No animation/transition. (Excerpt removed during layout hotfix.)
 * All classes prefixed imc-ra- for isolation from theme CSS.
 * Static grid: desktop 3 / tablet 2 / mobile 1 (overflow cards hidden).
 */
.related-articles {
    max-width: 1140px;
    margin: auto;
}
.imc-ra-section {
    margin: 24px 0;
}

.imc-ra-heading {
    margin: 0 0 24px;
    text-align: center;
    font-size: clamp(1.5rem, 3.2vw, 2.5rem);
    line-height: 1.3;
}

/* Static grid: desktop 3 / tablet 2 / mobile 1 columns. Overflow cards are
   hidden per breakpoint so the visible count matches the row. */
.imc-ra-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

.imc-ra-item {
    display: flex;
    flex-direction: column;
    min-width: 0; /* allow line-clamp inside grid track */
}

/* Mobile (<640px): 1 card — hide cards 2+. */
@media (max-width: 639.98px) {
    .imc-ra-item:nth-child(n + 2) {
        display: none;
    }
}

/* Tablet (640–991px): 2 cards — hide cards 3+. */
@media (min-width: 640px) and (max-width: 991.98px) {
    .imc-ra-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    .imc-ra-item:nth-child(n + 3) {
        display: none;
    }
}

/* Desktop (>=992px): 3 cards — hide cards 4+. */
@media (min-width: 992px) {
    .imc-ra-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }
    .imc-ra-item:nth-child(n + 4) {
        display: none;
    }
}

/* Thumbnail: 16:9, 6px radius, no border. */
.imc-ra-thumb {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    line-height: 0; /* kill inline-image baseline gap */
}

.imc-ra-thumb img,
.imc-ra-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
}

.imc-ra-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 16px;
    box-sizing: border-box;
    background: #e9e9e9;
    border-radius: 6px;
}

.imc-ra-placeholder-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #666;
    font-size: 0.9375rem;
    text-align: center;
}

/* Category tagline (orange). */
.imc-ra-tagline {
    margin: 6px 0 8px;
    font-size: 1.25rem;
    font-weight: 500;
    color: #f05b01;
}

/* Title (dark gray, clickable, 2-line clamp). */
.imc-ra-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 10px;
    font-family: var(--e-global-typography-031e959-font-family), Sans-serif;
    font-weight: 500;
    line-height: 1em;
}

.imc-ra-title a {
    color: #3f3f3f;
    text-decoration: none;
    font-size: 1.45rem;
}

/* Read-more (orange text link, pinned to the card bottom). */
.imc-ra-readmore {
    align-self: flex-start;
    margin-top: auto;
    font-size: 1.4rem !important;
    font-weight: 500;
    color: #f05b01;
    text-decoration: none;
    padding: 4px 0;
}

.imc-ra-readmore:hover {
    color: #c84a00;
    text-decoration: underline;
}
