/* ============================================================
   MODULE CSS 05 · ux.css — Lớp cải thiện thân thiện người dùng
   Nạp SAU CÙNG để ghi đè có chủ đích các module 01–04.
   Mục tiêu: điều hướng rõ ràng, chữ dễ đọc, nút đủ lớn để bấm
   trên điện thoại (tối thiểu 44px), phản hồi rõ khi tương tác,
   giữ nguyên phong cách: nền sáng, xanh lá nhạt, thẻ trắng bo
   tròn, một font Be Vietnam Pro.
   ============================================================ */

/* ---------- Liên kết bỏ qua: tới thẳng nội dung ---------- */
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 300;
  background: var(--accent); color: #ffffff; font-weight: 700;
  padding: 12px 18px; border-radius: var(--radius-pill);
  text-decoration: none; box-shadow: var(--shadow);
  transform: translateY(-200%); transition: transform 0.2s ease;
}
.skip-link:focus-visible { transform: none; color: #ffffff; }

/* ---------- Vòng focus rõ ràng cho mọi phần tử bấm được ---------- */
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Header: có bóng nhẹ khi đã cuộn trang ---------- */
header.site { transition: box-shadow 0.25s ease; }
header.site.scrolled { box-shadow: var(--shadow-hover); }

/* ---------- Điều hướng: vùng bấm cao tối thiểu 44px, trạng thái
   đang chọn nổi bật hơn (chữ đậm + nền xanh + gạch chân mảnh) --- */
nav.nav a {
  min-height: 44px; display: inline-flex; align-items: center;
  font-size: 0.92rem;
}
nav.nav a.active {
  box-shadow: inset 0 -3px 0 var(--accent);
}
nav.nav a.cta { min-height: 44px; }
@media (max-width: 960px) {
  nav.nav a { min-height: 48px; font-size: 1rem; padding: 12px 14px; }
  nav.nav a.cta { justify-content: center; }
}

/* ---------- Nút bấm chính: cao tối thiểu 48px, dễ bấm ---------- */
.btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.chip { min-height: 40px; padding: 8px 16px; }
.pager a { min-height: 56px; }

/* ---------- Thẻ sheet: nút chọn giọng & nút phụ đủ lớn ---------- */
.key-btn { min-height: 36px; padding: 6px 14px; font-size: 0.85rem; }
.key-btn:active { transform: scale(0.96); }
.buy-btn, .video-toggle { min-height: 46px; }
.sheet-more li a { padding: 8px 13px; }
.sheet-archive > summary { min-height: 52px; align-items: center; }

/* ---------- Ô tìm kiếm sheet: cao, chữ 16px (tránh iOS tự phóng),
   bám dính phía trên khi cuộn qua danh sách dài 340 thẻ ---------- */
.sheet-tools { position: sticky; top: 76px; z-index: 20; }
.sheet-search input { min-height: 52px; font-size: 1rem; padding: 13px 20px; }
@media (max-width: 640px) {
  .sheet-tools { top: 70px; padding: 12px; }
}

/* ---------- Trạng thái trống khi tìm kiếm: rõ ràng, dễ hiểu ------ */
.sheet-empty, .sheet-grid-empty {
  text-align: center; color: var(--ink-soft);
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius-m); padding: 28px 20px; font-size: 1rem;
}

/* ---------- Thông báo khi tab Sheet chưa tải xong (module 16) ---- */
.sheet-guard-note {
  margin: 0; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: 14px 16px; font-size: 0.95rem;
}
.sheet-guard-note button {
  font: inherit; font-weight: 700; color: var(--accent-ink, #fff);
  background: var(--accent); border: 0; border-radius: var(--radius-pill);
  padding: 8px 16px; margin-left: 8px; cursor: pointer; min-height: 40px;
}

/* ---------- Neo cuộn: chừa khoảng cho header cố định ------------- */
section[id], article[id], [id="noi-dung"] { scroll-margin-top: 84px; }

/* ---------- Thẻ sheet: nhấc nhẹ khi rê chuột (chỉ máy có chuột) -- */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .sheet-card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
  .sheet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
  .book { transition: transform 0.18s ease; }
  .book:hover { transform: translateY(-3px); }
}

