/* =========================================================
 * MUSK - DỰ ÁN TIÊU BIỂU
 * Nội dung theo Row/Column Flatsome, nền tràn full width
 * Riêng track slider tràn tới mép phải màn hình
 * ========================================================= */

.musk-featured-projects {
  position: relative;
  z-index: 1;
  width: 100%;
  color: #ffffff;
}

.musk-featured-projects,
.musk-featured-projects *,
.musk-featured-projects *::before,
.musk-featured-projects *::after {
  box-sizing: border-box;
}

/* Line trắng bên phải giống mẫu */

.musk-featured-projects__background::after {
  content: "";
  position: absolute;
  top: 0;
  right: 4px;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.88);
}

/* =========================================================
 * LAYOUT TRONG COLUMN
 * ========================================================= */

.musk-featured-projects__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 100px 0 50px 0px;
}

.musk-featured-projects__layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  align-items: stretch;
  gap: 40px;
}

/* =========================================================
 * CỘT NỘI DUNG BÊN TRÁI
 * ========================================================= */

.musk-featured-projects__intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 348px;
  padding: 8px 0 25px;
}

.musk-featured-projects__intro-content {
  min-width: 0;
}

.musk-featured-projects__description {
  max-width: 285px;
  margin-top: 30px;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  line-height: 1.65;
}

.musk-featured-projects__description p {
  margin: 0;
}

/* =========================================================
 * SLIDER
 *
 * Kéo dài tới mép phải màn hình để card cuối bị cắt.
 * ========================================================= */

.musk-featured-projects__slider {
  position: relative;
  min-width: 0;
  overflow: hidden;
  margin-right: calc(50% - 50vw);
}

.musk-featured-projects__viewport {
  width: 100%;
  overflow: hidden;
  touch-action: pan-y;
}

.musk-featured-projects__track {
  display: flex;
  align-items: stretch;
  width: max-content;
  gap: 20px;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* =========================================================
 * ITEM
 * ========================================================= */

.musk-featured-projects__item {
  display: flex;
  flex: 0 0 255px;
  width: 255px;
  min-width: 255px;
  max-width: 255px;
  margin: 0;
  padding: 0;
}

/* =========================================================
 * CARD
 * ========================================================= */

.musk-featured-projects__card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 345px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  color: #172039;
  text-decoration: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease;
}

.musk-featured-projects__card:hover {
  color: #172039;
  text-decoration: none;
}

/* =========================================================
 * ẢNH NỀN
 * ========================================================= */

.musk-featured-projects__media {
  position: relative;
  width: 100%;
  height: 245px;
  overflow: hidden;
  background-color: #fdfdfd;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.musk-featured-projects__media--empty {
  background: linear-gradient(145deg, #dce7ec, #cbd9e1);
}

.musk-featured-projects__media-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  background: linear-gradient(
    180deg,
    rgba(3, 8, 57, 0.04) 0%,
    rgba(3, 8, 57, 0) 55%,
    rgba(3, 8, 57, 0.08) 100%
    );
  pointer-events: none;
}

/* =========================================================
 * BADGE
 * ========================================================= */

.musk-featured-projects__badge {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  padding: 7px 13px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.95);
  color: #172039;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* =========================================================
 * NỘI DUNG CARD
 * ========================================================= */

.musk-featured-projects__card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-height: 100px;
  padding: 17px 15px 15px;
  background: linear-gradient(140deg, #ffffff, #f0f2f6);
}

/* =========================================================
 * NHÃN DÁN
 *
 * Màu do PHP chọn theo tên nhãn, đổ ra thành class hậu tố. Mỗi
 * tông là một cặp nền nhạt + chữ đậm cùng gam: nền đủ sáng để
 * không chọi với logo, chữ đủ đậm để đọc được.
 * ========================================================= */

.musk-featured-projects__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  gap: 7px;
}

.musk-featured-projects__tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.musk-featured-projects__tag--blue {
  background: #e8f0ff;
  color: #1550c8;
}

.musk-featured-projects__tag--teal {
  background: #e2f6f4;
  color: #0e7d75;
}

.musk-featured-projects__tag--violet {
  background: #efeaff;
  color: #5b3fc4;
}

.musk-featured-projects__tag--amber {
  background: #fdf1de;
  color: #9a6512;
}

.musk-featured-projects__tag--rose {
  background: #fdeaef;
  color: #b83a5c;
}

.musk-featured-projects__tag--green {
  background: #e6f6e8;
  color: #2c7a3d;
}

/* =========================================================
 * THANH ĐIỀU HƯỚNG PHÍA DƯỚI
 *
 * Kéo ngược về đúng mép phải của column.
 * ========================================================= */

