/* 최근 본 상품 칩 · 카탈로그 레일 */

.mall-recent-chip {
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(22px, env(safe-area-inset-bottom, 0px));
  z-index: 58;
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(53, 58, 66, 0.18);
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  color: #1f2329;
  background: #fff;
  box-shadow:
    0 2px 8px rgba(15, 22, 18, 0.08),
    0 10px 28px rgba(15, 22, 18, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.28s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mall-recent-chip--m {
  bottom: calc(var(--m-nav-offset, 62px) + 14px);
}

.mall-recent-chip.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.mall-recent-chip.is-leaving {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
}

.mall-recent-chip__thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 0;
  object-fit: cover;
  background: rgba(53, 58, 66, 0.06);
  border: 1px solid rgba(53, 58, 66, 0.1);
}

.mall-recent-chip__thumb--empty {
  display: block;
}

.mall-recent-chip__copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mall-recent-chip__kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  color: #5c6370;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mall-recent-chip__title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: #12161c;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mall-recent-chip__chev {
  flex: 0 0 auto;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 600;
  color: #353a42;
  opacity: 0.55;
}

.mall-recent-chip:hover {
  border-color: rgba(53, 58, 66, 0.28);
  box-shadow:
    0 4px 12px rgba(15, 22, 18, 0.1),
    0 14px 32px rgba(15, 22, 18, 0.12);
}

@media (min-width: 721px) {
  .mall-recent-chip {
    left: 50%;
    right: auto;
    width: min(440px, calc(100vw - 32px));
    transform: translate(-50%, 10px);
  }

  .mall-recent-chip.is-visible {
    transform: translate(-50%, 0);
  }

  .mall-recent-chip.is-leaving {
    transform: translate(-50%, 8px);
  }
}

/* ── 카탈로그 레일 · 캐러셀 (폭 넘침 방지) ── */
.mall-recent-rail,
.mall-local-brand-chips,
.mall-rail-carousel,
.mall-local-discovery__related {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.mall-rail-carousel__head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 12px;
  min-width: 0;
}

.mall-rail-carousel__title {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--mall-charcoal-deep, #353a42);
  white-space: nowrap;
}

.mall-rail-carousel__controls {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

.mall-rail-carousel__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--editorial-line, rgba(53, 58, 66, 0.14));
  border-radius: 0;
  cursor: pointer;
  color: #353a42;
  background: #fff;
  transition:
    border-color 0.2s ease,
    opacity 0.2s ease,
    background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mall-rail-carousel__nav:hover:not(:disabled) {
  border-color: rgba(53, 58, 66, 0.28);
  background: #fafaf9;
}

.mall-rail-carousel__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.mall-rail-carousel:not(.mall-rail-carousel--scrollable) .mall-rail-carousel__nav {
  display: none;
}

.mall-rail-carousel__reset {
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--editorial-line, rgba(53, 58, 66, 0.14));
  border-radius: 0;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--editorial-muted, #5c6370);
  background: #fff;
  white-space: nowrap;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mall-rail-carousel__reset:hover {
  border-color: rgba(53, 58, 66, 0.26);
  color: #353a42;
}

.mall-rail-carousel__viewport {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.mall-recent-rail {
  margin: 0 0 12px;
  padding: 0;
}

/* PC 카탈로그 — 편집샵 직각 패널 */
#mallWrap #catalog .mall-local-rail-panel {
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: clamp(14px, 2vw, 18px);
  border: 1px solid var(--editorial-line, rgba(15, 22, 18, 0.08));
  border-radius: 0;
  background: #fff;
}

#mallWrap #catalog .mall-local-rail-panel:last-of-type {
  margin-bottom: 14px;
}

/* 필터 열 — 자주 본 브랜드 · 최근 본 (각 1건) */
#mallWrap #catalog .filters--premium .mall-local-discovery-host {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  min-width: 0;
}

#mallWrap #catalog .filters--premium .mall-local-discovery-host:empty {
  display: none;
  margin: 0;
}

#mallWrap #catalog .filters--premium .mall-local-rail-panel {
  margin: 0;
}

#mallWrap #catalog .filters--premium .mall-local-rail-panel:last-of-type {
  margin-bottom: 0;
}

.mall-rail-carousel--solo .mall-recent-rail__track {
  overflow: visible;
}

.mall-rail-carousel--solo .mall-local-brand-chips__chip,
.mall-rail-carousel--solo .mall-recent-rail__item {
  width: 100%;
  max-width: none;
}

.mall-local-rail-panel .mall-rail-carousel__viewport {
  margin: 0 -2px;
}

.mall-recent-rail__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.mall-recent-rail__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mall-charcoal-deep, #353a42);
}

.mall-recent-rail__track {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mall-recent-rail__track::-webkit-scrollbar {
  display: none;
}

.mall-recent-rail__item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(220px, 78%);
  max-width: 220px;
  margin: 0;
  padding: 8px 10px 8px 8px;
  border: 1px solid rgba(53, 58, 66, 0.12);
  border-radius: 0;
  scroll-snap-align: start;
  cursor: pointer;
  text-align: left;
  color: inherit;
  background: #fff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mall-recent-rail__item:hover {
  border-color: rgba(53, 58, 66, 0.22);
  box-shadow: 0 4px 14px rgba(15, 22, 18, 0.06);
}

.mall-recent-rail__thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  object-fit: cover;
  background: rgba(53, 58, 66, 0.05);
}

.mall-recent-rail__thumb--empty {
  display: block;
}

.mall-recent-rail__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mall-recent-rail__brand {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(53, 58, 66, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mall-recent-rail__name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#mallWrap #catalog .products--premium {
  overflow-x: clip;
}

#mallWrap .products--premium .mall-recent-rail,
#mallWrap .products--premium .mall-local-brand-chips {
  margin-top: 0;
}

#mallWrap .products--premium .mall-local-rail-panel + .mall-local-rail-panel {
  margin-top: 0;
}

.m-catalog {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.m-catalog .mall-recent-rail,
.m-catalog .mall-local-brand-chips {
  margin: 0 16px 14px;
}
