/*!
 * patch.css — Lào Cai Số (laocaiso.com) — bản vá giao diện 2026-10-29
 * ---------------------------------------------------------------------------
 * NGUYÊN TẮC: chỉ THÊM rule, KHÔNG đổi cấu trúc DOM, KHÔNG đụng Bootstrap.
 * Mọi selector + con số dưới đây lấy từ đo thật bằng Chrome headless (CDP) ở
 * 1440x900 và 390x844. Bằng chứng: intake/laocaiso-ui-20261029/evidence/
 *
 * CHÈN Ở ĐÂU (layout head dùng chung):
 *   <link rel="stylesheet" href="/assets/css/style.css?v=...">              <-- có sẵn
 *   <link rel="stylesheet" href="/assets/css/ui-patch-20261029.css?v=1">    <-- THÊM DÒNG NÀY
 *
 * VÌ SAO CÓ "html.lcui" + !important (đo được, không phải thói quen):
 *   Site render thêm <style> INLINE TRONG BODY (5–6 khối/trang). Các khối đó
 *   đứng SAU head ⇒ với cùng độ ưu tiên chúng thắng rule nạp từ head.
 *   Đo thử: rule `#newsGrid .news-card-body h3{font-size:15px}` trong head
 *   KHÔNG có tác dụng (vẫn 13px), thêm !important thì ăn (15px).
 *   Ngoài !important, chính site còn dùng selector RẤT dài cũng kèm !important, ví dụ
 *   `html body.page-ui-news #newsGrid .news-card-body h3{font-size:13px!important}`
 *   ⇒ patch phải có độ ưu tiên CAO HƠN, nên mọi selector ở đây được đặt trong scope
 *   `html.lcui` (patch.js thêm class "lcui" vào <html>, 1 dòng, không đổi layout).
 *   Đo sau khi vá: tiêu đề thẻ mobile 13px → 15px, chữ phụ 3.41:1 → 5.39:1.
 *   !important chỉ đặt trên ĐÚNG thuộc tính cố ý đổi (color, font-size, line-height,
 *   max-width, kích thước thumb) — không đặt lên layout/position/display.
 *
 * GỠ: xoá đúng 1 dòng <link>. Toàn bộ là "additive" ⇒ không nạp file thì site
 * chạy y như hiện tại.
 */

:root {
  /* Đo: chữ phụ #7a8da3 trên nền trắng = 3.41:1 (trượt WCAG AA 4.5:1).
     #5a6b7d trên nền trắng = 5.39:1 (đạt AA cho chữ thường). */
  --lcui-muted: #5a6b7d;
  --lcui-line: #e3eaf1;
  --lcui-card: #ffffff;
  --lcui-ink: #07345d;
  --lcui-measure: 70ch;   /* ~70 ký tự/dòng; đo hiện tại: 1220px ≈ 150 ký tự/dòng */
}

/* ==========================================================================
   1) CHỮ PHỤ: đủ tương phản
   Đo (evidence/measure-run1.json):
     .news-card--compact p  13px desktop / 12.5px mobile  #7a8da3 trên #fff = 3.41:1
     .trend-item small      10px                          = 3.82:1
     .agri-resource small   11px                          = 4.07:1
     .explore-card-date     11px                          = 4.02:1
   ========================================================================== */
html.lcui body.page-ui-news #newsGrid .news-card--compact p,
html.lcui body .news-card--compact p,
html.lcui body .news-card-body p,
html.lcui body #newsPageIntro,
html.lcui body .explore-card-date,
html.lcui body .explore-card-date a,
html.lcui body .explore-card-source,
html.lcui body .agri-resource small,
html.lcui body .trend-item small,
html.lcui body .home-weather-date span {
  color: var(--lcui-muted) !important;
}

/* ==========================================================================
   2) CỠ CHỮ TỐI THIỂU cho chữ phụ quá nhỏ (10–12px)
   ========================================================================== */
