/* ==========================================================================
   스포츠 커머스 디자인 시스템 — 컴포넌트
   components.css · v1.0.0 · tokens.css → base.css 다음에 로드한다.

   규칙
   - 모든 값은 var(--토큰). 하드코딩된 색/px은 들어오지 않는다.
   - 컴포넌트에 margin과 고정 width를 주지 않는다 (바깥 여백은 부모의 gap).
   - hover는 @media (hover: hover) 안에서만 — 터치 기기에 hover가 남지 않게.
   - 모든 인터랙티브 요소는 default/hover/pressed/focus-visible/disabled 5상태.
   ========================================================================== */

/* ==========================================================================
   BUTTON — 높이 56 / 48 / 36px 셋만, 모서리 radius-md
   ========================================================================== */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-state) var(--ease),
              border-color var(--dur-state) var(--ease),
              opacity var(--dur-state) var(--ease);
}
.ds-btn:active { opacity: var(--press-opacity); }

/* size */
.ds-btn--lg { height: 56px; padding-inline: var(--space-8); font-size: 17px; line-height: 24px; }
.ds-btn--md { height: 48px; padding-inline: var(--space-6); font-size: 15px; line-height: 22px; }
.ds-btn--sm { height: 36px; padding-inline: var(--space-4); font-size: 14px; line-height: 20px; }
.ds-btn--block { width: 100%; }

/* variant — primary: 한 화면에 하나만 */
.ds-btn--primary { background: var(--brand-900); color: var(--text-on-dark); }
/* secondary: 선으로 구분하는 보조 액션. 1px은 1차 버튼 옆에서 가늘게 밀려 보여 1.5px */
.ds-btn--secondary { background: var(--surface); color: var(--brand-900); border: 1.5px solid var(--brand-900); }
.ds-btn--quiet { background: transparent; color: var(--text-body); border: 1px solid var(--border-strong); }
.ds-btn--danger { background: var(--price-sale); color: var(--text-on-dark); }
.ds-btn--ondark { background: var(--surface); color: var(--brand-900); }
.ds-btn--ondark-ghost { background: transparent; color: var(--text-on-dark); border: 1px solid rgba(255, 255, 255, 0.32); }
.ds-btn--text { height: auto; padding: 0; color: var(--text-sub); text-decoration: underline; font-size: 14px; line-height: 20px; }

/* 아이콘 전용 — aria-label 필수 */
.ds-btn--icon {
  width: 48px; height: 48px; padding: 0;
  background: var(--surface);
  color: var(--text-strong);
  border: 1px solid var(--border-subtle);
}
.ds-btn--icon-bare {
  width: 44px; height: 44px; padding: 0;
  background: transparent; border: 0;
  color: var(--text-strong);
}

@media (hover: hover) and (pointer: fine) {
  .ds-btn--primary:hover   { background: var(--brand-700); }
  .ds-btn--danger:hover    { filter: brightness(0.93); }
  .ds-btn--secondary:hover { background: var(--surface-muted); }
  .ds-btn--quiet:hover     { background: var(--surface-muted); }
  .ds-btn--icon:hover      { border-color: var(--border-strong); }
  .ds-btn--icon-bare:hover { background: var(--surface-muted); }
}

/* disabled — 숨기지 않고, 왜 못 누르는지 .ds-btn-hint로 알린다 */
.ds-btn:disabled,
.ds-btn[aria-disabled="true"] {
  background: var(--surface-disabled);
  color: var(--text-disabled);
  border-color: transparent;
  cursor: not-allowed;
  opacity: 1;
}
.ds-btn-hint { margin-top: var(--space-1); font-size: 13px; line-height: 20px; color: var(--text-sub); }

/* loading — 너비를 유지해 레이아웃이 흔들리지 않게 */
.ds-btn[data-loading="true"] { pointer-events: none; }
.ds-spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-pill);
  opacity: 0.7;
  animation: ds-spin 700ms linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* 상세 하단 버튼 조합 — 장바구니 40% + 구매 60% */
.ds-buy-row { display: flex; gap: var(--space-2); }
.ds-buy-row > .ds-btn--secondary { flex: 0 0 40%; }
.ds-buy-row > .ds-btn--primary { flex: 1; }

/* ==========================================================================
   BADGE — 상품 배지 / STATUS — 상태 칩 (색 + 문구를 함께)
   ========================================================================== */
.ds-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding-inline: var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.02em;
}
.ds-badge--sale { background: var(--price-sale); color: var(--text-on-dark); }
.ds-badge--auth { background: var(--accent); color: var(--on-accent); }
.ds-badge--new  { background: var(--brand-900); color: var(--text-on-dark); }
.ds-badge--soldout { background: var(--surface); color: var(--text-strong); border: 1px solid var(--border-strong); height: 24px; padding-inline: var(--space-3); }

.ds-count {
  min-width: 18px; height: 18px;
  padding-inline: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--price-sale);
  color: var(--text-on-dark);
  font-size: 12px; line-height: 18px; font-weight: 700;
  text-align: center;
}

.ds-status {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: 13px; line-height: 20px; font-weight: 600;
}
.ds-status--success { color: var(--status-success); }
.ds-status--danger  { color: var(--status-danger); }
.ds-status--info    { color: var(--status-info); }
.ds-status--warning { color: var(--status-warning); }

