/* Font: Figma ghi typeface là "UMobile Display" nhưng site KHÔNG có @font-face nào tên đó
   (wwwroot/css chỉ khai Unbeatable / Nunito / swiper-icons). Site render bằng "Unbeatable" —
   khai "UMobile Display" đơn lẻ sẽ rơi về Arial và lệch typeface với cả trang.

   Content Card Grid — SRS Part16 §3.3 · Figma 18375-11657 / 18375-10954 / 18375-11662 / 18418-125716 / 3813-48451
   Container (max-width 1280 + padding-inline 16) is the engine shell's job — not declared here. */

.uiw-content-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
  box-sizing: border-box;
}

/* Khi một widget render nhiều bản ghi (displayMode "all"), hai lưới liền nhau phải có khe —
   nếu không, card cuối lưới trên và card đầu lưới dưới chạm nhau và đọc thành MỘT card. */
.uiw-content-card-grid + .uiw-content-card-grid {
  margin-top: 24px;
}

.uiw-content-card-grid-card,
.uiw-content-card-grid-text,
.uiw-content-card-grid-actions,
.uiw-content-card-grid-title,
.uiw-content-card-grid-desc,
.uiw-content-card-grid-cta {
  box-sizing: border-box;
}

/* Card — Figma: bg #fff, radius 8, shadow 0 0 7 rgba(0,0,0,.12), padding 24/24/12/24,
   gap 24 giữa khối chữ và nút; space-between để nút luôn ghim đáy (SRS #4: gap 24px là tối thiểu). */
.uiw-content-card-grid-card {
  position: relative;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 7px rgba(0, 0, 0, 0.12);
  padding: 24px 24px 12px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  row-gap: 24px;
  /* default = 4 cột: (100% - 3*24) / 4. AB#135387 — flex-grow PHẢI là 0: hàng cuối thiếu card
     thì card lẻ giữ nguyên khổ và đứng thẳng cột với card đầu hàng trên, KHÔNG giãn kín hàng
     (BA chốt 09/09/2026: "1 card thì hiện ở vị trí đầu bên trái = với card 1, ko căn full lề"). */
  flex: 0 1 calc((100% - 72px) / 4);
  max-width: 100%;
  /* min-width:auto (mặc định của flex item) khiến 1 từ dài không ngắt được đẩy card vượt 294px
     và làm vỡ số card/hàng. Editor nhập URL/mã dài là kịch bản thật. */
  min-width: 0;
}

.uiw-content-card-grid[data-per-row="3"] .uiw-content-card-grid-card {
  flex-basis: calc((100% - 48px) / 3);
}

.uiw-content-card-grid[data-per-row="2"] .uiw-content-card-grid-card {
  flex-basis: calc((100% - 24px) / 2);
}

/* 1 per row: KHÔNG kéo full 1248px — giữ chiều rộng của mức 2-per-row (612px), căn giữa,
   và MỖI card một hàng riêng (SRS #1: "subsequent items each get their own centred row"). */
.uiw-content-card-grid[data-per-row="1"] {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
}

.uiw-content-card-grid[data-per-row="1"] .uiw-content-card-grid-card {
  flex: 0 0 auto;
  width: calc((100% - 24px) / 2);
}

/* Lớp phủ link: chỉ khi card có ĐÚNG 1 nút (gap A3) */
.uiw-content-card-grid-cardlink {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  z-index: 0;
  text-decoration: none;
}

.uiw-content-card-grid-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  row-gap: 4px;
  /* AB#133339 — overflow-wrap is inherited, so declaring it on the WRAPPER protects any node the
     HTML parser may re-parent out of .uiw-content-card-grid-desc / -title (rich-text fields emit
     <p>, and a nested <p> gets unwrapped into a sibling). Without this the escaped node inherits
     the default "normal" and a long unbroken string tears through the card. */
  overflow-wrap: anywhere;
  min-width: 0;
}

/* Chỉ card CÓ lớp phủ link (đúng 1 nút) mới phải nhường click cho lớp phủ.
   Áp pointer-events:none cho mọi card sẽ làm chữ ở card 0 hoặc ≥2 nút cũng không bôi đen/copy được. */
.uiw-content-card-grid-card[data-linked="1"] .uiw-content-card-grid-text {
  pointer-events: none;
}

.uiw-content-card-grid-title {
  margin: 0;
  /* AB#132345 — SRS Part16 §Content Card Grid #2/#3/#4 name the face "UMobile Display"; it was
     absent from the stack entirely. Kept ahead of "Unbeatable" (the family actually served, whose
     OpenType name IS "UMobile Display"), matching every other widget in this set. */
  font-family: 'Unbeatable','Arial','Helvetica Neue','Helvetica',sans-serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.2px;
  color: #000000;
  overflow-wrap: anywhere;
}

