/* ========================================= */
/* Tabs - All Tab Variants                  */
/* ========================================= */

/* Sub Tabs */
.sub-tabs {
  position: sticky;
  top: 0;
  z-index: 998;
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  background: var(--bg-default);
  gap: 8px;
  padding: var(--space-card) var(--gutter);   /* 위아래 16 (10-25 사용자 "간격 맞춰야"): 탭→칩 12·칩→배너 28 로 달랐다. 다른 탭의 탭→배너 16 과 같게 */
}
.sub-tabs:not([style*="none"]) + section { margin-top: 0; }   /* 칩 줄이 보일 때만 배너 자기 위 16 을 뺀다 — 숨겨져 있어도 형제로 남아 다른 탭 배너가 탭에 붙었던 것 (10-25) */
.sub-tabs::-webkit-scrollbar { display: none; }

.sub-tab {
  /* 26-08-27 컨셉 B 승격: 아웃라인 칩. 활성은 검정 채움 — 레드는 상위 탭·CTA 전용(레드 두 줄 겹침 방지) */
  display: inline-flex;
  align-items: center;
  height: 32px;   /* 10-18 칩 B 로 통일: 36 알약 → 32 · 라운드 8 · 회색 면 */
  padding: 0 12px;
  border-radius: var(--r-full);   /* 알약 — .filter-chip 과 같게 (10-26) */
  color: var(--fg-secondary);   /* 안 고른 칩 = 회색 글자 — .filter-chip 과 같게 (10-25 통일, 10-20 칩 검정 금지) */
  text-decoration: none;
  font: var(--t-tag-14); font-weight: 500;
  /* 칩 글자 = 줄높이 100% (10-21) */
  background: var(--bg-sunken);
  border: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
  flex-shrink: 0;
}
.sub-tab.is-active {   /* 10-26 검정 면 + 흰 글자 — .filter-chip 과 같게 */
  color: var(--fg-inverse);
  background: var(--bg-inverse);
  border-color: transparent;   /* 칩 선택 테두리 기준 (10-25): 회색 면 칩 = 고르면 연빨강 면만, 테두리 없음(필터 칩 .pb-chip 과 같게). 흰 면 + 테두리 칸(시간 고르기) = 연빨강 테두리 */
  font-weight: 600;   /* 고른 칩 = 600 — .filter-chip 과 같게 (10-25 통일, 옛 700) */
}

/* Fixed Tabs (homepage) */
.fixed-tabs {
  position: fixed;
  top: 54px;   /* 앱바 54 바로 밑 (10-20) */
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-control);   /* E5E5EA → D1D1D6 (26-08-27): 1px 연회색이 실기기에서 안 보임 */
  background: var(--bg-default);
  gap: 20px;   /* 12→20 (26-08-30 사용자: 빡빡함). 390 에서 4번째 탭이 중간에 걸쳐 잘리며 스크롤 단서 역할 */
  padding: 0 16px;
}
.fixed-tabs::-webkit-scrollbar { display: none; }
/* 우측 페이드 제거 (26-08-27 사용자: 끝을 흐리게 표현하지 말 것). 잘린 탭은 그대로 잘려 보인다 */

.fixed-tab {
  display: inline-flex;
  align-items: center;
  height: 44px;   /* 40 → 44 (10-20 사용자 "탭 높이 44로") — 탭 바 전체 45(밑줄 1 포함) */
  color: var(--fg-tab-idle); /* 26-08-31: 비활성 gray-700, 활성 검정 볼드 (빨강 활성 폐기 — 빨강은 CTA·배지·오류만) */
  text-decoration: none;
  font: var(--t-body-lg);   /* 16/24 */
  font-weight: 400; /* 26-08-31 사용자: 비활성 레귤러, 활성 볼드 (26-08-27 미디엄 폐기) */
  flex-shrink: 0;
  border-bottom: 2px solid transparent;
  position: relative;
}
.fixed-tab.is-active { color: var(--fg-primary); border-bottom-color: var(--border-focus); font-weight: 700; }
/* 누르는 영역만 좌우 10 넓힘 — 짧은 탭(All·FAQ)이 32 미만이라 (26-10-18, 모양 그대로) */
.fixed-tab::after { content: ''; position: absolute; inset: 0 -10px; }

   

