/* ── Reset ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --blue: #2563eb;
  --blue-l: #eff6ff;
  --blue-b: #bfdbfe;
  --purple: #7c3aed;
  --green: #059669;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --font: 'Inter', -apple-system, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 8px rgba(0,0,0,.07);
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

.grad { background: linear-gradient(135deg,#2563eb,#7c3aed); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }

/* ── NAV ───────────────────────────── */
.nav { position: fixed; top:0; left:0; right:0; z-index:100; padding: 12px 24px; transition: all .25s; }
.nav.scrolled { background: rgba(255,255,255,.95); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 9px 24px; }
.nav-inner { max-width: 1140px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo svg { width: 34px; height: 34px; flex-shrink: 0; }
.logo-name { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1.1; }
.logo-by { font-size: 10px; color: var(--text-4); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-link { font-size: 14px; font-weight: 500; color: var(--text-3); padding: 7px 12px; border-radius: 8px; transition: all .12s; }
.nav-link:hover, .nav-active { color: var(--text); background: var(--bg); }
.nav-active { font-weight: 600; color: var(--blue) !important; background: var(--blue-l) !important; }
.btn-try { padding: 9px 18px; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; border-radius: 8px; font-size: 13px; font-weight: 600; transition: opacity .15s; }
.btn-try:hover { opacity: .9; }

/* ── BLOG HEADER ────────────────────── */
.blog-header { padding: 110px 24px 56px; background: var(--surface); border-bottom: 1px solid var(--border); text-align: center; }
.bh-inner { max-width: 640px; margin: 0 auto; }
.bh-tag { display: inline-block; padding: 4px 14px; background: var(--blue-l); border: 1px solid var(--blue-b); border-radius: 50px; font-size: 12px; font-weight: 600; color: var(--blue); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 16px; }
.blog-header h1 { font-size: clamp(28px,5vw,44px); font-weight: 800; letter-spacing: -.5px; line-height: 1.2; margin-bottom: 14px; }
.blog-header p { font-size: 16px; color: var(--text-3); line-height: 1.7; }

/* ── BLOG BODY ──────────────────────── */
.blog-body { padding: 40px 24px 64px; }
.blog-container { max-width: 1140px; margin: 0 auto; }

/* Filter bar */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.filter-btn { padding: 7px 16px; border: 1.5px solid var(--border-2); border-radius: 50px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-3); cursor: pointer; transition: all .12s; font-family: var(--font); }
.filter-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
#catBtns { display: flex; flex-wrap: wrap; gap: 8px; }
.search-box { display: flex; align-items: center; gap: 8px; margin-left: auto; background: var(--surface); border: 1.5px solid var(--border-2); border-radius: 50px; padding: 7px 16px; }
.search-box svg { width: 14px; height: 14px; color: var(--text-4); flex-shrink: 0; }
.search-box input { border: none; outline: none; font-size: 13px; color: var(--text); background: none; font-family: var(--font); min-width: 140px; }
.search-box input::placeholder { color: var(--text-4); }

/* Posts grid */
.posts-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: all .2s; display: flex; flex-direction: column; }
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.post-featured { grid-column: span 3; display: grid; grid-template-columns: 1fr 1fr; }

.pc-img { display: block; background: var(--bg); height: 180px; overflow: hidden; }
.pc-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.post-card:hover .pc-img img { transform: scale(1.03); }
.pc-img-placeholder { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.post-featured .pc-img { height: auto; min-height: 280px; }

.pc-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pc-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--blue); }
.pc-title { font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--text); }
.pc-title a { color: inherit; transition: color .12s; }
.pc-title a:hover { color: var(--blue); }
.post-featured .pc-title { font-size: 22px; }
.pc-excerpt { font-size: 13px; color: var(--text-3); line-height: 1.65; flex: 1; }
.pc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.pc-date { font-size: 12px; color: var(--text-4); }
.pc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.pt { font-size: 11px; padding: 2px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 50px; color: var(--text-4); }

.blog-empty { text-align: center; padding: 64px 24px; color: var(--text-4); font-size: 16px; }
.blog-empty div { font-size: 48px; margin-bottom: 12px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pg-btn { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border-2); background: var(--surface); font-size: 14px; cursor: pointer; transition: all .12s; font-family: var(--font); color: var(--text-3); }
.pg-btn:hover { border-color: var(--blue); color: var(--blue); }
.pg-active { background: var(--blue); border-color: var(--blue); color: #fff !important; }

/* ── ARTICLE PAGE ────────────────────── */
.article-wrap { padding-top: 72px; }
.article-container { max-width: 1100px; margin: 0 auto; padding: 24px 24px 64px; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-4); margin-bottom: 28px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-3); transition: color .12s; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb span { color: var(--border-2); }
.breadcrumb span:last-child { color: var(--text-3); }

.not-found { text-align: center; padding: 80px 24px; }
.not-found div { font-size: 64px; font-weight: 800; color: var(--border-2); margin-bottom: 16px; }
.not-found h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.not-found p { color: var(--text-3); margin-bottom: 20px; }

.article-layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: start; }

/* Article header */
.article-header { margin-bottom: 24px; }
.ah-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ah-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--blue); background: var(--blue-l); padding: 3px 10px; border-radius: 50px; }
.ah-date { font-size: 13px; color: var(--text-4); }
.ah-title { font-size: clamp(24px,4vw,36px); font-weight: 800; line-height: 1.25; letter-spacing: -.3px; color: var(--text); margin-bottom: 14px; }
.ah-excerpt { font-size: 17px; color: var(--text-3); line-height: 1.7; margin-bottom: 14px; font-weight: 400; }
.ah-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ah-tag { font-size: 12px; color: var(--text-3); background: var(--bg); border: 1px solid var(--border); padding: 3px 10px; border-radius: 50px; }

