/* public/css/blog.css — trang Blog (việc 39·26, 15/10/2026).
 *
 * Tệp RIÊNG, nạp sau tokens.css + xmg.css, chỉ trên hai trang Blog — không
 * thêm dòng nào vào xmg.css (tệp vừa to vừa hay sửa). Màu, phông, khoảng cách
 * đều lấy biến của tokens.css: xanh ô-liu Xóm Mới Garden, phông Lora / Be Vietnam Pro.
 *
 * Tên lớp mang tiền tố `bv-` (bài viết) để không đụng lớp nào của web.
 */

.bv-khung { width: var(--w-content); margin-inline: auto; }

/* ── Đầu trang danh sách ─────────────────────────────────────────────── */
.bv-dau { padding-block: var(--sp-section) var(--sp-block); }
.bv-dau__tua {
  margin: 0;
  font-family: var(--f-heading);
  font-size: var(--t-display);
  line-height: 1.1;
  color: var(--c-brand-deep);
}
.bv-dau__phu {
  margin: .5em 0 0;
  max-width: var(--w-measure);
  font-size: var(--t-lead);
  color: var(--c-text-soft);
}

/* ── Lưới thẻ bài: dời sang the-bai.css (16/10/2026, việc 39·33) — thẻ còn hiện ở trang chủ /
 * trang chi nhánh qua phần tử "Bài viết Blog", nên khai một nơi cho cả hai. */

/* ── Một bài ─────────────────────────────────────────────────────────────
 * Điện thoại: đầu bài → mục lục → thân bài (thứ tự trong mã).
 * Máy tính (≥1100px, cùng mốc "máy tính" của web): mục lục sang cột phải,
 * dính theo khi cuộn. */
.bv-bai { padding-block: var(--sp-block) var(--sp-section); }
.bv-bai__luoi { display: grid; gap: var(--gap-m); }
@media (min-width: 1100px) {
  .bv-bai__luoi {
    grid-template-columns: minmax(0, 46rem) 15rem;
    justify-content: center;
    column-gap: var(--gap-xl);
  }
  .bv-bai__dau { grid-column: 1; grid-row: 1; }
  .bv-noi-dung { grid-column: 1; grid-row: 2; }
  .bv-bai__the { grid-column: 1; grid-row: 3; }
  .bv-muc-luc {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: start;
    position: sticky;
    top: 96px;
  }
}

.bv-quay-lai { font-weight: 600; color: var(--c-brand-deep); text-decoration: none; }
.bv-quay-lai:hover { text-decoration: underline; }
.bv-nhap {
  margin: var(--gap-s) 0 0;
  padding: .6em 1em;
  border-radius: var(--r-sm);
  background: var(--c-accent-tint);
  color: var(--c-text);
}
.bv-bai__tua {
  margin: .45em 0 .25em;
  font-family: var(--f-heading);
  font-size: var(--size-4);
  line-height: 1.15;
  color: var(--c-brand-deep);
}
.bv-bai__phu { margin: 0; font-size: var(--t-caption); color: var(--c-text-faint); }
.bv-bai__bia {
  display: block;
  width: 100%;
  margin-top: var(--gap-m);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r-md);
}

/* Mục lục */
.bv-muc-luc { font-size: var(--t-caption); }
.bv-muc-luc__nhan {
  margin: 0 0 .5em;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-text-soft);
}
.bv-muc-luc ol { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--c-line-soft); }
.bv-muc-luc a {
  display: block;
  margin-left: -2px;
  padding: .35em .9em;
  border-left: 2px solid transparent;
  color: var(--c-text-soft);
  text-decoration: none;
}
.bv-muc-luc a:hover { color: var(--c-brand-deep); }
.bv-muc-luc a.dang-xem { border-left-color: var(--c-brand); font-weight: 600; color: var(--c-brand-deep); }
/* Nền TRẮNG + viền, không dùng --c-brand-tint: tint (#e8ecdd) gần trùng nền trang
   --c-page (#e8ecdc) — lệch 1 đơn vị màu, khung thành vô hình (đo ảnh 15/10). */
@media (max-width: 1099.98px) {
  .bv-muc-luc {
    padding: var(--gap-s) var(--gap-m);
    border: 1px solid var(--c-line-soft);
    border-radius: var(--r-md);
    background: var(--c-surface);
  }
}

