/* ============================================================
   VI Feerie — Section "Bán chạy nhất" (carousel sản phẩm)
   ============================================================ */

.section {
  padding: 64px 0;
}

/* Nhãn nhỏ phía trên tiêu đề — giữ đơn giản, không dùng pill viết hoa toàn bộ */
.section__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section__eyebrow::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1.5px;
  background: var(--brand-deep);
}

.section__title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.section__desc {
  margin-top: 10px;
  max-width: 730px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.7;
}

/* ---------------- Đầu section ---------------- */
.best__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.best__intro {
  flex: 1;
  min-width: 0;
}

/* ---------------- Vùng carousel ---------------- */
.best__viewport {
  overflow: hidden;
  margin: 0 -4px;
  padding: 4px;
}

.best__track {
  display: flex;
  gap: 20px;
  list-style: none;
  will-change: transform;
}

.best__item {
  flex: 0 0 calc((100% - 20px * 3) / 4);
  min-width: 0;
}

/* Ba khối sản phẩm trang chủ dùng cùng carousel cuộn ngang. */
.home-products__head {
  margin-bottom: 36px;
  text-align: center;
}

.home-products--first .best__head {
  justify-content: center;
  text-align: center;
}

.home-products__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 4px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.home-products__viewport::-webkit-scrollbar {
  display: none;
}

.home-products__viewport.is-draggable {
  cursor: grab;
  scroll-snap-type: none;
}

.home-products__viewport.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.home-products__track > .best__item {
  scroll-snap-align: start;
}

/* ---------------- Card sản phẩm ---------------- */
.pcard {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: none;
  border-radius: 4px;
  overflow: hidden;
}

/* Nút hành động luôn nằm sát đáy pcard__body. */
.pcard__addcart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  margin-top: auto;
  padding: 8px 26px;
  border: none;
  border-radius: 24px;
  background: var(--brand-deep);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 10px rgba(143, 107, 132, 0.28);
  cursor: pointer;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.pcard__addcart svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.pcard__addcart:hover {
  background: var(--brand-deeper);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(143, 107, 132, 0.38);
}

.pcard__details {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  margin-top: auto;
  padding: 8px 26px;
  border: 0;
  border-radius: 24px;
  background: var(--brand-deep);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 10px rgba(143, 107, 132, 0.28);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.pcard__details svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.pcard__details:hover {
  background: var(--brand-deeper);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(143, 107, 132, 0.38);
}

/* Ảnh + đổi ảnh khi hover */
.pcard__media {
	position: relative;
	display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
	background: #f5efef;
}

.pcard__media-link {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
}

.pcard__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s var(--ease);
}

.pcard__img--back {
  opacity: 0;
}

.pcard:hover .pcard__media--has-hover .pcard__img--front {
  opacity: 0;
}

.pcard:hover .pcard__media--has-hover .pcard__img--back {
  opacity: 1;
}

/* Nhãn NEW và giảm giá cùng hàng như trên ảnh mẫu. */
.pcard__badges {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 5px;
  max-width: calc(100% - 52px);
}

.pcard__badge {
  display: inline-block;
  padding: 4px 7px;
  border: 1px solid rgba(158, 122, 145, 0.3);
  border-radius: 0;
  background: #fff;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.pcard__match-badge {
  position: absolute;
  top: 42px;
  left: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
}

/* Tim trong nút tròn trắng ở góc ảnh. */
.pcard__wish {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: var(--brand-deep);
  border: 0;
  box-shadow: 0 1px 6px rgba(56, 34, 19, 0.15);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.pcard__wish svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pcard__wish:hover {
  color: var(--brand-deeper);
  box-shadow: 0 2px 9px rgba(56, 34, 19, 0.22);
}

.pcard__wish.is-active {
	color: var(--brand-deep);
}

.pcard__wish.is-active svg {
	fill: currentColor;
}

/* Phần chữ */
.pcard__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  padding: 14px 14px 16px;
}

