/* ==========================================================================
   Sunme — Trang con + trang hệ thống (G4)
   Quy ước G4: MỘT file page.css cho toàn bộ trang con (hero, nội dung
   Gutenberg, nhóm dịch vụ, số liệu, giá trị) + archive / single / search /
   404. Chỉ trang Liên hệ có thêm file riêng contact.css (lưới liên hệ +
   hộp form) vì bố cục 2 cột đó không dùng ở đâu khác. Enqueue có điều
   kiện: page.css chỉ load ở trang KHÔNG phải trang chủ (xem functions.php).
   Mọi màu dùng biến, mọi khoảng cách dùng --space-*. KHÔNG chứa @media —
   mọi breakpoint nằm trong responsive.css.
   ========================================================================== */

/* --- Hero trang con: ảnh thành phố + lớp phủ đỏ, H1 36px/700 --- */
.sunme-page-hero {
  background:
    linear-gradient(var(--hero-overlay), var(--hero-overlay)),
    url(../images/page-hero-hcmc.webp) center / cover no-repeat;
  padding-block: var(--space-64);
  color: var(--white);
}

.sunme-page-hero h1 {
  color: var(--white);
  font-size: var(--fs-h1-page);
  font-weight: 700;
  line-height: var(--lh-h1);
  margin: 0 0 var(--space-12);
}

.sunme-page-hero-lead {
  color: var(--white-75);
  font-size: var(--fs-lead);
  margin: 0;
  max-width: 640px;
}

.sunme-breadcrumb {
  font-size: var(--fs-small);
  color: var(--white-70);
  margin-bottom: var(--space-16);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.sunme-breadcrumb a {
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
}

.sunme-breadcrumb a:hover {
  /* G5S: bỏ gạch chân; hover đổi sang đỏ nhạt cho thấy rõ trên hero
     tối (trước đây trắng -> trắng + gạch chân, bỏ gạch là mất hẳn
     phản hồi). */
  color: var(--red-pale);
}

.sunme-breadcrumb .lucide {
  width: 13px;
  height: 13px;
  vertical-align: -1px;
}

/* --- Thân trang --- */
.sunme-page-body {
  padding-block: var(--section-pad);
}

/* Case Study: mở bài sát lưới dự án (section dự án đã có divider + padding). */
.sunme-page-body--tight {
  padding-bottom: 0;
}

.sunme-page-content > :last-child {
  margin-bottom: 0;
}

/* --- Nội dung Gutenberg chung --- */
.sunme-page-content h2 {
  margin-top: 0;
}

.sunme-page-content h2:not(:first-child) {
  margin-top: var(--space-40);
}

.sunme-page-content ul,
.sunme-page-content ol {
  padding-left: 1.25em;
  margin: 0 0 var(--space-16);
}

.sunme-page-content ul li,
.sunme-page-content ol li {
  margin-bottom: var(--space-8);
}

.sunme-page-content ul li:last-child,
.sunme-page-content ol li:last-child {
  margin-bottom: 0;
}

/* Ảnh trong nội dung: bo góc + shadow như ảnh Giới thiệu (G2). */
.sunme-page-content .wp-block-image {
  margin: 0 0 var(--space-24);
}

.sunme-page-content .wp-block-image:last-child {
  margin-bottom: 0;
}

.sunme-page-content .wp-block-image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: block;
  width: 100%;
  height: auto;
}

/* Nút Gutenberg: cùng hệ nút chính (.sunme-btn-primary). */
.sunme-page-content .wp-block-buttons {
  display: flex;
  gap: var(--space-12);
  flex-wrap: wrap;
  margin: 0 0 var(--space-16);
}

.sunme-page-content .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  min-height: 44px;
  padding: var(--space-12) var(--space-24);
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--grad-btn);
  color: var(--white);
  box-shadow: var(--shadow-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-base),
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.sunme-page-content .wp-block-button__link:hover {
  background: var(--red-dark);
  color: var(--white);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

/* --- Giới thiệu: 2 cột chữ | ảnh --- */
.sunme-about-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-40);
  align-items: start;
  margin-bottom: var(--space-40);
}

.sunme-about-split .wp-block-image img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Hàng 4 ô số liệu: lưới + ô dùng lại about.css (.sunme-about-stats /
   .sunme-odo-box...); ở đây chỉ ép ô cao bằng nhau trong cột Gutenberg. */