/* CHIP — 필터·카테고리·브랜드. radius-pill은 여기에만.
   모바일은 44px(최소 터치 영역), PC는 36px. */
.ds-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 44px;
  padding-inline: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 14px; line-height: 20px;
  color: var(--text-body);
  white-space: nowrap;
}
.ds-chip[aria-pressed="true"], .ds-chip--on {
  background: var(--brand-900);
  color: var(--text-on-dark);
  border-color: var(--brand-900);
  font-weight: 600;
}
.ds-chip__remove { display: inline-flex; margin-right: calc(var(--space-2) * -1); padding: var(--space-2); color: inherit; }
@media (min-width: 1024px) {
  .ds-chip { height: 36px; }
}

/* CHIP NAV — 헤더 아래에 두는 보조 내비게이션 한 줄(카테고리·브랜드).
   고정하지 않는다. 모바일은 가로 스크롤 한 줄, PC는 두 줄까지 자동 줄바꿈. */
.ds-chipnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  padding-block: var(--space-3);
}
.ds-chipnav__inner { display: flex; align-items: flex-start; gap: var(--space-4); }
.ds-chipnav__label { display: none; }
.ds-chipnav__list { flex: 1; min-width: 0; }
@media (min-width: 1024px) {
  .ds-chipnav { padding-block: var(--space-4); }
  .ds-chipnav__label {
    display: block; flex: 0 0 auto;
    padding-top: 7px;                      /* 36px 칩의 가운데에 레이블을 맞춘다 */
    color: var(--text-sub);
    white-space: nowrap;
  }
  .ds-chipnav__list {
    flex-wrap: wrap;
    row-gap: var(--space-2);
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* 가로 스크롤 칩/캐러셀 */
.ds-scroller {
  display: flex; gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
}
.ds-scroller::-webkit-scrollbar { display: none; }
.ds-scroller > * { scroll-snap-align: start; flex: 0 0 auto; }

/* ==========================================================================
   PRICE — 순서 고정: 할인율 → 판매가 → 취소선 정가
   판매가는 할인이 있어도 항상 text-strong. price-sale은 할인율에만.
   ========================================================================== */
.ds-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;            /* 모바일 2열 카드에서 정가가 잘리지 않고 다음 줄로 넘어간다 */
  column-gap: var(--space-2);
  row-gap: 0;
  font-variant-numeric: tabular-nums;
}
.ds-price__rate { font-family: var(--font-display); font-weight: 700; color: var(--price-sale); }
.ds-price__now  { font-family: var(--font-display); font-weight: 700; color: var(--text-strong); }
.ds-price__was  { font-family: var(--font-sans); font-weight: 400; color: var(--text-muted); text-decoration: line-through; }
.ds-price__note { margin-top: var(--space-2); font-size: 13px; line-height: 20px; color: var(--accent-ink); }

/* variant: card */
.ds-price--card { column-gap: var(--space-2); }
.ds-price--card .ds-price__rate,
.ds-price--card .ds-price__now { font-size: 17px; line-height: 22px; }
.ds-price--card .ds-price__was { font-size: 13px; line-height: 18px; }

/* variant: detail */
.ds-price--detail .ds-price__rate,
.ds-price--detail .ds-price__now { font-size: 26px; line-height: 32px; }
.ds-price--detail .ds-price__was { font-size: 13px; line-height: 18px; }

/* variant: line (장바구니·주문 줄) — 할인율·정가 미표시 */
.ds-price--line .ds-price__now { font-family: var(--font-sans); font-size: 14px; line-height: 22px; font-weight: 600; }

/* variant: total (합계) */
.ds-price--total .ds-price__now { font-size: 26px; line-height: 32px; }

/* 품절 */
.ds-price--soldout .ds-price__now { color: var(--text-muted); }

@media (min-width: 1024px) {
  .ds-price--card .ds-price__rate,
  .ds-price--card .ds-price__now { font-size: 20px; line-height: 26px; }
  .ds-price--card .ds-price__was { font-size: 14px; line-height: 20px; }
  .ds-price--detail .ds-price__rate,
  .ds-price--detail .ds-price__now { font-size: 32px; line-height: 40px; }
  .ds-price--detail .ds-price__was { font-size: 14px; line-height: 20px; }
  .ds-price--total .ds-price__now { font-size: 32px; line-height: 40px; }
}

/* ==========================================================================
   PRODUCT CARD — 목록·캐러셀·추천에 쓰는 단 하나의 카드
   ========================================================================== */
.ds-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-none);
  transition: border-color var(--dur-state) var(--ease), box-shadow var(--dur-state) var(--ease);
}
.ds-card__media {
  position: relative;
  aspect-ratio: var(--card-media-ratio);
  background: var(--surface);
  border-radius: var(--radius-none);
}
.ds-card__media > img { width: 100%; height: 100%; object-fit: contain; }
.ds-card__badges { position: absolute; top: var(--space-2); left: var(--space-2); display: flex; gap: var(--space-1); }
.ds-card__wish {
  position: absolute; top: var(--space-2); right: var(--space-2);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  color: var(--text-sub);
}
.ds-card__body { padding: var(--space-3); }
.ds-card__brand { font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-sub); }
/* 2줄 자리를 미리 잡아 같은 행 카드의 가격 줄이 어긋나지 않게 한다 */
.ds-card__name  { margin-top: var(--space-1); font-size: 14px; line-height: 20px; min-height: 40px; font-weight: 500; color: var(--text-strong); }
.ds-card__price { margin-top: var(--space-2); }
.ds-card__meta  { margin-top: var(--space-1); display: flex; gap: var(--space-2); font-size: 12px; line-height: 18px; color: var(--text-sub); }

