/*
 * cnb-hub.css
 * ClicknBest — Category Hub Page Styles
 * 설치: child-theme/assets/css/cnb-hub.css
 * 적용 범위: .cnb-hub 래퍼 안의 모든 요소
 */

/* ── 토큰 ─────────────────────────────────────────────── */
.cnb-hub {
  --hub-max-w:    960px;
  --hub-pad:      20px;
  --hub-radius:   12px;
  --hub-border:   #e8e8e8;
  --hub-bg:       #f5f5f7;
  --hub-card:     #ffffff;
  --hub-txt:      #1a1a1a;
  --hub-sub:      #555555;
  --hub-mute:     #888888;
  --hub-blue:     #378ADD;
  --hub-green:    #1D9E75;
  --hub-amber:    #f59e0b;

  max-width: var(--hub-max-w);
  margin: 0 auto;
  padding: 0 0 32px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--hub-txt);
}
.cnb-hub *, .cnb-hub *::before, .cnb-hub *::after { box-sizing: border-box; }

/* ── 섹션 ──────────────────────────────────────────────── */
.cnb-hub-section {
  margin-bottom: 32px;
}

.cnb-hub-sh {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 700;
  color: var(--hub-txt);
  padding: 16px var(--hub-pad) 12px;
  border-top: 3px solid #efefef;
  margin: 0 0 0;
}

/* ── 카드 그리드 ───────────────────────────────────────── */
.cnb-hub-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 var(--hub-pad);
}
@media (min-width: 540px) {
  .cnb-hub-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .cnb-hub-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .cnb-hub-cards { grid-template-columns: repeat(4, 1fr); }
}

/* ── 카드 ──────────────────────────────────────────────── */
.cnb-hub-card {
  display: flex;
  flex-direction: column;
  background: var(--hub-card);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.cnb-hub-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  transform: translateY(-2px);
}

