/* ═══════════════════════════════════════════════════
   CHOICO – content.css
   Trang chữ: hướng dẫn, bài viết, giới thiệu, chính sách, danh sách bài,
   phần giới thiệu bên dưới bàn cờ. Cùng tông gỗ với trang chủ.
═══════════════════════════════════════════════════ */

:root {
  --rd-font:  'Be Vietnam Pro', 'Roboto', system-ui, sans-serif;
  --rd-paper: #efe8da;
  --rd-text:  #d7d1c6;
  --rd-muted: #9aa3b2;
  --rd-line:  rgba(239,232,218,.12);
  --rd-wood:  #d8a660;
  --rd-wood-hi: #e7bb7b;
  --rd-ink:   #22170b;
  --rd-panel: #0f1522;
}

/* ── Khung trang ─────────────────────────────── */
.ch-content { padding: 64px 48px 96px; font-family: var(--rd-font); color: var(--rd-text); }
.ch-article, .ch-list-head, .ch-related { max-width: 760px; margin: 0 auto; }
.ch-list-head, .ch-related { max-width: 1080px; }

/* ── Đường dẫn ───────────────────────────────── */
.ch-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 0 0 20px; padding: 0; font-size: .875rem; color: var(--rd-muted); }
.ch-crumbs li + li::before { content: '/'; margin-right: 8px; color: rgba(154,163,178,.5); }
.ch-crumbs a { color: var(--rd-muted); text-decoration: none; }
.ch-crumbs a:hover { color: var(--rd-wood-hi); text-decoration: underline; }

/* ── Đầu bài ─────────────────────────────────── */
.ch-article-head { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--rd-line); }
.ch-article-cat { display: inline-block; margin-bottom: 12px; font-size: .8125rem; font-weight: 600; color: var(--rd-wood-hi); text-decoration: none; }
.ch-article-cat:hover { text-decoration: underline; }
.ch-article-title { font-size: clamp(2rem, 4.2vw, 2.75rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; color: var(--rd-paper); text-wrap: balance; margin: 0; }
.ch-article-lede { margin: 16px 0 0; font-size: 1.1875rem; line-height: 1.6; color: var(--rd-text); max-width: 62ch; }
.ch-article-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 16px 0 0; font-size: .875rem; color: var(--rd-muted); }

/* ── Mục lục ─────────────────────────────────── */
.ch-toc { margin: 0 0 40px; padding: 20px 24px; border: 1px solid rgba(216,166,96,.22); border-radius: 12px; background: rgba(216,166,96,.04); }
.ch-toc-title { margin: 0 0 8px; font-size: .875rem; font-weight: 700; color: var(--rd-paper); }
.ch-toc ol { margin: 0; padding-left: 20px; columns: 2 260px; column-gap: 32px; }
.ch-toc li { margin: 4px 0; break-inside: avoid; font-size: .9375rem; }
.ch-toc a { color: var(--rd-text); text-decoration: none; }
.ch-toc a:hover { color: var(--rd-wood-hi); text-decoration: underline; }

/* ── Văn bản ─────────────────────────────────── */
.ch-prose { font-size: 1.0625rem; line-height: 1.8; color: var(--rd-text); }
.ch-prose > * + * { margin-top: 1.1em; }
.ch-prose h2 { margin-top: 2.2em; font-size: 1.625rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; color: var(--rd-paper); scroll-margin-top: 24px; }
.ch-prose h3 { margin-top: 1.8em; font-size: 1.25rem; font-weight: 700; line-height: 1.35; color: var(--rd-paper); }
.ch-prose h2 + *, .ch-prose h3 + * { margin-top: .6em; }
.ch-prose p, .ch-prose li { max-width: 70ch; }
.ch-prose strong, .ch-prose b { color: var(--rd-paper); font-weight: 700; }
.ch-prose a { color: var(--rd-wood-hi); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ch-prose a:hover { color: #f3cf9a; text-decoration-thickness: 2px; }
.ch-prose ul, .ch-prose ol { padding-left: 1.4em; }
.ch-prose li + li { margin-top: .45em; }
.ch-prose li::marker { color: var(--rd-wood); }
.ch-prose hr { border: 0; border-top: 1px solid var(--rd-line); margin: 2.4em 0; }
.ch-prose blockquote { position: relative; margin-left: 0; padding: 4px 0 4px 36px; color: var(--rd-paper); font-style: italic; }
.ch-prose blockquote::before { content: '“'; position: absolute; left: 0; top: -6px; font-size: 2.6rem; line-height: 1; font-style: normal; color: var(--rd-wood); }
.ch-prose code, .ch-prose kbd { font-size: .9em; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,.07); color: var(--rd-paper); }

/* Bảng (ví dụ: bảng giá trị quân, bảng Elo) */
.ch-prose .ch-table-wrap { overflow-x: auto; }
.ch-prose table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.5; }
.ch-prose th, .ch-prose td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--rd-line); vertical-align: top; }
.ch-prose th { color: var(--rd-paper); font-weight: 700; background: rgba(255,255,255,.03); }

