/* ==========================================================================
   Giao diện tin tức mới (03/12/2026) — theo bản demo docs/demo-giao-dien/trang-tin-tuc.html
   (tham khảo PetaPixel, The Verge, VnExpress, VNReview). CHỈ trang tin nạp file này (_Layout: ViewData["NewsHeader"]),
   trang sản phẩm / danh mục không tải -> không ảnh hưởng. Mọi lớp tiền tố kn-. Font: Roboto tự host của site.css (không thêm font).
   Không JS vẫn đọc được đủ; news.js chỉ thêm: mục lục bám theo, chia sẻ, cỡ chữ, nghe bài.
   ========================================================================== */
.kn {
  --kn-ink: #14161a; --kn-ink-2: #4b5160; --kn-ink-3: #6b7180; --kn-line: #e7e4df; --kn-paper: #fff; --kn-paper-2: #faf9f7;
  --kn-brand-ink: #b83200; --kn-r: 14px; --kn-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px -12px rgb(0 0 0 / .18);
  padding-bottom: 40px; color: var(--kn-ink);
}
/* text-wrap: balance chỉ cho tiêu đề H1 — áp cho mọi đoạn / thẻ (pretty, balance) làm "Style & Layout" điện thoại +~300 ms (Lighthouse 03/12) */
.kn-head h1, .kn-art-head h1 { text-wrap: balance; }
.kn img { max-width: 100%; }

/* Chuyên mục dạng nút tròn (cuộn ngang trên điện thoại) */
.kn-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; margin: 0; }
.kn-chips::-webkit-scrollbar { display: none; }
.kn-chips a { flex: none; display: inline-flex; padding: 7px 14px; border-radius: 999px; background: var(--kn-paper); border: 1px solid var(--kn-line);
  font-size: 14px; font-weight: 500; color: var(--kn-ink-2); white-space: nowrap; }
.kn-chips a:hover { color: var(--kn-ink); border-color: #f0b49c; }
.kn-chips a[aria-current="page"] { background: var(--kn-ink); color: #fff; border-color: var(--kn-ink); }
.kn-chips--sub a { font-size: 13px; padding: 5px 12px; background: var(--brand-soft); border-color: #ffd9c7; }

/* Đầu trang: tiêu đề lớn + giới thiệu */
.kn-head { padding: 18px 0 16px; }
.kn-head h1 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.15; letter-spacing: -.01em; }
.kn-head__intro { margin-top: 6px; color: var(--kn-ink-2); font-size: 15px; line-height: 1.6; max-width: 70ch; }
.kn-head__intro a[href] { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* Lưới khảm đầu trang: 1 bài lớn + 4 bài (máy tính); điện thoại: dải vuốt ngang */
.kn-mosaic { display: grid; gap: 12px; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: repeat(2, minmax(190px, 1fr)); height: clamp(400px, 46vw, 540px); }
.kn-mosaic > :first-child { grid-row: span 2; }
.kn-mosaic--few { grid-template-columns: 2fr 1fr; }
.kn-tile { position: relative; overflow: hidden; border-radius: var(--kn-r); background: #2a2a2a; isolation: isolate; color: #fff; display: block; }
.kn-tile .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: scale .6s cubic-bezier(.2,.7,.2,1); }
.kn-tile::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgb(0 0 0 / 0) 25%, rgb(0 0 0 / .55) 58%, rgb(0 0 0 / .88)); }
.kn-tile__body { position: absolute; inset: auto 0 0; padding: clamp(14px, 2vw, 22px); z-index: 1; }
.kn-tile__title { display: block; font-size: clamp(16px, 1.4vw, 19px); font-weight: 700; line-height: 1.3; text-shadow: 0 1px 12px rgb(0 0 0 / .45); }
.kn-mosaic > :first-child .kn-tile__title { font-size: clamp(21px, 2.5vw, 31px); line-height: 1.2; }
.kn-tile:hover { color: #fff; }
.kn-tile:hover .thumb { scale: 1.05; }
.kn-tile .kn-meta { color: rgb(255 255 255 / .85); margin-top: 8px; }

.kn-badge { display: inline-flex; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; border-radius: 6px;
  background: var(--brand); color: #fff; margin-bottom: 8px; }
.kn-badge--ghost { background: rgb(0 0 0 / .45); }
a.kn-badge:hover { color: #fff; filter: brightness(1.1); }
.kn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--kn-ink-3); }
.kn-meta > * + *::before { content: "•"; margin-right: 10px; opacity: .6; }

/* Bố cục 2 cột: luồng tin + cột bên */
.kn-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; margin-top: 28px; align-items: start; }
.kn-main { min-width: 0; display: grid; gap: 34px; align-content: start; }
.kn-side { display: grid; gap: 18px; align-content: start; min-width: 0; }
.kn-sec-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.kn-sec-title h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; display: flex; align-items: center; gap: 10px; }
.kn-sec-title h2::before { content: ""; width: 18px; height: 4px; border-radius: 4px; background: var(--brand); }
.kn-sec-title a { font-size: 14px; color: var(--kn-brand-ink); font-weight: 600; white-space: nowrap; }

