/* ==========================================================================
   CHÙA ONLINE — giao diện chung (header, footer, blog, trang con)
   Chất liệu: gỗ mun, sơn mài đỏ son, vàng lá, giấy dó. Không bo góc.
   Font: Bai Jamjuree (tiêu đề, điểm nhấn) · Roboto (đọc) · Lexend (giao diện)
   ========================================================================== */
:root {
  --co-wood: #170806;
  --co-wood-2: #1f0d09;
  --co-wood-3: #2a120c;
  --co-lac: #7a1a12;
  --co-lac-hi: #9a2618;
  --co-leaf: #c9973a;
  --co-leaf-hi: #ecc66f;
  --co-paper: #f0e2c2;
  --co-text: #e6d5b4;
  --co-muted: #a89a86;
  --co-line: rgba(201, 151, 58, 0.28);
  --co-line-hi: rgba(236, 198, 111, 0.75);
  --co-f-head: 'Bai Jamjuree', system-ui, sans-serif;
  --co-f-body: 'Roboto', system-ui, sans-serif;
  --co-f-ui: 'Lexend', system-ui, sans-serif;
  --co-head-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--co-head-h) + 16px); }
body {
  margin: 0;
  background: var(--co-wood);
  color: var(--co-text);
  font-family: var(--co-f-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--co-leaf-hi); }
:focus-visible { outline: 2px solid var(--co-leaf-hi); outline-offset: 2px; }
.screen-reader-text, .co-skip {
  position: absolute !important;
  width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.co-skip:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 999; background: var(--co-paper); color: var(--co-wood); padding: 8px 12px; }