/* Khung ghi chú / mẹo */
.ch-prose .ch-note { padding: 16px 20px; border-radius: 8px; background: rgba(216,166,96,.08); border: 1px solid rgba(216,166,96,.28); }
.ch-prose .ch-note > :first-child { margin-top: 0; }
.ch-prose .ch-note-title { display: block; margin-bottom: 4px; font-weight: 700; color: var(--rd-wood-hi); }

/* Hỏi đáp dạng mở/đóng */
.ch-prose details { border: 1px solid var(--rd-line); border-radius: 8px; padding: 0 20px; background: rgba(255,255,255,.02); }
.ch-prose details + details { margin-top: 12px; }
.ch-prose summary { cursor: pointer; padding: 16px 0; font-weight: 700; color: var(--rd-paper); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.ch-prose summary::-webkit-details-marker { display: none; }
.ch-prose summary::after { content: '+'; flex: none; font-size: 1.25rem; line-height: 1; color: var(--rd-wood); transition: transform .2s ease; }
.ch-prose details[open] summary::after { transform: rotate(45deg); }
.ch-prose details > :not(summary) { margin: 0 0 16px; }

/* ── Nút dùng chung trên trang nội dung ──────── */
.ch-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px;
  border: 1px solid var(--rd-line); border-radius: 8px; color: var(--rd-paper); font: 600 .9375rem var(--rd-font);
  text-decoration: none; transition: background-color .15s ease, border-color .15s ease;
}
.ch-btn:hover { border-color: rgba(239,232,218,.4); }
.ch-btn-main { background: var(--rd-wood); border-color: var(--rd-wood); color: var(--rd-ink); }
.ch-btn-main:hover { background: var(--rd-wood-hi); border-color: var(--rd-wood-hi); }

/* ── Khối mời chơi cuối bài ──────────────────── */
.ch-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
  margin-top: 56px; padding: 24px 28px; border-radius: 12px;
  background: linear-gradient(120deg, rgba(216,166,96,.14), rgba(216,166,96,.04)); border: 1px solid rgba(216,166,96,.3);
}
.ch-cta-title { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--rd-paper); }
.ch-cta-text { margin: 4px 0 0; color: var(--rd-text); }
.ch-cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Thẻ bài viết ────────────────────────────── */
.ch-section-title { font-size: 1.5rem; font-weight: 800; color: var(--rd-paper); margin: 0 0 20px; }
.ch-related { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--rd-line); }
.ch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.ch-cards-list { max-width: 1080px; margin: 40px auto 0; }
.ch-card { display: flex; }
.ch-card-link {
  display: flex; flex-direction: column; flex: 1; padding: 24px; border-radius: 12px;
  background: var(--rd-panel); border: 1px solid var(--rd-line); text-decoration: none; color: inherit;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
/* Ảnh bìa trên thẻ: tràn hết mép trên của thẻ */
.ch-card-link { overflow: hidden; }
.ch-card-img { display: block; width: calc(100% + 48px); max-width: none; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; margin: -24px -24px 18px; background: #0a0f1a; }

/* Ảnh bìa đầu bài + hình minh hoạ bàn cờ trong bài */
.ch-article-cover { margin: 0 0 32px; }
.ch-article-cover img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--rd-line); }
.ch-prose .ch-fig { margin: 1.8em auto; max-width: 440px; text-align: center; }
.ch-prose .ch-fig-wide { max-width: 600px; }
.ch-prose .ch-fig img { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 10px; box-shadow: 0 18px 36px -22px rgba(0,0,0,.9); }
.ch-prose .ch-fig figcaption { margin-top: 12px; font-size: .9375rem; line-height: 1.55; color: var(--rd-muted); text-align: left; }
.ch-card-link:hover { border-color: rgba(216,166,96,.5); transform: translateY(-3px); box-shadow: 0 16px 32px -20px rgba(0,0,0,.9); }
.ch-card-cat { font-size: .8125rem; font-weight: 600; color: var(--rd-wood-hi); }
.ch-card-title { margin: 8px 0 0; font-size: 1.1875rem; font-weight: 700; line-height: 1.35; color: var(--rd-paper); }
.ch-card-excerpt { margin: 12px 0 0; font-size: .9375rem; line-height: 1.6; color: var(--rd-text); flex: 1; }
.ch-card-meta { margin-top: 16px; font-size: .8125rem; color: var(--rd-muted); }