/* Thẻ bài trong luồng — container query: khung hẹp thì ảnh nhỏ bên trái */
.kn-feed { display: grid; gap: 12px; }
.kn-feed > li { container-type: inline-size; }
.kn-card { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; padding: 14px; background: var(--kn-paper); border: 1px solid var(--kn-line);
  border-radius: var(--kn-r); transition: border-color .2s, box-shadow .2s, translate .2s; }
.kn-card:hover { box-shadow: var(--kn-shadow); translate: 0 -2px; border-color: #f3c9b8; }
.kn-card__img { display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: #f1f3f5; }
.kn-card__img .thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.kn-card__body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.kn-card__cat { font-size: 11.5px; font-weight: 700; color: var(--kn-brand-ink); text-transform: uppercase; letter-spacing: .06em; align-self: flex-start; }
.kn-card__title { font-size: 18px; line-height: 1.35; font-weight: 700; }
.kn-card__title a:hover { color: var(--kn-brand-ink); }
.kn-card__sum { color: var(--kn-ink-2); font-size: 14.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kn-card .kn-meta { margin-top: auto; }
@container (max-width: 520px) {
  .kn-card { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 10px; }
  .kn-card__img { aspect-ratio: 1; }
  .kn-card__title { font-size: 15.5px; }
  .kn-card__sum { display: none; }
}
/* Thẻ mới nối vào (Tải thêm): hiện dần — @starting-style, không cần JS */
.kn-card { transition: opacity .35s ease, translate .35s ease, border-color .2s, box-shadow .2s; }
@starting-style { .kn-feed[data-more-list] .kn-card { opacity: 0; translate: 0 10px; } }

.nh-more-wrap { display: flex; justify-content: center; margin-top: 16px; }
.kn-more { display: inline-flex; align-items: center; height: 46px; padding: 0 28px; border-radius: 999px; border: 1px solid var(--kn-line); background: var(--kn-paper);
  font-weight: 600; font-size: 15px; color: var(--kn-ink); }
.kn-more:hover { border-color: var(--brand); color: var(--kn-brand-ink); }
.kn-more.is-loading { opacity: .6; pointer-events: none; }

/* Hộp cột bên */
.kn-box { background: var(--kn-paper); border: 1px solid var(--kn-line); border-radius: var(--kn-r); padding: 18px; }
.kn-box .kn-sec-title { margin-bottom: 10px; }
/* "Đọc nhiều" / "Đáng chú ý": số thứ tự lớn kiểu VnExpress */
.kn-rank { counter-reset: r; }
.kn-rank li { counter-increment: r; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-top: 1px solid var(--kn-line); }
.kn-rank li:first-child { border-top: 0; padding-top: 2px; }
.kn-rank li::before { content: counter(r); font-size: 28px; font-weight: 700; line-height: 1; color: #f4a688; }
.kn-rank a { font-size: 15px; font-weight: 600; line-height: 1.4; }
.kn-rank a:hover { color: var(--kn-brand-ink); }
/* Danh sách có ảnh nhỏ (khuyến mãi) */
.kn-mini { display: grid; gap: 12px; }
.kn-mini a { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; font-size: 14px; font-weight: 600; line-height: 1.4; }
.kn-mini .thumb { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; display: block; background: #f1f3f5; }
.kn-mini a:hover { color: var(--kn-brand-ink); }
.kn-box--promo { background: linear-gradient(160deg, #fff4ee, #fff 60%); border-color: #ffd9c7; }
.kn-cats { display: grid; gap: 2px; }
.kn-cats a { display: flex; justify-content: space-between; padding: 7px 6px; border-radius: 8px; font-size: 14px; color: var(--kn-ink-2); }
.kn-cats a:hover { background: var(--brand-soft); color: var(--kn-brand-ink); }
.kn-cats span { color: var(--kn-ink-3); font-size: 12.5px; }

/* Dải cuộn ngang theo chủ đề (Đánh giá, Mở hộp, Thủ thuật) — vẽ khi cuộn tới (content-visibility) */
.kn-rail-sec { margin-top: 40px; content-visibility: auto; contain-intrinsic-size: auto 340px; }
.kn-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.kn-rail > li { scroll-snap-align: start; min-width: 0; }
.kn-rail a { display: block; height: 100%; background: var(--kn-paper); border: 1px solid var(--kn-line); border-radius: var(--kn-r); overflow: hidden; transition: box-shadow .2s, translate .2s; }
.kn-rail a:hover { box-shadow: var(--kn-shadow); translate: 0 -2px; color: inherit; }
.kn-rail .thumb { aspect-ratio: 16 / 10; width: 100%; height: auto; object-fit: cover; display: block; background: #f1f3f5; }
.kn-rail__body { display: block; padding: 12px 14px 16px; }
.kn-rail__title { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.4; }
.kn-rail__body .kn-meta { margin-top: 8px; }
@media (min-width: 1100px) { .kn-rail { grid-auto-columns: calc((100% - 3 * 14px) / 4); } }

/* Sản phẩm mới (cuối /tin.html) */
.kn-products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kn-products a { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: center; background: var(--kn-paper); border: 1px solid var(--kn-line);
  border-radius: 12px; padding: 10px; }
.kn-products a:hover { border-color: var(--brand); color: inherit; }
.kn-products .thumb { width: 72px; height: 72px; object-fit: contain; display: block; }
.kn-products b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kn-products .price { font-size: 14.5px; }

/* Phân trang */
.kn .pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 18px; }
.kn .pager a, .kn .pager span { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border-radius: 999px;
  background: var(--kn-paper); border: 1px solid var(--kn-line); font-weight: 600; }
.kn .pager span[aria-current] { background: var(--kn-ink); color: #fff; border-color: var(--kn-ink); }

/* ------------------------------ Trang bài viết ------------------------------ */
/* Thanh tiến độ đọc: scroll-driven animation (Chrome / Edge / Safari mới); trình duyệt cũ không hiện — không cần JS */
.kn-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 200; transform-origin: 0 50%; scale: 0 1; background: var(--brand); pointer-events: none; display: none; }
@supports (animation-timeline: scroll()) {
  .kn-progress { display: block; animation: kn-read linear both; animation-timeline: scroll(root); }
  @keyframes kn-read { to { scale: 1 1; } }
}
.kn-art-head { padding: 8px 0 0; max-width: 860px; }
.kn-art-head h1 { font-size: clamp(26px, 3.8vw, 42px); line-height: 1.18; letter-spacing: -.015em; margin: 6px 0 12px; }
.kn-lede { font-size: clamp(16.5px, 1.5vw, 19px); line-height: 1.6; color: var(--kn-ink-2); max-width: 68ch; }
.kn-byline { display: flex; align-items: center; gap: 12px; margin: 18px 0 0; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--kn-line); }
.kn-avatar { width: 42px; height: 42px; border-radius: 50%; display: block; object-fit: contain; background: #fff; border: 1px solid var(--kn-line); padding: 4px; }
.kn-byline b { display: block; font-size: 14.5px; }
.kn-byline .kn-meta { font-size: 13px; }
.kn-tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.kn-tools button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--kn-line);
  background: var(--kn-paper); font-size: 13.5px; font-weight: 600; color: var(--kn-ink); }
.kn-tools button:hover { border-color: #f0b49c; }
.kn-tools button[aria-pressed="true"] { background: var(--kn-ink); color: #fff; border-color: var(--kn-ink); }
.kn-tools svg { width: 17px; height: 17px; flex: none; }
.kn-tools [hidden] { display: none; }
.kn-toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 300; background: var(--kn-ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--kn-shadow); }

.kn-art-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; margin-top: 26px; align-items: start; }
.kn-art-grid--toc { grid-template-columns: 220px minmax(0, 1fr) 300px; }
.kn-art-body { min-width: 0; max-width: 760px; }
.kn-toc { position: sticky; top: 96px; font-size: 14px; max-height: calc(100vh - 120px); overflow: auto; scrollbar-width: thin; }
.kn-toc summary { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--kn-ink-3); margin-bottom: 10px; cursor: pointer; list-style: none; }
.kn-toc summary::-webkit-details-marker { display: none; }
.kn-toc ol { border-left: 2px solid var(--kn-line); }
.kn-toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--kn-ink-2); line-height: 1.4; }
.kn-toc .kn-toc__l3 a { padding-left: 26px; font-size: 13px; }
.kn-toc a:hover { color: var(--kn-ink); }
.kn-toc a.on { color: var(--kn-brand-ink); border-color: var(--brand); font-weight: 600; }

/* Nội dung bài (HTML nhập từ kyma.vn / soạn ở admin): chữ to, dòng thoáng; --kn-fs đổi bằng nút cỡ chữ */
.kn .news-content { --kn-fs: 17.5px; font-size: var(--kn-fs); line-height: 1.8; color: #1f2329; }
.kn .news-content > * { margin-top: 0; margin-bottom: 1.05em; }
.kn .news-content h2 { font-size: 1.4em; line-height: 1.3; margin: 1.7em 0 .6em; scroll-margin-top: 110px; }
.kn .news-content h3 { font-size: 1.18em; line-height: 1.35; margin: 1.4em 0 .5em; scroll-margin-top: 110px; }
.kn .news-content p { margin: 0 0 1.05em; }
.kn .news-content img { border-radius: 12px; margin: 1.2em auto; }
.kn .news-content figure img { margin-bottom: .5em; }
.kn .news-content figcaption { font-size: 13.5px; color: var(--kn-ink-3); }
.kn .news-content blockquote { margin: 1.4em 0; padding: 6px 0 6px 20px; border-left: 4px solid var(--brand); background: none; font-size: 1.08em; color: var(--kn-ink); font-style: italic; }
.kn .news-content .news-table table, .kn .news-content > table { font-size: 14.5px; background: var(--kn-paper); }
.kn .news-content iframe, .kn .news-content .yt-facade { border-radius: 12px; overflow: hidden; }

.kn-art-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--kn-line); font-size: 13.5px; color: var(--kn-ink-3); display: grid; gap: 10px; }
.kn-art-foot .tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kn-art-foot .tag-chips a { background: var(--kn-paper); border: 1px solid var(--kn-line); border-radius: 999px; padding: 4px 12px; color: var(--kn-ink-2); font-size: 13px; }
.kn-art-foot .tag-chips a:hover { border-color: var(--brand); color: var(--kn-brand-ink); }
.kn-art-sec { margin-top: 40px; }
/* "Sản phẩm nhắc trong bài": giữ thẻ SP của site.css (.news-products .pcard), bỏ khung xám + tiêu đề cũ */
.kn .news-products { background: none; padding: 0; border-radius: 0; margin-left: 0; margin-right: 0; }
.kn .news-products h2 { position: static; padding-left: 0; margin: 0; font-size: 13px; line-height: inherit; }
.kn .news-products h2::before { position: static; width: 18px; height: 4px; border-radius: 4px; }
.kn-art-sec.kn-lazy { content-visibility: auto; contain-intrinsic-size: auto 420px; }
.kn-art-side { position: sticky; top: 96px; }
.kn-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kn-grid3 a { display: block; height: 100%; background: var(--kn-paper); border: 1px solid var(--kn-line); border-radius: var(--kn-r); overflow: hidden; }
.kn-grid3 a:hover { box-shadow: var(--kn-shadow); color: inherit; }
.kn-grid3 .thumb { aspect-ratio: 16 / 10; width: 100%; height: auto; object-fit: cover; display: block; background: #f1f3f5; }

/* ------------------------------ Màn hình nhỏ ------------------------------ */
@media (max-width: 1200px) {
  .kn-art-grid--toc { grid-template-columns: minmax(0, 1fr) 300px; }
  .kn-art-grid--toc .kn-toc { grid-column: 1; position: static; max-height: none; background: var(--kn-paper); border: 1px solid var(--kn-line); border-radius: var(--kn-r); padding: 12px 16px; }
  .kn-art-grid--toc .kn-toc summary { margin-bottom: 0; }
  .kn-art-grid--toc .kn-toc[open] summary { margin-bottom: 10px; }
  .kn-art-grid--toc .kn-art-side { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 1024px) {
  .kn-layout, .kn-art-grid, .kn-art-grid--toc { grid-template-columns: minmax(0, 1fr); }
  .kn-art-grid--toc .kn-art-side { grid-column: auto; grid-row: auto; }
  .kn-art-side { position: static; }
  .kn-art-body { max-width: none; }
  .kn-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .kn-mosaic { grid-template-columns: 1fr 1fr; grid-template-rows: none; height: auto; }
  .kn-mosaic > :first-child { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 16 / 10; }
  .kn-mosaic > * { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
  .kn-mosaic { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  .kn-mosaic::-webkit-scrollbar { display: none; }
  /* 4:3 — ảnh bìa ngang 800px: khung dọc 4:5 phải phóng to ảnh (mờ) */
  .kn-mosaic > *, .kn-mosaic > :first-child { flex: 0 0 86%; scroll-snap-align: center; aspect-ratio: 4 / 3; }
  .kn-mosaic > :first-child .kn-tile__title { font-size: 20px; }
  .kn-grid3 { grid-template-columns: minmax(0, 1fr); }
  .kn-products { grid-template-columns: minmax(0, 1fr); }
  .kn-tools { margin-left: 0; width: 100%; }
  .kn .news-content { --kn-fs: 16.5px; }
  .kn-head h1 { font-size: 24px; }
  .kn-box { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .kn *, .kn *::before, .kn *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