.sunme-page-stats .wp-block-column > .sunme-odo-box {
  height: 100%;
}

/* Khối giá trị: panel tint + 3 thẻ (thẻ dùng lại solutions.css). */
.sunme-page-values {
  background-color: var(--bg-tint);
  border-radius: var(--radius-lg);
  padding: var(--space-40);
  margin-top: var(--space-40);
}

.sunme-page-values h2 {
  text-align: center;
  margin-bottom: var(--space-32);
}

.sunme-value-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-24);
  align-items: stretch;
}

/* --- Dịch vụ: 3 nhóm, mỗi nhóm một anchor #seo/#ads/#automation --- */
.sunme-service-group {
  scroll-margin-top: 120px;
  padding-block: var(--space-40);
}

.sunme-service-group:first-child {
  padding-top: 0;
}

.sunme-service-group:last-child {
  padding-bottom: 0;
}

.sunme-service-group + .sunme-service-group {
  border-top: 1px solid var(--bg-divider);
}

.sunme-service-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-40);
  align-items: center;
}

.sunme-service-cols .wp-block-image {
  margin-bottom: 0;
}

.sunme-service-cols .wp-block-image img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Khung caption .wp-caption: Classic Editor ghi sẵn width cố định inline
   (300px lúc ảnh cỡ Medium, 1024px lúc cỡ Large). Bắt buộc width 100%
   !important để đè width inline đó — đo live 30/11: .wp-caption không có
   max-width nào, nên chỉ đổi ảnh sang Large mà không có rule này thì khung
   1024px sẽ tràn cột 580px. Ảnh Dịch vụ là 4:3 (v3, nối thêm cảnh từ v2 16/9
   30/11) nên object-fit cover không cắt gì. */
.sunme-service-cols .wp-caption {
  width: 100% !important;
  max-width: 100%;
}

.sunme-service-group h2 {
  margin-bottom: var(--space-12);
}

.sunme-service-group .sunme-lead {
  margin-bottom: var(--space-24);
}

.sunme-service-group .sunme-svc-list {
  margin-bottom: var(--space-24);
}

/* Mũi tên cuối mỗi link dịch vụ con: Gutenberg list-item không giữ được
   SVG inline khi admin sửa (RichText lược bỏ), nên vẽ bằng mask từ file
   icon của theme thay vì chèn <svg> vào nội dung (xem migrate-g4.php).
   Thẻ dịch vụ ở trang chủ (PHP) vẫn dùng <svg> inline như G2. */
.sunme-page-content .sunme-svc-list a::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background-color: var(--red);
  -webkit-mask: url(../icons/arrow-up-right.svg) no-repeat center / contain;
  mask: url(../icons/arrow-up-right.svg) no-repeat center / contain;
}

.sunme-service-group .wp-block-buttons {
  margin-bottom: 0;
}

/* --- Case Study: mở bài căn giữa --- */
.sunme-case-intro {
  text-align: center;
}

.sunme-case-intro p {
  color: var(--ink-body);
  max-width: 640px;
  margin-inline: auto;
}

/* --- Archive / tìm kiếm --- */
.sunme-archive-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
  margin-top: var(--space-32);
}

.sunme-archive-item {
  border-top: 1px solid var(--line);
  padding-top: var(--space-24);
}

.sunme-archive-item h2 {
  font-size: var(--fs-lead); /* G5S-8: tiêu đề thẻ lưu trữ = 17px chuẩn chung */
  margin-bottom: var(--space-8);
}

.sunme-archive-item p {
  color: var(--ink-body);
  margin-bottom: 0;
}

.sunme-archive-empty {
  color: var(--ink-muted);
  font-size: var(--fs-lead);
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
}

.sunme-search-count {
  color: var(--ink-muted);
  margin-bottom: var(--space-32);
}

/* Phân trang WordPress: nút số + prev/next. */
.sunme-archive .nav-links,
.sunme-search-results .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  justify-content: center;
  margin-top: var(--space-40);
}

.sunme-archive .nav-links a,
.sunme-archive .nav-links span,
.sunme-search-results .nav-links a,
.sunme-search-results .nav-links span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-heading);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base);
}

