/* ===========================================================================
   Agentra Blog — soft light theme (cream + forest + sage).
   Depends on brand.css (tokens + fonts). Same class names as the generator.
   =========================================================================== */

/* ---- top nav --------------------------------------------------------------*/
.blog-nav { position: sticky; top: 0; z-index: 50; display: flex; align-items: center;
  justify-content: space-between; padding: 14px 40px;
  background: rgba(13,16,27,0.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.blog-nav .brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display);
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; color: var(--forest); }
.blog-nav .brand img { height: 24px; width: auto; }
.blog-nav .sep { color: var(--dim); margin: 0 1px; }
.blog-nav .blog-label { color: var(--green-ink); }
.nav-links { display: flex; gap: 22px; font-size: 14px; }
.nav-links a { color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--forest); }

/* ---- reading progress -----------------------------------------------------*/
.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; }
.reading-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--lime)); }

/* ---- index hero -----------------------------------------------------------*/
.blog-hero { padding: 64px max(32px, calc((100% - 1300px) / 2)) 32px; background: var(--bg-soft); }
.blog-hero .eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--green-ink); }
.blog-hero .eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--green); }
.blog-hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08; letter-spacing: -.022em; color: var(--forest); margin: 20px 0 0; max-width: 19ch; }
.blog-hero .hero-desc { margin: 18px 0 0; max-width: 60ch; color: var(--muted); font-size: 17px; line-height: 1.6; }

/* ---- index post grid ------------------------------------------------------*/
.post-grid-section { padding: 30px max(32px, calc((100% - 1300px) / 2)) 80px; }
.section-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim); padding-bottom: 16px; border-bottom: 1px solid var(--rule); margin-bottom: 26px; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.post-card { display: block; background: var(--paper); border: 1px solid var(--rule); border-radius: 14px;
  padding: 26px 26px 22px; transition: border-color .2s, transform .15s, box-shadow .2s; }
.post-card:hover { border-color: rgba(70,177,82,.5); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,.4); }
/* card thumbnail (non-featured cards with a cover) */
.post-card.has-thumb { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-thumb { background: linear-gradient(155deg, var(--band), var(--band-2)); height: 158px;
  display: flex; align-items: center; justify-content: center; padding: 18px; }
.card-thumb img { max-width: 100%; max-height: 100%; width: auto; object-fit: contain; margin: 0;
  border-radius: 8px; border: 1px solid rgba(70,177,82,.22); box-shadow: none; background: #fff; }
.post-card.has-thumb .card-body { padding: 22px 24px 20px; }
.card-tag { display: inline-block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--green-ink); background: var(--mint);
  border: 1px solid rgba(70,177,82,.3); padding: 4px 10px; border-radius: 999px; }
.post-card h2 { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.3;
  color: var(--forest); margin: 14px 0 10px; letter-spacing: -.01em; }
.card-desc { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 0; }
.card-meta { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-family: var(--font-mono);
  font-size: 11.5px; color: var(--dim); }
.read-arrow { margin-left: auto; color: var(--green-ink); font-size: 15px; }
/* Featured: cùng kiểu thumbnail-trên như mọi thẻ, chỉ chiếm cả hàng + lớn hơn */
.post-card.featured { grid-column: 1 / -1; }
.post-card.featured .card-thumb { height: 300px; }
.post-card.featured .card-body { padding: 28px 32px 26px; }
.post-card.featured h2 { font-size: 27px; }
.post-card.featured .card-desc { font-size: 16px; max-width: 70ch; }

/* ---- article header -------------------------------------------------------*/
.article-header { background: var(--bg-soft); border-bottom: 1px solid var(--rule); }
.ah-inner { min-width: 0; }
.article-head { padding: 46px 32px 8px; }
.back-link { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.back-link:hover { color: var(--green-ink); }
.ah-tag { display: inline-block; margin-top: 18px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--green-ink); background: var(--mint);
  border: 1px solid rgba(70,177,82,.3); padding: 4px 11px; border-radius: 999px; }
.ah-inner h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.1; letter-spacing: -.02em; color: var(--forest); margin: 16px 0 0; }
.ah-desc { color: var(--muted); font-size: 18.5px; line-height: 1.55; margin: 16px 0 0; }
.ah-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 22px;
  font-family: var(--font-mono); font-size: 12px; color: var(--dim); }

/* ---- 3-column shell -------------------------------------------------------*/
.article-shell { max-width: 1300px; margin: 0 auto; padding: 44px 32px 0;
  display: grid; grid-template-columns: 220px minmax(0, 1fr) 220px; gap: 40px; align-items: stretch; }
/* header band: căn trái ở mép nội dung như nav/trang chủ, không đẩy vào cột giữa */
.article-head { display: block; padding: 46px 32px 30px; }
.article-head .rail-spacer { display: none; }
.article-head .ah-inner { max-width: 900px; }
/* full-width frame: TOC rail lines up with the nav logo, aside with "Trang chủ".
   rails are full-height cells so the sticky TOC / aside can travel while scrolling */