/* Thân bài — chữ khung soạn thảo sinh ra (đã qua bộ lọc BaiVietHtml). */
.bv-noi-dung { font-size: var(--t-body); line-height: 1.75; color: var(--c-text); overflow-wrap: anywhere; }
.bv-noi-dung > :first-child { margin-top: 0; }
.bv-noi-dung h2,
.bv-noi-dung h3,
.bv-noi-dung h4 {
  /* Thanh đầu trang dính trên cùng: chừa chỗ để bấm mục lục không bị nó che tiêu đề. */
  scroll-margin-top: 96px;
  font-family: var(--f-heading);
  line-height: 1.25;
  color: var(--c-brand-deep);
}
.bv-noi-dung h2 { margin: 1.8em 0 .55em; font-size: var(--size-3); }
.bv-noi-dung h3 { margin: 1.5em 0 .45em; font-size: var(--size-2); }
.bv-noi-dung h4 { margin: 1.3em 0 .4em; font-size: var(--size-1); }
/* 39·41 (30/10): tiêu đề mục TRONG thân bài đọc như sách — lấp đầy dòng, không «chia đều
   hai dòng» (xmg.css đặt balance cho h1-h3 toàn web, làm dòng 1 chỉ ~56% khung 736px).
   Nơi khác giữ balance. Ưu tiên (0,1,1) > h1,h2,h3 (0,0,1) nên thắng bất kể thứ tự nạp. */
.bv-noi-dung :is(h2, h3, h4) { text-wrap: wrap; }
.bv-noi-dung p,
.bv-noi-dung ul,
.bv-noi-dung ol { margin: 0 0 1.1em; }
.bv-noi-dung li + li { margin-top: .3em; }
.bv-noi-dung a { color: var(--c-brand-deep); text-decoration: underline; text-underline-offset: 2px; }
.bv-noi-dung img { max-width: 100%; height: auto; border-radius: var(--r-sm); }
/* Chú thích ảnh (16/10/2026, Sếp: "hình ghi nhỏ nguồn bên dưới"). Khung soạn chỉ có chữ
   nghiêng, không có cỡ chữ — nên quy ước: đoạn CHỈ gồm một câu nghiêng đứng NGAY SAU đoạn có
   ảnh là chú thích / ghi nguồn của ảnh đó → nhỏ, nhạt, sát ảnh. Câu nghiêng đứng chỗ khác giữ
   nguyên cỡ (lưới do-blog.py đo cả hai). Trình duyệt chưa hiểu :has() thì chỉ thấy cỡ thường. */
.bv-noi-dung p:has(> img) + p:has(> em:only-child) {
  margin-top: -.7em;
  font-size: var(--t-caption);
  line-height: 1.5;
  color: var(--c-text-soft);
}
.bv-noi-dung blockquote {
  margin: 1.4em 0;
  padding: .3em 1.1em;
  border-left: 4px solid var(--c-accent);
  color: var(--c-text-soft);
}
.bv-noi-dung pre {
  overflow-x: auto;
  padding: 1em;
  border: 1px solid var(--c-line-soft);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: var(--t-caption);
}
.bv-noi-dung table { width: 100%; margin: 0 0 1.2em; border-collapse: collapse; background: var(--c-surface); font-size: var(--t-caption); }
.bv-noi-dung th,
.bv-noi-dung td { padding: .55em .7em; border: 1px solid var(--c-line); text-align: left; vertical-align: top; }
.bv-noi-dung th { background: var(--c-line-soft); }
/* Lớp căn lề / thụt dòng của Quill — chỉ những lớp này lọt qua bộ lọc. */
.bv-noi-dung .ql-align-center { text-align: center; }
.bv-noi-dung .ql-align-right { text-align: right; }
.bv-noi-dung .ql-align-justify { text-align: justify; }
.bv-noi-dung .ql-indent-1 { padding-left: 3em; }
.bv-noi-dung .ql-indent-2 { padding-left: 6em; }
.bv-noi-dung .ql-indent-3 { padding-left: 9em; }

.bv-bai__the { display: flex; flex-wrap: wrap; gap: .5em; margin: var(--gap-m) 0 0; padding: 0; list-style: none; }
.bv-bai__the li {
  padding: .25em .8em;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  font-size: var(--t-caption);
  color: var(--c-brand-deep);
}