/* ---------- Nút về đầu trang ------------------------------------- */
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #ffffff; border: 0; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-hover);
  transition: opacity 0.2s ease, background 0.2s ease;
}
.to-top:hover { background: var(--accent); }
.to-top[hidden] { display: none; }
.to-top svg { width: 22px; height: 22px; fill: currentColor; }

/* ---------- Chữ phụ trong thẻ sheet: tăng nhẹ cho dễ đọc --------- */
.sheet-body .s-meta, .sheet-body .s-sub { font-size: 0.86rem; }
.sheet-count { font-size: 0.92rem; }

/* ---------- Popup: nút đóng đủ lớn để bấm trên điện thoại -------- */
.video-modal-close { min-width: 44px; min-height: 44px; }
.video-modal-actions a, .video-modal-actions button { min-height: 46px; }

/* ---------- Popup video: nút "Xem trên YouTube" thật nổi bật -----
   Trình xem trong ứng dụng chặn video nhúng, nên khi trình phát
   tại trang không chạy, nút mở YouTube là đường xem chắc chắn:
   nút lớn, viền sáng nổi trên lớp phủ tối, kèm dòng giải thích.
   Chỉ là giao diện — cơ chế phát nằm ở module 08-video-player.js. */
.vm-yt-btn {
  font-size: 1.1rem; font-weight: 800;
  padding: 16px 34px; min-height: 56px; gap: 11px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 14px 34px rgba(0, 0, 0, 0.45);
}
.vm-yt-btn svg { width: 20px; height: 20px; }
.vm-yt-btn:hover { transform: scale(1.03); }
.vm-yt-note {
  display: none; margin: 0; max-width: 34em;
  color: #ffffff; font-size: 0.94rem; font-weight: 500; line-height: 1.55;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
/* Dòng giải thích chỉ hiện cùng lúc với nút YouTube (trạng thái dự phòng) */
.vm-yt-btn:not([hidden]) ~ .vm-yt-note { display: block; }

/* Chân popup: link YouTube thành nút đặc lớn, luôn nhìn thấy */
.video-modal-foot { font-size: 0.92rem; align-items: center; }
.vm-yt-foot-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #ffffff !important; text-decoration: none;
  font-weight: 700; font-size: 1rem; white-space: nowrap;
  padding: 12px 22px; min-height: 48px; border-radius: var(--radius-pill);
  margin-left: auto; box-shadow: var(--shadow);
}
.vm-yt-foot-btn:hover { background: var(--accent); }
.vm-yt-foot-btn svg { width: 16px; height: 16px; fill: #ffffff; flex: 0 0 auto; }
@media (max-width: 580px) {
  .vm-yt-foot-btn { margin-left: 0; width: 100%; justify-content: center; }
  .vm-yt-btn { padding: 15px 26px; font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
  .to-top { transition: none; }
  header.site { transition: none; }
  .vm-yt-btn:hover { transform: none; }
}

/* ============================================================
   TINH CHỈNH TINH TẾ — sang trọng, nhẹ nhàng kiểu website
   nghệ sĩ lớn: nhịp typography rõ tầng, khoảng trắng thoáng
   và đều, bóng đổ mềm nhiều lớp, xanh lá hài hòa không gắt,
   chi tiết nhỏ (nút, viền, icon, hover) được chăm chút.
   ============================================================ */

/* Bóng và viền lấy thẳng từ token ở 01-base.css — module này không
   tự định nghĩa lại, để toàn trang chỉ có một quy ước duy nhất. */

/* Nhịp chữ: dòng thở đều, tiêu đề chặt và có tầng rõ */
body { line-height: 1.7; }
.sec-head { margin-bottom: 42px; }
.sec-head h2 { letter-spacing: -0.02em; margin-bottom: 12px; }
.sec-head p { font-size: 1.03rem; line-height: 1.7; }
.page-banner { padding-bottom: 46px; }
.page-banner h1 { letter-spacing: -0.02em; }
.page-banner p { line-height: 1.7; font-size: 1.02rem; }
.page-banner .crumb { letter-spacing: 0.04em; margin-bottom: 16px; }
.hero { padding-bottom: 72px; }
.hero .role { letter-spacing: 0.18em; }
.hero .lede { line-height: 1.75; }
.hero .rule { width: 56px; height: 3px; margin-bottom: 24px; }
.hero-photo img { box-shadow: var(--shadow); }
.hero-photo figcaption { padding-top: 12px; font-size: 0.85rem; }
.stat b { letter-spacing: -0.01em; }

/* Khoảng trắng: nhịp 8px — section cách đều 64px trên máy tính,
   48px trên điện thoại, ở mọi trang */
section.block { padding: var(--space-8) 20px; }
@media (max-width: 640px) {
  section.block { padding: var(--space-7) 16px; }
}
.sheet-grid { gap: 22px; }
.btn-row { gap: 12px; }

/* Nút: chuyển động mượt, bóng rất nhẹ khi rê chuột */
.btn { letter-spacing: 0.01em; transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease; }
.btn-gold:hover, .btn-mint:hover { box-shadow: var(--shadow-hover); }
.btn-ghost:hover { box-shadow: var(--shadow); }
.buy-btn, .video-toggle, .chip, .key-btn, .vm-yt-foot-btn { transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* Điều hướng: chữ thoáng, mục đang chọn thanh mảnh */
.brand { letter-spacing: 0.03em; }
nav.nav a { letter-spacing: 0.01em; transition: background 0.2s ease, color 0.2s ease; }

/* Thẻ: viền mảnh, góc đều, hover nhấc rất nhẹ đã có ở trên;
   bổ sung cho thẻ sách và khối thống kê */
.book, .stat, .sheet-card { border-color: var(--line); }
.pager a { transition: background 0.22s ease, border-color 0.22s ease; }
.pager a:hover { background: var(--accent-soft); }

/* Nút phát trên ảnh xem trước video: phóng rất nhẹ khi rê chuột */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .facade .play i { transition: transform 0.25s ease; }
  .facade:hover .play i { transform: scale(1.08); }
}

/* Ô tìm kiếm: bóng nhẹ cho cảm giác nổi trên nền */
.sheet-search input { box-shadow: inset 0 1px 3px rgba(46, 82, 32, 0.05); }
.sheet-tools { box-shadow: var(--shadow); }

/* Chân trang: giãn dòng thoáng hơn */
.foot-in { line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  .btn, .buy-btn, .video-toggle, .chip, .key-btn, .pager a, nav.nav a { transition: none; }
}

/* ============================================================
   MỤC SEMI CLASSIC (tab Video) — mặt thẻ dùng ảnh xem trước
   thật của từng video YouTube (assets/thumbs/<id>.jpg), cùng
   kiểu facade, nút phát và hiệu ứng như mọi video khác trên
   trang; không còn nền xanh phẳng kèm tên bài như trước.
   ============================================================ */

/* ============================================================
   VIDEO — CHUYỂN ĐỘNG TINH TẾ theo design system tối giản:
   ảnh xem trước phóng nhẹ khi rê chuột, nút phát có vòng sáng
   mềm đập nhịp chậm, thẻ video nâng nhẹ, popup mở mờ dần,
   vòng xoay tải mượt. Mọi hiệu ứng chuyển động đều tắt khi
   người dùng bật prefers-reduced-motion. Chỉ là CSS — cơ chế
   phát video (lớp phủ, đồng hồ 6 giây, nút YouTube dự phòng)
   nằm ở module 08-video-player.js, không đổi.
   ============================================================ */
.facade { overflow: hidden; }
.facade img { transition: transform 0.45s ease; }
.video-modal-backdrop, .img-modal-backdrop { animation: vmBackdropIn 0.25s ease both; }
@keyframes vmBackdropIn { from { opacity: 0; } to { opacity: 1; } }
.vm-spinner { border-width: 3px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .facade:hover img { transform: scale(1.04); }
  .video-card { transition: transform 0.25s ease, box-shadow 0.25s ease; }
  .video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
  .facade .play i { animation: playPulse 2.8s ease-out infinite; }
  .facade:hover .play i {
    animation: none; transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(76, 132, 48, 0.16), 0 10px 26px rgba(0, 0, 0, 0.35);
  }
}
@keyframes playPulse {
  0% { box-shadow: 0 0 0 0 rgba(76, 132, 48, 0.32), 0 8px 24px rgba(0, 0, 0, 0.35); }
  70% { box-shadow: 0 0 0 16px rgba(76, 132, 48, 0), 0 8px 24px rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(76, 132, 48, 0), 0 8px 24px rgba(0, 0, 0, 0.35); }
}
@media (prefers-reduced-motion: reduce) {
  .facade img, .video-card { transition: none; }
  .video-modal-backdrop, .img-modal-backdrop { animation: none; }
  .facade .play i { animation: none; }
}

/* ============================================================
   NÚT & ICON NHỎ GỌN — thống nhất toàn trang: nút nhỏ hơn,
   padding vừa phải, icon trong khoảng 16–20px. Vùng chạm vẫn
   giữ tối thiểu 44px ở các nút thao tác chính để dễ bấm trên
   điện thoại, chữ trên nút giữ cỡ đọc rõ. Khối này nạp cuối
   cùng nên thắng các cỡ nút lớn hơn ở các module trước.
   ============================================================ */
.btn { min-height: 44px; padding: 9px 18px; font-size: 0.9rem; }
nav.nav a { padding: 7px 10px; font-size: 0.88rem; }
nav.nav a.cta { padding: 8px 14px; }
.chip { min-height: 40px; padding: 6px 13px; font-size: 0.85rem; }
.key-btn { min-height: 34px; padding: 5px 11px; font-size: 0.82rem; }
.buy-btn { min-height: 44px; padding: 9px 15px; font-size: 0.88rem; }
.buy-btn svg { width: 14px; height: 14px; }
.video-toggle { min-height: 44px; padding: 9px 13px; font-size: 0.84rem; }
.facade .play i { width: 52px; height: 52px; }
.facade .play svg { width: 20px; height: 20px; }
.sheet-video .facade .play i { width: 44px; height: 44px; }
.sheet-video .facade .play svg { width: 17px; height: 17px; }
.plist .facade .play i { width: 42px; height: 42px; }
.plist .facade .play svg { width: 17px; height: 17px; }
.semi-grid .facade .play i { width: 46px; height: 46px; }
.semi-grid .facade .play svg { width: 18px; height: 18px; }
.link-card .ic { flex-basis: 38px; width: 38px; height: 38px; }
.link-card .ic svg { width: 18px; height: 18px; }
.essay .e-source a.src-btn { min-height: 40px; padding: 8px 14px; font-size: 0.85rem; }
.essay-toc button { padding: 9px 13px; }
.sheet-more li a { padding: 6px 11px; }
.pager a { min-height: 48px; padding: 13px 16px; }
.to-top { width: 44px; height: 44px; }
.to-top svg { width: 19px; height: 19px; }
.skip-link { padding: 10px 16px; }
.video-modal-close svg { width: 16px; height: 16px; }
.vm-yt-btn { min-height: 52px; padding: 13px 26px; font-size: 1.02rem; }
.vm-yt-btn svg { width: 18px; height: 18px; }
.vm-yt-foot-btn { min-height: 44px; padding: 10px 18px; font-size: 0.95rem; }
.vm-retry { min-height: 38px; padding: 7px 15px; }
.video-modal-actions a, .video-modal-actions button { min-height: 44px; }
.sheet-archive > summary { min-height: 48px; }
@media (max-width: 580px) {
  .vm-yt-btn { min-height: 48px; padding: 12px 22px; font-size: 0.98rem; }
}