.toc-rail, .article-aside { min-height: 100%; }
.rail-spacer { min-width: 0; }
/* keep the reading measure sane while the rails sit at the page edges */
.article-body, .ah-inner { max-width: 720px; }

.toc { position: sticky; top: 86px; }
.toc-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 14px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: 13.5px; line-height: 1.4; color: var(--muted); transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--forest); }
.toc li.toc-l3 a { padding-left: 28px; font-size: 12.5px; color: var(--dim); }
.toc a.active { color: var(--green-ink); border-left-color: var(--green); }

.aside-card { position: sticky; top: 86px; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--paper-2); padding: 18px; }
.aside-meta { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.aside-meta .dot { color: var(--dim); }
.aside-author { margin-top: 8px; font-size: 13px; color: var(--forest); font-weight: 600; }
.aside-sep { height: 1px; background: var(--rule); margin: 16px 0; }
.aside-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.as-label { width: 100%; font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }
.as-btn { font-family: var(--font-mono); font-size: 12px; color: var(--muted); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 8px; padding: 6px 10px; cursor: pointer; transition: color .15s, border-color .15s; }
.as-btn:hover { color: var(--green-ink); border-color: rgba(70,177,82,.5); }
.aside-cta { display: block; text-align: center; margin-top: 16px; background: var(--green); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 13.5px; padding: 11px; border-radius: 9px; }
.aside-cta:hover { background: var(--green-h); }

/* ---- article body (light reading) -----------------------------------------*/
.article-body { min-width: 0; color: var(--text); }
.article-body > *:first-child { margin-top: 0; }
.article-body p { font-size: 18px; line-height: 1.8; margin: 0 0 22px; color: var(--text);
  text-align: justify; text-justify: inter-word; }
.article-body li { text-align: justify; text-justify: inter-word; }
.article-body .lead { font-size: 21px; line-height: 1.62; font-weight: 500; color: var(--forest); margin-bottom: 28px; }
.article-body h2 { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.25;
  letter-spacing: -.015em; color: var(--forest); margin: 46px 0 14px; scroll-margin-top: 80px; }
.article-body h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--forest);
  margin: 32px 0 10px; scroll-margin-top: 80px; }
.article-body a { color: var(--green-ink); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1px; text-decoration-color: rgba(70,177,82,.45); }
.article-body a:hover { text-decoration-color: var(--green); }
.article-body strong { font-weight: 700; color: var(--forest); }
.article-body em { font-style: italic; }
.article-body ul, .article-body ol { margin: 0 0 22px; padding-left: 24px; }
.article-body li { font-size: 18px; line-height: 1.75; margin: 7px 0; color: var(--text); }
.article-body li::marker { color: var(--green); }
.article-body code { font-family: var(--font-mono); font-size: .85em; background: var(--paper-3);
  border: 1px solid var(--rule); border-radius: 6px; padding: 1px 6px; color: #8fd89e; }
.article-body pre { background: var(--paper-3); border: 1px solid var(--rule); border-radius: 12px;
  padding: 18px 20px; overflow: auto; margin: 0 0 24px; font-size: 14px; line-height: 1.6; color: var(--text); }
.article-body pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 14px; }
.article-body figure { margin: 28px 0; }
.article-body img { border-radius: 14px; border: 1px solid rgba(70,177,82,.22); margin: 8px 0;
  background: var(--paper); padding: 6px; box-shadow: 0 12px 34px rgba(0,0,0,.45); }
.article-body figcaption { margin-top: 10px; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--dim); }
.article-body hr { border: 0; border-top: 1px solid var(--rule); margin: 38px 0; }

/* tables */
.article-body table { width: 100%; border-collapse: collapse; margin: 8px 0 28px; font-size: 15px;
  border-top: 1.5px solid var(--forest); border-bottom: 1.5px solid var(--forest); }
.article-body thead th { text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 13px;
  color: var(--forest); padding: 11px 14px; border-bottom: 1px solid var(--forest); }
.article-body tbody td { padding: 11px 14px; color: var(--text); vertical-align: top; }
.article-body tbody tr:hover td { background: var(--paper-2); }

/* blockquote */
.article-body blockquote { margin: 30px 0; padding: 6px 0 6px 24px; border-left: 3px solid var(--green);
  font-family: var(--font-display); font-weight: 500; font-style: italic; font-size: 21px; line-height: 1.5; color: var(--forest); }
.article-body blockquote p { font-size: inherit; color: inherit; margin: 0; }

/* stat row */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 10px 0 30px; }
.stat-box { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 16px; }
.stat-box .snum { font-family: var(--font-display); font-weight: 800; font-size: 27px; letter-spacing: -.01em; color: var(--green-ink); }
.stat-box .sdesc { margin-top: 6px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }

/* skill chips */
.skill-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 10px 0 28px; }
.skill-chip { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13px;
  color: var(--forest); background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px; padding: 6px 14px 6px 6px; }
.skill-chip .sc-num { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px;
  padding: 0 5px; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; font-size: 11px; }

/* demo panel (stays a dark forest panel for contrast) */
.demo-card { background: linear-gradient(160deg, var(--band), var(--band-2)); border: 1px solid rgba(70,177,82,.25);
  border-radius: 14px; padding: 20px 22px; margin: 10px 0 28px; }