/* 이미지 */
.cnb-hub-card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #f0f0f0;
}
.cnb-hub-card-img--placeholder {
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

/* 카드 본문 */
.cnb-hub-card-body {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cnb-hub-card-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--hub-mute);
}
.cnb-hub-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--hub-txt);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cnb-hub-card-excerpt {
  font-size: 12px;
  color: var(--hub-sub);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.cnb-hub-card-date {
  font-size: 11px;
  color: var(--hub-mute);
  margin-top: 4px;
}

/* ── 타입별 상단 색상 강조 ─────────────────────────────── */
.cnb-hub-card--anchor-selection { border-top: 3px solid #1D9E75; }
.cnb-hub-card--anchor-list      { border-top: 3px solid #378ADD; }
.cnb-hub-card--article          { border-top: 3px solid #f59e0b; }
.cnb-hub-card--comparison       { border-top: 3px solid #8B5CF6; }
.cnb-hub-card--mi               { border-top: 3px solid #06b6d4; }
.cnb-hub-card--review           { border-top: 3px solid #e11d48; }

/* ── 빈 상태 (섹션 숨김은 PHP에서 처리, JS fallback) ───── */
.cnb-hub-section:empty { display: none; }

/* ── Hero + Description ────────────────────────────────── */
.cnb-hub-hero {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  padding: 24px var(--hub-pad) 20px;
  margin-bottom: 0;
}
.cnb-hub-breadcrumb {
  font-size: 12px; color: #888; margin-bottom: 10px;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.cnb-hub-breadcrumb a { color: #888; text-decoration: none; }
.cnb-hub-breadcrumb a:hover { color: var(--hub-blue); }
.cnb-hub-h1 {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 800; line-height: 1.25;
  margin: 0 0 12px;
}
.cnb-hub-desc {
  font-size: 15px; line-height: 1.75; color: #444;
  max-width: 700px; margin: 0;
}

/* ── Market Intelligence (텍스트형) ────────────────────── */
.cnb-hub-mi {
  background: #f0f7ff;
  border: 1px solid #d0e4f7;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px var(--hub-pad) 0;
}
.cnb-hub-mi-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--hub-blue); margin-bottom: 10px;
}
.cnb-hub-mi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.cnb-hub-mi-item {
  background: #fff; border-radius: 7px;
  padding: 10px 12px; border: 1px solid #d0e4f7;
}
.cnb-hub-mi-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; color: #888; margin-bottom: 3px;
}
.cnb-hub-mi-val { font-size: 15px; font-weight: 800; color: #1a1a1a; }
.cnb-hub-mi-desc {
  font-size: 13px; color: #555; line-height: 1.65; margin: 0;
}
.cnb-hub-mi-more {
  color: var(--hub-blue); font-weight: 600;
  text-decoration: none; margin-left: 5px;
}

/* ── Internal Links ────────────────────────────────────── */
.cnb-hub-internal {
  margin: 24px var(--hub-pad) 0;
  padding-top: 20px;
  border-top: 2px solid #efefef;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.cnb-hub-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--hub-blue);
  border: 1.5px solid #d0e4f7; border-radius: 20px;
  padding: 7px 14px; background: #f0f7ff; text-decoration: none;
  transition: background .15s;
}
.cnb-hub-link:hover { background: #deeeff; }
/*
 * Browse Subcategories / Browse Categories
 * mid 카테고리 → leaf 카드, top 카테고리 → mid 카드
 * HTML 구조: cnb-sub-item > cnb-sub-card(이미지링크) + cnb-sub-name(링크) + cnb-sub-desc
 */

/* ── 그리드 컨테이너 ─────────────────────────────────── */
.cnb-sub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px 12px;
  padding: 0 var(--hub-pad, 20px) 12px;
  margin-top: 6px;
}

@media (min-width: 480px) {
  .cnb-sub-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (min-width: 768px) {
  .cnb-sub-cards { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* ── item 래퍼: 이미지 + 이름 + 설명 ───────────────────── */
.cnb-sub-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── 카드 = 이미지 링크만 ────────────────────────────── */
.cnb-sub-card {
  display: block;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
  transition: transform .18s ease, box-shadow .18s ease;
}
.cnb-sub-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.16);
}

/* ── 실제 이미지 ─────────────────────────────────────── */
.cnb-sub-img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
}

/* ── 카테고리명 (카드 바깥, 링크) ───────────────────── */
.cnb-sub-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.35;
  text-decoration: none;
}
.cnb-sub-name:hover {
  color: #378ADD;
  text-decoration: underline;
}

/* ── 짧은 설명 (카드 바깥) ──────────────────────────── */
.cnb-sub-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   Home Page Hub 전용 스타일
   적용: .cnb-home-* 클래스
══════════════════════════════════════════════════════ */

/* ── Hero ──────────────────────────────────────────── */
.cnb-home-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 48px 24px;
  text-align: center;
}
.cnb-home-hero h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.25;
}
.cnb-home-hero p {
  font-size: 1rem;
  color: #94a3b8;
  margin: 0 auto 20px;
  max-width: 600px;
  line-height: 1.65;
}
.cnb-home-cta {
  display: inline-block;
  background: #378ADD;
  color: #fff;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  transition: background .15s;
}
.cnb-home-cta:hover { background: #2563eb; }

/* ── 섹션 공통 ─────────────────────────────────────── */
.cnb-home-section {
  padding: 28px 20px;
  max-width: 960px;
  margin: 0 auto;
}
.cnb-home-section h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

/* ── Top Categories ────────────────────────────────── */
.cnb-home-topcats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.cnb-home-topcat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cnb-home-topcat-img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
  transition: transform .18s, box-shadow .18s;
}
.cnb-home-topcat-img:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.16);
}
.cnb-home-topcat-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
}
.cnb-home-topcat-name:hover { color: #378ADD; }

/* ── How It Works ──────────────────────────────────── */
.cnb-home-how { background: #f8fafc; }
.cnb-home-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 600px) {
  .cnb-home-steps { grid-template-columns: 1fr; }
}
.cnb-home-step {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
}
.cnb-home-step-icon { font-size: 2rem; margin-bottom: 10px; }
.cnb-home-step h3 {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px;
}
.cnb-home-step p {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}

/* ── Popular Quick Links ───────────────────────────── */
.cnb-home-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cnb-home-quicklink {
  display: inline-block;
  padding: 6px 14px;
  background: #f0f7ff;
  border: 1px solid #d0e4f7;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #378ADD;
  text-decoration: none;
  transition: background .15s;
}
.cnb-home-quicklink:hover { background: #deeeff; }

/* ── Latest Reviews 카드 그리드 ─────────────────────── */
.cnb-home-reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
@media (max-width: 480px) {
  .cnb-home-reviews-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

.cnb-home-review-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .18s, box-shadow .18s;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.cnb-home-review-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.cnb-home-review-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.cnb-home-review-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cnb-home-review-excerpt {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cnb-home-review-date {
  font-size: 10px;
  color: #94a3b8;
  margin-top: auto;
  padding-top: 6px;
}

/* ── Top Picks / Rising Fast / Hidden Gems 카드 ─────────────── */
.cnb-tp-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.cnb-tp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
@media (max-width: 480px) {
  .cnb-tp-featured { grid-template-columns: 1fr; }
  .cnb-tp-grid     { grid-template-columns: 1fr 1fr; }
}
.cnb-tp-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.cnb-tp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

/* ── Video Card ────────────────────────────────────────────── */
.cnb-hub-card--video { border-top: 3px solid #06b6d4; }
.cnb-hub-card--video .cnb-hub-card-type { color: #06b6d4; }

/* ── Description 섹션 ──────────────────────────────────────── */
.cnb-desc-section {
  margin: 8px 0 0;
  padding: 0 var(--hub-pad, 20px);
}
.cnb-desc-set {
  margin-bottom: 24px;
}
.cnb-desc-media {
  width: 100%;
  margin-bottom: 12px;
}
.cnb-desc-media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
  display: block;
}
.cnb-desc-media video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  display: block;
}
.cnb-desc-media img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}
.cnb-desc-para {
  font-size: 15px;
  line-height: 1.8;
  color: #444;
  white-space: pre-line;
}
/* 데스크탑 가로 레이아웃 */
@media (min-width: 768px) {
  .cnb-desc-set--side {
    display: flex;
    gap: 24px;
    align-items: flex-start;
  }
  .cnb-desc-set--side .cnb-desc-media {
    flex: 0 0 45%;
    width: 45%;
    margin-bottom: 0;
  }
  .cnb-desc-set--side .cnb-desc-para {
    flex: 1;
  }
}