/* ------------------------------------------------------------------ header + menu 1 hàng */
.co-head {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--co-head-h);
  background: rgba(23, 8, 6, 0.96);
  border-bottom: 1px solid var(--co-line);
  backdrop-filter: blur(6px);
}
.admin-bar .co-head { top: 32px; }
@media (max-width: 782px) { .admin-bar .co-head { top: 0; } }
.co-head-in {
  max-width: 1320px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.co-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.co-brand-mark { width: 30px; height: 30px; fill: none; stroke: var(--co-leaf-hi); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.co-brand-name { font-family: var(--co-f-head); font-weight: 700; font-size: 20px; color: var(--co-paper); white-space: nowrap; }
.co-logo { max-height: 42px; width: auto; }

.co-nav { flex: 1; min-width: 0; }
.co-menu, .co-menu ul { list-style: none; margin: 0; padding: 0; }
.co-menu { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; white-space: nowrap; }
.co-menu > li { position: relative; }
.co-menu a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-family: var(--co-f-ui);
  font-size: 14.5px;
  color: var(--co-text);
  text-decoration: none;
  background: none !important;
  border-bottom: 2px solid transparent;
}
.co-menu > li > a:hover { color: var(--co-leaf-hi); }
.co-menu > .current-menu-item > a,
.co-menu > .current-menu-ancestor > a,
.co-menu > .current-cat > a { color: var(--co-leaf-hi); border-bottom-color: var(--co-leaf); }
.co-caret { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; flex-shrink: 0; }
.co-menu .sub-menu, .co-menu .children {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 6px 0;
  background: var(--co-wood-2);
  border: 1px solid var(--co-line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.co-menu li:hover > .sub-menu, .co-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.co-menu .sub-menu a { padding: 8px 16px; border: 0; white-space: normal; }
.co-menu .sub-menu a:hover { color: var(--co-paper); background: var(--co-lac) !important; }

.co-menu-btn { display: none; margin-left: auto; width: 42px; height: 42px; background: none; border: 1px solid var(--co-line); cursor: pointer; padding: 11px 9px; flex-direction: column; justify-content: space-between; }
.co-menu-btn span { display: block; height: 2px; background: var(--co-paper); }

@media (max-width: 900px) {
  .co-menu-btn { display: flex; }
  .co-nav {
    position: absolute;
    top: var(--co-head-h);
    left: 0;
    right: 0;
    background: var(--co-wood-2);
    border-bottom: 1px solid var(--co-line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .co-menu-open .co-nav { max-height: 80vh; overflow-y: auto; }
  .co-menu { flex-direction: column; align-items: stretch; padding: 8px 0; white-space: normal; }
  .co-menu a { padding: 12px 20px; border: 0; }
  .co-menu .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 6px 16px; background: none; }
}

/* ------------------------------------------------------------------ khung trang */
.co-wrap { max-width: 1240px; margin: 0 auto; padding: 28px 20px 64px; }
.co-title {
  font-family: var(--co-f-head);
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.2;
  color: var(--co-paper);
  margin: 6px 0 14px;
  text-wrap: balance;
}
.co-crumb { font-family: var(--co-f-ui); font-size: 13px; color: var(--co-muted); display: flex; flex-wrap: wrap; gap: 8px; }
.co-crumb a { color: var(--co-muted); text-decoration: none; }
.co-crumb a:hover { color: var(--co-leaf-hi); }
.co-cover { margin: 18px 0 24px; border: 1px solid var(--co-line); }
.co-cover img { display: block; width: 100%; }
.co-btn { display: inline-block; font-family: var(--co-f-ui); font-weight: 600; background: var(--co-leaf-hi); color: var(--co-wood); padding: 12px 22px; text-decoration: none; }

/* ------------------------------------------------------------------ nội dung bài */
.co-prose { font-size: 17.5px; line-height: 1.8; color: var(--co-text); max-width: 72ch; }
.co-prose > * { margin: 0 0 1.1em; }
.co-prose h2 {
  font-family: var(--co-f-head);
  font-weight: 700;
  font-size: 27px;
  line-height: 1.3;
  color: var(--co-leaf-hi);
  margin: 1.8em 0 0.6em;
  padding-top: 0.6em;
  border-top: 1px solid var(--co-line);
}
.co-prose h3 { font-family: var(--co-f-head); font-weight: 600; font-size: 21px; color: var(--co-paper); margin: 1.5em 0 0.5em; }
.co-prose h4 { font-family: var(--co-f-head); font-size: 18px; color: var(--co-paper); }
.co-prose a { color: var(--co-leaf-hi); text-underline-offset: 3px; }
.co-prose strong { color: var(--co-paper); }
.co-prose ul, .co-prose ol { padding-left: 1.3em; }
.co-prose li { margin-bottom: 0.4em; }
.co-prose li::marker { color: var(--co-leaf); }
.co-prose blockquote {
  margin-left: 0;
  padding: 14px 20px;
  border-left: 4px solid var(--co-lac-hi);
  background: var(--co-wood-2);
  font-family: var(--co-f-head);
  font-size: 19px;
  color: var(--co-paper);
}
.co-prose table { width: 100%; border-collapse: collapse; font-size: 15.5px; display: block; overflow-x: auto; }
.co-prose th, .co-prose td { border: 1px solid var(--co-line); padding: 9px 12px; text-align: left; }
.co-prose th { background: var(--co-wood-3); font-family: var(--co-f-ui); font-weight: 500; color: var(--co-paper); }
.co-prose figure { margin-left: 0; margin-right: 0; }
.co-prose figcaption, .co-prose .wp-element-caption { font-size: 14px; color: var(--co-muted); margin-top: 6px; }
.co-prose img { border: 1px solid var(--co-line); }
.co-prose code { background: var(--co-wood-3); padding: 2px 6px; font-size: 0.9em; }

/* Chỉ giữ 1 mục lục: ẩn mục lục của các plugin */
#ez-toc-container, .ez-toc-v2_0_17, .rank-math-toc-block, .wp-block-rank-math-toc-block, .lwptoc, #toc_container, .toc_widget { display: none !important; }

/* ------------------------------------------------------------------ mục lục */
.co-toc {
  border: 1px solid var(--co-line-hi);
  background: var(--co-wood-2);
  margin: 0 0 26px;
}
.co-toc-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--co-lac);
  color: var(--co-paper);
  border: 0;
  padding: 11px 14px;
  font-family: var(--co-f-head);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}
.co-toc-head svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.2s; }
.co-toc.is-closed .co-toc-head svg { transform: rotate(-90deg); }
.co-toc.is-closed .co-toc-list { display: none; }
.co-toc-list { list-style: none; margin: 0; padding: 6px 0; counter-reset: toc; }
.co-toc-list li { counter-increment: toc; }
.co-toc-list a {
  display: grid;
  grid-template-columns: 26px 1fr;
  padding: 8px 14px 8px 10px;
  font-family: var(--co-f-ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--co-text);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.co-toc-list a::before { content: counter(toc) "."; color: var(--co-leaf); }
.co-toc-list a:hover { background: var(--co-wood-3); border-left-color: var(--co-leaf-hi); color: var(--co-paper); }

/* ------------------------------------------------------------------ cột bài random */
.co-rand { border: 1px solid var(--co-line-hi); background: var(--co-wood-2); }
.co-rand-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--co-line); }
.co-rand-title { margin: 0; font-family: var(--co-f-head); font-weight: 600; font-size: 17px; color: var(--co-paper); }
.co-rand-shuffle {
  font-family: var(--co-f-ui);
  font-size: 12.5px;
  background: transparent;
  color: var(--co-leaf-hi);
  border: 1px solid var(--co-leaf);
  padding: 5px 10px;
  cursor: pointer;
}
.co-rand-shuffle:hover { background: var(--co-leaf-hi); color: var(--co-wood); }
.co-rand-list { list-style: none; margin: 0; padding: 0; }
.co-rand-item + .co-rand-item { border-top: 1px dashed var(--co-line); }
.co-rand-link {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  text-decoration: none;
  transition: background 0.15s ease;
}
.co-rand-link:hover { background: var(--co-wood-3); }
.co-rand-link:hover .co-rand-name { color: var(--co-leaf-hi); }
.co-rand-thumb { position: relative; width: 58px; height: 58px; }
.co-rand-thumb img, .co-rand-noimg { display: block; width: 58px; height: 58px; object-fit: cover; box-shadow: 4px 4px 0 var(--co-lac); }
.co-rand-noimg { background: linear-gradient(135deg, var(--co-lac), var(--co-wood-3)); }
.co-rand-cat { display: block; font-family: var(--co-f-ui); font-size: 11.5px; color: var(--co-leaf); margin-bottom: 2px; }
.co-rand-name {
  font-family: var(--co-f-head);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.35;
  color: var(--co-paper);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------------ trang chủ: phần nội dung dưới chánh điện */
.co-home { max-width: 1320px; margin: 0 auto; padding: 48px 20px 72px; }
.co-home-head { max-width: 860px; margin: 0 auto 36px; text-align: center; }
.co-home-h1 {
  font-family: var(--co-f-head);
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.2;
  color: var(--co-paper);
  margin: 0 0 12px;
  text-wrap: balance;
}
.co-home-intro { font-size: 18px; color: var(--co-muted); margin: 0 auto; max-width: 62ch; }
.co-home-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 36px; align-items: start; }
.co-home.no-toc .co-home-grid { grid-template-columns: minmax(0, 1fr) 300px; }
.co-home-toc { position: sticky; top: calc(var(--co-head-h) + 16px); max-height: calc(100vh - var(--co-head-h) - 32px); overflow-y: auto; }
.co-home-body { max-width: none; }
.co-home-body:empty { display: none; }