.sunme-archive .nav-links a:hover,
.sunme-search-results .nav-links a:hover {
  background-color: var(--bg-mega-active);
  border-color: var(--red-line);
  color: var(--red-dark);
  text-decoration: none;
}

.sunme-archive .nav-links span.current,
.sunme-search-results .nav-links span.current {
  background: var(--grad-btn);
  border-color: transparent;
  color: var(--white);
}

/* --- Form tìm kiếm (404 + trang kết quả) --- */
.sunme-search-form {
  display: flex;
  gap: var(--space-12);
  max-width: 640px;
  margin: 0 auto var(--space-32);
}

.sunme-search-results .sunme-search-form {
  margin-inline: 0;
}

.sunme-search-input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-xs);
  padding: var(--space-12) var(--space-16);
  font-family: inherit;
  font-size: var(--fs-card);
  color: var(--ink-body);
  background-color: var(--input-bg);
  transition: border-color var(--transition-base),
    background-color var(--transition-base);
}

.sunme-search-input:focus {
  outline: none;
  border-color: var(--red);
  background-color: var(--white);
}

.sunme-search-submit {
  flex: none;
}

.sunme-search-submit .lucide {
  width: 18px;
  height: 18px;
}

/* --- Single: cột đọc hẹp, meta, ảnh đại diện, nút quay lại --- */
.sunme-single-wrap {
  max-width: 860px;
  margin-inline: auto;
}

/* --- Single: sidebar trái "nổi bật" (G5P) ---
   Lưới 2 cột: sidebar 320px TRÁI (lệnh Lobe — DIWE đặt phải) + nội
   dung phải (giữ cột đọc 860px). Tablet/mobile: sidebar xếp dưới
   nội dung (xem responsive.css). */
.sunme-single-layout--has-sidebar {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--space-48);
  align-items: start;
}

.sunme-single-main {
  min-width: 0;
}

.sunme-single-main .sunme-single-wrap {
  margin-inline: 0;
}

.sunme-single-sidebar-title {
  margin-bottom: var(--space-24);
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-lead); /* G5S-8: tiêu đề khối sidebar = 17px chuẩn chung */
  font-weight: 700;
  line-height: var(--lh-heading);
  color: var(--ink-heading);
  position: relative;
}

/* Gạch chân nhấn đỏ Sunme dưới tiêu đề khối (48×3px, theo mẫu
   gạch chân H2 bài viết §3.9). */
.sunme-single-sidebar-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 48px;
  height: 3px;
  background-color: var(--red-mid);
}

/* G5S-14 (Lobe 24/11 22:18, theo mẫu Videmi): gạch đầu heading TỰ
   ĐỘNG trong nội dung bài viết — không cần markup tay. H2: đường kẻ
   mảnh full-width + đoạn đỏ 48x3px ở đầu (đúng pattern tiêu đề
   sidebar phía trên, chỉ thêm đường kẻ mảnh); H3: chỉ đường kẻ mảnh.
   Phạm vi CHỈ .sunme-entry-content (single post + single project,
   single.php) — KHÔNG áp ra H2 section trang chủ, hero trang con,
   tiêu đề sidebar, "Bài viết liên quan" hay heading nào khác. */
.sunme-entry-content h2 {
  position: relative;
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--line);
}

.sunme-entry-content h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 48px;
  height: 3px;
  background-color: var(--red-mid);
}

.sunme-entry-content h3 {
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--line);
}

/* G6X (Lobe 28/11 16:36 + sửa màu 16:40): bảng trong nội dung bài
   viết — theo bố cục mẫu screenshot anh gửi, nhưng màu ĐỎ SUNME chủ
   đạo (không dùng xanh lá của mẫu), và BO 4 GÓC theo yêu cầu.
   Phạm vi CHỈ .sunme-entry-content (single post + single project).
   border-collapse: separate + border-spacing: 0 để bo góc hoạt động
   (collapse sẽ cắt mất radius); radius phụ trên 4 ô góc để nền
   header / hàng cuối không tràn ra ngoài góc bo. */
.sunme-entry-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--red-mid);
  border-radius: 12px;
  overflow: hidden;
  margin: var(--space-24) 0;
  background-color: #fff;
  font-size: var(--fs-body);
  line-height: 1.6;
}

