/* ==========================================================
   Single blog post
   ========================================================== */
.single-blog {
  background: var(--gray-50);
  padding: 3rem 0 5rem;
  font-family: var(--font-body);
  color: var(--color-text);
}

.single-blog__article,
.post-nav,
.single-blog__back {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Header ---------- */
.single-blog__header {
  text-align: center;
  margin-bottom: 2rem;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.breadcrumb a {
  color: var(--primary-600);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

.single-blog__title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--gray-900);
  word-break: break-word;
}

.single-blog__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.single-blog__meta span,
.single-blog__meta time {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.single-blog__dot {
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--gray-200);
}

/* ---------- Cover ---------- */
.single-blog__cover {
  margin: 0 0 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--primary-100);
  box-shadow: var(--shadow-board);
  background: var(--primary-50);
}

.single-blog__cover img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Share ---------- */
.share {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.share__label {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}

.share__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  padding: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: var(--white);
  color: var(--gray-700);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.share__btn:hover {
  transform: translateY(-2px);
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: var(--white);
  box-shadow: 0 6px 14px var(--primary-shadow);
}

.share__btn:focus-visible {
  outline: 2px solid var(--primary-600);
  outline-offset: 2px;
}

.share__btn--copy {
  padding: 0 1rem;
}

.share__btn--copy.is-copied {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: var(--white);
}

.share--bottom {
  justify-content: space-between;
}

/* ---------- Nội dung bài viết ---------- */
.entry-content {
  background: var(--white);
  border: 1px solid var(--bap-line);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  font-size: 15px;
  line-height: 1.8;
  color: var(--gray-700);
  overflow-wrap: break-word;
}

.entry-content > *:first-child { margin-top: 0; }
.entry-content > *:last-child { margin-bottom: 0; }

.entry-content p {
  margin: 0 0 1.25rem;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin: 2rem 0 0.875rem;
  line-height: 1.35;
  color: var(--gray-900);
}

.entry-content h2 { font-size: 1.5rem; }
.entry-content h3 { font-size: 1.25rem; }
.entry-content h4 { font-size: 1.0625rem; }

.entry-content a {
  color: var(--primary-600);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-content a:hover {
  color: var(--primary-700);
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.entry-content li {
  margin-bottom: 0.375rem;
}

.entry-content li::marker {
  color: var(--primary-500);
}

.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.entry-content figure {
  margin: 1.75rem 0;
}

.entry-content figcaption {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.entry-content blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--primary-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--primary-50);
  color: var(--gray-700);
  font-style: italic;
}

.entry-content blockquote p:last-child {
  margin-bottom: 0;
}

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

.entry-content code {
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  background: var(--gray-100);
  font-size: 0.9em;
}

.entry-content pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--night);
  color: var(--gray-100);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

.entry-content pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.entry-content table {
  display: block;
  width: 100%;
  margin: 0 0 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.entry-content th,
.entry-content td {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--bap-line);
  text-align: left;
}

.entry-content th {
  background: var(--primary-50);
  color: var(--gray-900);
}

/* Video & YouTube trong nội dung bài */
.entry-content .wp-block-embed__wrapper,
.entry-content .wp-block-video {
  margin: 1.5rem 0;
}

.entry-content .wp-block-embed__wrapper iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-md);
}

.entry-content video {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

/* ---------- Footer bài viết ---------- */
.single-blog__footer {
  margin-top: 2rem;
  padding: 1.25rem 1.25rem;
  border: 1px solid var(--primary-100);
  border-radius: var(--radius-lg);
  background: var(--primary-50);
}

/* ---------- Prev / Next ---------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 3rem;
}

.post-nav__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem;
  border: 1px solid var(--primary-100);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-board);
  transition: transform 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.post-nav__item:hover {
  transform: translateY(-3px);
  border-color: var(--primary-500);
  box-shadow: 0 14px 24px -6px var(--primary-shadow-hover);
}

.post-nav__thumb {
  flex: 0 0 3.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--primary-50);
}

.post-nav__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-nav__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
}

.post-nav__text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.post-nav__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-600);
}

.post-nav__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--gray-900);
}

.post-nav__item:hover .post-nav__title {
  color: var(--primary-700);
}

/* Bài kế tiếp: chữ căn phải, ảnh bên phải */
.post-nav__item--next .post-nav__text {
  text-align: right;
}

/* ---------- Back button ---------- */
.single-blog__back {
  margin-top: 2rem;
  text-align: center;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  background: var(--bap);
  color: var(--white);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 14px var(--primary-shadow);
  transition: background 0.2s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
}

.btn-back:hover {
  background: var(--bap-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px var(--primary-shadow-hover);
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (min-width: 640px) {
  .single-blog {
    padding: 4rem 0 6rem;
  }

  .single-blog__title {
    font-size: 2.25rem;
  }

  .entry-content {
    padding: 2.25rem 2.5rem;
    font-size: 15px;
  }

  .single-blog__footer {
    padding: 1.25rem 1.75rem;
  }

  .post-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Chỉ có bài kế tiếp thì vẫn nằm cột bên phải */
  .post-nav__item--next:only-child {
    grid-column: 2;
  }
}

@media (min-width: 1024px) {
  .single-blog__article,
  .post-nav,
  .single-blog__back {
    max-width: 1028px;
  }

  .single-blog__title {
    font-size: 2.5rem;
  }
}

/* Mobile nhỏ: nút share gọn lại, copy link xuống dòng riêng */
@media (max-width: 479px) {
  .share--bottom {
    justify-content: center;
  }

  .share__btn--copy {
    flex: 1 1 100%;
  }

  .post-nav__thumb {
    flex-basis: 3rem;
    width: 3rem;
    height: 3rem;
  }

  .post-nav__item--next .post-nav__text {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .share__btn,
  .post-nav__item,
  .btn-back {
    transition: none;
  }

  .share__btn:hover,
  .post-nav__item:hover,
  .btn-back:hover {
    transform: none;
  }
}