/*
 * Hub "Chứng chỉ hành nghề xây dựng" (/chung-chi-hanh-nghe-xay-dung/) — CHUYÊN MỤC
 * term 12. Chỉ nạp khi is_category( 'chung-chi-hanh-nghe-xay-dung' ) && ! is_search()
 * (functions.php). Mọi selector scope theo .vdt-cchnx-* (root .vdt-cchn-xd-topic)
 * hoặc body.category-chung-chi-hanh-nghe-xay-dung.
 *
 * Cùng khung với Hero chuyên mục Đấu thầu / BĐS / Chỉ huy trưởng / BIM. Nhận diện
 * riêng: xanh + teal, vàng institutional (#CFA23A) chỉ làm điểm nhấn; dải ghi chú
 * pháp lý dưới Hero. Ảnh nền ở wp-content/uploads/anh-nen/, URL do PHP truyền qua
 * --vdt-cchnx-bg-desktop / --vdt-cchnx-bg-mobile; thiếu biến thì chỉ còn gradient.
 */

.vdt-cchnx-hero {
  --vdt-cchnx-navy: #0b1f3a;
  --vdt-cchnx-blue: #1e5bff;
  --vdt-cchnx-cyan: #00b8d9;
  --vdt-cchnx-teal: #0e9f8a;
  --vdt-cchnx-gold: #cfa23a;
  --vdt-cchnx-gold-soft: #e6c875;
  --vdt-cchnx-ice: #f2f7ff;
  --vdt-cchnx-muted: #475467;
  --vdt-cchnx-base: #eef5fd;

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 16px 0 18px;
  background: linear-gradient(160deg, #f7fbff 0%, var(--vdt-cchnx-base) 55%, #e4eefb 100%);
  border-bottom: 1px solid rgba(214, 228, 244, .9);
}

/* Ảnh minh họa desktop: cụm Hạng 1-2-3 / chứng chỉ / khiên nằm giữa cột chữ và
   card. Mép trái cụm (49% bề rộng ảnh) đặt cách mép cột chữ ~630px; hai mép ảnh
   làm mờ bằng mask để hòa vào nền. */
.vdt-cchnx-hero::before {
  --vdt-cchnx-img-w: clamp(900px, 66vw, 1200px);
  content: "";
  position: absolute;
  z-index: -2;
  top: 50%;
  left: calc(max(32px, 50vw - 738px) + 630px - .49 * var(--vdt-cchnx-img-w));
  width: var(--vdt-cchnx-img-w);
  aspect-ratio: 1672 / 941;
  transform: translateY(calc(-62% + 14px));
  background: var(--vdt-cchnx-bg-desktop, none) center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 84%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 84%, transparent 100%);
  pointer-events: none;
}

/* Lớp phủ sáng phía cột chữ. */
.vdt-cchnx-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(247, 251, 255, .95) 0%, rgba(247, 251, 255, .8) 34%, rgba(247, 251, 255, 0) 48%);
  pointer-events: none;
}

.vdt-cchnx-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 640px) minmax(360px, 420px);
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

/* ---------- Cột nội dung ---------- */

.vdt-cchnx-hero .vdt-cchnx-hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--vdt-cchnx-blue);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.vdt-cchnx-hero .vdt-cchnx-hero__kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--vdt-cchnx-blue), var(--vdt-cchnx-cyan));
}

.vdt-cchnx-hero .vdt-cchnx-hero__title {
  margin: 0 0 14px;
  color: var(--vdt-cchnx-navy);
  font-size: clamp(2.25rem, 2.9vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -.02em;
}

.vdt-cchnx-hero .vdt-cchnx-hero__title span {
  color: var(--vdt-cchnx-blue);
}

.vdt-cchnx-hero .vdt-cchnx-hero__desc {
  max-width: 540px;
  margin: 0;
  color: var(--vdt-cchnx-muted);
  font-size: 16.5px;
  line-height: 1.65;
  text-wrap: pretty;
}

.vdt-cchnx-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.vdt-cchnx-hero__actions .vdt-btn {
  min-height: 48px;
  box-shadow: none;
}

.vdt-cchnx-hero__actions .vdt-btn--primary {
  box-shadow: 0 10px 24px rgba(30, 91, 255, .20);
}

.vdt-cchnx-hero__actions .vdt-btn:hover {
  transform: translateY(-1px);
}

.vdt-cchnx-hero .vdt-cchnx-hero__consult {
  color: var(--vdt-cchnx-blue);
  border-color: rgba(30, 91, 255, .35);
  background: rgba(255, 255, 255, .92);
}

.vdt-cchnx-hero .vdt-cchnx-hero__consult:hover {
  border-color: var(--vdt-cchnx-blue);
  background: #fff;
}

.vdt-cchnx-hero__consult svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vdt-cchnx-hero .vdt-cchnx-hero__topics {
  margin: 18px 0 0;
  color: #5b6b7f;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.vdt-cchnx-hero__topics span {
  margin: 0 6px;
  color: var(--vdt-cchnx-gold);
}

.vdt-cchnx-hero__pills ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.vdt-cchnx-hero .vdt-cchnx-hero__pills li {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.3;
}

.vdt-cchnx-hero__pills a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(190, 208, 232, .95);
  border-radius: 999px;
  color: var(--vdt-cchnx-navy);
  background: rgba(255, 255, 255, .86);
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.vdt-cchnx-hero__pills a:hover,
.vdt-cchnx-hero__pills a:focus-visible {
  color: var(--vdt-cchnx-blue);
  border-color: var(--vdt-cchnx-blue);
  background: var(--vdt-cchnx-ice);
}

.vdt-cchnx-hero__actions .vdt-btn:focus-visible,
.vdt-cchnx-hero__pills a:focus-visible,
.vdt-cchnx-quick__link:focus-visible,
.vdt-cchnx-quick__footer:focus-visible {
  outline: 3px solid rgba(30, 91, 255, .55);
  outline-offset: 2px;
}

/* ---------- Card Truy cập nhanh ---------- */

.vdt-cchnx-quick {
  padding: 14px 14px 4px;
  border: 1px solid rgba(196, 213, 236, .9);
  border-radius: 24px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 18px 44px rgba(11, 31, 58, .10);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: vdt-cchnx-rise .45s ease-out both;
}

.vdt-cchnx-quick__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 8px;
  border-bottom: 1px solid #e8eef6;
}