/* 품절 */
.ds-card--soldout .ds-card__media::after {
  content: ""; position: absolute; inset: 0; background: var(--overlay);
}
.ds-card__soldout {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
  .ds-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card-hover); }
}
.ds-card:active { opacity: var(--press-opacity); }
.ds-card:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

@media (min-width: 1024px) {
  .ds-card__body { padding: var(--space-5); }
  .ds-card__brand { font-size: 13px; }
  .ds-card__name  { margin-top: 6px; font-size: 15px; line-height: 22px; min-height: 44px; }
  .ds-card__price { margin-top: var(--space-3); }
  .ds-card__meta  { margin-top: var(--space-2); gap: var(--space-3); font-size: 13px; line-height: 20px; }
}

/* ==========================================================================
   HEADER — 모바일 56px 1단 / PC 36+72+52 = 160px 3단
   ========================================================================== */
.ds-header {
  position: sticky; top: 0;
  z-index: var(--z-header);
  background: var(--surface);
  box-shadow: var(--shadow-sticky);
}
.ds-header__mobile {
  height: var(--header-mobile);
  display: flex; align-items: center;
  padding-inline: 6px;
  border-bottom: 1px solid var(--border-subtle);
}
.ds-header__mobile-title { flex: 1; text-align: center; font-size: 16px; line-height: 24px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ds-header__util { display: none; }
.ds-header__main { display: none; }
.ds-gnb { display: none; }

.ds-logo { display: inline-flex; align-items: center; justify-content: center; }
.ds-logo img { display: block; height: 44px; width: auto; }
.ds-logo--footer img, .sp-auth__logo img { height: 64px; }

@media (min-width: 1024px) {
  .ds-header { top: calc(var(--header-util) * -1); }
  .ds-header__mobile { display: none; }

  .ds-header__util {
    display: flex; align-items: center; justify-content: flex-end;
    gap: var(--space-5);
    height: var(--header-util);
    background: var(--brand-900);
    padding-inline: var(--gutter);
  }
  .ds-header__util a { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-on-dark); opacity: 0.88; }

  .ds-header__main {
    display: flex; align-items: center; justify-content: center; gap: var(--space-10);
    position: relative;
    height: var(--header-main);
    padding-inline: var(--gutter);
  }
  .ds-header__icons { position: absolute; right: var(--gutter); display: flex; align-items: center; gap: var(--space-4); }
  .ds-header__icon { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); }
  .ds-header__icon .ds-count { position: absolute; top: 2px; right: 2px; }

  .ds-header__main .ds-logo img { height: 60px; }

  .ds-gnb {
    position: relative;                 /* 대분류 패널의 기준 */
    display: flex; align-items: stretch; justify-content: center; gap: var(--space-20);
    height: var(--header-gnb);
    padding-inline: var(--gutter);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
  }
  /* 패널을 가진 1차 항목 */
  .ds-gnb__item { display: flex; }
  .ds-gnb__item > a { gap: var(--space-1); }

  /* 1차 메뉴를 같은 너비의 칸으로 나눈다. 칸 사이와 양 끝에 border-subtle 1px 세로선. */
  .ds-gnb--cells { gap: 0; }
  .ds-gnb--cells > a,
  .ds-gnb--cells > .ds-gnb__item {
    /* 칸 하나는 --gnb-cell이 기본이고, 좁아지면 같은 비율로 줄어든다 */
    flex: 0 1 var(--gnb-cell);
    min-width: 0;
    justify-content: center;
    border-left: 1px solid var(--border-subtle);
  }
  .ds-gnb--cells > :last-child { border-right: 1px solid var(--border-subtle); }
  .ds-gnb--cells > .ds-gnb__item > a { flex: 1; justify-content: center; }
  /* 어느 칸이 열려 있는지 칸 전체로 알린다 */
  .ds-gnb--cells > .ds-gnb__item:focus-within { background: var(--surface-muted); }
  @media (hover: hover) and (pointer: fine) {
    .ds-gnb--cells > .ds-gnb__item:hover,
    .ds-gnb--cells > a:hover { background: var(--surface-muted); }
  }
  .ds-gnb a {
    display: flex; align-items: center;
    font-size: 16px; line-height: 24px; font-weight: 600;
    color: var(--text-strong);
    border-bottom: 2px solid transparent;
  }
  .ds-gnb a[aria-current], .ds-gnb a.is-on { border-bottom-color: var(--accent); }
  .ds-gnb__spacer { margin-left: auto; }

  /* 항목이 많아 한 줄에 들어가지 않을 때(브랜드 나열 등). 최대 두 줄까지만 쓴다. */
  .ds-gnb--wrap {
    height: auto;
    min-height: var(--header-gnb);
    flex-wrap: wrap;
    align-items: center;
    row-gap: var(--space-2);
    column-gap: var(--space-6);
    padding-block: var(--space-3);
  }
  .ds-gnb--wrap a { font-size: 14px; line-height: 20px; font-weight: 500; }
  .ds-gnb--wrap a[aria-current], .ds-gnb--wrap a.is-on { font-weight: 700; }

  /* 대분류 패널 — hover와 키보드(:focus-within) 모두에서 열린다 */
  .ds-gnb__item > .ds-gnb-panel { display: none; }
  .ds-gnb__item:hover > .ds-gnb-panel,
  .ds-gnb__item:focus-within > .ds-gnb-panel { display: flex; }
  .ds-gnb-panel {
    position: absolute; left: 0; right: 0; top: 100%;
    z-index: var(--z-dropdown);
    display: flex; gap: var(--space-10);
    background: var(--surface);
    border-top: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-overlay);
    padding: var(--space-8) var(--gutter);
  }
  /* 1차 카테고리 수만큼 열을 만든다. 좁아지면 자동으로 줄을 접는다. */
  .ds-gnb-panel__cols { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: var(--space-6) var(--space-8); }
  .ds-gnb-panel h4 { font-size: 18px; line-height: 28px; font-weight: 600; margin-bottom: var(--space-3); }
  .ds-gnb-panel a { display: block; padding-block: 6px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-sub); }
  .ds-gnb-panel__promo { width: 280px; background: var(--bg-sunken); border-radius: var(--radius-lg); padding: var(--space-5); }
  /* 세로 리스트형 패널 — 1차를 세로로 쌓고 hover/포커스 시 2차를 그 자리에서 펼친다.
     1차가 7개를 넘거나 2차가 길면 패널 안에서 스크롤한다. */
  .ds-gnb__item--list { position: relative; }
  .ds-gnb-panel--list {
    left: 0; right: auto;
    width: var(--gnb-cell);
    max-height: var(--gnb-panel-max);
    overflow-y: auto;
    padding: 0;
    gap: 0;
  }
  .ds-gnb__item:hover > .ds-gnb-panel--list,
  .ds-gnb__item:focus-within > .ds-gnb-panel--list { display: block; }

  .ds-catlist { width: 100%; }
  .ds-gnb-panel .ds-catlist__main {
    display: flex; align-items: center; justify-content: center; gap: var(--space-1);
    min-height: 48px;
    padding-inline: var(--space-4);
    font-size: 14px; line-height: 20px; font-weight: 500;
    color: var(--text-strong);
    border-bottom: 1px solid var(--border-subtle);
  }
  .ds-catlist__sub { display: none; background: var(--surface-muted); }
  .ds-gnb-panel .ds-catlist__sub a {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px;
    padding-inline: var(--space-4);
    font-size: 14px; line-height: 20px; font-weight: 400;
    color: var(--text-sub);
    border-bottom: 1px solid var(--border-subtle);
  }
  .ds-catlist__item:hover > .ds-catlist__sub,
  .ds-catlist__item:focus-within > .ds-catlist__sub { display: block; }
  /* 2차가 없는 평평한 목록(브랜드) — 글자 굵기를 바꾸면 줄이 흔들려 면으로만 표시한다 */
  .ds-gnb-panel .ds-catlist--flat .ds-catlist__item:hover > .ds-catlist__main,
  .ds-gnb-panel .ds-catlist--flat .ds-catlist__item:focus-within > .ds-catlist__main {
    background: var(--surface-muted);
    color: var(--text-strong);
    font-weight: 500;
  }

  /* 펼쳐진 1차는 색과 굵기 둘로 표시한다 */
  .ds-gnb-panel .ds-catlist__item:hover > .ds-catlist__main,
  .ds-gnb-panel .ds-catlist__item:focus-within > .ds-catlist__main { color: var(--accent-ink); font-weight: 700; }
  @media (hover: hover) and (pointer: fine) {
    .ds-gnb-panel .ds-catlist__sub a:hover { background: var(--bg-sunken); color: var(--text-strong); }
  }

  /* 제목 없이 이름만 길게 나열할 때(브랜드 목록) */
  .ds-gnb-panel__plain { flex: 1; columns: 4; column-gap: var(--space-10); }
  .ds-gnb-panel__plain a { break-inside: avoid; }
}

