/*
Theme Name: KTDB
Theme URI: https://ktdb.me/
Description: Theme kí tự đặc biệt KTDB — gọn nhẹ, thuần CSS/JS (không jQuery, không Bootstrap). Cần plugin "KTDB Core" để có công cụ tạo kí tự & bảng kí tự.
Author: KTDB
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: ktdb
*/

/* ===================== TOKENS ===================== */
:root {
  --acc: #e60023;
  --bg: #ffffff;
  --soft: #f9f9f9;
  --line: #e5e5e5;
  --ink: #0f0f0f;
  --mut: #606060;
  /* cầu nối sang plugin KTDB Core */
  --ktdb-acc: var(--acc);
  --ktdb-bg: var(--bg);
  --ktdb-soft: var(--soft);
  --ktdb-line: var(--line);
  --ktdb-ink: var(--ink);
  --ktdb-mut: var(--mut);
  --wrap: 1280px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::selection { background: rgba(230, 0, 35, .16); }
img { max-width: 100%; height: auto; }
a { color: var(--acc); }

/* ===================== LAYOUT ===================== */
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: clamp(14px, 3vw, 28px); padding-right: clamp(14px, 3vw, 28px); }
.section { max-width: var(--wrap); margin: 0 auto; padding: clamp(36px, 5vw, 60px) clamp(14px, 3vw, 28px) 0; }
.section--narrow { max-width: 880px; }
.section--flush { padding-top: 0; }
.scroll-anchor { scroll-margin-top: 80px; }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.sec-head h2 { margin: 0; }
.sec-link { flex: none; text-decoration: none; font-weight: 700; color: var(--acc); font-size: 14px; }

h1, h2, h3 { letter-spacing: -.02em; }
.h-sec { font-size: clamp(22px, 3.4vw, 30px); font-weight: 900; margin: 0; }

/* ===================== HEADER ===================== */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.site-header__in {
  max-width: var(--wrap); margin: 0 auto; padding: 10px clamp(14px, 3vw, 28px);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.brand__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--acc); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 17px; }
.brand__name { font-weight: 900; font-size: 20px; letter-spacing: -.03em; color: var(--ink); }
.brand__name span { color: var(--acc); }

.hsearch {
  flex: 1 1 280px; min-width: 0; max-width: 520px; display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--soft);
}
.hsearch input {
  flex: 1; border: none; background: transparent; outline: none; color: var(--ink);
  font-size: 14.5px; padding: 9px 18px; font-family: inherit;
}
.hsearch input::placeholder { color: var(--mut); }
.hsearch button {
  display: grid; place-items: center; width: 58px; height: 38px; border: none; border-left: 1px solid var(--line);
  color: var(--mut); font-size: 17px; background: #f0f0f0; cursor: pointer;
}