.uiw-content-card-grid-desc {
  margin: 0;
  /* AB#132345 — SRS Part16 §Content Card Grid #2/#3/#4 name the face "UMobile Display"; it was
     absent from the stack entirely. Kept ahead of "Unbeatable" (the family actually served, whose
     OpenType name IS "UMobile Display"), matching every other widget in this set. */
  font-family: 'Unbeatable','Arial','Helvetica Neue','Helvetica',sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 0;
  color: #4d4d4d;
  /* AB#133911 — bỏ white-space:pre-line. Description là rich text (<p>/<br> mang ngắt dòng thật);
     pre-line biến mọi \n thô mà editor chèn giữa các từ thành line-break → mỗi từ một dòng. */
  overflow-wrap: anywhere;
}

.uiw-content-card-grid-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 8px;
}

.uiw-content-card-grid-cta {
  display: inline-flex;
  align-items: center;
  column-gap: 4px;
  /* AB#132345 — SRS Part16 §Content Card Grid #2/#3/#4 name the face "UMobile Display"; it was
     absent from the stack entirely. Kept ahead of "Unbeatable" (the family actually served, whose
     OpenType name IS "UMobile Display"), matching every other widget in this set. */
  font-family: 'Unbeatable','Arial','Helvetica Neue','Helvetica',sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: #ff7300;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.uiw-content-card-grid-cta:hover,
.uiw-content-card-grid-cta:focus {
  text-decoration: underline;
}

/* Mũi tên phải của Figma, dựng bằng border chevron (không cần asset).
   Đây là FALLBACK cho engine không hỗ trợ mask — xem khối @supports ngay dưới. */
.uiw-content-card-grid-cta::after {
  content: "";
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

/* AB#133442 — comment cũ ghi "16x16" nhưng hình thật chỉ 8x8: width/height 6px + 2px border.
   QA đo đúng 8x8. Border-chevron không thể vừa cho hộp ĐÚNG 16x16 vừa giữ tỉ lệ mũi tên
   (hình vuông xoay 45° có bounding box theo đường chéo), nên dùng SVG mask: hộp đúng 16x16 theo
   icon frame của Figma, nét mũi tên đúng tỉ lệ, và vẫn ăn currentColor nên cả biến thể cam và
   trắng đều đúng. Bọc trong @supports để engine không có mask giữ nguyên chevron cũ thay vì
   hiện một khối vuông đặc. */
@supports ((-webkit-mask-image: url("")) or (mask-image: url(""))) {
  .uiw-content-card-grid-cta::after {
    width: 16px;
    height: 16px;
    border: 0;
    transform: none;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: 16px 16px;
            mask-size: 16px 16px;
  }
}

/* Tablet 768–1023px — KHÔNG có trong SRS/Figma (chỉ định nghĩa 1248 và 390). Nếu để nguyên 4 cột,
   ở 768px mỗi card chỉ còn ~166px và title 20px vỡ. Tạm hạ 4/3 cột xuống 2 cột — xem gap A5. */
@media (min-width: 768px) and (max-width: 1023px) {
  .uiw-content-card-grid[data-per-row="4"] .uiw-content-card-grid-card,
  .uiw-content-card-grid[data-per-row="3"] .uiw-content-card-grid-card,
  .uiw-content-card-grid-card {
    flex-basis: calc((100% - 24px) / 2);
  }
}

/* Mobile — Figma node 3813-48451: 1 cột, card full width, padding 24/16/12/16,
   title 18/24 ls -0.18, description 14/18. Khoảng cách giữa card giữ 24px. */
@media (max-width: 767px) {
  .uiw-content-card-grid,
  .uiw-content-card-grid[data-per-row="1"],
  .uiw-content-card-grid[data-per-row="2"],
  .uiw-content-card-grid[data-per-row="3"],
  .uiw-content-card-grid[data-per-row="4"] {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 24px;
  }

  .uiw-content-card-grid-card,
  .uiw-content-card-grid[data-per-row="1"] .uiw-content-card-grid-card,
  .uiw-content-card-grid[data-per-row="2"] .uiw-content-card-grid-card,
  .uiw-content-card-grid[data-per-row="3"] .uiw-content-card-grid-card {
    flex: 0 0 auto;
    width: 100%;
    padding: 24px 16px 12px 16px;
  }

  .uiw-content-card-grid-title {
    font-size: 18px;
    line-height: 24px;
    letter-spacing: -0.18px;
  }

  .uiw-content-card-grid-desc {
    font-size: 14px;
    line-height: 18px;
  }
}

/* R3 BA 21/10: the title is rich text. Editor runs keep their colour and weight; size, line height and face follow
   the title (AB#137661: the editor stores font-size:16px inline). */
.uiw-content-card-grid-title .uiw-content-card-grid-tline { display: block; }
.uiw-content-card-grid-title * { font-size: inherit !important; line-height: inherit !important; font-family: inherit !important; letter-spacing: inherit !important; margin: 0; }