/* ==========================================================================
   MOBILE MENU — 전체 카테고리. 좌측에서 밀려 들어오는 2단 서랍.
   좌 120px 대분류(bg-sunken) + 우 중분류(surface). 1024px 이상에서는 쓰지 않는다.
   ========================================================================== */
.ds-drawer { position: fixed; inset: 0; z-index: var(--z-modal); visibility: hidden; }
.ds-drawer.is-open { visibility: visible; }

.ds-drawer__scrim {
  position: absolute; inset: 0;
  background: var(--overlay);
  opacity: 0;
  transition: opacity var(--dur-layer) var(--ease);
}
.ds-drawer.is-open .ds-drawer__scrim { opacity: 1; }

.ds-drawer__panel {
  position: absolute; inset: 0 auto 0 0;
  width: min(var(--drawer-w), 86vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  transform: translateX(-100%);
  transition: transform var(--dur-layer) var(--ease);   /* transform만 애니메이션한다 */
}
.ds-drawer.is-open .ds-drawer__panel { transform: none; }

.ds-drawer__top {
  flex: 0 0 auto;
  min-height: var(--header-mobile);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px; line-height: 20px; font-weight: 600;
  color: var(--text-strong);
}
.ds-drawer__body { flex: 1; display: flex; min-height: 0; }

/* 좌: 대분류 */
.ds-drawer__main { flex: 0 0 120px; background: var(--bg-sunken); overflow-y: auto; padding-block: var(--space-2); }
.ds-drawer__main button {
  display: flex; align-items: center;
  width: 100%; min-height: 48px;
  padding-inline: var(--space-4);
  border-left: 3px solid transparent;
  font-size: 14px; line-height: 20px;
  color: var(--text-body);
  text-align: left;
}
.ds-drawer__main button[aria-selected="true"] {
  background: var(--surface);
  border-left-color: var(--accent);
  color: var(--text-strong);
  font-weight: 700;
}

/* 우: 중분류 */
.ds-drawer__subs { flex: 1; overflow-y: auto; padding-block: var(--space-2); }
.ds-drawer__subs a {
  display: flex; align-items: center;
  min-height: 48px;
  padding-inline: var(--space-4);
  font-size: 14px; line-height: 20px;
  color: var(--text-body);
}
.ds-drawer__subs a:first-child { font-weight: 600; color: var(--text-strong); }
.ds-drawer__subs a:active { background: var(--surface-muted); }

.ds-drawer__foot {
  flex: 0 0 auto;
  display: flex; gap: var(--space-5);
  padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  font-size: 14px; line-height: 20px; font-weight: 500;
  color: var(--text-sub);
}

/* 서랍이 열려 있는 동안에는 하단 탭바를 숨긴다 — 고정 요소를 두 개 쌓지 않는다 */
body.is-drawer-open .ds-tabbar { display: none; }

@media (min-width: 1024px) { .ds-drawer { display: none; } }

/* ==========================================================================
   SEARCH — PC 상시 노출 360px / 모바일 전체화면
   ========================================================================== */
.ds-search {
  display: flex; align-items: center; gap: var(--space-2);
  height: 44px;
  background: var(--surface);
  border: 1.5px solid var(--brand-900);   /* 사이트의 주요 동작이라 일반 입력보다 강하게 */
  border-radius: var(--radius-md);
  padding-left: var(--space-4);
  padding-right: 10px;
}
.ds-search__input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font-size: 16px; line-height: 24px;
}
.ds-search__input::placeholder { color: var(--text-muted); }
.ds-search__submit { width: 44px; height: 44px; margin-right: -10px; display: flex; align-items: center; justify-content: center; }