@media (max-width: 575.98px) {
  html.lcui body .trend-item small { font-size: 11.5px !important; line-height: 1.35 !important; }
  html.lcui body .explore-card-date,
  html.lcui body .agri-resource small { font-size: 12px !important; line-height: 1.4 !important; }
  html.lcui body #newsPageIntro { font-size: 13px !important; line-height: 1.5 !important; }
}

/* ==========================================================================
   3) DANH SÁCH TIN trên mobile
   Đo: tiêu đề thẻ 13px/17.55px (clamp 2), tóm tắt 12.5px, h1 trang 19px.
   ========================================================================== */
@media (max-width: 575.98px) {
  html.lcui body.page-ui-news #newsGrid .news-card-body h3 { font-size: 15px !important; line-height: 1.35 !important; }
  html.lcui body.page-ui-news #newsGrid .news-card--compact p { font-size: 13.5px !important; line-height: 1.45 !important; }
}

/* ==========================================================================
   4) BÀI ĐỌC — SỐ ĐO THẬT (đo lại, sửa một kết luận sai trước đó)
   Thân bài dùng .explore-article-content: 18px/33.48px, cột 794px (desktop)
   và 18px/30.6px mobile ⇒ CỠ CHỮ ĐÃ TỐT, không cần tăng.
   Vấn đề thật còn lại chỉ là SỐ ĐO DÒNG: cột 794px ở 18px ≈ 88 ký tự/dòng
   (chuẩn dễ đọc 45–75) ⇒ giới hạn lại 70ch.
   Phụ đề hero (.explore-detail-hero > p): 16px desktop nhưng 13.5px trên
   mobile ⇒ tăng lên 15px cho điện thoại.
   Dòng mô tả đầu bài cẩm nang (.section-desc): 14px/21.7px trên cột 886px
   ⇒ nâng 16px cho cân với thân bài 18px.
   Class body THẬT (đo): page-ui-explore / page-ui-explore-detail /
   page-ui-agri-guides / page-ui-agri-guide-detail ⇒ khớp theo tiền tố.
   ========================================================================== */
html.lcui body[class*="page-ui-explore"] .explore-article-content :is(p, ul, ol, blockquote),
html.lcui body[class*="page-ui-agri"] .explore-article-content :is(p, ul, ol, blockquote) {
  max-width: min(100%, var(--lcui-measure)) !important;
}

html.lcui body[class*="page-ui-agri"] .agri-detail-card .section-desc {
  font-size: 16px !important;
  line-height: 1.7 !important;
}

/* --------------------------------------------------------------------------
   4b) HAI CHỖ TỪNG BỊ KẾT LUẬN SAI LÀ "KHÔNG VÁ ĐƯỢC" — ĐÃ VÁ ĐƯỢC
   Lỗi cũ của bản này: selector sinh ra "body body ..." nên KHÔNG bao giờ khớp.
   Nguyên nhân gốc của 13.5px / 19px nằm trong mobile-app.css (site tự dùng
   !important + selector dài, y như patch này). Đo lại 2026-10-29:
     · phụ đề hero:  mobile-app.css DÒNG 3630 `font-size:13.5px!important`,
       selector `html body.page-ui-explore-detail .explore-detail
       .explore-detail-hero--audio-first > p`, trong @media (max-width:991.98px)
     · h1 danh sách tin: mobile-app.css DÒNG 3393 `font-size:19px!important`,
       selector `html body.page-ui-news #newsPageTitle`, cùng @media
   Với scope html.lcui (+1 class) patch thắng mà KHÔNG cần sửa mobile-app.css.
   Đo sau khi vá: 390px → hero 15px, h1 21px; 1440px → giữ 16px / 28px (không đổi).
   Bọc @media để desktop không bị ảnh hưởng.
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  html.lcui body.page-ui-news #newsPageTitle {
    font-size: 21px !important;
    line-height: 1.25 !important;
  }
  html.lcui body[class*="page-ui-explore"] .explore-detail .explore-detail-hero--audio-first > p {
    font-size: 15px !important;
    line-height: 1.55 !important;
  }
}

/* ==========================================================================
   5) ẢNH THUMB DANH SÁCH TIN trên mobile — TÙY CHỌN, cân nhắc trước khi bật
   Đo: thumb hiển thị 42x42 (mobile) / 318x198 (desktop), ảnh khai báo
       width=112 height=112, file nguồn 800x452 ⇒ trên mobile gần như vô dụng.
   Đánh đổi: thẻ tin cao thêm ~10px (mật độ danh sách giảm).
   Muốn giữ mật độ cũ: XOÁ khối @media này.
   ========================================================================== */
