/* ==========================================================================
   스포츠 커머스 디자인 시스템 — 리셋 · 타이포 · 레이아웃
   base.css · v1.0.0 · tokens.css 다음에 로드한다.

   타입 스타일 클래스 규칙
   - `.t-<이름>`      : 반응형. 1024px 미만에서 모바일 값, 이상에서 PC 값으로 자동 전환
   - `.t-<이름>-m`    : 항상 모바일 값으로 고정 (예외 처리용)
   - `.t-<이름>-pc`   : 항상 PC 값으로 고정 (예외 처리용)
   컴포넌트 안에서 font-size / line-height를 직접 쓰지 않고 이 클래스를 붙인다.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 26px;
  font-weight: 400;
  word-break: keep-all;          /* 한글 어절 단위 줄바꿈 */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

/* 숫자는 가격·수량·주문번호에서 자리를 맞춘다 */
.num, .t-price-card, .t-price-detail, .t-discount-card, .t-discount-detail {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   2. FOCUS — 어떤 요소에서도 지우지 않는다
   -------------------------------------------------------------------------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-ring-offset);
  border-radius: inherit;
}

/* 본문으로 바로가기 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-toast);
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--brand-900);
  color: var(--text-on-dark);
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   3. 접근성 유틸
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 최소 터치 영역 44×44px — 시각적으로 작은 아이콘 버튼에 붙인다 */
.tap-44 {
  position: relative;
}
.tap-44::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
}

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY — Display (영문 히어로 카피 전용)
   -------------------------------------------------------------------------- */
[class^="t-display"], [class*=" t-display"],
[class^="t-price"], [class*=" t-price"],
[class^="t-discount"], [class*=" t-discount"] {
  font-family: var(--font-display);
}

.t-display-01, .t-display-01-m { font-size: 32px; line-height: 38px; font-weight: 700; letter-spacing: -0.01em; }
.t-display-02, .t-display-02-m { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.01em; }
.t-display-01-pc { font-size: 56px; line-height: 60px; font-weight: 700; letter-spacing: -0.02em; }
.t-display-02-pc { font-size: 44px; line-height: 50px; font-weight: 700; letter-spacing: -0.02em; }

/* TYPOGRAPHY — Heading */
.t-heading-01, .t-heading-01-m { font-size: 24px; line-height: 34px; font-weight: 700; }
.t-heading-02, .t-heading-02-m { font-size: 20px; line-height: 30px; font-weight: 700; }
.t-heading-03, .t-heading-03-m { font-size: 18px; line-height: 26px; font-weight: 600; }
.t-heading-04, .t-heading-04-m { font-size: 16px; line-height: 24px; font-weight: 600; }
.t-heading-01-pc { font-size: 32px; line-height: 42px; font-weight: 700; letter-spacing: -0.01em; }
.t-heading-02-pc { font-size: 24px; line-height: 34px; font-weight: 700; }
.t-heading-03-pc { font-size: 20px; line-height: 30px; font-weight: 600; }
.t-heading-04-pc { font-size: 18px; line-height: 28px; font-weight: 600; }

/* TYPOGRAPHY — Body */
.t-body-lg, .t-body-lg-m { font-size: 16px; line-height: 26px; font-weight: 400; }
.t-body,    .t-body-m    { font-size: 14px; line-height: 24px; font-weight: 400; }
.t-body-sm, .t-body-sm-m { font-size: 13px; line-height: 20px; font-weight: 400; }
.t-caption, .t-caption-m { font-size: 12px; line-height: 18px; font-weight: 400; }
.t-body-lg-pc { font-size: 17px; line-height: 28px; font-weight: 400; }
.t-body-pc    { font-size: 15px; line-height: 26px; font-weight: 400; }
.t-body-sm-pc { font-size: 14px; line-height: 22px; font-weight: 400; }
.t-caption-pc { font-size: 13px; line-height: 20px; font-weight: 400; }
.t-micro      { font-size: 12px; line-height: 18px; font-weight: 500; } /* PC 푸터 고지 전용 */

/* TYPOGRAPHY — Product & Price */
.t-product-brand { font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: 0.02em; }
.t-product-name, .t-product-name-m { font-size: 14px; line-height: 20px; font-weight: 500; }
.t-product-name-pc { font-size: 15px; line-height: 22px; font-weight: 500; }
.t-price-card,  .t-price-card-m  { font-size: 17px; line-height: 22px; font-weight: 700; }
.t-price-card-pc { font-size: 20px; line-height: 26px; font-weight: 700; }
.t-price-detail, .t-price-detail-m { font-size: 26px; line-height: 32px; font-weight: 700; }
.t-price-detail-pc { font-size: 32px; line-height: 40px; font-weight: 700; }
.t-price-strike, .t-price-strike-m { font-size: 13px; line-height: 18px; font-weight: 400; font-family: var(--font-sans); }
.t-price-strike-pc { font-size: 14px; line-height: 20px; font-weight: 400; font-family: var(--font-sans); }
.t-discount-card  { font-size: 17px; line-height: 22px; font-weight: 700; }
.t-discount-card-pc { font-size: 20px; line-height: 26px; font-weight: 700; }
.t-discount-detail { font-size: 26px; line-height: 32px; font-weight: 700; }
.t-discount-detail-pc { font-size: 32px; line-height: 40px; font-weight: 700; }