.ds-autocomplete {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding-block: 6px;
  z-index: var(--z-dropdown);
}
.ds-autocomplete li { display: flex; align-items: center; height: 44px; padding-inline: var(--space-4); font-size: 15px; line-height: 24px; color: var(--text-body); }
.ds-autocomplete li[aria-selected="true"] { background: var(--surface-muted); }
.ds-autocomplete b { font-weight: 700; color: var(--text-strong); }  /* 색을 바꾸지 않고 굵기만 */

@media (min-width: 1024px) {
  .ds-search { flex: 0 0 360px; }
  .ds-search__input { font-size: 15px; }
}
@media (min-width: 1440px) {
  .ds-search { flex-basis: 420px; }
}

/* ==========================================================================
   MAIN BANNER — 사진 위에 텍스트를 올리지 않는다
   ========================================================================== */
.ds-banner { display: flex; flex-direction: column; border-radius: var(--radius-none); overflow: hidden; }
.ds-banner__shot { aspect-ratio: 375 / 220; background: var(--bg-sunken); }
.ds-banner__shot > img { width: 100%; height: 100%; object-fit: cover; }
.ds-banner__copy { background: var(--brand-900); color: var(--text-on-dark); padding: var(--space-6); }
.ds-banner__eyebrow { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.02em; color: var(--accent); }
.ds-banner__rule { width: 48px; height: 2px; background: var(--accent); margin-block: var(--space-4) var(--space-5); }
.ds-banner__desc { margin-top: var(--space-3); opacity: 0.8; }
.ds-banner__cta { margin-top: var(--space-5); }
.ds-banner__controls {
  display: flex; align-items: center; gap: 10px;
  margin-top: var(--space-5);
  font-size: 13px; line-height: 20px; color: var(--text-on-dark); opacity: 0.8;
}
.ds-banner__pause {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
}
@media (min-width: 1024px) {
  .ds-banner { flex-direction: row; aspect-ratio: var(--banner-ratio-pc); }
  /* 모바일은 이미지 → 카피 순서, PC는 카피가 좌측 40% */
  .ds-banner__copy { order: -1; flex: 0 0 40%; display: flex; flex-direction: column; justify-content: center; padding: var(--space-16); }
  .ds-banner__shot { flex: 1; aspect-ratio: auto; }
}

/* ==========================================================================
   FILTER & SORT — PC 사이드바 240px / 모바일 sticky 바 + 바텀시트
   ========================================================================== */
