/* ============================================================
   VinFast — Trang chi tiết bài viết (single-post.php)
   Bố cục + thành phần riêng của trang. Nội dung bài và khối VinFast ở blog-content.css.
   Khối lớn cách nhau 56–88px; đoạn 18px; không dùng bóng đổ trong template này.
   ============================================================ */

/* ── Breadcrumb ──────────────────────────────────────────── */
.vf-post-crumbs {
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}
.vf-post-crumbs p {
  width: min(100% - 2 * var(--container-gutter), calc(var(--container-max) - 2 * var(--container-px-md)));
  margin: 0 auto;
  padding: 13px 0;
}

/* ── Bố cục 2 cột ────────────────────────────────────────── */
.vf-post__wrap {
  width: min(100% - 2 * var(--container-gutter), calc(var(--container-max) - 2 * var(--container-px-md)));
  margin: 0 auto;
  padding: 56px 0 96px;
}
.vf-post__layout {
  display: grid;
  grid-template-columns: minmax(0, 838px) 300px;
  gap: 28px;
  justify-content: space-between;
  align-items: start;
}
.vf-post__article {
  min-width: 0;
}
.vf-post__mtoc {
  display: none;
}
@media (max-width: 1023px) {
  .vf-post__layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .vf-post__mtoc {
    display: block;
  }
}
@media (max-width: 767px) {
  .vf-post__wrap {
    padding-top: 36px;
    padding-bottom: 72px;
  }
}

/* ── Đầu bài ─────────────────────────────────────────────── */
.vf-post__kicker {
  margin: 0 0 14px;
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-cta-primary);
}
.vf-post__kicker a {
  color: inherit;
  text-decoration: none;
}
.vf-post__header .vf-hero-title { margin-bottom: 22px; }
.vf-post__header .vf-hero-lead { max-width: none; margin-bottom: 26px; }
.vf-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.vf-post__meta > * {
  white-space: nowrap;
}
.vf-post__author {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-style: normal;
}
.vf-post__author :is(strong, a) {
  color: var(--color-text-heading);
  font-weight: var(--font-bold);
  text-decoration: none;
}
.vf-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface-mist);
  color: var(--color-brand-primary);
  font-size: var(--text-xs);
  font-weight: 900;
}
.vf-post__sep {
  width: 1px;
  height: 16px;
  background: var(--color-border-strong);
}
@media (max-width: 767px) {
  .vf-post__meta {
    column-gap: 12px;
  }
  .vf-post__author {
    flex-basis: 100%;
  }
  .vf-post__sep {
    display: none;
  }
}

