/**
 * 파일명: assets/css/category-hub.css
 * 위치: /assets/css/
 * 기능: 전체 카테고리 허브(category.php, id 없이 접근) 전용 스타일
 *
 * @version   1.2.0
 * @updated   2026-07-27
 * @standalone 원천 고유 디자인이다 — panchok/zengift 로 복사하지 않는다(2026-07-27 사용자 결정).
 *             팔레트 출처: ~/OneDrive/WEB/Projects/docs/design/design_system_03-dark-mono-clean.md
 * @changelog
 *   1.2.0 (2026-07-27) 서버 반영 후 2차 피드백 반영 —
 *                      ① 리스트형의 판매 1위 블록을 index 상품카드처럼 이미지 상단/텍스트 하단
 *                         수직 레이아웃으로 변경(기존 가로형은 공간 비효율적이라는 피드백)
 *                      ② 히어로 설명문 재배치 — 분야별 1위를 나열하던 긴 문장을 리드 문단에서
 *                         분리해 보조 캡션(.hub-highlights, 13px)으로 축소. 각 카드가 이미
 *                         이미지로 보여주므로 겹치는 정보를 덜 두드러지게 했다(GEO 목적상 삭제는
 *                         하지 않고 시각적 비중만 낮춤)
 *   1.1.0 (2026-07-27) 레이아웃 개편(사용자 요청, 서버 반영 후 피드백) —
 *                      ① 대분류·소분류 모두 "판매 1위" 상품을 이미지+제목+주문건수로 강조
 *                      ② 카드형/리스트형 토글(우측 상단) 추가 — .hub-grid 에 view-card/view-list
 *                         클래스를 토글하는 방식으로 마크업은 하나만 유지한다
 *                      기존 텍스트 전용 .hub-top, pill 전용 .hub-sub-chip 은 제거하고
 *                      이미지 포함 구조(.hub-top-product, .hub-sub-link)로 교체
 *   1.0.0 (2026-07-27) 최초 작성 — 4단계 2차: 전체 카테고리 허브 신설
 */

body.cat-hub {
    --color-bg: #fbfbfc;
    --color-surface: #ffffff;
    --color-dot: #dcdde3;
    --color-accent: #111317;
    --color-accent-dark: #000000;
    --color-on-accent: #ffffff;
    --color-link: #2563eb;
    --color-text: #0c0d10;
    --color-text-muted: #71757e;
    --color-border: #d4d6dd;
    --color-success: #16a34a;
    --shadow: 0 1px 2px rgba(16, 18, 24, .04), 0 6px 24px rgba(16, 18, 24, .05);
    --radius: 16px;

    background-color: var(--color-bg);
    background-image: radial-gradient(var(--color-dot) 1px, transparent 1px);
    background-size: 22px 22px;
    background-position: -11px -11px;
    color: var(--color-text);
    word-break: keep-all;
}

@media (prefers-color-scheme: dark) {
    body.cat-hub {
        --color-bg: #0d0d0d;
        --color-surface: #1a1a1a;
        --color-dot: #232326;
        --color-accent: #f0f0f0;
        --color-accent-dark: #ffffff;
        --color-on-accent: #111317;
        --color-text: #e0e0e0;
        --color-text-muted: #888888;
        --color-border: #333333;
        --color-link: #60a5fa;
        --color-success: #22c55e;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 24px rgba(0, 0, 0, .4);
    }
}

/* ===== 히어로 ===== */
.hub-hero {
    padding: 2.5rem 0 1.5rem;
}
.hub-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.hub-hero h1 {
    font-size: clamp(28px, 5vw, 40px);
    font-weight: 800;
    letter-spacing: -.5px;
    margin: 0 0 .75rem;
}
.hub-hero p {
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1.65;
    max-width: 760px;
    margin-bottom: 0;
}
/* 분야별 판매 1위 요약 문장 — AI 검색 인용을 위해 본문에는 남기되(GEO), 위 리드 문단과는
   시각적으로 분리해 덜 두드러지게 한다(사용자 피드백: 기존엔 한 문단으로 뒤엉켜 비효율적이었다).
   각 카드에서 이미 이미지로 보여주므로 여기서는 보조 캡션 역할만 한다. */