.ds-listing { display: block; }
.ds-filterbar {
  position: sticky; top: var(--header-mobile);
  z-index: var(--z-sticky);
  height: 48px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
}
.ds-filter { display: none; }
.ds-filter__summary { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--space-3); border-bottom: 1px solid var(--border-subtle); font-size: 14px; line-height: 20px; font-weight: 600; }
.ds-filter__summary b { color: var(--price-sale); }
.ds-filter__group { margin-top: var(--space-6); }
.ds-filter__group > h4 { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); font-size: 14px; line-height: 20px; font-weight: 600; }
/* 선택자를 2단으로 둬 아래 .ds-check(inline-flex)보다 우선하게 한다 — 한 줄에 하나씩 */
.ds-filter .ds-filter__opt { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 48px; font-size: 14px; line-height: 22px; color: var(--text-body); }
.ds-sheet .ds-filter__opt { display: flex; width: 100%; }
.ds-filter__opt .ds-filter__n { margin-left: auto; font-size: 13px; color: var(--text-sub); }
.ds-filter__opt[aria-disabled="true"],
.ds-filter__opt[aria-disabled="true"] .ds-filter__n { color: var(--text-disabled); }
.ds-filter__price { display: flex; align-items: center; gap: 6px; }

.ds-sort {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding-inline: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
}

@media (min-width: 1024px) {
  .ds-listing { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-10); }
  .ds-filterbar { display: none; }
  .ds-filter { display: block; position: sticky; top: calc(var(--header-pc-sticky) + var(--space-4)); align-self: start; }
  .ds-filter__opt { min-height: 32px; }
}

/* ==========================================================================
   PAGINATION — 번호 이동. 무한 스크롤을 쓰지 않는다.
   ========================================================================== */
.ds-pagination { display: flex; justify-content: center; gap: var(--space-1); margin-top: var(--space-12); }
.ds-pagination a, .ds-pagination span {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  font-size: 14px; line-height: 22px;
  color: var(--text-sub);
}
.ds-pagination [aria-current="page"] { background: var(--brand-900); color: var(--text-on-dark); font-weight: 600; }
.ds-pagination [aria-disabled="true"] { color: var(--text-disabled); pointer-events: none; }
.ds-pagination__gap { color: var(--text-muted); pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .ds-pagination a:hover { background: var(--surface-muted); }
}
@media (min-width: 1024px) {
  .ds-pagination { margin-top: var(--space-16); }
  .ds-pagination a, .ds-pagination span { width: 40px; height: 40px; }
}

/* ==========================================================================
   FOOTER — brand-900 고객센터 띠 + brand-800 본문. 다크 면 불투명도는 4단만.
   ========================================================================== */
.ds-footer { background: var(--brand-800); color: var(--text-on-dark); }
.ds-footer__cs { background: var(--brand-900); padding-block: var(--space-6); }
.ds-footer__cs-inner { display: flex; flex-direction: column; gap: var(--space-4); }
.ds-footer__tel { font-family: var(--font-display); font-size: 24px; line-height: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ds-footer__hours { font-size: 12px; line-height: 18px; opacity: 0.72; margin-top: var(--space-1); }
.ds-footer__links { padding-block: var(--space-12); }
.ds-footer__links h4 { font-size: 14px; line-height: 20px; font-weight: 600; margin-bottom: var(--space-3); }
.ds-footer__links a { display: block; padding-block: 5px; font-size: 14px; line-height: 20px; font-weight: 500; opacity: 0.72; }
.ds-footer__acc-row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 1px solid var(--brand-700); font-size: 14px; }
.ds-footer__legal { border-top: 1px solid var(--brand-700); padding-block: var(--space-6); }
.ds-footer__legal-links { display: flex; flex-wrap: wrap; gap: var(--space-5); margin-bottom: 10px; }
.ds-footer__legal-links a { font-size: 12px; line-height: 18px; font-weight: 600; opacity: 0.88; }  /* 법적 의무 링크는 한 단 또렷하게 */
.ds-footer__legal p { font-size: 12px; line-height: 18px; font-weight: 500; opacity: 0.6; }
@media (min-width: 1024px) {
  .ds-footer__cs { padding-block: var(--space-8); }
  .ds-footer__cs-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .ds-footer__tel { font-size: 28px; line-height: 34px; }
  .ds-footer__hours { font-size: 13px; line-height: 20px; }
  .ds-footer__links { padding-block: var(--space-16); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 260px; gap: var(--space-10); }
}

/* ==========================================================================
   MOBILE TAB BAR / ACTION BAR — 둘을 동시에 쌓지 않는다
   ========================================================================== */
.ds-tabbar {
  position: fixed; inset: auto 0 0 0;
  z-index: var(--z-header);
  height: calc(var(--tabbar-mobile) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--surface);
  box-shadow: 0 -1px 0 rgba(23, 25, 28, 0.08);
}
.ds-tabbar__item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-1);
  position: relative;
  color: var(--text-sub);
  font-size: 12px; line-height: 18px;
}
/* 활성은 색만이 아니라 굵기와 채운 아이콘으로도 바뀐다 */
.ds-tabbar__item[aria-current="page"] { color: var(--text-strong); font-weight: 700; }
.ds-tabbar__item .ds-count { position: absolute; top: var(--space-1); right: 18px; }
.ds-tabbar__item:active { opacity: var(--press-opacity); }