@media (max-width: 575.98px) {
  html.lcui body.page-ui-news #newsGrid .news-card--compact .news-card-thumb {
    width: 64px !important;
    height: 64px !important;
    flex: 0 0 64px !important;
  }
  html.lcui body.page-ui-news #newsGrid .news-card--compact .news-card-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 8px;
  }
}

/* ==========================================================================
   6) THANH ĐIỀU HƯỚNG ĐÁY (mobile): chỉ bù safe-area của iPhone
   GHI CHÚ ĐO LẠI: site ĐÃ chừa chỗ sẵn — main#app trên mobile có
   padding-bottom: 68px (đo 390x844) ⇒ KHÔNG thêm padding ở đây để tránh
   cộng dồn khoảng trắng. Chỉ bù vùng "tai thỏ" của iOS.
   ========================================================================== */
@media (max-width: 991.98px) {
  html.lcui body .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}

/* ==========================================================================
   7) TIÊU ĐỀ DÀI: không tràn / không cắt chữ dở
   Đo: hiện tại 0 phần tử tràn ngang ở cả 1440 và 390 (giữ nguyên như vậy).
   ========================================================================== */
html.lcui body .news-card-body h3,
html.lcui body .explore-card-title,
html.lcui body .agri-guide-card h3,
html.lcui body .agri-detail-card h1 {
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* ==========================================================================
   8) BÀN PHÍM / A11Y
   ========================================================================== */
:where(a, button, [role="button"], input, select, textarea, summary):focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   9) THÀNH PHẦN DO patch.js CHÈN (không tự xuất hiện nếu không có JS)
   Style bám token của site: card trắng, viền #e3eaf1, bo 12px, chữ 14–15px.
   ========================================================================== */
.lcui-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--lcui-card);
  border: 1px solid var(--lcui-line);
  border-radius: 12px;
}
.lcui-search input[type="search"] {
  flex: 1 1 220px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--lcui-ink);
  border: 1px solid var(--lcui-line);
  border-radius: 10px;
  background: #fff;
}
.lcui-search .lcui-count {
  font-size: 13px;
  color: var(--lcui-muted);
  min-width: 8ch;
}

.lcui-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--lcui-ink);
  background: #f7fbff;
  border: 1px solid var(--lcui-line);
  border-left: 4px solid #2b7de9;
  border-radius: 12px;
}
.lcui-notice b { font-weight: 700; }
.lcui-notice a {
  color: #0b57d0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lcui-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.lcui-chips a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--lcui-ink);
  background: #eef4fb;
  border: 1px solid var(--lcui-line);
  border-radius: 999px;
  text-decoration: none;
}
.lcui-chips a:hover,
.lcui-chips a:focus-visible { background: #e2ecf9; }

.lcui-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--lcui-muted);
}
.lcui-crumb a {
  color: var(--lcui-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lcui-crumb [aria-current="page"] { color: var(--lcui-ink); text-decoration: none; }

.lcui-empty-note {
  margin: 10px 0;
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--lcui-muted);
  background: #fff;
  border: 1px dashed var(--lcui-line);
  border-radius: 12px;
}
