/* Home — Knowledge Center / Blog grid (Version 2) */

.home-blog-v2 {
    --hbv2-primary: #0068e0;
    --hbv2-primary-deep: #004070;
    --hbv2-heading: #001d4a;
    --hbv2-text: #333333;
    --hbv2-muted: #5a6270;
    --hbv2-border: #e2eaf3;
    --hbv2-surface: #ffffff;
    --hbv2-featured: #071428;
    --hbv2-featured-mid: #0c2340;
    --hbv2-cta-bg: #eef6fc;
    --hbv2-content-max: min(1520px, calc(100vw - clamp(24px, 4vw, 48px)));
    --hbv2-content-pad-x: var(--fv2-page-gutter, 24px);
    --hbv2-featured-span: 2;
    --hbv2-grid-gap: clamp(16px, 2vw, 24px);

    position: relative;
    isolation: isolate;
    overflow-x: clip;
    color: var(--hbv2-text);
    background: var(--hbv2-surface);
}

.home-blog-v2__decor {
    position: absolute;
    top: 0;
    right: 0;
    width: min(42vw, 520px);
    height: min(36vw, 420px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    background-image: radial-gradient(circle, rgba(0, 104, 224, 0.14) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
    mask-image: linear-gradient(135deg, transparent 20%, #000 72%);
    -webkit-mask-image: linear-gradient(135deg, transparent 20%, #000 72%);
}

.home-blog-v2__stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--hbv2-content-max);
    margin-inline: auto;
    padding-inline: max(var(--hbv2-content-pad-x), env(safe-area-inset-left, 0px))
        max(var(--hbv2-content-pad-x), env(safe-area-inset-right, 0px));
}

@media only screen and (min-width: 1300px) {
    .home-blog-v2 {
        --hbv2-content-max: min(1560px, calc(100vw - 32px));
    }
}

/* —— Header —— */
.home-blog-v2__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: clamp(20px, 3vw, 40px);
    margin-bottom: clamp(28px, 4vw, 44px);
}

.home-blog-v2__head-main {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 52rem;
}

.home-blog-v2__kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hbv2-primary);
}

.home-blog-v2__kicker-line {
    flex: 0 0 auto;
    width: 28px;
    height: 2px;
    border-radius: 999px;
    background: var(--hbv2-primary);
}

.home-blog-v2__title {
    margin: 0 0 14px;
    font-size: clamp(1.65rem, 2.6vw, 2.125rem);
    line-height: 1.25;
    font-weight: 700;
    color: var(--hbv2-heading);
}

.home-blog-v2__lead {
    margin: 0;
    max-width: 46rem;
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    line-height: 1.75;
    color: var(--hbv2-muted);
}

.home-blog-v2__view-all {
    flex: 0 0 auto;
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    background: linear-gradient(90deg, #0056b3 0%, var(--hbv2-primary) 100%);
    box-shadow: 0 10px 24px rgba(0, 104, 224, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, gap 0.2s ease;
}

.home-blog-v2__view-all:hover {
    color: #fff;
    gap: 12px;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(0, 104, 224, 0.34);
}

.home-blog-v2__view-all i {
    font-size: 1.15em;
    line-height: 1;
}

/* —— Grid —— */
.home-blog-v2__grid {
    container-type: inline-size;
    container-name: home-blog-v2-grid;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--hbv2-grid-gap);
    align-items: stretch;
}

.home-blog-v2__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
}

.home-blog-v2__card-media {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    flex: 0 0 auto;
}

.home-blog-v2__card-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.35s ease;
}

.home-blog-v2__card:hover .home-blog-v2__card-media img {
    transform: scale(1.04);
}

/* —— Featured card (overlay + gradient ตาม mockup) —— */
.home-blog-v2__card--featured {
    position: relative;
    grid-column: span var(--hbv2-featured-span);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    border: 1px solid transparent;
    background: var(--hbv2-featured);
    box-shadow: 0 18px 40px rgba(0, 29, 74, 0.22);
}

.home-blog-v2__card--featured .home-blog-v2__card-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    flex: none;
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
}

.home-blog-v2__card--featured .home-blog-v2__card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        to top,
        rgba(7, 20, 40, 0.97) 0%,
        rgba(7, 20, 40, 0.9) 24%,
        rgba(7, 20, 40, 0.62) 44%,
        rgba(7, 20, 40, 0.28) 62%,
        rgba(7, 20, 40, 0.08) 78%,
        rgba(7, 20, 40, 0) 88%
    );
    pointer-events: none;
}

.home-blog-v2__card--featured .home-blog-v2__card-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    min-height: 100%;
    object-fit: cover;
    object-position: center center;
}

.home-blog-v2__card--featured .home-blog-v2__featured-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    bottom: auto;
    z-index: 3;
}

.home-blog-v2__card--featured .home-blog-v2__card-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding: clamp(16px, 2vw, 22px);
    background: transparent;
}

