/* ================= 카테고리 탭 ================= */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}

.tab-btn {
    padding: 10px 22px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--color-muted);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.tab-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.tab-btn.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* 하위 카테고리 탭 (예: RF-Module → PLL / VCO / 기타 Module) */
.category-tabs:has(+ .category-subtabs) {
    margin-bottom: 16px;
}
.category-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background-color: var(--color-bg);
}
.subtab-btn {
    padding: 8px 18px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background-color: #fff;
    font-size: .875rem;
    font-weight: 600;
    color: var(--color-muted);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.subtab-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.subtab-btn.active {
    border-color: var(--color-primary);
    background-color: #fff;
    color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

/* ================= 제품 카드 그리드 ================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.loading-msg,
.empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 0;
    color: var(--color-muted);
}

.product-card {
    display: block;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}
.product-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--color-bg);
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-bg), var(--color-border));
}

.card-body {
    padding: 18px 20px;
}

.card-title {
    font-size: 1rem;
    margin-bottom: 8px;
}

.card-summary {
    font-size: .85rem;
    color: var(--color-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================= 제품 상세 ================= */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-bottom: 60px;
}

.detail-viewer {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    align-self: start;
}

.detail-main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
    margin-bottom: 16px;
    background-color: var(--color-bg);
}
.detail-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-thumb-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-thumb {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
}
.detail-thumb.active {
    border-color: var(--color-primary);
}
.detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background-color: var(--color-bg);
    color: var(--color-primary);
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.detail-title {
    font-size: 1.6rem;
    margin-bottom: 24px;   /* 요약 문구를 없앴으므로 제목과 사양표 사이 간격을 여기서 둔다 */
}

.detail-summary {
    color: var(--color-muted);
    margin-bottom: 24px;
    line-height: 1.7;
}

.spec-table {
    width: 100%;
    margin-bottom: 32px;
}
.spec-table th,
.spec-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    font-size: .9rem;
}
.spec-table th {
    width: 140px;
    background-color: var(--color-bg);
    color: var(--color-muted);
    font-weight: 600;
}

.detail-description {
    line-height: 1.8;
    margin-bottom: 60px;
}
.detail-description img {
    border-radius: var(--radius);
    margin: 12px 0;
}
.detail-description h2 {
    font-size: 1.3rem;
    margin: 44px 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-text);
}
.detail-description h2:first-child {
    margin-top: 0;
}
.detail-description p {
    color: var(--color-muted);
    margin-bottom: 12px;
}

/* 제품 설명 안의 표 (핀 구성 / Type 구성) */
.detail-description .data-table {
    width: 100%;
    margin-bottom: 8px;
}
.detail-description .data-table th,
.detail-description .data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    font-size: .9rem;
}
.detail-description .data-table thead th {
    background-color: var(--color-bg);
    color: var(--color-muted);
    font-weight: 600;
}
.detail-description .data-table .num {
    width: 64px;
    color: var(--color-muted);
}

/* 핀 구성 표 위 왼쪽 안내 문구 (회색) */
.detail-description .pin-note {
    margin: 0 0 8px;
    text-align: left;
    font-size: .875rem;
    color: var(--color-muted);
}

/* 제품 설명 안의 이미지 (크기 비교 / 측정 화면) */
.detail-description figure {
    margin: 8px 0 24px;
}
.detail-description figure img {
    width: 100%;
    margin: 0;
    border: 1px solid var(--color-border);
}
.detail-description figcaption {
    margin-top: 8px;
    font-size: .85rem;
    color: var(--color-muted);
}
.figure-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.figure-grid figure {
    margin: 0;
}

