.custom-featured-collection {
  --cfc-gap: 16px;
  --cfc-tab-active: #333;
  --cfc-image-ratio: 2/3;
  --cfc-desktop-columns: 5;
  --cfc-mobile-peek-columns: 2.25;
}

.custom-featured-collection__container {
  width: 100%;
}

/* 头部：PC 三栏布局 */
.custom-featured-collection__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.custom-featured-collection__title {
  justify-self: start;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #222;
  line-height: 1.2;
  text-transform: uppercase;
}

.custom-featured-collection__tabs-wrapper {
  justify-self: center;
  max-width: 100%;
}

.custom-featured-collection__tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.custom-featured-collection__tabs::-webkit-scrollbar {
  display: none;
}

.custom-featured-collection__tabs:has(.custom-featured-collection__tab:only-child) {
  display: none;
}

.custom-featured-collection__tab {
  flex-shrink: 0;
  padding: 8px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #999;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.custom-featured-collection__tab:hover {
  color: #555;
}

.custom-featured-collection__tab.is-active {
  color: var(--cfc-tab-active);
  border-bottom-color: var(--cfc-tab-active);
}

.custom-featured-collection__view-all {
  justify-self: end;
  font-size: 12px;
  font-weight: 400;
  color: #666;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.custom-featured-collection__view-all:hover {
  color: #222;
}

/* Tab 面板 */
.custom-featured-collection__panel {
  display: none;
}

.custom-featured-collection__panel.is-active {
  display: block;
}

/* 商品滑动区 */
.custom-featured-collection__grid-wrapper {
  position: relative;
}

.custom-featured-collection__grid {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: var(--cfc-gap);
  padding: 4px 0 8px;
}

.custom-featured-collection__grid::-webkit-scrollbar {
  display: none;
}

.custom-featured-collection__card {
  position: relative;
  flex: 0 0 calc((100% - var(--cfc-gap) * (var(--cfc-desktop-columns) - 1)) / var(--cfc-desktop-columns));
  min-width: calc((100% - var(--cfc-gap) * (var(--cfc-desktop-columns) - 1)) / var(--cfc-desktop-columns));
  scroll-snap-align: start;
}

/* 滑动箭头 */
.custom-featured-collection__nav {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.custom-featured-collection__nav:hover {
  color: #666;
}

.custom-featured-collection__nav.is-disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.custom-featured-collection__nav--prev {
  left: -36px;
}

.custom-featured-collection__nav--next {
  right: -36px;
}

.custom-featured-collection__nav svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* 排名序号：卡片左上角 */
.custom-featured-collection__rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  margin: 0;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  text-align: left;
  color: #ccc;
  pointer-events: none;
}

/* 商品图片 */
.custom-featured-collection__image {
  position: relative;
  aspect-ratio: var(--cfc-image-ratio, 2/3);
  overflow: hidden;
  background: #f5f5f5;
}

.custom-featured-collection__image-link {
  display: block;
  width: 100%;
  height: 100%;
}

.custom-featured-collection__image img,
.custom-featured-collection__image svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 色块 + 收藏行 */
.custom-featured-collection__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
  margin-top: 8px;
}

.custom-featured-collection__swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.custom-featured-collection__swatch {
  flex-shrink: 0;
  display: block;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f5f5f5;
}

.custom-featured-collection__swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.custom-featured-collection__swatch-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.custom-featured-collection__swatch-inner::before,
.custom-featured-collection__swatch-inner::after {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  content: "";
}

.custom-featured-collection__swatch-inner::before {
  background-image: var(--swatch-background-default-image);
  background-repeat: repeat;
  background-position: center;
  background-size: 14px;
}

.custom-featured-collection__swatch-inner::after {
  background-color: var(--swatch-background-color, transparent);
}

.custom-featured-collection__wishlist {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
}

.custom-featured-collection__wishlist:hover {
  color: #333;
}

/* 商品信息 */
.custom-featured-collection__info {
  padding: 8px 0 0;
}

.custom-featured-collection__product-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.custom-featured-collection__product-title a {
  color: inherit;
  text-decoration: none;
}

.custom-featured-collection__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.custom-featured-collection__price-current {
  font-size: 13px;
  font-weight: 700;
  color: #222;
}

.custom-featured-collection__price-compare {
  font-size: 11px;
  color: #999;
  text-decoration: line-through;
}

.custom-featured-collection__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-featured-collection__label {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  color: #888;
}

.custom-featured-collection__label.is-new {
  color: #e60000;
  font-weight: 600;
}

/* 移动端 */
@media (max-width: 959px) {
  .custom-featured-collection__container {
    padding: 0 16px;
  }

  .custom-featured-collection__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
  }

  .custom-featured-collection__title {
    justify-self: center;
    font-size: 20px;
    text-align: center;
  }

  .custom-featured-collection__tabs-wrapper {
    width: 100%;
    justify-self: center;
  }

  .custom-featured-collection__tabs {
    justify-content: center;
    width: 100%;
  }

  .custom-featured-collection__tab {
    padding: 6px 14px;
    font-size: 12px;
  }

  .custom-featured-collection__view-all {
    display: none;
  }

  .custom-featured-collection__nav {
    display: none;
  }

  .custom-featured-collection__card {
    flex: 0 0 calc((100% - var(--cfc-gap) * 2) / var(--cfc-mobile-peek-columns));
    min-width: calc((100% - var(--cfc-gap) * 2) / var(--cfc-mobile-peek-columns));
  }

  .custom-featured-collection__rank {
    top: 6px;
    left: 6px;
    font-size: 22px;
  }

  .custom-featured-collection__product-title {
    font-size: 11px;
  }

  .custom-featured-collection__price-current {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .custom-featured-collection {
    --cfc-gap: 12px;
  }
}
