/*
 * CNV single-post editorial card system.
 *
 * The composition shortcode owns visual cohesion between Related and
 * Featured. Source shortcodes remain independently reusable and only supply
 * production data/markup.
 */

.cnv-single-post-layout {
    --cnv-editorial-ink: #17191e;
    --cnv-editorial-muted: #7a838f;
    --cnv-editorial-line: #e6eaf0;
    --cnv-editorial-accent: #2456c6;
    --cnv-editorial-pill-bg: #f1f5ff;
    --cnv-editorial-pill-line: #d6e1fb;
}

.cnv-single-post-layout :is(.cnv-related-smart, .cnv-featured-recent) :is(.cnv-related-smart__title, .cnv-featured-recent__title) {
    position: relative;
    margin-bottom: 22px !important;
    padding-left: 26px;
    color: var(--cnv-editorial-ink) !important;
    font-size: 21px !important;
    font-weight: 750 !important;
    letter-spacing: -0.02em !important;
    text-align: left !important;
}

.cnv-single-post-layout :is(.cnv-related-smart, .cnv-featured-recent) :is(.cnv-related-smart__title, .cnv-featured-recent__title)::before {
    position: absolute;
    top: 0.54em;
    left: 0;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: var(--cnv-editorial-accent);
    content: "";
}

.cnv-single-post-layout :is(.cnv-related-smart__content, .cnv-featured-recent__content) {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.cnv-single-post-layout :is(.cnv-related-smart__meta, .cnv-related-smart__date, .cnv-featured-recent__meta, .cnv-featured-recent__date) {
    display: none;
}

.cnv-single-post-layout :is(.cnv-related-smart__thumb, .cnv-featured-recent__thumb) {
    border-radius: 12px !important;
    background: #eef1f5;
}

.cnv-single-post-layout :is(.cnv-related-smart__link, .cnv-featured-recent__link) {
    cursor: pointer;
}

.cnv-single-post-layout :is(.cnv-related-smart__link, .cnv-featured-recent__link):hover :is(.cnv-related-smart__headline, .cnv-featured-recent__headline) {
    color: var(--cnv-editorial-accent) !important;
}

/* Laptop: preserve the reading rail, but use the same title, image, type and
 * interaction rules as the full-width Featured grid. */
@media (min-width: 1019px) {
    .cnv-single-post-layout__related .cnv-related-smart__list {
        gap: 26px !important;
    }

    .cnv-single-post-layout__related .cnv-related-smart__link,
    .cnv-single-post-layout__related .cnv-related-smart__item:first-child .cnv-related-smart__link {
        gap: 11px;
    }

    .cnv-single-post-layout__related .cnv-related-smart__headline,
    .cnv-single-post-layout__related .cnv-related-smart__item:first-child .cnv-related-smart__headline {
        font-size: 15px !important;
        line-height: 1.34 !important;
    }

    .cnv-single-post-layout__featured .cnv-featured-recent__grid {
        gap: 30px 22px !important;
    }

    .cnv-single-post-layout__featured .cnv-featured-recent__headline {
        color: var(--cnv-editorial-ink) !important;
        font-size: 15px !important;
        line-height: 1.34 !important;
        font-weight: 700 !important;
    }
}

/* Tablet: both sections use the same two-column editorial-card grid. */
@media (min-width: 768px) and (max-width: 1018px) {
    .cnv-single-post-layout__related {
        width: min(100%, 760px);
    }

    .cnv-single-post-layout__related .cnv-related-smart__list,
    .cnv-single-post-layout__featured .cnv-featured-recent__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 28px 20px !important;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__link, .cnv-featured-recent__link),
    .cnv-single-post-layout .cnv-related-smart__item:first-child .cnv-related-smart__link {
        gap: 12px;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__thumb, .cnv-featured-recent__thumb),
    .cnv-single-post-layout .cnv-related-smart__item:first-child .cnv-related-smart__thumb {
        aspect-ratio: 16 / 10;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__headline, .cnv-featured-recent__headline),
    .cnv-single-post-layout .cnv-related-smart__item:first-child .cnv-related-smart__headline {
        color: var(--cnv-editorial-ink) !important;
        font-size: 16px !important;
        line-height: 1.32 !important;
        font-weight: 700 !important;
    }
}