.detail-cta {
    margin-top: 40px;
    padding: 28px 32px;
    border-radius: var(--radius);
    background-color: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.detail-cta p {
    margin: 0;
    color: var(--color-text);
    font-weight: 600;
}

.related-section .section-sub-title {
    font-size: 1.3rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-text);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* 상세 페이지의 "상세 Spec" 버튼 (사양표 바로 아래) */
.detail-spec-btn {
    margin-top: -8px;
}

/* ================= 상세 Spec 페이지 (엑셀 사양표) ================= */
.spec-page-head .page-heading {
    margin-top: 8px;
}
.spec-back-link {
    display: inline-block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--color-primary);
}
.spec-back-link:hover {
    text-decoration: underline;
}

/* 표가 넓으면 이 상자 안에서만 가로 스크롤 (페이지 전체는 넘치지 않음) */
.spec-sheet-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.spec-sheet-scroll:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.spec-sheet {
    width: 100%;
    min-width: 820px;   /* 이보다 좁은 화면(태블릿·휴대폰)에서는 가로 스크롤 */
    border-collapse: collapse;
    font-size: .85rem;
    text-align: center;
}
.spec-sheet th,
.spec-sheet td {
    padding: 11px 5px;
    border: 1px solid var(--color-border);
    vertical-align: middle;
}
.spec-sheet thead th {
    background-color: var(--color-primary);
    border-color: rgba(255, 255, 255, .25);
    color: #fff;
    font-weight: 700;
    line-height: 1.4;
}
.spec-sheet tbody tr:nth-child(even) td,
.spec-sheet tbody tr:nth-child(even) th {
    background-color: var(--color-bg);
}
.spec-sheet tbody tr:hover td,
.spec-sheet tbody tr:hover th {
    background-color: #eef3fa;
}
/* Part Number: 두 모델명을 같은 폭의 두 칸으로, 왼쪽 정렬 */
.spec-sheet .spec-part {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    box-sizing: border-box;
    white-space: nowrap;
    text-align: left;
    padding-left: 10px;
    padding-right: 6px;
    font-weight: 700;
    color: var(--color-text);
    background-color: #fff;
}
.spec-sheet td {
    font-variant-numeric: tabular-nums;
}
/* 가로 스크롤할 때 Part Number 두 칸은 왼쪽에 고정 */
.spec-sheet thead tr:first-child th:first-child,
.spec-sheet .spec-part-1 {
    position: sticky;
    left: 0;
    z-index: 1;
}
.spec-sheet .spec-part-2 {
    position: sticky;
    left: 108px;
    z-index: 1;
    box-shadow: 1px 0 0 var(--color-border);
}

/* Datasheet가 있는 모델 강조 (엑셀의 파란 칸) */
.spec-sheet tbody .spec-part.is-datasheet {
    background-color: #dfe9f7;
    color: var(--color-primary);
}
.spec-sheet tbody .spec-part:not(.is-datasheet) {
    color: var(--color-muted);
    font-weight: 600;
}
.spec-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: .85rem;
    color: var(--color-muted);
}
.spec-legend-swatch {
    flex: none;
    width: 26px;
    height: 12px;
    border-radius: 2px;
    background-color: #dfe9f7;
    border: 1px solid #b9cde9;
}
/* Data 열의 PDF 링크 */
.spec-pdf-link {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background-color: var(--color-primary);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .03em;
    white-space: nowrap;
}
.spec-pdf-link:hover {
    background-color: #143a6d;
}
.spec-pdf-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ================= 태블릿 (768~1199px) ================= */
@media (min-width: 768px) and (max-width: 1199px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ================= 모바일 (767px 이하) ================= */
@media (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .product-detail {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .detail-viewer {
        position: static;
    }
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .figure-grid {
        grid-template-columns: 1fr;
    }
    /* 좁은 폰: 카드 2열에서 본문이 78px 남짓이라 제목이 접히고 치수가 잘림 → 여백을 줄이고, 긴 영문 제목은 줄바꿈 허용 */
    .card-body {
        padding: 12px 14px;
    }
    .card-title {
        overflow-wrap: anywhere;
    }
    .spec-table th {
        width: 34%;
    }
    .detail-description .data-table th,
    .detail-description .data-table td {
        padding: 8px 8px;
        font-size: .82rem;
    }
    .detail-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}