.ds-actionbar {
  position: fixed; inset: auto 0 0 0;
  z-index: var(--z-header);
  height: calc(var(--actionbar-mobile) + env(safe-area-inset-bottom));
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--brand-900);
}
.ds-actionbar__wish { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; color: var(--text-on-dark); opacity: 0.9; }
.ds-actionbar__cart { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-on-dark); font-size: 12px; line-height: 16px; font-weight: 600; }
.ds-actionbar__buy { flex: 1; }

/* PAY BAR — 합계 + 1차 액션을 담는 흰 하단 고정 바 (장바구니·주문서).
   brand-900 면인 .ds-actionbar와 달리 금액을 읽어야 하므로 surface를 쓴다. */
.ds-paybar {
  position: fixed; inset: auto 0 0 0;
  z-index: var(--z-header);
  background: var(--surface);
  box-shadow: 0 -1px 0 rgba(23, 25, 28, 0.08);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
}
.ds-paybar__sum { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-3); }
.ds-paybar ~ .ds-tabbar { display: none; }
@media (min-width: 1024px) { .ds-paybar { display: none; } }

/* 구매 바가 있는 화면(상품 상세)에서는 탭바를 자동으로 숨긴다.
   DOM에서 .ds-actionbar가 .ds-tabbar보다 앞에 와야 한다. */
.ds-actionbar ~ .ds-tabbar { display: none; }

@media (min-width: 1024px) {
  .ds-tabbar, .ds-actionbar { display: none; }
}

/* ==========================================================================
   FORM — 레이블은 입력 위에. 플레이스홀더로 레이블을 대체하지 않는다.
   ========================================================================== */
.ds-field { display: block; }
.ds-field + .ds-field { margin-top: var(--space-5); }
.ds-field__label { display: block; margin-bottom: var(--space-2); font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-strong); }
.ds-field__req { color: var(--text-sub); font-weight: 400; }   /* (필수) 텍스트 — *만 쓰지 않는다 */
.ds-field__help { margin-top: var(--space-2); font-size: 13px; line-height: 20px; color: var(--text-sub); }
.ds-field__error { margin-top: var(--space-2); display: flex; align-items: center; gap: var(--space-1); font-size: 13px; line-height: 20px; color: var(--status-danger); font-weight: 600; }

.ds-input, .ds-select, .ds-textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 16px; line-height: 24px;   /* 모바일 16px — iOS 확대 방지 */
  color: var(--text-strong);
  transition: border-color var(--dur-state) var(--ease);
}
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--text-muted); }
.ds-textarea { min-height: 120px; resize: vertical; }
.ds-select { appearance: none; padding-right: var(--space-10); }
.ds-input[aria-invalid="true"], .ds-select[aria-invalid="true"], .ds-textarea[aria-invalid="true"] { border-color: var(--status-danger); }
.ds-input:disabled, .ds-select:disabled, .ds-textarea:disabled { background: var(--surface-disabled); color: var(--text-disabled); cursor: not-allowed; }
@media (min-width: 1024px) {
  .ds-input, .ds-select, .ds-textarea { font-size: 15px; }
}

/* 체크박스 / 라디오 — 18px, 터치 영역은 줄 전체 */
.ds-check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; line-height: 22px; color: var(--text-body); cursor: pointer; }
.ds-check__box {
  flex: 0 0 18px; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: transparent;
}
.ds-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.ds-check input:checked + .ds-check__box { background: var(--brand-900); border-color: var(--brand-900); color: var(--text-on-dark); }
.ds-check input:focus-visible + .ds-check__box { outline: 2px solid var(--focus-ring); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-ring-offset); }
.ds-check--radio .ds-check__box { border-radius: var(--radius-pill); }

/* 수량 스테퍼 — 버튼 44×44 */
.ds-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.ds-stepper button { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text-strong); }
.ds-stepper button:disabled { color: var(--text-disabled); cursor: not-allowed; }
.ds-stepper input { width: 48px; height: 44px; border: 0; border-inline: 1px solid var(--border-subtle); text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; background: transparent; }

/* ==========================================================================
   TABLE — 스펙 표. 헤더 brand-800, 짝수 행 surface-muted
   ========================================================================== */