/* Generic tabs (points page) */
.tabs {
  position: sticky;
  top: min(54px, 8vh);
  z-index: 999;
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-control);   /* .fixed-tabs 와 같은 선·간격 (26-09-12) */
  background: var(--bg-default);
  gap: 20px;
  padding-left: 16px;
  padding-right: 16px;
  margin: 0 -16px;
}
.tabs::-webkit-scrollbar { display: none; }

/* 상단 탭 규칙을 .fixed-tab 과 같게 — 활성 검정 볼드+밑줄, 비활성 회색 레귤러 (26-09-12: 여기만 빨강 활성이 남아 있었다) */
.tab {
  display: inline-flex;
  align-items: center;
  height: 44px;   /* 40 → 44 (10-20 사용자 "탭 높이 44로") — 탭 바 전체 45(밑줄 1 포함) */
  color: var(--fg-tab-idle);
  text-decoration: none;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  border-bottom: 2px solid transparent;
}
.tab.is-active { color: var(--fg-primary); border-bottom-color: var(--border-focus); font-weight: 700; }

/* 상세 탭 = 흐름 속 (10-23 사용자 "위치 개선") — 사진·제목 아래 8 띠 + 탭, 내려가면 상단바(54) 밑에 붙음(.is-pinned, scripts/detail-tabs-stick.js).
   붙는 동안 빈자리는 .tabs-slot 높이가 지킨다(점프 없음). 공동구매 1-3 세 장 · 일반 캠페인 상세 두 장 */
.tabs-slot { box-sizing: border-box; height: 53px; margin: 24px -16px; border-top: 8px solid var(--bg-sunken); }
.tabs-slot > .fixed-tabs { position: static; }
.tabs-slot > .fixed-tabs.is-pinned { position: fixed; top: 54px; box-shadow: var(--shadow-1); }   /* 좌우는 .fixed-tabs 값(넓은 화면 430 폭 포함) 그대로 */
html:has(.tabs-slot) { scroll-padding-top: 115px; }   /* 탭 눌러 이동하면 구간 머리가 상단바 + 탭(54+45) 아래 16 띄고 */

/* 탭이 3개 이하 = 너비를 같은 폭으로 나눔 (10-25 사용자 "왜 전체 너비로 안 하고 왼쪽으로 치우쳤냐", 내 캠페인·메시지·문의·알림 등).
   4개 이상(홈·상세)은 그대로 가로로 밀기 */
/* 10-25 탭 3개(Campaigns·Super Pass·Group Buy)에서 긴 글(+40%)이 360 칸을 넘쳐 옆 탭 글자와 겹쳤다 → 칸 = 같은 폭이되 글자보다 좁아지지 않게,
   넘치면 4개 이상 탭처럼 가로로 밀기(잘린 탭은 그대로). 좌우 4 = 넘칠 때 이웃 탭 글자와 붙지 않게 */
.fixed-tabs:not(:has(> .fixed-tab:nth-of-type(4))) { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); gap: 0; overflow-x: auto; overflow-y: hidden; }
.fixed-tabs:not(:has(> .fixed-tab:nth-of-type(4))) > .fixed-tab { justify-content: center; min-width: 0; padding: 0 4px; text-align: center; }
.fixed-tabs:not(:has(> .fixed-tab:nth-of-type(4))) > .fixed-tab::after { inset: 0; }
/* .tabs(포인트) 도 같은 규칙 — 3개 이하면 같은 폭 (10-25) */
.tabs:not(:has(> .tab:nth-of-type(4))) { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; overflow: visible; }
.tabs:not(:has(> .tab:nth-of-type(4))) > .tab { justify-content: center; min-width: 0; }