/* ── Ảnh bìa (LCP) ───────────────────────────────────────── */
.vf-post__cover {
  margin: 36px 0 0;
}
.vf-post__cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
}
.vf-post__cover figcaption {
  margin-top: 10px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* ── Thân bài ────────────────────────────────────────────── */
.vf-prose {
  margin-top: 20px;
}
.vf-prose > :first-child > h2:first-child,
.vf-prose > h2:first-child {
  margin-top: var(--space-fluid-md);
}

/* Nguồn tham khảo: H2 cỡ H3 */
.vf-sources .vf-sources__title {
  margin: 44px 0 12px;
  font-size: var(--font-size-h3);
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
  scroll-margin-top: 96px;
}
@media (max-width: 1023px) {
  .vf-post__article h2 {
    scroll-margin-top: 60px; /* + scroll-padding-top 80px của html = 140px: qua header 64 và viên thuốc TOC (đáy ~125px) */
  }
}
.vf-sources ul {
  margin: 0;
  padding-left: 22px;
  font-size: var(--font-size-body);
  line-height: 1.75;
  color: var(--color-text-secondary);
}
.vf-sources a {
  color: var(--color-brand-primary);
  text-underline-offset: 3px;
}
.vf-sources a:hover {
  color: var(--color-cta-primary);
}

/* Hộp tác giả */
.vf-author-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 56px;
  padding: 22px 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.vf-author-box .vf-avatar {
  width: 52px;
  height: 52px;
  font-size: var(--text-base);
}
.vf-author-box__name {
  margin: 0 0 2px;
  font-size: var(--text-base);
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
}
.vf-author-box__desc {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* ── Mục lục ─────────────────────────────────────────────── */
.vf-toc__title {
  margin: 0 0 14px;
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-heading);
}
.vf-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.vf-toc--desktop .vf-toc__list {
  border-left: 1px solid var(--color-border);
}
.vf-toc--desktop a {
  display: block;
  margin-left: -1px;
  padding: 8px 8px 8px 16px;
  border-left: 2px solid transparent;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1.45;
  text-decoration: none;
  color: var(--color-text-secondary);
  transition: color 150ms ease, border-color 150ms ease;
}
.vf-toc--desktop a:hover {
  color: var(--color-cta-primary);
}
.vf-toc--desktop a[aria-current="location"] {
  border-left-color: var(--color-cta-primary);
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
}

.vf-post__mtoc {
  /* Viên thuốc dính dưới header (64px ở ≤1180px): cuộn tới đâu hiện mục đang đọc tới đó, bấm để mở danh sách.
     Header ẩn khi kéo xuống (#masthead.is-hidden, site-header.js) thì viên thuốc lên sát mép trên. Dải nền 8px
     quanh viên thuốc che chữ chạy qua khe hở giữa header và viên thuốc. */
  position: sticky;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + 64px);
  z-index: var(--z-raised);
  margin: 12px 0 0;
  padding: 8px 0;
  background: var(--color-surface);
  transition: top 0.25s ease;
}
body:has(#masthead.is-hidden) .vf-post__mtoc {
  top: var(--wp-admin--admin-bar--height, 0px);
}
.vf-post__mtoc details {
  position: relative;
}
.vf-post__mtoc summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  color: var(--color-brand-deep);
  cursor: pointer;
  list-style: none;
}
.vf-post__mtoc summary::-webkit-details-marker {
  display: none;
}
.vf-toc__icon {
  flex: none;
  color: var(--color-cta-primary);
}
.vf-toc__current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vf-post__mtoc ol {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: min(60vh, 420px);
  margin: 0;
  padding: 8px 18px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-base);
  line-height: 1.45;
  list-style: none;
}
.vf-post__mtoc li {
  padding: 0;
}
.vf-post__mtoc ol a {
  display: block;
  padding: 10px 0;
  color: var(--color-text-muted);
  text-decoration: none;
}
.vf-post__mtoc ol a[aria-current="location"] {
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
}
.vf-post__mtoc ol::before {
  content: "Mục lục";
  padding: 14px 0 6px;
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-heading);
}
/* Nền mờ phủ trang khi danh sách mở (nằm dưới viên thuốc và thẻ, trong cùng stacking context) */
.vf-post__mtoc details[open]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-below);
  background: rgba(11, 26, 48, 0.35);
}

/* ── Cột phụ (desktop) ───────────────────────────────────── */
.vf-post__aside {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
@media (max-width: 1023px) {
  .vf-post__aside {
    display: none;
  }
}
.vf-topics {
  padding: 0 4px;
}
.vf-topics__title {
  margin: 0 0 8px;
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
}
.vf-topics ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}
.vf-topics a {
  display: block;
  padding: 11px 0 11px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-base);
  text-decoration: none;
  color: var(--color-text-secondary);
}
.vf-topics a:hover {
  color: var(--color-cta-primary);
}
.vf-topics a[aria-current="page"] {
  padding-left: 10px;
  border-left: 2px solid var(--color-cta-primary);
  font-weight: var(--font-extrabold);
  color: var(--color-cta-primary);
}
.vf-side-cta {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--color-brand-tint-soft);
}
.vf-side-cta__title,
h2.vf-side-cta__title {
  margin: 0 0 4px;
  font-size: var(--text-base);
  font-weight: var(--font-extrabold);
  line-height: 1.35;
  color: var(--color-brand-deep);
}
.vf-side-cta__sub {
  margin: 0 0 14px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text-secondary);
}
.vf-side-cta .vf-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  background: var(--color-cta-primary);
  color: var(--color-text-inverse);
  box-shadow: none;
}