.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.nav a { text-decoration: none; color: var(--ink); font-weight: 500; font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { background: var(--soft); }
.nav a.is-active { color: var(--acc); background: var(--soft); font-weight: 700; }
.nav a.nav-cta { color: var(--acc); font-weight: 700; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--acc); }
.nav a.nav-cta:hover { background: var(--acc); color: #fff; }

.nav-toggle { display: none; }

/* ===================== HERO ===================== */
.hero { max-width: var(--wrap); margin: 0 auto; padding: clamp(28px, 4vw, 48px) clamp(14px, 3vw, 28px) 8px; }
.hero__head { max-width: 680px; margin: clamp(40px, 6vw, 56px) auto clamp(8px, 2vw, 16px); text-align: center; }
.hero__head h1 { font-size: clamp(25px, 3.6vw, 38px); line-height: 1.18; font-weight: 900; letter-spacing: -.03em; margin: 0; text-wrap: balance; }
.hero__head h1 .acc { color: var(--acc); }
.hero__head p { font-size: clamp(14.5px, 1.9vw, 16.5px); color: var(--mut); margin: 14px auto 0; text-wrap: pretty; }

/* ===================== FEATURED CARDS / GRID ===================== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.card-grid--tight { gap: 22px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pcard { text-decoration: none; color: inherit; display: block; }
.pcard__thumb {
  aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  color: #fff; position: relative; background: linear-gradient(135deg, #e60023, #ff7a59);
}
.pcard__thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcard__thumb-txt { font-size: 27px; font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, .2); padding: 0 12px; text-align: center; }
.pcard__badge {
  position: absolute; left: 10px; top: 10px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 6px; text-transform: uppercase;
}
.pcard__title { font-size: 16.5px; font-weight: 700; margin: 11px 0 0; line-height: 1.35; }
.pcard__meta { color: var(--mut); font-size: 13px; margin: 6px 0 0; }

/* gradient theo chủ đề (gán qua data-grad) */
.pcard__thumb[data-grad="tiktok"]    { background: linear-gradient(135deg, #e60023, #ff7a59); }
.pcard__thumb[data-grad="instagram"] { background: linear-gradient(135deg, #7c3aed, #ec4899); }
.pcard__thumb[data-grad="zalo"]      { background: linear-gradient(135deg, #0ea5e9, #22d3ee); }
.pcard__thumb[data-grad="facebook"]  { background: linear-gradient(135deg, #1a73e8, #4f46e5); }
.pcard__thumb[data-grad="bang"]      { background: linear-gradient(135deg, #0f9d58, #22d3ee); }
.pcard__thumb[data-grad="2"]         { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.pcard__thumb[data-grad="3"]         { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.pcard__thumb[data-grad="4"]         { background: linear-gradient(135deg, #64748b, #0f172a); }

/* ===================== TRUST ===================== */
.trust { margin-top: clamp(40px, 5vw, 64px); background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trust__in { max-width: var(--wrap); margin: 0 auto; padding: clamp(40px, 5vw, 64px) clamp(14px, 3vw, 28px); display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 38px; align-items: center; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc); background: rgba(230, 0, 35, .08); border-radius: 999px; padding: 6px 13px; }
.trust h2 { font-size: clamp(24px, 3.6vw, 34px); font-weight: 900; margin: 14px 0 0; line-height: 1.12; }
.trust p { color: var(--mut); font-size: clamp(15px, 2vw, 16.5px); margin: 14px 0 0; max-width: 54ch; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.chips span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px; font-weight: 600; font-size: 13.5px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stat b { display: block; font-size: 30px; font-weight: 900; color: var(--ink); }
.stat b.acc { color: var(--acc); }
.stat span { color: var(--mut); font-size: 13.5px; margin-top: 5px; display: block; }

/* ===================== PROSE (SEO / single body) ===================== */
.prose { font-size: 16.5px; line-height: 1.8; color: #1a1a1a; }
.prose h2 { font-size: clamp(24px, 3.6vw, 34px); font-weight: 900; line-height: 1.15; margin: 30px 0 0; text-wrap: balance; }
.prose h3 { font-size: clamp(19px, 2.6vw, 23px); font-weight: 900; margin: 30px 0 0; }
.prose p { margin: 14px 0 0; }
.prose ul, .prose ol { margin: 12px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 9px; }
.prose a { color: var(--acc); text-decoration: none; font-weight: 500; }
.prose a:hover { text-decoration: underline; }
.prose img { border-radius: 12px; margin-top: 16px; }
.prose blockquote {
  margin: 24px 0 0; border-left: 4px solid var(--acc); background: var(--soft);
  border-radius: 0 10px 10px 0; padding: 16px 18px; color: #333; font-size: 16px; line-height: 1.7;
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.prose thead tr { background: var(--soft); }
.prose figure { margin: 24px 0 0; }
.prose figcaption { color: var(--mut); font-size: 12.5px; margin-top: 8px; text-align: center; }

/* ===================== FAQ ===================== */
.faq { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 4px 18px; }
.faq summary { cursor: pointer; list-style: none; font-weight: 700; font-size: 15.5px; padding: 14px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--acc); }
.faq details[open] summary::after { content: '–'; }
.faq p { color: var(--mut); font-size: 14.5px; margin: 0 0 14px; }

/* ===================== ARCHIVE ===================== */
.page-head { max-width: var(--wrap); margin: 0 auto; padding: clamp(24px, 4vw, 40px) clamp(14px, 3vw, 28px) 0; }
.page-head h1 { font-size: clamp(26px, 4vw, 42px); font-weight: 900; letter-spacing: -.03em; margin: 12px 0 0; }
.page-head .lead { font-size: clamp(15px, 2vw, 17px); color: var(--mut); max-width: 64ch; margin: 10px 0 0; text-wrap: pretty; }

.breadcrumb { font-size: 13px; color: var(--mut); display: flex; gap: 7px; flex-wrap: wrap; }
.breadcrumb a { text-decoration: none; color: var(--mut); }
.breadcrumb a:hover { color: var(--acc); }
.breadcrumb .cur { color: var(--ink); }

.filter { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }
.filter button {
  cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13.5px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--ink);
}
.filter button.is-on { border-color: var(--acc); background: var(--acc); color: #fff; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 7px; margin-top: 40px; flex-wrap: wrap; }
.pagination a, .pagination span {
  text-decoration: none; display: grid; place-items: center; min-width: 38px; height: 38px;
  border-radius: 9px; border: 1px solid var(--line); color: var(--ink); font-weight: 500; font-size: 14px; padding: 0 8px;
}
.pagination a:hover { background: var(--soft); }
.pagination .current { background: var(--acc); color: #fff; border-color: var(--acc); font-weight: 700; }
.pagination .dots { border: none; }

/* ===================== SINGLE ===================== */
article.single { max-width: var(--wrap); margin: 0 auto; padding: clamp(20px, 4vw, 36px) clamp(14px, 3vw, 28px) 0; }
.single__cat { display: inline-block; margin-top: 16px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc); background: rgba(230, 0, 35, .08); border-radius: 6px; padding: 5px 10px; }
.single__title { font-size: clamp(28px, 4.6vw, 44px); font-weight: 900; letter-spacing: -.03em; line-height: 1.12; margin: 14px 0 0; text-wrap: balance; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.byline__ava { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--acc), #ff7a59); display: grid; place-items: center; color: #fff; font-weight: 900; overflow: hidden; }
.byline__ava img { width: 100%; height: 100%; object-fit: cover; }
.byline__name { font-weight: 700; font-size: 14px; }
.byline__meta { color: var(--mut); font-size: 13px; }
.byline__share { margin-left: auto; display: flex; gap: 8px; }
.byline__share a { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); font-size: 15px; color: var(--mut); cursor: pointer; text-decoration: none; }
.byline__share a:hover { background: var(--soft); color: var(--acc); }

.featimg { aspect-ratio: 16/9; max-height: 480px; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #e60023, #ff7a59); display: grid; place-items: center; color: #fff; margin-top: 24px; }
.featimg img { width: 100%; height: 100%; object-fit: cover; }
.featimg span { font-size: clamp(30px, 6vw, 52px); font-weight: 700; text-shadow: 0 3px 14px rgba(0, 0, 0, .22); }

.toc { margin: 26px 0 0; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); padding: 18px 20px; }
.toc__t { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--mut); margin-bottom: 10px; }
.toc ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14.5px; }
.toc a { text-decoration: none; color: var(--ink); }
.toc a:hover { color: var(--acc); }

.entry { font-size: 16.5px; line-height: 1.75; color: #1a1a1a; }
.entry h2 { font-size: clamp(22px, 3.2vw, 28px); font-weight: 900; margin: 34px 0 0; scroll-margin-top: 80px; }
.entry h3 { font-size: clamp(19px, 2.6vw, 22px); font-weight: 900; margin: 28px 0 0; scroll-margin-top: 80px; }
.entry p { margin: 12px 0 0; }
.entry ul, .entry ol { margin: 14px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.entry a { color: var(--acc); text-decoration: none; font-weight: 500; }
.entry a:hover { text-decoration: underline; }
.entry img { border-radius: 14px; margin-top: 16px; }
.entry blockquote { margin: 20px 0 0; border-left: 4px solid var(--acc); background: var(--soft); border-radius: 0 10px 10px 0; padding: 16px 18px; color: #333; font-size: 16px; }
.entry table { width: 100%; border-collapse: collapse; font-size: 14px; }
.entry th, .entry td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.entry thead tr { background: var(--soft); }
.entry .wp-block-table { overflow-x: auto; }

.tags { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { text-decoration: none; font-size: 13px; color: var(--mut); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; }
.tags a:hover { color: var(--acc); border-color: var(--acc); }

/* ===================== FOOTER ===================== */
.site-footer { background: var(--soft); border-top: 1px solid var(--line); margin-top: clamp(40px, 5vw, 64px); }
.site-footer__cols { max-width: var(--wrap); margin: 0 auto; padding: clamp(36px, 5vw, 52px) clamp(14px, 3vw, 28px) 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 30px; }
.fcol h4 { font-weight: 700; font-size: 14px; margin: 0 0 11px; }
.fcol ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.fcol a { text-decoration: none; color: var(--mut); font-size: 14px; }
.fcol a:hover { color: var(--acc); }
.fabout p { color: var(--mut); font-size: 13.5px; margin: 11px 0 0; max-width: 34ch; }
.site-footer__bar { max-width: var(--wrap); margin: 0 auto; padding: 16px clamp(14px, 3vw, 28px) 28px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.site-footer__bar span { color: var(--mut); font-size: 13px; }
.footer-simple { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; padding: 28px clamp(14px, 3vw, 28px); max-width: var(--wrap); margin: 0 auto; }
.footer-simple nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-simple nav a { text-decoration: none; color: var(--mut); font-size: 13.5px; }
.footer-simple nav a:hover { color: var(--acc); }

/* ===================== 404 / SEARCH EMPTY ===================== */
.notice { max-width: 680px; margin: clamp(40px, 8vw, 90px) auto; text-align: center; padding: 0 20px; }
.notice .big { font-size: clamp(60px, 14vw, 120px); font-weight: 900; color: var(--acc); line-height: 1; letter-spacing: -.04em; }
.notice h1, .notice h2 { font-size: clamp(22px, 3.4vw, 30px); font-weight: 900; margin: 12px 0 0; }
.notice p { color: var(--mut); margin: 12px 0 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; text-decoration: none; font-weight: 700; font-size: 15px; color: #fff; background: var(--acc); border-radius: 999px; padding: 11px 22px; }
.btn:hover { filter: brightness(1.08); }
.btn--ghost { color: var(--acc); background: transparent; border: 1px solid var(--acc); }
.btn--ghost:hover { background: var(--acc); color: #fff; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
  /* 1 dòng: logo + ô tìm + icon menu */
  .site-header__in { gap: 10px; }
  .hsearch { flex: 1 1 auto; max-width: none; }
  .nav-toggle {
    display: grid; place-items: center; width: 40px; height: 38px; border: 1px solid var(--line);
    background: var(--soft); border-radius: 8px; cursor: pointer; font-size: 18px; flex: none;
  }
  /* menu xổ xuống dòng dưới khi mở */
  .nav {
    display: none; order: 5; flex-basis: 100%; margin-left: 0;
    flex-direction: column; gap: 4px; padding-top: 8px;
  }
  .nav.is-open { display: flex; }
  .nav a { width: 100%; padding: 10px 12px; }
}