.ds-table { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.ds-table th, .ds-table td { padding: var(--space-3) var(--space-4); font-size: 14px; line-height: 22px; text-align: left; vertical-align: top; }
.ds-table thead th { background: var(--brand-800); color: var(--text-on-dark); font-weight: 600; }
.ds-table tbody th { width: 30%; background: var(--surface-muted); color: var(--text-strong); font-weight: 600; border-top: 1px solid var(--border-subtle); }
.ds-table tbody td { color: var(--text-body); border-top: 1px solid var(--border-subtle); }

/* ==========================================================================
   TABS — 활성은 accent 2px 인디케이터 + 굵기
   ========================================================================== */
.ds-tabs {
  position: sticky; top: var(--header-mobile);
  z-index: var(--z-sticky);
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}
.ds-tabs__tab {
  flex: 1;
  min-height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 22px; font-weight: 600;
  color: var(--text-sub);
  border-bottom: 2px solid transparent;
}
.ds-tabs__tab[aria-selected="true"] { color: var(--text-strong); border-bottom-color: var(--accent); font-weight: 700; }
@media (min-width: 1024px) {
  .ds-tabs { top: var(--header-pc-sticky); }
}

/* ==========================================================================
   ACCORDION — details/summary로 만든다. 키보드와 스크린리더가 기본으로 동작한다.
   공지사항·FAQ·상품문의처럼 제목만 훑다가 하나씩 펼치는 목록에 쓴다.
   ========================================================================== */
.ds-accordion { border-top: 1px solid var(--border-subtle); }
.ds-accordion > details { border-bottom: 1px solid var(--border-subtle); }
.ds-accordion__q {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 64px;
  padding-block: var(--space-4);
  font-size: 15px; line-height: 24px; font-weight: 600;
  color: var(--text-strong);
  cursor: pointer;
  list-style: none;
}
.ds-accordion__q::-webkit-details-marker { display: none; }
.ds-accordion__q:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ds-accordion__q .ds-accordion__ic {
  margin-left: auto; flex: 0 0 auto;
  color: var(--text-sub);
  transition: transform var(--dur-state) var(--ease);
}
.ds-accordion > details[open] .ds-accordion__ic { transform: rotate(180deg); }
.ds-accordion__meta { flex: 0 0 auto; color: var(--text-sub); font-weight: 400; }
.ds-accordion__a {
  padding: var(--space-4) var(--space-5) var(--space-6);
  margin-bottom: var(--space-4);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  color: var(--text-body);
}
@media (hover: hover) and (pointer: fine) {
  .ds-accordion__q:hover { color: var(--accent-ink); }
}

/* ==========================================================================
   LAYERS — 모달 / 바텀시트 / 토스트
   ========================================================================== */
.ds-overlay { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--overlay); }
.ds-modal {
  position: fixed; z-index: var(--z-modal);
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - var(--space-8)));
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-6);
}
.ds-sheet {
  position: fixed; inset: auto 0 0 0; z-index: var(--z-modal);
  max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-overlay);
}
.ds-sheet__head { min-height: 52px; display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 26px; font-weight: 600; border-bottom: 1px solid var(--border-subtle); }
.ds-sheet__body { flex: 1; overflow-y: auto; padding: var(--space-3) var(--space-4); }
.ds-sheet__foot { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-subtle); }

.ds-toast {
  position: fixed; z-index: var(--z-toast);
  left: var(--space-4); right: var(--space-4); bottom: calc(var(--tabbar-mobile) + var(--space-4));
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  background: var(--brand-900); color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-3) var(--space-4);
  font-size: 15px; line-height: 22px;
}
.ds-toast--error { background: var(--price-sale); }
.ds-toast__action { font-size: 14px; font-weight: 600; text-decoration: underline; color: inherit; }
@media (min-width: 1024px) {
  .ds-toast { left: auto; right: var(--space-10); bottom: var(--space-10); width: 360px; }
}

/* ==========================================================================
   LAYER — 바텀시트·모달을 띄우는 껍데기. 안에 .ds-sheet 또는 .ds-modal을 넣는다.
   ========================================================================== */
.ds-layer { position: fixed; inset: 0; z-index: var(--z-modal); visibility: hidden; }
.ds-layer.is-open { visibility: visible; }
.ds-layer__scrim {
  position: absolute; inset: 0;
  background: var(--overlay);
  opacity: 0;
  transition: opacity var(--dur-layer) var(--ease);
}
.ds-layer.is-open .ds-layer__scrim { opacity: 1; }
.ds-layer .ds-sheet { transform: translateY(100%); transition: transform var(--dur-layer) var(--ease); }
.ds-layer.is-open .ds-sheet { transform: none; }

/* ==========================================================================
   SKELETON · EMPTY
   ========================================================================== */
.ds-skeleton { background: var(--skeleton); border-radius: var(--radius-sm); }
.ds-skeleton--media { aspect-ratio: var(--card-media-ratio); border-radius: var(--radius-none); }
.ds-skeleton--line { height: 20px; }

.ds-empty { text-align: center; padding-block: var(--space-16); }
.ds-empty__icon { color: var(--text-muted); margin: 0 auto var(--space-4); }
.ds-empty__text { font-size: 15px; line-height: 26px; color: var(--text-body); }
.ds-empty__action { margin-top: var(--space-5); }

/* ==========================================================================
   혜택 블록 — accent-soft. 한 화면에 accent 면은 최대 2곳.
   ========================================================================== */
.ds-benefit { background: var(--accent-soft); border-radius: var(--radius-lg); padding: var(--space-4); }
.ds-benefit dt { font-size: 13px; line-height: 20px; color: var(--text-sub); }
.ds-benefit dd { font-size: 14px; line-height: 22px; font-weight: 600; color: var(--text-strong); }

/* 신뢰 블록 — bg-sunken, 상단 accent 2px */
.ds-trust { background: var(--bg-sunken); border-top: 2px solid var(--accent); }

.ds-logo--footer img { filter: brightness(0) invert(1); }