/* Mobile: both groups inherit the homepage's compact, scannable news feed. */
@media (max-width: 767px) {
    .cnv-single-post-layout :is(.cnv-related-smart, .cnv-featured-recent) {
        margin-bottom: 0;
    }

    .cnv-single-post-layout :is(.cnv-related-smart, .cnv-featured-recent) :is(.cnv-related-smart__title, .cnv-featured-recent__title) {
        margin-bottom: 16px !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
        font-size: 20px !important;
        line-height: 1.2 !important;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__list, .cnv-featured-recent__grid) {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0 !important;
        border-top: 1px solid var(--cnv-editorial-line) !important;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__item, .cnv-featured-recent__item) {
        border-bottom: 1px solid var(--cnv-editorial-line) !important;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__link, .cnv-featured-recent__link),
    .cnv-single-post-layout .cnv-related-smart__item:first-child .cnv-related-smart__link {
        grid-template-columns: minmax(108px, 38%) minmax(0, 1fr) !important;
        align-items: start;
        gap: 14px !important;
        min-height: 132px !important;
        padding: 14px 0 !important;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__thumb, .cnv-featured-recent__thumb),
    .cnv-single-post-layout .cnv-related-smart__item:first-child .cnv-related-smart__thumb {
        aspect-ratio: 16 / 10;
        border-radius: 10px !important;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__content, .cnv-featured-recent__content) {
        align-content: start;
        gap: 6px;
        padding-top: 1px;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__meta, .cnv-related-smart__date, .cnv-featured-recent__meta, .cnv-featured-recent__date) {
        display: block;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__category, .cnv-featured-recent__category) {
        display: inline-flex;
        max-width: 100%;
        overflow: hidden;
        padding: 4px 8px;
        border: 1px solid var(--cnv-editorial-pill-line);
        border-radius: 999px;
        color: #2456a9;
        background: var(--cnv-editorial-pill-bg);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.01em;
        line-height: 1.1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Component styles are printed after this shared stylesheet. Keep the
     * canonical mobile type selectors one level more specific so both feeds
     * retain the same Vietnamese text metrics regardless of print order. */
    .cnv-single-post-layout .cnv-related-smart .cnv-related-smart__headline,
    .cnv-single-post-layout .cnv-related-smart .cnv-related-smart__item:first-child .cnv-related-smart__headline,
    .cnv-single-post-layout .cnv-featured-recent .cnv-featured-recent__headline {
        display: -webkit-box;
        overflow: hidden;
        color: var(--cnv-editorial-ink) !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        letter-spacing: -0.01em !important;
        line-height: 1.3 !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__date, .cnv-featured-recent__date) {
        color: var(--cnv-editorial-muted);
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
    }

    .cnv-single-post-layout :is(.cnv-related-smart__link, .cnv-featured-recent__link):focus-visible {
        outline-offset: -2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cnv-single-post-layout :is(.cnv-related-smart__thumb, .cnv-featured-recent__thumb) img {
        transition: none;
    }
}

/* Compact, dated related list fits beside the reading rail when sticky. */
@media(min-width:1019px){
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__list{gap:0!important}
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__item{border-bottom:1px solid var(--cnv-editorial-line)}
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__link{grid-template-columns:88px minmax(0,1fr);gap:12px;align-items:start;padding:12px 0;min-height:88px}
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__thumb{aspect-ratio:4/3;border-radius:6px!important}
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__headline,
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__item:first-child .cnv-related-smart__headline{font-size:15px!important;line-height:1.4!important;font-weight:600!important}
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__title{margin-bottom:8px!important}
}
.cnv-single-post-layout .cnv-related-smart .cnv-related-smart__date{display:block;color:#626a73;font-size:12px;line-height:1.4;font-weight:400}
.cnv-single-post-layout .cnv-featured-recent .cnv-featured-recent__date{display:block;color:#626a73;font-size:12px;line-height:1.4;font-weight:400}
.cnv-single-post-layout .cnv-related-smart__link:not(:has(.cnv-related-smart__thumb)),.cnv-single-post-layout .cnv-featured-recent__link:not(:has(.cnv-featured-recent__thumb)){grid-template-columns:minmax(0,1fr)!important}
@media(max-width:767px){
 .cnv-single-post-layout .cnv-related-smart .cnv-related-smart__link,.cnv-single-post-layout .cnv-featured-recent .cnv-featured-recent__link{min-height:104px!important;padding:12px 0!important;grid-template-columns:100px minmax(0,1fr)!important;gap:12px!important}
 .cnv-single-post-layout .cnv-related-smart .cnv-related-smart__headline,.cnv-single-post-layout .cnv-related-smart .cnv-related-smart__item:first-child .cnv-related-smart__headline,.cnv-single-post-layout .cnv-featured-recent .cnv-featured-recent__headline{font-size:15px!important;line-height:1.4!important;font-weight:600!important}
}

@media(min-width:1019px){
 .cnv-single-post-layout__related .cnv-related-smart .cnv-related-smart__headline{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
}