.sunme-entry-content table th,
.sunme-entry-content table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--red-line);
  border-right: 1px solid var(--red-line);
}

.sunme-entry-content table th:last-child,
.sunme-entry-content table td:last-child {
  border-right: none;
}

.sunme-entry-content table thead th {
  background-color: var(--red-mid);
  color: #fff;
  font-weight: 700;
  vertical-align: middle;
  border-bottom: none;
  border-right: none;
}

.sunme-entry-content table tbody tr:nth-child(even) td {
  background-color: var(--red-soft);
}

.sunme-entry-content table tbody tr:last-child td {
  border-bottom: none;
}

/* Bo 4 góc: radius trên 4 ô góc (12px trừ 1px viền = 11px). */
.sunme-entry-content table thead tr:first-child th:first-child {
  border-top-left-radius: 11px;
}

.sunme-entry-content table thead tr:first-child th:last-child {
  border-top-right-radius: 11px;
}

.sunme-entry-content table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 11px;
}

.sunme-entry-content table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 11px;
}

/* Bảng không có thead: bo góc trên cho hàng đầu của tbody. */
.sunme-entry-content table tbody:first-child tr:first-child td:first-child {
  border-top-left-radius: 11px;
}

.sunme-entry-content table tbody:first-child tr:first-child td:last-child {
  border-top-right-radius: 11px;
}

/* Mobile: bảng rộng cuộn ngang thay vì vỡ layout. */
@media (max-width: 767px) {
  .sunme-entry-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 15px;
  }

  .sunme-entry-content table th,
  .sunme-entry-content table td {
    padding: 10px 12px;
  }
}

.sunme-single-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-16);
}

.sunme-single-sidebar-link {
  display: flex;
  gap: var(--space-16);
  align-items: flex-start;
  text-decoration: none;
}

.sunme-single-sidebar-thumb {
  flex: none;
  width: 96px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-tint);
}

.sunme-single-sidebar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-base);
}

.sunme-single-sidebar-link:hover .sunme-single-sidebar-thumb img {
  transform: scale(1.06);
}

/* G5X: mục sidebar dự án chưa đủ nội dung chi tiết thì KHÔNG link —
   tắt zoom ảnh + đỏ tiêu đề khi hover (không gợi ý bấm được). */
.sunme-single-sidebar-link--nolink:hover .sunme-single-sidebar-thumb img {
  transform: none;
}

.sunme-single-sidebar-link--nolink:hover .sunme-single-sidebar-item-title {
  color: inherit;
}

.sunme-single-sidebar-text {
  min-width: 0;
  display: grid;
  gap: var(--space-4);
}

.sunme-single-sidebar-cat {
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--ink-muted);
}

.sunme-single-sidebar-item-title {
  font-size: var(--fs-card);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-heading);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sunme-single-sidebar-link:hover .sunme-single-sidebar-item-title {
  color: var(--red-mid);
}

/* G5Z3 (Lobe 26/11 07:33): ô kết quả dự án (.sunme-project-result)
   đã bỏ hẳn khỏi render — rule này xóa cùng vòng. */

.sunme-entry-meta {
  color: var(--ink-muted);
  font-size: var(--fs-small);
  margin-bottom: var(--space-24);
}

.sunme-entry-meta a {
  color: var(--ink-muted);
  font-weight: 600;
}

.sunme-entry-meta a:hover {
  color: var(--red-dark);
}

.sunme-entry-thumbnail {
  margin-bottom: var(--space-32);
}

.sunme-entry-thumbnail img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: block;
  width: 100%;
  height: auto;
}

.sunme-single-back {
  margin-top: var(--space-40);
  margin-bottom: 0;
}

.sunme-single-back .lucide {
  width: 18px;
  height: 18px;
}

.sunme-related .sunme-section-head {
  margin-bottom: var(--space-32);
}

/* --- 404 --- */
.sunme-not-found-inner {
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
}

.sunme-not-found-code {
  font-size: 97px;
  font-weight: 700;
  line-height: 1;
  margin: 0 0 var(--space-16);
  background: var(--grad-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sunme-not-found-inner > p:not(.sunme-not-found-code) {
  color: var(--ink-body);
}

.sunme-not-found-actions {
  display: flex;
  gap: var(--space-12);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-32);
  margin-bottom: 0;
}