/* TYPOGRAPHY — UI */
.t-nav-01 { font-size: 16px; line-height: 24px; font-weight: 600; }
.t-nav-02 { font-size: 14px; line-height: 20px; font-weight: 500; }
.t-btn-lg { font-size: 17px; line-height: 24px; font-weight: 600; }
.t-btn-md { font-size: 15px; line-height: 22px; font-weight: 600; }
.t-btn-sm { font-size: 14px; line-height: 20px; font-weight: 600; }
.t-label  { font-size: 14px; line-height: 20px; font-weight: 600; }
.t-input, .t-input-m { font-size: 16px; line-height: 24px; font-weight: 400; } /* 모바일 16px 고정 — iOS 확대 방지 */
.t-input-pc { font-size: 15px; line-height: 24px; font-weight: 400; }
.t-badge  { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.02em; }
.t-tab    { font-size: 15px; line-height: 22px; font-weight: 600; }

/* 1024px 이상 — 반응형 클래스를 PC 값으로 전환 */
@media (min-width: 1024px) {
  body { font-size: 15px; line-height: 26px; }
  .t-display-01 { font-size: 56px; line-height: 60px; letter-spacing: -0.02em; }
  .t-display-02 { font-size: 44px; line-height: 50px; letter-spacing: -0.02em; }
  .t-heading-01 { font-size: 32px; line-height: 42px; letter-spacing: -0.01em; }
  .t-heading-02 { font-size: 24px; line-height: 34px; }
  .t-heading-03 { font-size: 20px; line-height: 30px; }
  .t-heading-04 { font-size: 18px; line-height: 28px; }
  .t-body-lg    { font-size: 17px; line-height: 28px; }
  .t-body       { font-size: 15px; line-height: 26px; }
  .t-body-sm    { font-size: 14px; line-height: 22px; }
  .t-caption    { font-size: 13px; line-height: 20px; }
  .t-product-name   { font-size: 15px; line-height: 22px; }
  .t-price-card     { font-size: 20px; line-height: 26px; }
  .t-price-detail   { font-size: 32px; line-height: 40px; }
  .t-price-strike   { font-size: 14px; line-height: 20px; }
  .t-discount-card  { font-size: 20px; line-height: 26px; }
  .t-discount-detail{ font-size: 32px; line-height: 40px; }
  .t-input          { font-size: 15px; }
}

/* 색 유틸 — 토큰 이름을 그대로 쓴다 */
.c-strong   { color: var(--text-strong); }
.c-body     { color: var(--text-body); }
.c-sub      { color: var(--text-sub); }
.c-muted    { color: var(--text-muted); }   /* 24px 이상/아이콘/플레이스홀더만 */
.c-on-dark  { color: var(--text-on-dark); }
.c-sale     { color: var(--price-sale); }
.c-accent   { color: var(--accent-ink); }   /* accent가 아니라 accent-ink */
.c-success  { color: var(--status-success); }
.c-info     { color: var(--status-info); }
.c-warning  { color: var(--status-warning); }

/* --------------------------------------------------------------------------
   5. LAYOUT
   -------------------------------------------------------------------------- */
.ds-container {
  width: 100%;
  max-width: calc(var(--container-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.ds-container--wide {
  max-width: calc(var(--container-wide) + var(--gutter) * 2);
}
/* 배경은 뷰포트 끝까지, 내용은 컨테이너 규칙을 따르는 전체너비 섹션 */
.ds-bleed { width: 100%; }

/* 섹션 간격 */
.ds-section { padding-block: var(--space-12); }
.ds-section + .ds-section { padding-top: 0; margin-top: var(--section-gap-mobile); }
.ds-section__head { margin-bottom: var(--space-5); display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }

/* 상품 그리드 — 2 → 3 → 4열 */
.ds-grid-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--grid-gap-mobile-x);
  row-gap: var(--grid-gap-mobile-y);
}

/* 12/8/4열 범용 그리드 */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap-mobile-x);
}

@media (min-width: 768px) {
  .ds-grid-products { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--grid-gap-pc); row-gap: var(--grid-gap-pc); }
  .ds-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--grid-gap-pc); }
}
@media (min-width: 1024px) {
  .ds-section { padding-block: var(--space-16); }
  .ds-section + .ds-section { margin-top: var(--section-gap-pc); }
  .ds-section__head { margin-bottom: var(--space-8); }
  .ds-grid-products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ds-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

/* 고정 영역을 피하는 본문 여백 */
.ds-has-tabbar  { padding-bottom: calc(var(--tabbar-mobile) + env(safe-area-inset-bottom) + var(--space-4)); }
.ds-has-actionbar { padding-bottom: calc(var(--actionbar-mobile) + env(safe-area-inset-bottom) + var(--space-4)); }
.ds-has-paybar    { padding-bottom: calc(112px + env(safe-area-inset-bottom) + var(--space-4)); }
@media (min-width: 1024px) {
  .ds-has-tabbar, .ds-has-actionbar, .ds-has-paybar { padding-bottom: 0; }
}

/* 고정 헤더를 고려한 앵커 이동 */
[id] { scroll-margin-top: calc(var(--header-mobile) + var(--space-4)); }
@media (min-width: 1024px) {
  [id] { scroll-margin-top: calc(var(--header-pc-sticky) + var(--space-4)); }
}

/* 뷰포트 범위별 표시 */
.pc-only { display: none; }
@media (min-width: 1024px) {
  .pc-only { display: revert; }
  .mobile-only { display: none !important; }
}

/* 2줄 말줄임 — 상품명 */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 본문 줄 길이 상한 (약 76자) */
.measure { max-width: 72ch; }

/* --------------------------------------------------------------------------
   6. MOTION — 사용자가 모션을 줄이도록 설정하면 전부 끈다
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