.pcard__type {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* Tag phân loại (Lens Ngày / Lens Tháng…) nằm ngay trên tên sản phẩm */
.pcard__tag {
  align-self: flex-start;
  color: var(--brand-deep);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
}

.pcard__title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.pcard__title a {
  transition: color 0.2s var(--ease);
}

.pcard__title a:hover {
  color: var(--brand-deep);
}

/* Hàng chấm màu lens — dùng lens swatch làm option đổi màu */
.pcard__swatches {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 2px;
}

.pcard__sw {
  width: 22px;
  height: 22px;
  padding: 1px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
  cursor: pointer;
}

.pcard__sw img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.pcard__sw:hover {
  border-color: var(--brand-deep);
  transform: translateY(-1px);
}

.pcard__sw.is-active {
  border-color: var(--ink);
}

.pcard__sw-more {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  height: 22px;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  margin-left: 2px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.pcard__sw-more:hover,
.pcard__swatches.is-open .pcard__sw-more {
  background: var(--ink);
  color: #fff;
}

/* Popup xem đầy đủ màu — mở khi bấm +5 */
.pcard__sw-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: -4px;
  right: -4px;
  z-index: 5;
  padding: 12px 12px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 14px 30px -14px rgba(56, 34, 19, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.pcard__swatches.is-open .pcard__sw-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.pcard__sw-popup::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 18px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

.pcard__sw-popup__title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pcard__sw-popup__grid {
  display: grid;
  /* Tối đa 4 cột, tự rút còn 3 rồi 2 khi card hẹp dần.
     Cột không bao giờ nhỏ hơn 48px — đủ cho nhãn dài nhất ("Midnight", 47px)
     nên chữ không bị vỡ giữa từ. */
  grid-template-columns: repeat(auto-fit, minmax(max(48px, calc((100% - 12px) / 4)), 1fr));
  gap: 4px;
  /* Card hẹp phải xếp 2 cột nên lưới cao quá khung — cho cuộn trong popup,
     tiêu đề ở trên vẫn đứng yên. Desktop 4 cột thấp hơn mức này nên không cuộn. */
  max-height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-light) transparent;
}

.pcard__sw-popup__grid::-webkit-scrollbar {
  width: 5px;
}

.pcard__sw-popup__grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--brand-light);
}

.pcard__sw-popup__grid::-webkit-scrollbar-thumb:hover {
  background: var(--brand-deep);
}

.pcard__sw-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 2px;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  transition: background 0.15s var(--ease);
}

.pcard__sw-opt img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  padding: 1px;
  object-fit: cover;
  transition: border-color 0.15s var(--ease);
}

.pcard__sw-opt:hover {
  background: var(--brand-tint);
}

.pcard__sw-opt:hover img,
.pcard__sw-opt.is-active img {
  border-color: var(--ink);
}

.pcard__sw-opt.is-active {
  color: var(--ink);
  font-weight: 600;
}

/* Chọn nhanh thông số ngay trên card */
.pcard__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pcard__variation-message {
  margin: 2px 0 0;
  color: #c8475c;
  font-size: 12px;
  line-height: 1.4;
}

.pcard__spec {
  position: relative;
  width: max-content;
  min-width: 0;
}

.pcard__spec select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: max-content;
  padding: 10px 22px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.pcard__spec select:hover,
.pcard__spec select:focus {
  border-color: var(--ink);
  outline: none;
}

.pcard__spec::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.pcard__spec::before {
  content: attr(data-label);
  position: absolute;
  left: 10px;
  top: -6px;
  padding: 0 4px;
  background: #fff;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 1;
}

.pcard__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
}

.pcard__price-new {
  color: #d94b5a;
  font-size: 16px;
  font-weight: 700;
}

.pcard__price-old {
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: line-through;
}

/* Hàng hành động — luôn nằm sát đáy card để card không/có biến thể vẫn thẳng hàng */
.pcard__actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
}

.pcard__view {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border-radius: 2px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.pcard__view:hover {
  background: var(--ink);
  color: #fff;
}

.pcard__cart {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 2px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.pcard__cart svg {
  width: 16px;
  height: 16px;
}

.pcard__cart:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

/* ============================================================
   Responsive
   ============================================================ */

@media screen and (max-width: 1100px) {
  .section {
    padding: 48px 0;
  }

  .section__title {
    font-size: 30px;
  }

  .best__item {
    flex-basis: calc((100% - 20px * 2) / 3);
  }
}

@media screen and (max-width: 820px) {
  .section {
    padding: 38px 0;
  }

  .section__title {
    font-size: 26px;
  }

  .best__head {
    align-items: center;
    margin-bottom: 24px;
  }

  .home-products__head {
    margin-bottom: 24px;
  }

  .best__track {
    gap: 14px;
  }

  .best__item {
    flex-basis: calc((100% - 14px) / 2);
  }

  .pcard__body {
    padding: 12px 10px 14px;
  }

  .pcard__title {
    font-size: 13.5px;
  }

  .pcard__price-new {
    font-size: 15px;
  }
}

@media screen and (max-width: 520px) {
  .section__title {
    font-size: 22px;
  }

  .section__desc {
    font-size: 13.5px;
  }

  .best__item {
    flex-basis: calc((100% - 12px) / 2);
  }

  .best__track {
    gap: 12px;
  }

  .pcard__view,
  .pcard__cart {
    height: 36px;
  }

  .pcard__view {
    font-size: 12px;
  }

  .pcard__spec select {
    font-size: 10px
  }

  /* Nút gọn trên mobile nhưng vẫn bám đáy card. */
  .pcard__addcart,
  .pcard__details {
    gap: 6px;
    padding: 8px 16px;
    font-size: 11.5px;
    box-shadow: 0 2px 7px rgba(143, 107, 132, 0.26);
  }

  .pcard__addcart svg {
    width: 15px;
    height: 15px;
  }
}

@media screen and (max-width: 420px) {
  .pcard__sw-popup {
    padding: 10px 10px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-products__viewport {
    scroll-behavior: auto;
  }

  .pcard__img {
    transition: opacity 0.2s linear !important;
  }
}