/* ── Trang Blog theo tiếng /{tiếng}/blog — bố cục «tạp chí» (phiếu 0636 · việc 39, mẫu I Sếp chọn 13/11/2026) ──
 * Phạm vi `.bv-lt` để KHÔNG đổi thẻ bài ở trang chủ / chi nhánh (phần tử "Bài viết Blog" dùng chung the-bai.css).
 * Ảnh mọi thẻ cao BẰNG NHAU: khung tỉ lệ cố định, ảnh phủ kín bằng position:absolute + object-fit:cover — ảnh
 * dọc / vuông / ngang đều không kéo khung cao thêm (lỗi thẻ Phú Quốc cao hơn ở mẫu 8296).
 * Lưới: 3 cột (≥900px) · 2 cột (600–899px) · 1 cột (điện thoại, 390px). */
.bv-nhan { display: inline-block; margin: 0 0 .6em; padding: .2em .8em; border-radius: var(--r-pill); background: var(--c-brand); color: #fff; font-size: var(--t-caption); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; align-self: flex-start; }
.bv-noibat { display: grid; gap: 0; margin-bottom: var(--gap-xl); overflow: hidden; border-radius: var(--r-md); background: var(--c-surface); box-shadow: var(--shadow-soft); color: inherit; text-decoration: none; }
.bv-noibat__anh { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--c-brand-tint); display: grid; place-items: center; }
.bv-noibat__anh img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.bv-noibat__anh span { font-family: var(--f-heading); font-size: var(--size-5); color: var(--c-brand); }
.bv-noibat__than { display: flex; flex-direction: column; justify-content: center; gap: .6em; padding: var(--gap-m); }
.bv-noibat__than time { font-size: var(--t-caption); color: var(--c-text-faint); }
.bv-noibat__tua { margin: 0; font-family: var(--f-heading); font-size: var(--size-3); line-height: 1.2; color: var(--c-brand-deep); overflow-wrap: anywhere; }
.bv-noibat__than p { margin: 0; color: var(--c-text-soft); overflow-wrap: anywhere; }
.bv-doc { align-self: flex-start; margin-top: .4em; padding: .55em 1.2em; border-radius: var(--r-pill); background: var(--c-brand); color: #fff; font-weight: 600; }
.bv-noibat:hover .bv-doc, .bv-noibat:focus-visible .bv-doc { background: var(--c-brand-deep); }
@media (min-width: 900px) {
  .bv-noibat { grid-template-columns: 1.25fr 1fr; }
  .bv-noibat__anh { aspect-ratio: auto; min-height: 22rem; }
  .bv-noibat__than { padding: var(--gap-l); }
  .bv-noibat__tua { font-size: var(--size-4); }
}
.bv-muc { margin: 0 0 var(--gap-s); font-family: var(--f-heading); font-size: var(--t-h3); color: var(--c-brand-deep); }
.bv-lt .bv-luoi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 899.98px) { .bv-lt .bv-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599.98px) { .bv-lt .bv-luoi { grid-template-columns: minmax(0, 1fr); } }
.bv-lt .bv-khac .bv-luoi { padding-bottom: var(--sp-section); }
.bv-lt .bv-the__anh { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.bv-lt .bv-the__anh img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.bv-lt .bv-the__tua { overflow-wrap: anywhere; }
.bv-lt .bv-the__than { flex: 1; }

/* ── Đầu trang Blog = phần tử Tiêu đề + Chữ trong khối (phiếu 0647) ──────────────────────────────
 * Tựa (h1) và dòng giới thiệu là phần tử thường của trình sửa trang; tiêu đề đã có luật «tiêu đề mục» chung (xmg.css).
 * Chỉ chỉnh nhịp: tựa sát dòng giới thiệu, dòng giới thiệu to như câu dẫn, cách lưới bài một khoảng.
 * (Chữ gốc: không đổi cỡ chữ tựa — kế thừa luật chung để khớp mọi trang.) */
.xb:has(.el-blog--trang) .xb__inner > .el--heading { margin-bottom: .35em; }
.xb:has(.el-blog--trang) .xb__inner > .el--text { margin-bottom: var(--sp-block); }
.xb:has(.el-blog--trang) .xb__inner > .el--text .el__text { max-width: var(--w-measure); font-size: var(--t-lead); color: var(--c-text-soft); }
/* Phiếu 0651 — căn lề: khối đã rộng đúng 1200 (xb--w-wide) nên lưới bài chiếm hết bề rộng khối, thẳng lề với tựa + giới thiệu
 * (như bản mẫu I 0636: tựa, giới thiệu, thẻ cùng x = 120 ở 1440). Trước: .bv-khung tự co lần nữa (--w-content + lề auto) → thụt 48px mỗi bên. */
.el-blog--trang .bv-lt .bv-khung { width: 100%; margin-inline: 0; }
