/* =========================================================
 * MUSK - SƠ ĐỒ CHU TRÌNH
 *
 * Element nằm trong Section / Row / Column có sẵn.
 * Không đặt container hoặc max-width tổng.
 *
 * Lưới ba cột: khối nội dung - ảnh - khối nội dung. Vị trí bốn
 * khối đặt tay theo nth-child chứ không để lưới tự xếp, vì thứ
 * tự đọc là 1 trên trái, 2 trên phải, 3 dưới phải, 4 dưới trái
 * - không khớp với bất kỳ chiều tự xếp nào của grid.
 *
 * Cỡ chữ tiêu đề khối và nội dung do ux-builder/typography.css
 * quyết định, ở đây không đặt lại.
 * ========================================================= */

.musk-process-cycle {
  position: relative;
  z-index: 0;
  isolation: isolate;
  width: 100%;
  padding: 100px 0 50px 0;
}

.musk-process-cycle,
.musk-process-cycle *,
.musk-process-cycle *::before,
.musk-process-cycle *::after {
  box-sizing: border-box;
}

.musk-process-cycle__inner {
  position: relative;
  z-index: 2;
  width: 100%;
}

/* =========================================================
 * HEADER
 * ========================================================= */

.musk-process-cycle__header {
  margin-bottom: 44px;
  text-align: center;
}

.musk-process-cycle__description {
  max-width: 720px;
  margin: 12px auto 0;
  color: #29394f;
  font-weight: 400;
}

/* =========================================================
 * LƯỚI SƠ ĐỒ
 * ========================================================= */

.musk-process-cycle__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
  width: 100%;
  column-gap: 40px;
  row-gap: 46px;
}

/* Ảnh chiếm cột giữa, cao suốt hai hàng. */

.musk-process-cycle__media {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 100%;
  margin: 0 auto;
}

.musk-process-cycle__media img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 !important;
  object-fit: contain;
  object-position: center;
}

/* Bốn khối quanh ảnh, theo chiều đọc 1 trên trái -> 2 trên phải
   -> 3 dưới phải -> 4 dưới trái. Khối thứ năm trở đi tự xếp tiếp.

   Đếm bằng :nth-child nên các khối phải là con đầu tiên của lưới:
   PHP in chúng ra trước ảnh, đúng vì thế. */

.musk-process-cycle__item:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.musk-process-cycle__item:nth-child(2) {
  grid-column: 3;
  grid-row: 1;
}

.musk-process-cycle__item:nth-child(3) {
  grid-column: 3;
  grid-row: 2;
}

.musk-process-cycle__item:nth-child(4) {
  grid-column: 1;
  grid-row: 2;
}

/* =========================================================
 * KHỐI NỘI DUNG
 * ========================================================= */

.musk-process-cycle__item {
  min-width: 0;
}

.musk-process-cycle__item-head {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.musk-process-cycle__number {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--musk-cycle-accent, #1558f4);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

/* Gạch dưới tiêu đề chạy hết phần còn lại của hàng, nên đặt
   trên chính thẻ tiêu đề với flex: 1 chứ không phải một thẻ rời. */

.musk-process-cycle__card-title {
  flex: 1;
  min-width: 0;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--musk-cycle-accent, #1558f4);
  margin: 0;
  color: #0b1b3b;
  font-weight: 700;
  text-transform: uppercase;
}

/* =========================================================
 * NỘI DUNG HTML NGƯỜI DÙNG NHẬP
 *
 * Người dùng thường dán vào một danh sách ul li. Đặt lại dấu
 * đầu dòng theo màu nhấn của khối.
 * ========================================================= */

.musk-process-cycle__content {
  color: #29394f;
  font-weight: 400;
}

.musk-process-cycle__content > *:first-child {
  margin-top: 0;
}

.musk-process-cycle__content > *:last-child {
  margin-bottom: 0;
}

.musk-process-cycle__content p {
  margin: 0 0 10px;
}

.musk-process-cycle__content ul,
.musk-process-cycle__content ol {
  padding: 0;
  margin: 0;
  list-style: none;
}

.musk-process-cycle__content li {
  position: relative;
  margin: 0 0 9px !important;
  padding-left: 18px;
  list-style: none;
}

.musk-process-cycle__content li:last-child {
  margin-bottom: 0 !important;
}

.musk-process-cycle__content li::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--musk-cycle-accent, #1558f4);
}

.musk-process-cycle__content a {
  color: var(--musk-cycle-accent, #1558f4);
  text-decoration: none;
}

.musk-process-cycle__content a:hover {
  text-decoration: underline;
}

/* =========================================================
 * TABLET
 *
 * Cột giữa co lại, hai cột chữ vẫn đủ chỗ.
 * ========================================================= */

@media (max-width: 1024px) {
  .musk-process-cycle__layout {
    column-gap: 24px;
    row-gap: 34px;
  }

  .musk-process-cycle__media {
    max-width: 280px !important;
  }
}

/* =========================================================
 * MOBILE
 *
 * Một cột: ảnh trên đầu rồi tới bốn khối theo đúng thứ tự đã
 * nhập. Phải gỡ hết phần đặt vị trí tay ở trên, không thì các
 * khối vẫn bám vào cột 3 vốn không còn tồn tại.
 * ========================================================= */

@media (max-width: 767px) {
  .musk-process-cycle {
    padding: 50px 0;
  }

  .musk-process-cycle__header {
    margin-bottom: 30px;
  }

  .musk-process-cycle__layout {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 26px;
  }

  .musk-process-cycle__media,
  .musk-process-cycle__item:nth-child(1),
  .musk-process-cycle__item:nth-child(2),
  .musk-process-cycle__item:nth-child(3),
  .musk-process-cycle__item:nth-child(4) {
    grid-column: 1;
    grid-row: auto;
  }

  /*
   * Khối thứ 3 (dưới phải trên desktop) và khối thứ 4 (dưới trái)
   * đổi chỗ khi xếp dọc: nội dung đang nhập số 03 cho khối thứ 4
   * và 04 cho khối thứ 3, nên đổi lại để trên mobile số chạy đúng
   * 01 -> 02 -> 03 -> 04. Khối thứ 5 trở đi xếp sau cùng.
   */

  .musk-process-cycle__item:nth-child(3) {
    order: 4;
  }

  .musk-process-cycle__item:nth-child(4) {
    order: 3;
  }

  .musk-process-cycle__item:nth-child(n + 5) {
    order: 5;
  }

  /* Ảnh nằm cuối DOM nhưng phải đọc trước, kéo lên đầu bằng order. */

  .musk-process-cycle__media {
    order: -1;
    max-width: 320px !important;
  }

  .musk-process-cycle__item-head {
    margin-bottom: 11px;
    gap: 10px;
  }

  .musk-process-cycle__number {
    min-width: 32px;
    height: 32px;
    border-radius: 7px;
    font-size: 14px;
  }

  .musk-process-cycle__card-title {
    padding-bottom: 7px;
  }
}