.musk-featured-projects__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 45px;
  margin-top: 17px;
  margin-right: calc(50vw - 40%);
}

/* =========================================================
 * DOTS
 * ========================================================= */

.musk-featured-projects__dots {
  display: flex;
  align-items: center;
  min-height: 12px;
  gap: 7px;
}

.musk-featured-projects__dots[hidden] {
  display: none;
}

.musk-featured-projects__dot {
  display: block !important;
  flex: 0 0 22px;
  width: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  height: 2px !important;
  min-height: 2px !important;
  max-height: 2px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.18) !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition:
    width 0.25s ease,
    background-color 0.25s ease;
}

.musk-featured-projects__dot::before,
.musk-featured-projects__dot::after {
  display: none !important;
  content: none !important;
}

.musk-featured-projects__dot:hover,
.musk-featured-projects__dot:focus,
.musk-featured-projects__dot:active {
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  box-shadow: none !important;
}

.musk-featured-projects__dot.is-active {
  flex-basis: 27px;
  width: 27px !important;
  min-width: 27px !important;
  max-width: 27px !important;
  background: white !important;
}

.musk-featured-projects__dot:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 4px;
}

/* =========================================================
 * NÚT TRÁI PHẢI
 * ========================================================= */

.musk-featured-projects__controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.musk-featured-projects__arrow {
  display: inline-flex !important;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.32) !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
  font-size: 0 !important;
  line-height: 0 !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.musk-featured-projects__arrow::before,
.musk-featured-projects__arrow::after {
  display: none !important;
  content: none !important;
}

.musk-featured-projects__arrow svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.musk-featured-projects__arrow:hover {
  border-color: #ffffff !important;
  background: rgba(255, 255, 255, 0.16) !important;
}

.musk-featured-projects__arrow:first-child:hover {
  transform: translateX(-3px);
}

.musk-featured-projects__arrow:last-child:hover {
  transform: translateX(3px);
}

.musk-featured-projects__arrow:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.45);
  outline-offset: 3px;
}

.musk-featured-projects__arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* =========================================================
 * GHI ĐÈ HỆ DÙNG CHUNG
 *
 * Chỉnh .musk-title / .musk-btn cho riêng element này.
 * File element luôn nạp sau style.css nên thắng cascade.
 * ========================================================= */

.musk-featured-projects .musk-title {
  max-width: 300px;
}

.musk-featured-projects .musk-title__heading {
  color: #ffffff;
}

@media (hover: hover) {
  .musk-featured-projects__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.21);
  }
}

/* =========================================================
 * MOBILE
 * ========================================================= */

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

  .musk-featured-projects__layout {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .musk-featured-projects__intro {
    min-height: 0;
  }

  .musk-featured-projects__description {
    max-width: 620px;
    margin-top: 18px;
    line-height: 1.65;
  }

  .musk-featured-projects .musk-title {
    max-width: 520px;
  }

  .musk-featured-projects .musk-btn {
    margin-top: 26px;
  }

  .musk-featured-projects__track {
    gap: 14px;
  }

  /* Bề rộng do JS tính bằng px và ép !important qua
     setProperty (xem featured-projects.js, sizeMobileItems()).

     Track có width: max-content nên tự co theo nội dung; %
     trên flex-basis không có container xác định để tính, ra
     đúng lỗi 1 cột thay vì 2 - phải đo viewport thật bằng JS. */

  .musk-featured-projects__item {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
  }

  .musk-featured-projects__background::after {
    display: none;
  }

  /* Card giờ hẹp hơn nhiều (2 cột thay vì gần full width),
     giữ nguyên chiều cao cũ (355px, cao hơn cả desktop) sẽ ra
     thẻ hẹp mà cao lêu nghêu. Giảm hẳn cho cân tỉ lệ. */

  .musk-featured-projects__card {
    min-height: 215px;
    border-radius: 9px;
  }

  .musk-featured-projects__media {
    height: 130px;
  }

  .musk-featured-projects__card-content {
    min-height: 80px;
    padding: 13px 12px 12px;
  }

  .musk-featured-projects__tags {
    gap: 6px;
  }

  .musk-featured-projects__tag {
    padding: 4px 9px;
    font-size: 11px;
  }

  .musk-featured-projects__arrow {
    flex-basis: 36px;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
  }

  .musk-featured-projects .musk-title__heading {
    line-height: 1.15;
  }
}

@media (prefers-reduced-motion: reduce) {
  .musk-featured-projects__track,
  .musk-featured-projects__card,
  .musk-featured-projects__dot,
  .musk-featured-projects__arrow {
    transition: none !important;
  }
}