.ch-pagination { max-width: 1080px; margin: 40px auto 0; }
.ch-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-pagination .page-numbers { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 14px; border: 1px solid var(--rd-line); border-radius: 8px; color: var(--rd-paper); text-decoration: none; }
.ch-pagination .page-numbers.current { background: var(--rd-wood); border-color: var(--rd-wood); color: var(--rd-ink); }
.ch-empty { max-width: 1080px; margin: 32px auto 0; color: var(--rd-muted); }
.ch-empty a { color: var(--rd-wood-hi); text-decoration: underline; text-underline-offset: 3px; }

/* ── Trang 404 ───────────────────────────────── */
.ch-404 { text-align: center; padding-top: 48px; }
.ch-404-code { margin: 0; font-size: clamp(5rem, 16vw, 9rem); font-weight: 800; line-height: 1; color: transparent; -webkit-text-stroke: 2px rgba(216,166,96,.5); }
.ch-404 .ch-article-lede { margin-left: auto; margin-right: auto; }
.ch-404 .ch-cta-actions { justify-content: center; margin-top: 28px; }

/* ── Phần giới thiệu bên dưới bàn cờ ─────────── */
.ch-game-guide { padding: 64px 48px 80px; border-top: 1px solid var(--rd-line); background: #0a0f1a; font-family: var(--rd-font); }
.ch-game-guide .ch-prose { max-width: 760px; margin: 0 auto; }
.ch-game-guide .ch-prose > h2:first-child { margin-top: 0; }

/* ── Màn hình nhỏ ────────────────────────────── */
@media (max-width: 768px) {
  .ch-content { padding: 28px 16px 72px; } /* thanh trên cố định đã chừa chỗ (body padding-top) */
  .ch-game-guide { padding: 48px 16px 64px; }
  .ch-toc { padding: 16px 18px; }
  .ch-prose { font-size: 1rem; }
  .ch-prose h2 { font-size: 1.375rem; }
  .ch-cta { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .ch-card-link, .ch-prose summary::after { transition: none; }
  .ch-card-link:hover { transform: none; }
}

/* ── Form liên hệ ────────────────────────────── */
.ch-form { display: grid; gap: 18px; max-width: 560px; margin-top: 24px; }
.ch-form-row { display: grid; gap: 6px; }
.ch-form label { font-size: .9375rem; font-weight: 600; color: var(--rd-paper); }
.ch-form input, .ch-form select, .ch-form textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 8px;
  border: 1px solid rgba(239,232,218,.2); background: rgba(255,255,255,.04); color: var(--rd-paper);
  font: 1rem/1.5 var(--rd-font);
}
.ch-form select option { background: #141b2b; }
.ch-form input:focus, .ch-form select:focus, .ch-form textarea:focus { outline: 2px solid var(--rd-wood); outline-offset: 1px; border-color: transparent; }
.ch-form button { justify-self: start; border: 0; cursor: pointer; }
.ch-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ch-form-msg { padding: 12px 16px; border-radius: 8px; font-weight: 600; }
.ch-form-ok  { background: rgba(63,167,106,.14); border: 1px solid rgba(63,167,106,.45); color: #9be7b8; }
.ch-form-err { background: rgba(229,83,75,.12); border: 1px solid rgba(229,83,75,.45); color: #ffb0a8; }

/* ── Thông báo cookie ────────────────────────── */
.ch-cookie {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1050;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; max-width: 760px; margin: 0 auto;
  padding: 16px 20px; border-radius: 12px; background: #141b2b; border: 1px solid rgba(216,166,96,.35);
  box-shadow: 0 16px 40px rgba(0,0,0,.55); font: .9375rem/1.55 var(--rd-font); color: var(--rd-text);
}
.ch-cookie[hidden] { display: none; }
.ch-cookie p { margin: 0; flex: 1 1 320px; }
.ch-cookie a { color: var(--rd-wood-hi); text-decoration: underline; text-underline-offset: 2px; }
.ch-cookie .ch-btn { border: 0; cursor: pointer; }

/* Vùng chạm 44px cho đường dẫn, mục lục, nhãn chuyên mục trên màn hình cảm ứng */
@media (max-width: 768px), (pointer: coarse) {
  .ch-crumbs a, .ch-crumbs span { display: inline-flex; align-items: center; min-height: 44px; }
  .ch-crumbs ol { gap: 0 8px; margin-bottom: 8px; }
  .ch-toc li { margin: 0; }
  .ch-toc a { display: flex; align-items: center; min-height: 44px; }
  .ch-article-cat { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; margin-bottom: 4px; }
}