.hub-hero p.hub-highlights {
    margin-top: .6rem;
    font-size: 13px;
    color: var(--color-text-muted);
    max-width: 760px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.hub-highlights i { margin-top: 2px; color: var(--color-link); flex-shrink: 0; }
.hub-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    box-shadow: var(--shadow);
    padding: 5px 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-top: 1rem;
}
.hub-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 15%, transparent);
}

/* ===== 카드형/리스트형 토글 ===== */
.hub-toolbar {
    display: flex;
    gap: .4rem;
    flex-shrink: 0;
}
.hub-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.hub-view-btn:hover {
    border-color: #c7c9d0;
}
.hub-view-btn.active {
    background: var(--color-accent);
    color: var(--color-on-accent);
    border-color: var(--color-accent);
}

/* ===== 카드형(기본) ===== */
.hub-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1rem 0 2rem;
}
.hub-grid.view-card {
    grid-template-columns: 1fr;
}
@media (min-width: 768px)  { .hub-grid.view-card { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .hub-grid.view-card { grid-template-columns: repeat(3, 1fr); } }

.hub-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: border-color .15s;
    display: flex;
    flex-direction: column;
    gap: .9rem;
}
.hub-card:hover { border-color: #c7c9d0; }

.hub-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.hub-card-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}
.hub-card-title a {
    color: var(--color-text);
    text-decoration: none;
}
.hub-card-title a:hover { color: var(--color-link); }

.hub-card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
}
.hub-card-link:hover { color: var(--color-link); }

/* ===== 판매 1위 상품 (대분류·소분류 공통 톤) ===== */
.hub-top-product {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: color-mix(in srgb, var(--color-link) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-link) 18%, transparent);
    border-radius: 12px;
    padding: .6rem;
    text-decoration: none;
}
.hub-top-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 20px;
}
.hub-top-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.hub-top-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.hub-top-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-link);
    text-transform: uppercase;
    letter-spacing: .02em;
}
.hub-top-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-top-count {
    font-size: 12.5px;
    color: var(--color-text-muted);
}

/* ===== 소분류 목록 ===== */
.hub-subs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.hub-sub {
    flex: 0 0 auto;
}
.hub-sub-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 160px;
    padding: .4rem .55rem;
    border-radius: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    text-decoration: none;
    transition: border-color .15s;
}
.hub-sub-link:hover { border-color: #c7c9d0; }
.hub-sub-thumb {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: color-mix(in srgb, var(--color-link) 6%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--color-text-muted);
}
.hub-sub-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.hub-sub-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}
.hub-sub-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-sub-top {
    font-size: 11px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-sub-top-empty {
    font-style: italic;
}

/* ===== 리스트형 ===== */
.hub-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.hub-grid.view-list .hub-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}
.hub-grid.view-list .hub-card-head {
    flex: 0 0 180px;
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
}

/* 리스트형의 판매 1위 — index.php 상품카드처럼 이미지를 상단에 크게, 텍스트는 하단(사용자 피드백) */
.hub-grid.view-list .hub-top-product {
    flex: 0 0 150px;
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    padding: .6rem .6rem .75rem;
}
.hub-grid.view-list .hub-top-thumb {
    width: 100%;
    height: 110px;
    border-radius: 8px;
}
.hub-grid.view-list .hub-top-info {
    align-items: center;
    text-align: center;
}
.hub-grid.view-list .hub-top-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.hub-grid.view-list .hub-subs {
    flex: 1 1 320px;
}
.hub-grid.view-list .hub-sub-link {
    width: 140px;
}

@media (max-width: 768px) {
    .hub-grid.view-list .hub-card {
        flex-direction: column;
        align-items: stretch;
    }
    .hub-grid.view-list .hub-card-head,
    .hub-grid.view-list .hub-top-product,
    .hub-grid.view-list .hub-subs {
        flex: none;
        width: 100%;
    }
}

/* ===== FAQ ===== */
.hub-faq {
    margin: 1rem 0 2.5rem;
}
.hub-faq h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 1.25rem;
}
.hub-faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: .75rem;
}
.hub-faq-item summary {
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    list-style: none;
}
.hub-faq-item summary::-webkit-details-marker { display: none; }
.hub-faq-item summary::before {
    content: '+';
    display: inline-block;
    width: 1.2em;
    color: var(--color-link);
    font-weight: 800;
}
.hub-faq-item[open] summary::before { content: '\2212'; }
.hub-faq-item p {
    margin: .6rem 0 0;
    padding-left: 1.2em;
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.65;
}
