/* Blog (/blog/**, plus the latest-posts strip on the home page) — layered on
   top of /styles.css and /huong-dan/guide.css, reusing their theme tokens.
   Hand-written; the pages are generated by landing/_build/build-guide.mjs
   and filled in by blog.js. */

.b-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .b-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .b-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.b-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card-bg);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.b-card:hover {
  border-color: var(--accent);
}

.b-card-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: var(--bg-soft);
}

.b-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1.25rem 1.25rem;
}

.b-card h2,
.b-card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
}

.b-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.b-date {
  font-size: 0.8rem;
  color: var(--faint);
}

.b-more {
  display: block;
  margin: 2rem auto 0;
}

/* .btn / .wrap set their own display, which would beat the hidden
   attribute blog.js toggles. */
.b-more[hidden],
.b-related[hidden],
[data-blog-latest][hidden] {
  display: none;
}

.b-message {
  padding: 3rem 0;
  text-align: center;
  color: var(--muted);
}

.b-message h1 {
  color: var(--ink);
}

.b-loading {
  padding: 3rem 0;
  text-align: center;
  color: var(--faint);
}

/* ---------- Post ---------- */

.b-article {
  max-width: 46rem;
  margin: 0 auto;
}

.b-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 0.75rem;
  margin-bottom: 2rem;
}

.b-body {
  font-size: 1.05rem;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.b-body > :first-child {
  margin-top: 0;
}

.b-body h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.5rem;
  line-height: 1.3;
}

.b-body h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.2rem;
}

.b-body h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}

.b-body p,
.b-body ul,
.b-body ol {
  margin: 0 0 1rem;
}

.b-body li + li {
  margin-top: 0.35rem;
}

.b-body a {
  color: var(--accent);
}

.b-body img {
  display: block;
  height: auto;
  margin: 1.5rem auto;
  border-radius: 0.5rem;
}

.b-body blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 0.5rem 0.5rem 0;
}

.b-body blockquote p:last-child {
  margin-bottom: 0;
}

.b-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.b-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 0.3rem;
  background: var(--bg-soft);
}

/* Message templates and formulas: keep their line breaks, but wrap long
   lines rather than scroll. */
.b-body pre {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg-soft);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.b-body pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.b-table {
  margin: 1.5rem 0;
  overflow-x: auto;
}

.b-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.55;
}

.b-body th,
.b-body td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.b-body th {
  background: var(--bg-soft);
  font-weight: 600;
}

.b-body td p,
.b-body th p {
  margin: 0;
}

.b-body td p + p,
.b-body th p + p {
  margin-top: 0.4rem;
}

@media (max-width: 639px) {
  .b-body table {
    min-width: 32rem;
  }
}

.b-related {
  max-width: 72rem;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.b-related h2 {
  margin: 0 0 1.25rem;
  font-size: 1.4rem;
}

/* Home page "Bài viết mới" strip — hidden until blog.js has posts for it. */
.b-latest-all {
  display: block;
  margin-top: 1.5rem;
  text-align: center;
}