/* ------------------------------------------------------------------ trang con: content trái + cột phải */
.co-page { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 44px; align-items: start; }
.co-page-side { position: sticky; top: calc(var(--co-head-h) + 20px); }
.co-page-main .co-prose { max-width: none; }

/* ------------------------------------------------------------------ bài viết */
.co-single { max-width: 820px; }
.co-article-cat { display: inline-block; font-family: var(--co-f-ui); font-size: 13px; color: var(--co-paper); background: var(--co-lac); padding: 3px 10px; text-decoration: none; margin-top: 14px; }
.co-article-meta { font-family: var(--co-f-ui); font-size: 14px; color: var(--co-muted); margin: 0; }
.co-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; }
.co-tags a { font-family: var(--co-f-ui); font-size: 13px; color: var(--co-text); border: 1px solid var(--co-line); padding: 4px 10px; text-decoration: none; }
.co-tags a:hover { border-color: var(--co-leaf-hi); color: var(--co-leaf-hi); }
.co-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.co-pn-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--co-line-hi);
  background: var(--co-wood-2);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.co-pn-next { text-align: right; }
.co-pn-item:hover { background: var(--co-lac); border-color: var(--co-leaf-hi); }
.co-pn-label { font-family: var(--co-f-ui); font-size: 12.5px; color: var(--co-leaf); }
.co-pn-item:hover .co-pn-label { color: var(--co-leaf-hi); }
.co-pn-title { font-family: var(--co-f-head); font-weight: 600; font-size: 16.5px; line-height: 1.35; color: var(--co-paper); }