.demo-card .demo-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); margin-bottom: 12px; }
.demo-card p { color: #cfe0d4; font-size: 15.5px; line-height: 1.62; margin: 0 0 10px; }
.demo-card p:last-child { margin-bottom: 0; }
.demo-card strong { color: #fff; }
.demo-card code { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.16); color: #bce8c1; }
.demo-card blockquote { border-left-color: var(--lime); color: #eef3ec; font-style: normal; font-size: 16px; margin: 0 0 12px; padding-left: 16px; }
.demo-card .stat-row, .demo-card table { margin-bottom: 0; }

/* callouts (light tints) */
.callout { margin: 0 0 26px; padding: 18px 20px; border: 1px solid var(--rule); border-left-width: 3px;
  border-radius: 12px; background: var(--paper-2); }
.callout .ctitle { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--forest); }
.callout p { font-size: 16.5px; line-height: 1.68; margin: 0; color: var(--text); }
.callout.warn { border-left-color: #d98a3a; background: var(--warm-soft); }
.callout.warn .ctitle { color: #e2a463; }
.callout.principle { border-left-color: var(--green); background: var(--mint); }
.callout.principle .ctitle { color: var(--green-ink); }
.callout.note { border-left-color: #5a9bf0; background: var(--blue-soft); }
.callout.note .ctitle { color: #86adf0; }

/* prev / next */
.post-nav { max-width: 780px; margin: 40px auto 0; padding: 24px 24px 0; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: 16px; }
.post-nav a { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--forest); max-width: 48%; line-height: 1.4; }
.post-nav a:hover { color: var(--green-ink); }
.post-nav .prev::before { content: "\2190\00a0"; color: var(--dim); }
.post-nav .next { margin-left: auto; text-align: right; }

/* CTA (dark forest band) */
.article-cta { margin-top: 64px; background: linear-gradient(160deg, var(--band), var(--band-2)); }
.cta-inner { max-width: 780px; margin: 0 auto; padding: 54px 24px 60px; text-align: center; }
.cta-inner h3 { font-family: var(--font-display); font-weight: 700; font-size: 25px; color: #fff; margin: 0 0 12px; }
.cta-inner p { color: var(--on-dark-mut); font-size: 16.5px; max-width: 56ch; margin: 0 auto 24px; line-height: 1.6; }
.cta-btn { display: inline-block; margin: 6px; padding: 13px 22px; border-radius: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; background: var(--lime); color: #1c2a12; transition: background .15s, border-color .15s, color .15s; }
.cta-btn:hover { background: #c2e040; }
.cta-btn.secondary { background: transparent; color: var(--on-dark); border: 1px solid rgba(255,255,255,.25); }
.cta-btn.secondary:hover { border-color: var(--lime); color: var(--lime); }

/* empty state */
.blog-empty { text-align: center; max-width: 560px; margin: 0 auto; padding: 56px 20px 80px; }
.be-mark { font-size: 38px; line-height: 1; color: var(--green); margin-bottom: 16px; }
.blog-empty h2 { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--forest); margin: 0 0 12px; }
.blog-empty p { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0; }

.lang-badge { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; }

/* site footer (dark forest band) */
.blog-foot { border-top: 1px solid var(--rule); background: var(--band); }
.bf-inner { padding: 26px 40px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.bf-brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; font-size: 12px; color: var(--on-dark); }
.bf-brand img { height: 24px; width: auto; }
.bf-copy { font-size: 13px; color: var(--on-dark-mut); }
.bf-links { margin-left: auto; display: flex; gap: 18px; font-size: 13px; }
.bf-links a { color: var(--on-dark-mut); }
.bf-links a:hover { color: var(--lime); }

/* ---- responsive -----------------------------------------------------------*/
@media (max-width: 1280px) {
  .article-shell { grid-template-columns: minmax(0, 1fr); max-width: 784px; margin: 0 auto; gap: 0; }
  .toc-rail, .article-aside { display: none; }
}
@media (max-width: 760px) {
  .blog-nav { padding: 12px 20px; }
  .blog-nav .brand { font-size: 12px; gap: 7px; }
  .blog-nav .brand img { height: 20px; }
  .nav-links { gap: 13px; font-size: 12.5px; }
  .blog-hero { padding: 52px 20px 28px; }
  .post-grid-section { padding: 24px 18px 60px; }
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .post-card.featured .card-thumb { height: 200px; }
  .post-card.featured h2 { font-size: 22px; }
  .post-card.featured .card-body { padding: 22px 22px 18px; }
  .article-head { padding: 38px 20px 8px; }
  .article-shell { padding: 30px 20px 0; }
  .article-body p, .article-body li { font-size: 17px; }
  .article-body .lead { font-size: 19px; }
  .stat-row { grid-template-columns: 1fr; }
  .post-nav { padding: 22px 18px 0; }
  .post-nav a { max-width: 46%; font-size: 14px; }
  .bf-inner { padding: 22px 18px; gap: 12px; }
  .bf-links { margin-left: 0; }
}
