/* Blog kiểu báo điện tử (VnExpress), màu chủ đạo = vàng thương hiệu của từng site
 * (--brand-yellow / --brand-dark do shop/base.html dựng từ theme_json). SOW blog B4.
 * Chỉ 3 template blog nạp file này: media_hub / media_topic / media_post. */
.blg { --blg-accent: var(--brand-yellow, #ffd200); --blg-ink: #222; --blg-muted: #757575; --blg-line: #e5e5e5;
       max-width: 1160px; margin: 0 auto; padding: 0 16px 32px; color: var(--blg-ink); font-size: 15px; }
.blg a { color: inherit; text-decoration: none; }
.blg a:hover { color: #9f7a00; }
.blg img { display: block; width: 100%; height: auto; }

/* Thanh chuyên mục */
.blg-nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; border-bottom: 3px solid var(--blg-accent);
           margin: 12px 0 18px; scrollbar-width: none; }
.blg-nav::-webkit-scrollbar { display: none; }
.blg-nav a { flex: 0 0 auto; padding: 9px 12px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.blg-nav a.is-home { background: var(--blg-accent); color: #111; border-radius: 6px 6px 0 0; }
.blg-nav a.is-active { color: #111; box-shadow: inset 0 -3px 0 #111; }
.blg-nav .count { color: var(--blg-muted); font-weight: 400; font-size: 12px; }

.blg-banner { margin: 0 0 4px; }
/* Có banner: sát thanh menu ngang (~2px) và nội dung dóng thẳng mép trái/phải banner (user 2026-09-23). */
.page-wrap:has(> .blg-banner) { padding-top: 2px; }
.blg-banner + .blg { max-width: none; padding-inline: 0; }
.blg-crumb { font-size: 13px; color: var(--blg-muted); margin-bottom: 6px; }
.blg-crumb a { color: #9f7a00; font-weight: 600; }
.blg-crumb span { margin: 0 6px; }

/* Lưới 2 cột: nội dung + cột phải */
.blg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
@media (max-width: 991px) { .blg-grid { grid-template-columns: 1fr; gap: 20px; } }

/* Tin chính */
.blg-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; padding-bottom: 18px;
           border-bottom: 1px solid var(--blg-line); margin-bottom: 18px; }
@media (max-width: 767px) { .blg-top { grid-template-columns: 1fr; } }
.blg-lead img { aspect-ratio: 16 / 9; object-fit: cover; object-position: center; border-radius: 4px; background: #f3f3f3; }
.blg-lead h2 { font-size: 24px; line-height: 1.3; margin: 10px 0 6px; font-weight: 700; }
.blg-lead p { color: #4f4f4f; line-height: 1.55; margin: 0; }
.blg-side-list { list-style: none; margin: 0; padding: 0; }
.blg-side-list li { padding: 10px 0; border-bottom: 1px solid var(--blg-line); }
.blg-side-list li:first-child { padding-top: 0; }
.blg-side-list a { font-weight: 700; line-height: 1.4; font-size: 15px; }

/* Dòng tin: ảnh trái, chữ phải */
.blg-item { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--blg-line); }
/* Mọi ảnh thẻ bài cùng khung 16:9 (user 2026-09-23), cắt giữa để không méo. */
.blg-item .thumb img, .blg-item .thumb .ph { aspect-ratio: 16 / 9; object-fit: cover; object-position: center; border-radius: 4px; background: #f3f3f3; }
.blg-item h3 { font-size: 18px; line-height: 1.35; margin: 0 0 6px; font-weight: 700; }
/* Tiêu đề + bút sửa luôn 1 dòng, dài thì '...' (user 2026-09-23). */
.blg-item h3 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.blg-item h3 > a:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blg-item h3 > .blg-edit { flex: 0 0 auto; margin-inline-start: 0; }
.blg-item p { margin: 0 0 6px; color: #4f4f4f; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 575px) {
    .blg-item { grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
    .blg-item h3 { font-size: 15px; }
    .blg-item p { display: none; }
}
.blg-meta { font-size: 12px; color: var(--blg-muted); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.blg-meta a { color: #9f7a00; font-weight: 600; }
.blg-meta .views::before { content: "\f06e"; font-family: FontAwesome; margin-inline-end: 4px; }

/* Dải chuyên mục ở trang chủ blog */
.blg-sec { margin: 8px 0 22px; }
.blg-sec-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 2px solid #111; padding-top: 8px; margin-bottom: 12px; }
.blg-sec-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.blg-sec-head h2 a::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--blg-accent); margin-inline-end: 8px; }
.blg-sec-head .more { font-size: 13px; color: var(--blg-muted); }
.blg-sec-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 767px) { .blg-sec-body { grid-template-columns: 1fr; } }
.blg-sec-body .blg-lead h2 { font-size: 18px; }

/* Cột phải */
.blg-box { margin-bottom: 24px; }
.blg-box h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 3px solid var(--blg-accent); }
.blg-rank { list-style: none; margin: 0; padding: 0; counter-reset: blgrank; }
.blg-rank li { counter-increment: blgrank; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--blg-line); }
.blg-rank li::before { content: counter(blgrank); font-size: 22px; font-weight: 700; color: var(--blg-accent); line-height: 1; -webkit-text-stroke: 1px #9f7a00; }
.blg-rank a { font-weight: 600; line-height: 1.4; font-size: 14px; }
.blg-rank .blg-meta { margin-top: 2px; }

/* Trang bài */
.blg-article h1 { font-size: 32px; line-height: 1.3; font-weight: 700; margin: 6px 0 10px; }
@media (max-width: 575px) { .blg-article h1 { font-size: 24px; } }
.blg-article .sapo { font-weight: 700; font-size: 17px; line-height: 1.55; margin: 12px 0 18px; }
.blg-body { font-size: 17px; line-height: 1.7; }  /* căng hết cột bài, không chừa khoảng trống trước cột Xem nhiều (user 2026-09-27) */
/* Bảng trong bài dùng hết bề ngang cột bài (article là container) — bảng
 * nhiều cột không co dúm.
 * Ô bảng chỉ bẻ từ khi từ dài hơn cả cột (break-word), không bẻ từng ký tự
 * như luật bảng bài SP (anywhere) — tránh cột STT thành "S / T / T". */
.blg-article { container-type: inline-size; }
.blg-article .blg-body .rich-table-wrap { width: 100cqi; max-width: 100cqi; }
.blg-body .rich-table-wrap th, .blg-body .rich-table-wrap td { overflow-wrap: break-word; word-break: normal; }
.blg-body h2 { font-size: 22px; margin: 26px 0 10px; font-weight: 700; }
.blg-body h3 { font-size: 19px; margin: 20px 0 8px; font-weight: 700; }
.blg-body p { margin: 0 0 14px; }
.blg-body a { color: #9f7a00; text-decoration: underline; text-underline-offset: 3px; }
/* Ảnh trong thân bài giữ cỡ thật (width:auto), chỉ co khi rộng hơn khung —
 * .blg img width:100% là luật ảnh thẻ bài ở trang danh sách, từng kéo icon
 * 50px trong bảng HDSD lên 783px vỡ hạt. */
.blg-body img { width: auto; max-width: 100%; height: auto; margin: 8px 0; }
.blg-body table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: 15px; }
.blg-body th { background: var(--blg-accent); color: #111; }
.blg-body th, .blg-body td { border: 1px solid #ddd; padding: 6px 8px; text-align: start; vertical-align: top; }
.blg-body blockquote { border-inline-start: 4px solid var(--blg-accent); background: #fffbea; margin: 14px 0; padding: 10px 14px; }
.blg-source { font-size: 13px; color: var(--blg-muted); margin: 8px 0 18px; word-break: break-all; }

/* Khối thẻ sản phẩm do trợ lý AI dựng trong bài */
.blg-body .blog-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 20px; }
.blg-body .blog-product { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--blg-line); border-radius: 8px; padding: 8px;
                          text-decoration: none; color: var(--blg-ink); font-size: 13px; line-height: 1.35; background: #fff; }
.blg-body .blog-product:hover { border-color: var(--blg-accent); }
.blg-body .blog-product img { aspect-ratio: 1; object-fit: contain; margin: 0 0 4px; }
.blg-body .blog-product-sku { color: var(--blg-muted); font-size: 12px; }

/* Bình luận */
.blg-comments { margin-top: 24px; border-top: 2px solid #111; padding-top: 10px; }
.blg-comments h2 { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
.blg-cmt-form textarea { width: 100%; min-height: 84px; border: 1px solid #ccc; border-radius: 4px; padding: 8px 10px; font: inherit; }
.blg-cmt-form .row-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0 12px; font-size: 13px; color: var(--blg-muted); }
.blg-btn { background: var(--blg-accent); color: #111; border: 0; border-radius: 4px; padding: 7px 16px; font-weight: 700; cursor: pointer;
           display: inline-flex; align-items: center; justify-content: center; }
.blg-btn:disabled { opacity: .6; cursor: default; }
.blg-cmt { padding: 12px 0; border-bottom: 1px solid var(--blg-line); }
.blg-cmt .who { font-weight: 700; font-size: 14px; }
.blg-cmt .txt { margin: 4px 0; line-height: 1.55; white-space: pre-line; }
.blg-cmt .acts { font-size: 12px; color: var(--blg-muted); display: flex; gap: 12px; }
.blg-cmt .acts button { border: 0; background: none; color: #9f7a00; font-weight: 600; cursor: pointer; padding: 0; font-size: 12px; }
.blg-cmt .replies { margin-inline-start: 24px; border-inline-start: 2px solid var(--blg-line); padding-inline-start: 12px; }
.blg-cmt-note { font-size: 13px; color: #9f7a00; margin: 6px 0; }
.blg-hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Phân trang */
.blg-pager { display: flex; gap: 10px; justify-content: center; margin: 18px 0; font-size: 14px; }
.blg-pager a, .blg-pager span { padding: 6px 12px; border: 1px solid var(--blg-line); border-radius: 4px; }
.blg-pager span { background: var(--blg-accent); border-color: var(--blg-accent); font-weight: 700; }

.blg-edit { font-size: 12px; margin-inline-start: 8px; }
.blg-empty { padding: 40px 0; text-align: center; color: var(--blg-muted); }