/* ------------------------------------------------------------------ danh sách bài: thẻ ngang */
.co-list { max-width: 960px; }
.co-list-desc { color: var(--co-muted); max-width: 70ch; }
.co-cards { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.co-card {
  position: relative;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  border: 1px solid var(--co-line-hi);
  background: var(--co-wood-2);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.co-card:hover { border-color: var(--co-leaf-hi); background: var(--co-wood-3); transform: translateX(3px); }
.co-card:hover .co-card-title { color: var(--co-leaf-hi); }
.co-card-hit { position: absolute; inset: 0; z-index: 2; }
.co-card-img { overflow: hidden; border-right: 1px solid var(--co-line); }
.co-card-img img, .co-card-noimg { display: block; width: 100%; height: 100%; min-height: 160px; object-fit: cover; }
.co-card-noimg { background: linear-gradient(135deg, var(--co-lac), var(--co-wood-3)); }
.co-card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.co-card-cat { align-self: flex-start; font-family: var(--co-f-ui); font-size: 12px; color: var(--co-leaf-hi); border-bottom: 1px solid var(--co-leaf); }
.co-card-title { margin: 0; font-family: var(--co-f-head); font-weight: 600; font-size: 20px; line-height: 1.3; color: var(--co-paper); }
.co-card-meta { margin: 0; font-family: var(--co-f-ui); font-size: 13px; color: var(--co-muted); }
.co-card-excerpt {
  margin: 2px 0 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--co-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.co-pager, .navigation.pagination { margin-top: 30px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--co-f-ui); }
.nav-links .page-numbers { min-width: 40px; padding: 8px 12px; text-align: center; border: 1px solid var(--co-line); color: var(--co-text); text-decoration: none; }
.nav-links .page-numbers.current, .nav-links a.page-numbers:hover { background: var(--co-lac); border-color: var(--co-leaf); color: var(--co-paper); }
.co-empty { color: var(--co-muted); }

.search-form { display: flex; gap: 8px; max-width: 460px; margin: 16px 0; }
.search-form label { flex: 1; }
.search-field { width: 100%; padding: 11px 12px; font-size: 16px; background: var(--co-wood-2); border: 1px solid var(--co-line-hi); color: var(--co-paper); }
.search-submit { font-family: var(--co-f-ui); background: var(--co-leaf-hi); color: var(--co-wood); border: 0; padding: 0 18px; cursor: pointer; }

/* ------------------------------------------------------------------ bình luận */
.comments-area { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--co-line); }
.comment-list { list-style: none; padding: 0; }
.comment-body { border: 1px solid var(--co-line); padding: 14px 16px; margin-bottom: 12px; background: var(--co-wood-2); }
.comment-form input:not([type=submit]):not([type=checkbox]), .comment-form textarea { width: 100%; background: var(--co-wood-2); border: 1px solid var(--co-line-hi); color: var(--co-paper); padding: 10px; font: inherit; }
.comment-form .submit { font-family: var(--co-f-ui); background: var(--co-leaf-hi); color: var(--co-wood); border: 0; padding: 12px 20px; cursor: pointer; }

/* ------------------------------------------------------------------ footer */
.co-foot {
  margin-top: 0;
  background:
    linear-gradient(180deg, var(--co-lac) 0 6px, transparent 6px),
    radial-gradient(90% 120% at 15% 0%, rgba(122, 26, 18, 0.28), transparent 60%),
    #120604;
  border-top: 1px solid var(--co-leaf);
}
.co-foot-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 52px 20px 36px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.2fr;
  gap: 40px;
}
.co-foot-name { font-family: var(--co-f-head); font-weight: 700; font-size: 26px; color: var(--co-leaf-hi); margin: 0 0 10px; }
.co-foot-about { color: var(--co-muted); font-size: 15.5px; margin: 0; max-width: 42ch; }
.co-foot-h { font-family: var(--co-f-head); font-weight: 600; font-size: 16px; color: var(--co-paper); margin: 4px 0 12px; }
.co-foot-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.co-foot-menu a { font-family: var(--co-f-ui); font-size: 14.5px; color: var(--co-text); text-decoration: none; }
.co-foot-menu a:hover { color: var(--co-leaf-hi); }
.co-foot-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0 0 18px; background: var(--co-line); border: 1px solid var(--co-line); }
.co-foot-stats div { background: #160705; padding: 12px; }
.co-foot-stats dt { font-family: var(--co-f-ui); font-size: 11.5px; color: var(--co-muted); }
.co-foot-stats dd { margin: 2px 0 0; font-family: var(--co-f-head); font-weight: 700; font-size: 20px; color: var(--co-paper); }
.co-foot-contact { font-size: 14.5px; color: var(--co-muted); }
.co-foot-contact p { margin: 0 0 6px; }
.co-foot-copy {
  margin: 0;
  padding: 16px 20px;
  text-align: center;
  font-family: var(--co-f-ui);
  font-size: 13px;
  color: var(--co-muted);
  border-top: 1px solid var(--co-line);
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .co-home-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .co-home-side { grid-column: 1 / -1; }
  .co-home.no-toc .co-home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body { font-size: 16.5px; }
  .co-home { padding: 32px 16px 56px; }
  .co-home-grid, .co-home.no-toc .co-home-grid { grid-template-columns: 1fr; gap: 24px; }
  .co-home-toc { position: static; max-height: none; }
  .co-page { grid-template-columns: 1fr; gap: 32px; }
  .co-page-side { position: static; }
  .co-wrap { padding: 20px 16px 48px; }
  .co-foot-in { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .co-prose { font-size: 17px; }
  .co-prose h2 { font-size: 23px; }
}
@media (max-width: 640px) {
  .co-card { grid-template-columns: 96px minmax(0, 1fr); }
  .co-card-img img, .co-card-noimg { min-height: 0; aspect-ratio: 1; height: 96px; }
  .co-card-img { border-right: 0; padding: 10px 0 10px 10px; }
  .co-card-body { padding: 10px 12px; gap: 3px; }
  .co-card-title { font-size: 16px; }
  .co-card-excerpt { display: none; }
  .co-card:hover { transform: none; }
  .co-pn { grid-template-columns: 1fr; }
  .co-pn-next { text-align: left; }
  .co-foot-stats dd { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