/* ── Bài viết liên quan ──────────────────────────────────── */
.vf-related {
  margin-top: 88px;
  padding-top: 56px;
  border-top: 1px solid var(--color-border);
}
.vf-related__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 32px;
}
.vf-related__title {
  margin: 0;
  font-size: var(--font-size-title);
  letter-spacing: -0.03em;
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
}
.vf-related__all {
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  text-decoration: none;
  color: var(--color-brand-primary);
}
.vf-related__all:hover {
  color: var(--color-cta-primary);
}
.vf-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 40px 28px;
}
.vf-post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.vf-post-card__thumb {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
}
.vf-post-card__thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.vf-post-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.vf-post-card__meta {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.vf-post-card__excerpt {
  display: none; /* chỉ hiện ở bài nổi bật trên di động */
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-text-secondary);
}
.vf-post-card__title {
  margin: 0;
  font-size: var(--font-size-h4);
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-weight: var(--font-extrabold);
  color: var(--color-text-heading);
  text-wrap: pretty;
}
.vf-post-card__title a {
  color: inherit;
  text-decoration: none;
}
.vf-post-card__title a:hover {
  color: var(--color-cta-primary);
}
.vf-post-card__more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: auto;
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  text-decoration: none;
  color: var(--color-brand-primary);
}
.vf-post-card__more:hover {
  color: var(--color-cta-primary);
}

/* Desktop/tablet: 3 thẻ đầu. Di động: 1 bài nổi bật (thẻ lớn) + 5 tin phụ dạng dòng (ảnh nhỏ bên trái). */
@media (min-width: 768px) {
  .vf-related__grid .vf-post-card:nth-child(n + 4) {
    display: none;
  }
}
@media (max-width: 767px) {
  .vf-related {
    margin-top: 64px;
    padding-top: 40px;
  }
  .vf-related__head {
    margin-bottom: 24px;
  }
  .vf-related__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  /* Bài nổi bật: ảnh lớn, tiêu đề, mô tả ngắn, ngày · thời gian đọc (meta xuống cuối). */
  .vf-related__grid .vf-post-card:first-child {
    gap: 14px;
    padding-bottom: 22px;
  }
  .vf-related__grid .vf-post-card:first-child .vf-post-card__body {
    gap: 8px;
  }
  .vf-related__grid .vf-post-card:first-child .vf-post-card__title {
    font-size: var(--text-xl);
    line-height: 1.35;
  }
  .vf-related__grid .vf-post-card:first-child .vf-post-card__excerpt {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  /* Tin phụ: ảnh nhỏ bên trái, tiêu đề bên phải, ngày · thời gian đọc dưới tiêu đề. */
  .vf-related__grid .vf-post-card:not(:first-child) {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
  }
  .vf-related__grid .vf-post-card:not(:first-child):not(:has(.vf-post-card__thumb)) {
    grid-template-columns: minmax(0, 1fr);
  }
  .vf-related__grid .vf-post-card:not(:first-child) .vf-post-card__thumb {
    border-radius: var(--radius-md);
  }
  .vf-related__grid .vf-post-card:not(:first-child) .vf-post-card__body {
    gap: 6px;
  }
  .vf-related__grid .vf-post-card__meta {
    order: 3; /* dưới tiêu đề */
    font-size: var(--text-xs);
  }
  .vf-related__grid .vf-post-card:not(:first-child) .vf-post-card__title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    font-size: var(--text-base);
    line-height: 1.4;
  }
  .vf-related__grid .vf-post-card__more {
    display: none; /* trùng đích với tiêu đề */
  }
}

@media (prefers-reduced-motion: reduce) {
  .vf-toc--desktop a {
    transition: none;
  }
}