.art-thumb-img { width: 100%; border-radius: var(--radius); margin-bottom: 28px; border: 1px solid var(--border); }

/* Article body */
.article-body { font-size: 16px; line-height: 1.85; color: var(--text-2); }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { color: var(--text); font-weight: 700; margin: 1.5em 0 .6em; line-height: 1.3; }
.article-body h2 { font-size: 22px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.article-body h3 { font-size: 18px; }
.article-body h4 { font-size: 16px; }
.article-body p { margin-bottom: 1.1em; }
.article-body ul, .article-body ol { padding-left: 1.6em; margin-bottom: 1.1em; }
.article-body li { margin-bottom: .5em; }
.article-body a { color: var(--blue); text-decoration: underline; text-decoration-color: rgba(37,99,235,.3); }
.article-body a:hover { text-decoration-color: var(--blue); }
.article-body img { max-width: 100%; border-radius: 10px; margin: 1.4em 0; border: 1px solid var(--border); }
.article-body blockquote { border-left: 3px solid var(--blue); background: var(--blue-l); padding: 14px 18px; margin: 1.4em 0; border-radius: 0 8px 8px 0; color: var(--text-3); font-style: italic; }
.article-body code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: .88em; font-family: monospace; }
.article-body pre { background: #1e293b; color: #e2e8f0; border-radius: 8px; padding: 16px; overflow-x: auto; margin: 1.4em 0; }
.article-body strong { color: var(--text); }
.article-body table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 14px; }
.article-body th { background: var(--bg); border: 1px solid var(--border); padding: 10px 14px; text-align: left; font-weight: 600; }
.article-body td { border: 1px solid var(--border); padding: 10px 14px; }

/* Article sidebar */
.article-sidebar { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 16px; }
.as-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.as-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.as-card p { font-size: 13px; color: var(--text-3); line-height: 1.65; }
.related-item { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); transition: background .1s; }
.related-item:last-child { border-bottom: none; }
.related-item:hover .ri-title { color: var(--blue); }
.ri-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--blue); letter-spacing: .4px; margin-bottom: 3px; }
.ri-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 3px; transition: color .12s; }
.ri-date { font-size: 11px; color: var(--text-4); }

/* ── FOOTER ─────────────────────────── */
.blog-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 40px 24px 28px; }
.bf-inner { max-width: 1100px; margin: 0 auto; }
.bf-brand { margin-bottom: 16px; }
.bf-brand .logo { margin-bottom: 8px; }
.bf-brand p { font-size: 13px; color: var(--text-4); }
.bf-links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.bf-links a { font-size: 13px; color: var(--text-3); transition: color .12s; }
.bf-links a:hover { color: var(--blue); }
.bf-copy { font-size: 12px; color: var(--text-4); }

/* Buttons */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; border-radius: 8px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: opacity .15s; font-family: var(--font); }
.btn-primary:hover { opacity: .9; }

/* ── RESPONSIVE ─────────────────────── */
@media (max-width: 900px) {
  .posts-grid { grid-template-columns: repeat(2,1fr); }
  .post-featured { grid-column: span 2; grid-template-columns: 1fr; }
  .post-featured .pc-img { height: 220px; }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
}
@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; }
  .post-featured { grid-column: span 1; }
  .nav-right { gap: 4px; }
  .nav-link { display: none; }
}
@media (max-width: 400px) {
  .filter-bar { gap: 6px; }
  .search-box { margin-left: 0; width: 100%; }
}

/* ── SEO article extras ─────────────────────────────────────────────── */
.art-thumb-wrap { margin: 0 0 28px; }
.art-thumb-wrap img { display: block; }

/* Internal links inside body */
.article-body a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, .35);
}
.article-body a:hover { border-bottom-color: var(--blue); }

/* Inline "Đọc thêm" box */
.inline-related {
  margin: 28px 0;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(37,99,235,.06), rgba(124,58,237,.06));
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
}
.inline-related .ir-label {
  font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--blue); margin-bottom: 8px;
}
.inline-related ul { margin: 0; padding-left: 18px; }
.inline-related li { margin: 4px 0; }
.inline-related a { color: var(--text); font-weight: 600; text-decoration: none; border: none; }
.inline-related a:hover { color: var(--blue); }

/* CTA block at end of article */
.article-cta {
  margin-top: 40px;
  padding: 28px;
  text-align: center;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  border-radius: var(--radius);
  color: #fff;
}
.article-cta h3 { font-size: 20px; font-weight: 800; margin: 0 0 8px; color: #fff; }
.article-cta p { color: rgba(255,255,255,.9); margin: 0 0 18px; font-size: 15px; }
.article-cta .btn-primary { background: #fff; color: var(--blue); margin: 0 6px 8px; }
.btn-ghost {
  display: inline-flex; align-items: center; padding: 10px 20px;
  border: 1px solid rgba(255,255,255,.6); color: #fff; border-radius: 8px;
  font-size: 14px; font-weight: 600; text-decoration: none; margin: 0 6px 8px;
}
.btn-ghost:hover { background: rgba(255,255,255,.12); }

.related-list { display: block; }