.vdt-cchnx-quick__badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--vdt-cchnx-navy);
  background: linear-gradient(135deg, var(--vdt-cchnx-gold), var(--vdt-cchnx-gold-soft));
}

.vdt-cchnx-quick__badge svg,
.vdt-cchnx-quick__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vdt-cchnx-quick .vdt-cchnx-quick__title {
  margin: 0;
  color: var(--vdt-cchnx-navy);
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

.vdt-cchnx-quick .vdt-cchnx-quick__sub {
  margin: 1px 0 0;
  color: #667085;
  font-size: 12.5px;
  line-height: 1.45;
}

.vdt-cchnx-quick__list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.vdt-cchnx-quick .vdt-cchnx-quick__list li {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.35;
}

.vdt-cchnx-quick__list li + li {
  border-top: 1px solid #eef2f7;
}

.vdt-cchnx-quick__link {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 3px 8px;
  border-radius: 14px;
  color: var(--vdt-cchnx-navy);
  font-weight: 600;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

.vdt-cchnx-quick__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--vdt-cchnx-blue);
  background: var(--vdt-cchnx-ice);
  transition: background .2s ease;
}

.vdt-cchnx-quick__chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #98a2b3;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(-90deg);
  transition: stroke .2s ease, transform .2s ease;
}

.vdt-cchnx-quick__link:hover,
.vdt-cchnx-quick__link:focus-visible {
  color: var(--vdt-cchnx-blue);
  background: #f2f7ff;
}

.vdt-cchnx-quick__link:hover .vdt-cchnx-quick__icon {
  background: rgba(30, 91, 255, .13);
}

.vdt-cchnx-quick__link:hover .vdt-cchnx-quick__chevron,
.vdt-cchnx-quick__link:focus-visible .vdt-cchnx-quick__chevron {
  stroke: var(--vdt-cchnx-blue);
  transform: rotate(-90deg) translateY(2px);
}

/* Link tư vấn hồ sơ tách riêng ở chân card (theo mockup). */
.vdt-cchnx-quick__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin: 6px 0 6px;
  padding: 6px 12px;
  border: 1px solid rgba(30, 91, 255, .14);
  border-radius: 14px;
  color: var(--vdt-cchnx-blue);
  background: var(--vdt-cchnx-ice);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease;
}

.vdt-cchnx-quick__footer svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}

.vdt-cchnx-quick__footer:hover,
.vdt-cchnx-quick__footer:focus-visible {
  border-color: rgba(30, 91, 255, .35);
  background: #e6efff;
}

.vdt-cchnx-quick__footer:hover .vdt-cchnx-quick__footer-arrow {
  transform: translateX(2px);
}

/* ---------- Ghi chú pháp lý dưới Hero ---------- */

.vdt-cchnx-note-wrap {
  margin-top: 16px;
}

body.vdt-page .vdt-cchnx-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid #dbe6f5;
  border-radius: 12px;
  color: #475467;
  background: #f5f9ff;
  font-size: 13.5px;
  line-height: 1.55;
}

.vdt-cchnx-note svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  fill: none;
  stroke: #1e5bff;
  stroke-width: 2;
  stroke-linecap: round;
}

@keyframes vdt-cchnx-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Danh sách bài viết bên dưới ---------- */

body.category-chung-chi-hanh-nghe-xay-dung .vdt-blog-archive {
  padding-top: 32px;
}

body.category-chung-chi-hanh-nghe-xay-dung #danh-sach-bai-viet {
  scroll-margin-top: 112px;
}

/* ---------- Tablet 768–1199: nội dung trên, card dưới ---------- */