.home-blog-v2__card--featured .home-blog-v2__card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-size: clamp(1.18rem, 1.58vw, 1.38rem);
    line-height: 1.4;
}

.home-blog-v2__card--featured .home-blog-v2__card-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
}

.home-blog-v2__card--featured .home-blog-v2__card-title,
.home-blog-v2__card--featured .home-blog-v2__card-title a {
    color: #fff;
}

.home-blog-v2__featured-badge {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--hbv2-primary);
}

.home-blog-v2__featured-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    transition: gap 0.2s ease, opacity 0.2s ease;
}

.home-blog-v2__featured-cta span {
    border-bottom: 2px solid var(--hbv2-primary);
    padding-bottom: 2px;
}

.home-blog-v2__featured-cta:hover {
    gap: 12px;
    color: #fff;
    opacity: 0.92;
}

.home-blog-v2__card--featured .home-blog-v2__card-foot {
    margin-top: 4px;
    padding-top: 0;
    border-top: none;
}

/* Standard card */
.home-blog-v2__card--standard {
    background: var(--hbv2-surface);
    border: 1px solid var(--hbv2-border);
    box-shadow: 0 8px 24px rgba(0, 29, 74, 0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.home-blog-v2__card--standard:hover {
    box-shadow: 0 14px 32px rgba(0, 29, 74, 0.1);
    transform: translateY(-2px);
}

.home-blog-v2__card--standard .home-blog-v2__card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: clamp(14px, 1.8vw, 18px);
}

.home-blog-v2__cat {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--hbv2-primary);
    text-decoration: none;
}

.home-blog-v2__cat:hover {
    color: var(--hbv2-primary-deep);
}

.home-blog-v2__card-title {
    margin: 0;
    font-size: clamp(0.98rem, 1.15vw, 1.05rem);
    line-height: 1.45;
    font-weight: 700;
}

.home-blog-v2__card-title a {
    color: var(--hbv2-heading);
    text-decoration: none;
    transition: color 0.2s ease;
}

.home-blog-v2__card-title a:hover {
    color: var(--hbv2-primary);
}

.home-blog-v2__card-excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--hbv2-muted);
}

.home-blog-v2__card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--hbv2-border);
}

.home-blog-v2__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    min-width: 0;
}

.home-blog-v2__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.3;
    color: var(--hbv2-muted);
}

.home-blog-v2__meta-item i {
    color: var(--hbv2-primary);
    font-size: 14px;
    line-height: 1;
}

.home-blog-v2__card-arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: var(--hbv2-primary);
    background: rgba(0, 104, 224, 0.08);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.home-blog-v2__card-arrow:hover {
    color: #fff;
    background: var(--hbv2-primary);
}

/* —— CTA banner —— */
.home-blog-v2__cta {
    display: flex;
    align-items: center;
    gap: clamp(16px, 2.5vw, 28px);
    margin-top: clamp(28px, 4vw, 40px);
    padding: clamp(18px, 2.5vw, 24px) clamp(18px, 3vw, 28px);
    border-radius: 16px;
    background: var(--hbv2-cta-bg);
}

.home-blog-v2__cta-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff;
    color: var(--hbv2-primary);
    box-shadow: 0 8px 20px rgba(0, 104, 224, 0.12);
}

.home-blog-v2__cta-icon i {
    font-size: 24px;
    line-height: 1;
}

.home-blog-v2__cta-text {
    flex: 1 1 auto;
    min-width: 0;
}

.home-blog-v2__cta-title {
    margin: 0 0 4px;
    font-size: clamp(1rem, 1.4vw, 1.125rem);
    font-weight: 700;
    color: var(--hbv2-heading);
}

.home-blog-v2__cta-lead {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--hbv2-muted);
}

.home-blog-v2__cta-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(90deg, #0056b3 0%, var(--hbv2-primary) 100%);
    box-shadow: 0 10px 24px rgba(0, 104, 224, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-blog-v2__cta-btn:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(0, 104, 224, 0.34);
}

/* —— Empty state —— */
.home-blog-v2__empty {
    grid-column: 1 / -1;
    padding: 2.5rem 1.5rem;
    text-align: center;
    border: 1px dashed var(--hbv2-border);
    border-radius: 14px;
    color: var(--hbv2-muted);
}

/* —— Responsive —— */
@media (max-width: 1199.98px) {
    .home-blog-v2 {
        --hbv2-featured-span: 1;
    }

    .home-blog-v2__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .home-blog-v2__head {
        flex-direction: column;
        align-items: stretch;
    }

    .home-blog-v2__view-all {
        align-self: flex-start;
    }

    .home-blog-v2__cta {
        flex-wrap: wrap;
    }

    .home-blog-v2__cta-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .home-blog-v2__grid {
        grid-template-columns: 1fr;
    }

    .home-blog-v2__card--featured {
        min-height: clamp(340px, 88vw, 460px);
    }

    .home-blog-v2__decor {
        width: 70vw;
        height: 220px;
        opacity: 0.35;
    }
}
