/* Trang "Blog" - page-blog.php
   Layout tham khảo: https://alibabamedia.vn/tin-tuc/ */

.blog-archive {
  background: #ffffff;
}

.blog-archive__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px 24px;
}

@media (min-width: 640px) {
  .blog-archive__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .blog-archive__grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(8, 10, 55, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px rgba(8, 10, 55, 0.12);
}

.blog-card__thumb {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f2f4f8;
}

.blog-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-card__thumb img {
  transform: scale(1.06);
}

.blog-card__body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.blog-card__title {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__title a {
  color: #17181A;
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-card__title a:hover {
  color: #58AD40;
}

.blog-card__excerpt {
  margin: 0 0 18px 0;
  color: #64748b;
  font-size: 14.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.blog-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.blog-card__date {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(115deg, #58AD40, #17386C);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 100px;
  white-space: nowrap;
}

.blog-card__cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.blog-card__cat svg {
  color: #FF6004;
  flex-shrink: 0;
}

.blog-archive__empty {
  text-align: center;
  color: #475569;
  padding: 60px 0;
  font-size: 16px;
}

/* Phân trang - dùng chung phong cách với trang Dự án */
.blog-archive__pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
}

.blog-archive__pagination span,
.blog-archive__pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  border-radius: 10px;
  background: #f2f4f8;
  color: #17181A;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.blog-archive__pagination a:hover {
  background: #e5e9f2;
}

.blog-archive__pagination span.current {
  background: #FF6004;
  color: #ffffff;
}

/* ============================================================
   Trang chi tiết bài viết Blog - single.php
   Layout tham khảo: https://alibabamedia.vn/media-marketing-la-gi/
   ============================================================ */

.blog-single {
  background: #ffffff;
}

.blog-single__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  /* align-items:start là BẮT BUỘC để position:sticky của sidebar hoạt động.
     Mặc định Grid dùng align-items:stretch, sẽ kéo <aside> cao bằng đúng cột
     nội dung chính (hàng nghìn px) - lúc đó sidebar không còn khoảng trống
     nào để trượt/dính khi cuộn, sticky coi như vô dụng. Với align-items:start,
     hàng grid vẫn cao bằng cột nội dung chính, nhưng <aside> chỉ cao bằng nội
     dung thật của nó, để lại khoảng trống bên dưới cho sticky hoạt động. */
  align-items: start;
}

@media (min-width: 1024px) {
  .blog-single__grid {
    grid-template-columns: 2fr 1fr;
    gap: 48px;
  }
}

.blog-single__title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.35;
  color: #17181A;
  margin: 0 0 16px 0;
}

@media (min-width: 1024px) {
  .blog-single__title {
    font-size: 32px;
  }
}

.blog-single__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid #eef0f4;
}

.blog-single__meta-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.blog-single__cat {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(115deg, #58AD40, #17386C);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 100px;
  text-decoration: none !important;
}

.blog-single__author,
.blog-single__date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 14px;
}

.blog-single__author svg,
.blog-single__date svg {
  color: #94a3b8;
  flex-shrink: 0;
}

.blog-single__meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.blog-single__share-label {
  font-weight: 600;
  color: #17181A;
  font-size: 14px;
}

.blog-single__meta-right .caia-social-share {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-single__thumb {
  overflow: hidden;
  border-radius: 16px;
  margin-bottom: 28px;
}

.blog-single__thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.blog-single__content {
  color: #475569;
  font-size: 16px;
  line-height: 1.8;
}

.blog-single__content h2,
.blog-single__content h3 {
  color: #17181A;
  font-weight: 700;
  margin: 32px 0 14px 0;
}

.blog-single__content h2 {
  font-size: 22px;
}

.blog-single__content h3 {
  font-size: 18px;
}

.blog-single__content p {
  margin: 0 0 18px 0;
}

.blog-single__content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 10px 0 20px 0;
}

.blog-single__content ul,
.blog-single__content ol {
  padding-left: 20px;
  margin: 0 0 18px 0;
}

.blog-single__content li {
  margin-bottom: 8px;
}

/* Sidebar dính theo khi cuộn trang (giống sidebar "Thông tin dự án") */
.blog-single__sidebar {
  position: relative;
}

@media (min-width: 1024px) {
  .blog-single__sidebar {
    position: sticky;
    top: 196px;
    /* QUAN TRỌNG: phải là "stretch", không phải "start". Đã kiểm chứng bằng
       test độc lập: với align-self:start, sticky hoàn toàn không bám (cuộn
       trôi thẳng theo trang, đo được offset lệch đúng bằng số px đã cuộn -
       tức là bị coi như position:static). Đổi thành "stretch" thì bám đúng
       vị trí top đã khai báo khi cuộn qua. Đây là cơ chế containing-block của
       CSS Grid cho phần tử sticky, không phải vấn đề thẩm mỹ. */
    align-self: start;
  }
}

/* Ô tìm kiếm */
.blog-single__sidebar .search-form {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  background: #ffffff;
  border: 1px solid #e9edf5;
  border-radius: 100px;
  box-shadow: 0 10px 25px rgba(23, 56, 108, 0.08);
  overflow: hidden;
  padding: 5px 5px 5px 4px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.blog-single__sidebar .search-form:focus-within {
  border-color: #58AD40;
  box-shadow: 0 10px 28px rgba(88, 173, 64, 0.18);
}

.blog-single__sidebar .search-form-input {
  flex-grow: 1;
  min-width: 0;
}

/* Form tìm kiếm của theme dùng class riêng "search-form-input" /
   "search-form-submit" (không phải class chuẩn "search-field"/"search-submit"
   của WordPress core), nên phải nhắm đúng 2 class này. */
.blog-single__sidebar .search-form-input {
  width: 100%;
  border: none !important;
  outline: none;
  padding: 12px 14px 12px 40px !important;
  font-size: 14px;
  background: no-repeat 14px center / 16px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  color: #17181A;
  height: auto !important;
  margin: 0 !important;
}

.blog-single__sidebar .search-form-input::placeholder {
  color: #94a3b8 !important;
  font-style: normal !important;
}

.blog-single__sidebar .search-form-submit {
  border: none !important;
  cursor: pointer;
  background: linear-gradient(115deg, #58AD40, #17386C) !important;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  padding: 12px 22px !important;
  border-radius: 100px;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
  margin: 0 !important;
}

.blog-single__sidebar .search-form-submit:hover {
  opacity: 0.9;
}

.blog-single__latest-heading {
  font-size: 18px;
  font-weight: 700;
  color: #17181A;
  margin: 0 0 18px 0;
}

.blog-single__latest-item {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  margin-bottom: 16px;
}

.blog-single__latest-item:last-child {
  margin-bottom: 0;
}

.blog-single__latest-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: #f2f4f8;
  display: block;
}

.blog-single__latest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.blog-single__latest-title {
  font-size: 14px;
  font-weight: 600;
  color: #17181A;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s ease;
}

.blog-single__latest-item:hover .blog-single__latest-title {
  color: #58AD40;
}
