/* ==========================================================
   pages-discover.css — 통합 검색(#/search) + 카탈로그(#/catalog/:section)
   담당: OPUS-K (T-010) · 이 파일은 T-010 담당자만 수정한다.

   주입 방식: index.html 수정 금지 규칙에 따라 js/pages/search.js ·
   js/pages/catalog.js 가 로드 시 <link id="css-pages-discover"> 를 head 에
   1회 주입한다(중복 방지 가드). 코어가 index.html 에 <link> 를 직접 추가하면
   주입 가드가 그대로 통과되어 중복 로드는 발생하지 않는다.

   네이밍 규칙: 전역 클릭 위임(app.js)이 가로채는 .chip / .tab / .follow-btn 은
   쓰지 않고 전부 `dc-` 프리픽스를 사용한다.
   외부 라이브러리 0
   ========================================================== */

/* ==========================================================
   0. 공통
   ========================================================== */

.dc-page {
  padding-bottom: 40px;
}

.dc-block {
  margin-top: 28px;
}

.dc-block:first-of-type {
  margin-top: 20px;
}

.dc-block__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dc-block__title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.dc-block__act {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-sub);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.dc-block__act:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.dc-empty-line {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  padding: 6px 2px;
}

/* ==========================================================
   1. 검색 폼
   ========================================================== */

.dc-searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.dc-searchbar:focus-within {
  border-color: #111;
  box-shadow: var(--shadow-md);
}

.dc-searchbar > svg {
  flex: none;
  color: var(--text-faint);
}

.dc-searchbar__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.dc-searchbar__input::placeholder {
  color: var(--text-faint);
}

.dc-searchbar__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.dc-searchbar__clear,
.dc-searchbar__submit {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.dc-searchbar__clear {
  width: 26px;
  height: 26px;
  color: var(--text-faint);
  background: var(--bg-soft);
}

.dc-searchbar__clear:hover {
  color: var(--text);
  background: var(--line-strong);
}

.dc-searchbar__submit {
  height: 36px;
  padding: 0 18px;
  background: #111;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.dc-searchbar__submit:hover {
  background: #000;
}

/* ==========================================================
   2. 최근 검색어 / 인기 검색어 칩
   ========================================================== */

.dc-taglist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 최근 검색어 = 링크 + 삭제 버튼 한 쌍 */
.dc-recent {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 4px 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--dur) var(--ease);
}

.dc-recent:hover {
  background: var(--line-strong);
}

.dc-recent__link {
  color: inherit;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-recent__del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 4px;
  border-radius: 50%;
  color: var(--text-faint);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.dc-recent__del:hover {
  background: rgba(17, 17, 17, 0.12);
  color: var(--text);
}

/* 인기 검색어 */
.dc-hot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.dc-hot:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
}

.dc-hot__rank {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--purple);
}

/* ==========================================================
   3. 검색 결과 탭
   ========================================================== */

.dc-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 22px 0 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.dc-tabs::-webkit-scrollbar {
  display: none;
}

.dc-tab {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 42px;
  padding: 0 14px;
  color: var(--text-sub);
  font-size: var(--fs-body);
  font-weight: 700;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}

.dc-tab:hover {
  color: var(--text);
}

.dc-tab.is-active {
  color: var(--text);
}

.dc-tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2.5px;
  border-radius: 2px;
  background: #111;
}

.dc-tab__n {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--text-faint);
}

.dc-tab.is-active .dc-tab__n {
  color: var(--purple);
}

.dc-results {
  margin-top: 20px;
}

.dc-resulthead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  font-size: var(--fs-sm);
  color: var(--text-sub);
}

.dc-resulthead b {
  color: var(--text);
  font-weight: 800;
}

/* ==========================================================
   4. 카탈로그 툴바 (필터 칩 + 정렬)
   ========================================================== */

.dc-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dc-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 320px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.dc-chips::-webkit-scrollbar {
  display: none;
}

.dc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.dc-chip:hover {
  background: var(--line-strong);
}

.dc-chip.is-active {
  background: #111;
  color: #fff;
}

.dc-chip__emoji {
  font-size: 13px;
  line-height: 1;
}

.dc-sorts {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-left: auto;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
}

.dc-sort {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  color: var(--text-sub);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.dc-sort:hover {
  color: var(--text);
}

.dc-sort.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.dc-count {
  margin: 14px 0 12px;
  font-size: var(--fs-sm);
  color: var(--text-sub);
}

.dc-count b {
  color: var(--text);
  font-weight: 800;
}

/* ==========================================================
   5. 더 보기
   ========================================================== */

.dc-morewrap {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.dc-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 26px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  color: var(--text);
  font-size: var(--fs-body);
  font-weight: 700;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.dc-more:hover {
  background: var(--bg-soft);
  border-color: #111;
}

.dc-more__n {
  color: var(--text-faint);
  font-weight: 600;
}

/* ==========================================================
   6. 크리에이터 카드 (검색 탭 · 카탈로그 creators 섹션 공용)
   ========================================================== */

.dc-grid {
  display: grid;
  gap: var(--gap);
}

.dc-grid--creators {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dc-creator {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.dc-creator:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.dc-creator__go {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.dc-creator__go:focus-visible {
  outline: 3px solid var(--lime-strong);
  outline-offset: -3px;
}

.dc-creator__avatar {
  width: 54px;
  height: 54px;
}

.dc-creator__body {
  flex: 1;
  min-width: 0;
}

.dc-creator__name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-body);
  font-weight: 800;
  color: var(--text);
}

.dc-creator__name .verified {
  color: var(--purple);
}

.dc-creator__meta {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-sub);
}

.dc-creator__bio {
  margin-top: 7px;
  font-size: var(--fs-sm);
  color: var(--text-sub);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dc-creator__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.dc-tag {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-sub);
  font-size: var(--fs-2xs);
  font-weight: 600;
}

.dc-follow {
  position: relative;
  z-index: 2;
  flex: none;
  height: 30px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: #111;
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.dc-follow:hover {
  background: #000;
}

.dc-follow.is-on {
  background: var(--bg-soft);
  color: var(--text-sub);
}

/* ==========================================================
   7. 반응형
   ========================================================== */

@media (max-width: 1000px) {
  .dc-grid--creators {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dc-toolbar {
    gap: 10px;
  }

  .dc-sorts {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .dc-grid--creators {
    grid-template-columns: minmax(0, 1fr);
  }

  .dc-searchbar {
    height: 48px;
    padding: 0 10px 0 12px;
  }

  .dc-searchbar__submit {
    height: 32px;
    padding: 0 13px;
  }

  .dc-chips {
    flex: 1 1 100%;
  }

  .dc-sorts {
    width: 100%;
    justify-content: space-between;
  }

  .dc-sort {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .dc-tab {
    padding: 0 11px;
  }

  .dc-creator__bio {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
}