@media (max-width: 1199px) {
  .vdt-cchnx-hero::before,
  .vdt-cchnx-hero::after {
    display: none;
  }

  .vdt-cchnx-hero {
    padding: 0 0 32px;
    background: linear-gradient(160deg, #f7fbff 0%, var(--vdt-cchnx-base) 55%, #e4eefb 100%);
  }

  .vdt-cchnx-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  /* Ảnh ngang cao bằng khối chữ, canh phải, tràn mép; chữ giới hạn 54% bề rộng. */
  .vdt-cchnx-hero__content {
    margin: 0 calc(50% - 50vw);
    padding: 36px calc(50vw - 50%) 34px;
    background:
      linear-gradient(90deg, rgba(247, 251, 255, .96) 0%, rgba(247, 251, 255, .86) 44%, rgba(247, 251, 255, 0) 60%),
      linear-gradient(180deg, rgba(247, 251, 255, 0) 68%, #f1f8fd 100%),
      var(--vdt-cchnx-bg-desktop, none) 100% 50% / auto 100% no-repeat;
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__content > * {
    max-width: 54%;
  }

  .vdt-cchnx-quick__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
  }

  .vdt-cchnx-quick__list li + li {
    border-top: 0;
  }

  .vdt-cchnx-quick__list li {
    border-bottom: 1px solid #eef2f7;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  /* Khối chữ cao hơn khi hẹp: giới hạn chiều cao ảnh để skyline không lấn sang cột chữ. */
  .vdt-cchnx-hero__content {
    background:
      linear-gradient(90deg, rgba(247, 251, 255, .96) 0%, rgba(247, 251, 255, .86) 44%, rgba(247, 251, 255, 0) 60%),
      linear-gradient(180deg, #f6fbfe 0%, #f6fbfe 12%, rgba(247, 251, 255, .7) 20%, rgba(247, 251, 255, 0) 34%, rgba(247, 251, 255, 0) 68%, #f1f8fd 100%),
      var(--vdt-cchnx-bg-desktop, none) 100% 100% / auto min(100%, 400px) no-repeat;
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__content > * {
    max-width: 52%;
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__topics {
    letter-spacing: .06em;
  }
}

/* ---------- Mobile <= 767: ảnh dọc, xếp chồng ---------- */

@media (max-width: 767px) {
  .vdt-cchnx-hero {
    padding: 22px 0 24px;
    background: linear-gradient(180deg, #f7fbff 0%, var(--vdt-cchnx-base) 100%);
  }

  .vdt-cchnx-hero__inner {
    gap: 0;
  }

  /* Ảnh dọc tràn mép, neo đáy khối nội dung: skyline hiện ở khoảng trống dưới
     pills; phần trời phía trên nằm sau chữ với lớp phủ sáng. */
  .vdt-cchnx-hero__content {
    max-width: none;
    min-height: 0;
    margin: -22px calc(50% - 50vw) 0;
    padding: 22px calc(50vw - 50%) min(64vw, 260px);
    background:
      linear-gradient(180deg, rgba(247, 251, 255, .92) 0%, rgba(247, 251, 255, .8) 50%, rgba(247, 251, 255, 0) 72%),
      var(--vdt-cchnx-bg-mobile, none) center calc(100% + 8vw) / 100% auto no-repeat,
      var(--vdt-cchnx-base);
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__content > * {
    max-width: none;
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__title {
    font-size: clamp(1.875rem, 8.4vw, 2.125rem);
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__desc {
    font-size: 16px;
  }

  .vdt-cchnx-hero__actions .vdt-btn {
    flex: 1 1 100%;
  }

  .vdt-cchnx-hero .vdt-cchnx-hero__topics {
    display: none;
  }

  .vdt-cchnx-hero__pills ul {
    margin-top: 18px;
  }

  .vdt-cchnx-hero__pills a {
    min-height: 44px;
    padding: 0 16px;
  }

  .vdt-cchnx-quick {
    position: relative;
    margin-top: -36px;
    padding: 16px 12px 8px;
    border-radius: 22px;
  }

  .vdt-cchnx-quick__list {
    display: block;
  }

  .vdt-cchnx-quick__list li {
    border-bottom: 0;
  }

  .vdt-cchnx-quick__list li + li {
    border-top: 1px solid #eef2f7;
  }

  .vdt-cchnx-quick__link {
    min-height: 52px;
  }

  .vdt-cchnx-quick__footer {
    min-height: 48px;
    margin: 8px 0 4px;
  }

  body.vdt-page .vdt-cchnx-note {
    font-size: 13px;
  }

  body.category-chung-chi-hanh-nghe-xay-dung .vdt-blog-archive {
    padding-top: 36px;
  }

  body.category-chung-chi-hanh-nghe-xay-dung #danh-sach-bai-viet {
    scroll-margin-top: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vdt-cchnx-quick {
    animation: none;
  }

  .vdt-cchnx-hero__actions .vdt-btn,
  .vdt-cchnx-hero__pills a,
  .vdt-cchnx-quick__link,
  .vdt-cchnx-quick__chevron,
  .vdt-cchnx-quick__footer,
  .vdt-cchnx-quick__footer svg {
    transition: none;
  }

  .vdt-cchnx-hero__actions .vdt-btn:hover {
    transform: none;
  }
}
