/*
 * Chuyên mục BIM xây dựng (/bim-xay-dung/, category term 71) — BIM Knowledge Hub.
 * Chỉ nạp khi is_category( 'bim-xay-dung' ) && ! is_search() (functions.php). Mọi
 * selector scope theo .vdt-bimhub-* (root .vdt-bim-hub) hoặc body.category-bim-xay-dung.
 *
 * Cùng khung với Hero chuyên mục khác. Nhận diện riêng: cobalt/cyan, mô hình BIM +
 * CDE; violet chỉ ở dấu chấm dòng Model • Coordinate • Manage • CDE.
 * Ảnh nền ở wp-content/uploads/anh-nen/, URL do PHP truyền qua
 * --vdt-bimhub-bg-desktop / --vdt-bimhub-bg-mobile; thiếu biến thì chỉ còn gradient.
 */

.vdt-bimhub-hero {
  --vdt-bimhub-navy: #081b33;
  --vdt-bimhub-blue: #1e5bff;
  --vdt-bimhub-cyan: #00b8d9;
  --vdt-bimhub-teal: #0ea5a8;
  --vdt-bimhub-ice: #eef8ff;
  --vdt-bimhub-violet: #6366f1;
  --vdt-bimhub-muted: #475467;
  --vdt-bimhub-base: #eef6fd;

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

/* Ảnh mô hình BIM desktop: mép trái tòa nhà (50% bề rộng ảnh) neo sát cột chữ,
   đám mây CDE phía trên; hai mép ảnh làm mờ bằng mask để hòa vào nền. */
.vdt-bimhub-hero::before {
  --vdt-bimhub-img-w: clamp(900px, 62vw, 1150px);
  content: "";
  position: absolute;
  z-index: -2;
  top: 50%;
  left: calc(max(32px, 50vw - 738px) + 600px - .5 * var(--vdt-bimhub-img-w));
  width: var(--vdt-bimhub-img-w);
  aspect-ratio: 1672 / 941;
  transform: translateY(calc(-50% + 8px));
  background: var(--vdt-bimhub-bg-desktop, none) center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 86%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 86%, transparent 100%);
  pointer-events: none;
}

/* Lớp phủ sáng phía cột chữ. */
.vdt-bimhub-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) 46%);
  pointer-events: none;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

.vdt-bimhub-hero__course svg,
.vdt-bimhub-quick__footer svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vdt-bimhub-hero .vdt-bimhub-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-bimhub-hero__topics span {
  margin: 0 6px;
  color: var(--vdt-bimhub-violet);
}

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

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

.vdt-bimhub-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-bimhub-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-bimhub-hero__pills a:hover,
.vdt-bimhub-hero__pills a:focus-visible {
  color: var(--vdt-bimhub-blue);
  border-color: var(--vdt-bimhub-blue);
  background: var(--vdt-bimhub-ice);
}

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

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

.vdt-bimhub-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-bimhub-rise .45s ease-out both;
}

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

.vdt-bimhub-quick__badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--vdt-bimhub-blue), var(--vdt-bimhub-cyan));
}

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

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

.vdt-bimhub-quick .vdt-bimhub-quick__sub {
  margin: 2px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

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

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

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

.vdt-bimhub-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-bimhub-navy);
  font-weight: 600;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

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

.vdt-bimhub-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-bimhub-quick__link:hover,
.vdt-bimhub-quick__link:focus-visible {
  color: var(--vdt-bimhub-blue);
  background: #f2f8ff;
}

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

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

/* Đường tách nhẹ với chức năng Đào tạo tại đơn vị. */
.vdt-bimhub-quick__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  margin: 4px -16px 0;
  padding: 8px 24px 2px;
  border-top: 1px solid #e8eef6;
  color: var(--vdt-bimhub-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 0 0 22px 22px;
  transition: color .2s ease;
}

.vdt-bimhub-quick__footer:hover {
  color: var(--vdt-bimhub-navy);
}

.vdt-bimhub-quick__footer:hover svg {
  transform: translateX(2px);
}

.vdt-bimhub-quick__footer svg {
  transition: transform .2s ease;
}

@keyframes vdt-bimhub-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-bim-xay-dung .vdt-blog-archive {
  padding-top: 48px;
}

body.category-bim-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-bimhub-hero::before,
  .vdt-bimhub-hero::after {
    display: none;
  }

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

  .vdt-bimhub-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-bimhub-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-bimhub-bg-desktop, none) 100% 50% / auto 100% no-repeat;
  }

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

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

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

  .vdt-bimhub-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-bimhub-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-bimhub-bg-desktop, none) 100% 100% / auto min(100%, 400px) no-repeat;
  }

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

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

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

  .vdt-bimhub-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-bimhub-hero__content {
    max-width: none;
    min-height: 0;
    margin: -22px calc(50% - 50vw) 0;
    padding: 22px calc(50vw - 50%) min(70vw, 290px);
    background:
      linear-gradient(180deg, rgba(247, 251, 255, .92) 0%, rgba(247, 251, 255, .8) 50%, rgba(247, 251, 255, 0) 72%),
      var(--vdt-bimhub-bg-mobile, none) center calc(100% + 22vw) / 100% auto no-repeat,
      var(--vdt-bimhub-base);
  }

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

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

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

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

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

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

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

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

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

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

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

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

  .vdt-bimhub-quick__footer {
    min-height: 44px;
    margin: 6px -12px 0;
    padding: 10px 20px 4px;
  }

  body.category-bim-xay-dung .vdt-blog-archive {
    padding-top: 36px;
  }

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

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

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

  .vdt-bimhub-hero__actions .vdt-btn:hover,
  .vdt-bimhub-quick__footer:hover svg {
    transform: none;
  }
}
