/* ===== CSS 변수 정의 ===== */
:root {
    --color-bg: #f8f9fa;
    --color-white: #ffffff;
    --color-text: #222222;
    --color-text-light: #444444;
    --color-text-muted: #888888;
    --color-primary: #1a237e;
    --color-primary-light: #3949ab;
    --color-accent: #ff6f00;
    --color-border: #e0e0e0;
    --color-border-light: #eeeeee;
    --color-hover: #f5f5f5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --max-width: 1200px;
    --font-size-base: 16px;
}

/* ===== Part Nav 버튼 (맨 앞에 배치하여 확실히 적용) ===== */
.part-nav-btn {
    display: inline-block !important;
    padding: 10px 20px !important;
    background: #ffffff !important;
    color: #1a237e !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    border: 2px solid #1a237e !important;
    border-radius: 25px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
}

/* ===== 기본 스타일 리셋 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    font-size: var(--font-size-base);
    padding-top: 54px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-light);
}

img {
    max-width: 100%;
}

/* 인라인 width 속성 강제 무시 (모바일 viewport 보호) */
table[width],
iframe[width] {
    max-width: 100% !important;
    width: auto !important;
}

/* ===== 레이아웃 컨테이너 ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.page-wrapper {
    background: var(--color-white);
    min-height: 100vh;
}

/* ===== 상단 광고 영역 ===== */
.ad-top {
    background: var(--color-white);
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.ad-top .container {
    display: flex;
    justify-content: center;
}

.ad-slot {
    display: block;
    text-align: center;
}

.ad-slot-top {
    width: 640px;
    max-width: 100%;
    margin: 0 auto;
}

/* ===== 헤더 (키트 정보) ===== */
.kit-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 24px 0;
}

.kit-header .container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.kit-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kit-grade {
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
}

.kit-code {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    opacity: 0.9;
    padding: 4px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
}

.kit-name {
    font-size: 20px;
    font-weight: 700;
}

/* ===== 탭 네비게이션 ===== */
.tab-nav {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
}

.tab-nav .container {
    display: flex;
    gap: 0;
}

.tab-link {
    flex: 1;
    padding: 16px 20px;
    text-align: center;
    color: var(--color-text-light);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

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

.tab-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: var(--color-white);
}

.tab-link span.label {
    font-weight: 700;
}

.tab-link span.sub {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-left: 6px;
}

/* ===== 메인 콘텐츠 ===== */
.content {
    padding: 32px 0 48px;
}

/* ===== 제품 정보 헤더 ===== */
.product-info {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.product-image {
    flex-shrink: 0;
}

.product-image a {
    display: block;
    cursor: zoom-in;
}

.product-image img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
}

.product-meta {
    flex: 1;
}

.product-meta .meta-item {
    margin-bottom: 8px;
    font-size: 14px;
}

.product-meta .meta-label {
    color: var(--color-text-muted);
    margin-right: 8px;
}

.product-meta .meta-value {
    font-weight: 500;
    color: var(--color-text);
}

.product-meta .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-accent);
}

/* 목차 */
.toc {
    margin-top: 24px;
}

.toc-title {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin-bottom: 8px;
}

.toc-list a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
}

.toc-list a:hover {
    background: var(--color-primary);
    color: white;
}

.toc-list .num {
    background: var(--color-primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.toc-list a:hover .num {
    background: white;
    color: var(--color-primary);
}

/* ===== 섹션 스타일 ===== */
.section {
    margin-bottom: 48px;
    scroll-margin-top: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-primary);
}

.section-header .section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    text-align: left;
    margin-bottom: 0;
}

.section-top-link {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 4px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.section-top-link:hover {
    background: var(--color-primary);
    color: white;
}

/* 섹션 제목 (Review 페이지용) */
.section-title {
    text-align: center;
    margin-bottom: 32px;
}

.section-title h1 {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    padding: 10px 32px;
    border-radius: var(--radius-md);
    letter-spacing: 2px;
}

.section-title-box {
    text-align: center;
    margin-bottom: 32px;
}

.section-title-box h1 {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    padding: 10px 32px;
    border-radius: var(--radius-md);
    letter-spacing: 2px;
}

.section-subtitle {
    text-align: center;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}

/* ===== 이미지 갤러리 ===== */
.gallery-section {
    margin-bottom: 40px;
}

.gallery-single {
    text-align: center;
    margin-bottom: 32px;
}

.gallery-single a {
    display: inline-block;
    cursor: zoom-in;
}

.gallery-single img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.gallery-caption {
    margin-top: 2px;
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* 다중 이미지 그리드 */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 2px;
}

.gallery-grid a {
    display: block;
    cursor: zoom-in;
}

.gallery-grid img {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.gallery-grid-caption {
    text-align: center;
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 32px;
    padding-top: 2px;
}

/* 구분선 */
.divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 40px 0;
}

/* ===== 총평 섹션 ===== */
.review-text {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-top: 48px;
    border-left: 4px solid var(--color-primary);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.review-text p {
    margin-bottom: 16px;
    text-align: justify;
    word-break: keep-all;
}

.review-text p:last-child {
    margin-bottom: 0;
}

/* ===== 하단 광고 영역 ===== */
.ad-bottom {
    padding: 32px 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-border-light);
}

.ad-bottom .container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

.ad-bottom .ad-slot-bottom {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

/* ===== 푸터 ===== */
.footer {
    text-align: center;
    padding: 24px 0;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
}

.footer a {
    color: var(--color-text-muted);
    font-size: 13px;
}

.footer a:hover {
    color: var(--color-primary);
}

/* ===== LIGHTBOX ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox-overlay.show {
    opacity: 1;
}

/* 닫기 버튼 - 이미지 위에 오버레이 */
.lightbox-close {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.lightbox-close::before,
.lightbox-close::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 2px;
    background: white;
}

.lightbox-close::before {
    transform: rotate(45deg);
}

.lightbox-close::after {
    transform: rotate(-45deg);
}

.lightbox-close:hover {
    background: rgba(0,0,0,0.7);
}

/* 이미지 컨테이너 - 상단 여백 최소화 */
.lightbox-content {
    position: relative;
    width: 100%;
    max-width: 100vw;
    max-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 75px);
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: zoom-in;
}

.lightbox-image.loaded {
    opacity: 1;
}

.lightbox-image.zoomed {
    cursor: zoom-out;
}

.lightbox-image.dragging {
    transition: opacity 0.3s ease;
    cursor: grabbing;
}

/* 로딩 스피너 */
.lightbox-loader {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.lightbox-loader.hidden {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 하단 정보 영역 - 최소화 */
.lightbox-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    text-align: center;
}

.lightbox-caption {
    color: white;
    font-size: 18px;
    margin-bottom: 6px;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.5);
}

/* 하단 네비게이션 (버튼 + 카운터) */
.lightbox-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.lightbox-nav {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.25);
}

.lightbox-nav:active {
    background: rgba(255,255,255,0.35);
}

.lightbox-nav::before {
    content: '';
    width: 8px;
    height: 8px;
    border-top: 2px solid white;
    border-right: 2px solid white;
}

.lightbox-nav.prev::before {
    transform: rotate(-135deg);
    margin-left: 3px;
}

.lightbox-nav.next::before {
    transform: rotate(45deg);
    margin-right: 3px;
}

.lightbox-counter {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-family: 'Roboto Mono', monospace;
    min-width: 60px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* body 스크롤 막기 */
body.lightbox-open {
    overflow: hidden;
}

/* ===== 모바일 반응형 (태블릿) ===== */
@media (max-width: 768px) {
    :root {
        --max-width: 100%;
        --font-size-base: 17px;
    }

    .kit-header {
        padding: 16px 0;
    }

    .kit-header .container {
        flex-wrap: wrap;
    }

    .kit-name {
        font-size: 18px;
        width: 100%;
    }

    .tab-link {
        padding: 14px 12px;
        font-size: 14px;
    }

    .tab-link span.sub {
        display: none;
    }

    /* Info 페이지 제품 정보 */
    .product-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .product-meta {
        width: 100%;
    }

    .toc-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .toc-list li {
        margin-bottom: 0;
    }

    .section-title h1 {
        font-size: 16px;
        padding: 8px 24px;
    }

    .gallery-caption,
    .gallery-grid-caption {
        font-size: 15px;
    }

    .review-text {
        padding: 20px;
    }

    .ad-bottom .ad-slot-bottom {
        max-width: 100%;
    }

    /* Lightbox 모바일 */
    .lightbox-close {
        top: 3px;
        right: 3px;
        width: 32px;
        height: 32px;
    }

    .lightbox-caption {
        font-size: 18px;
    }
}

/* ===== 모바일 반응형 (스마트폰) ===== */
@media (max-width: 480px) {
    :root {
        --font-size-base: 19px;
    }

    body {
        line-height: 1.8;
    }

    .container {
        padding: 0 12px;
    }

    .kit-header {
        padding: 14px 0;
    }

    .kit-meta {
        gap: 10px;
    }

    .kit-grade {
        font-size: 12px;
        padding: 5px 12px;
    }

    .kit-code {
        font-size: 13px;
        padding: 3px 10px;
    }

    .kit-name {
        font-size: 17px;
        margin-top: 4px;
    }

    .tab-link {
        padding: 16px 8px;
        font-size: 15px;
    }

    .content {
        padding: 24px 0 32px;
    }

    .section-title {
        margin-bottom: 24px;
    }

    .section-title h1 {
        font-size: 17px;
        padding: 10px 20px;
    }

    .section-subtitle {
        font-size: 14px;
    }

    /* 이미지 시원시원하게 */
    .gallery-single {
        margin-bottom: 28px;
    }

    .gallery-single img {
        width: 100%;
        border-radius: var(--radius-sm);
    }

    .gallery-caption {
        font-size: 16px;
        margin-top: 4px;
        line-height: 1.7;
    }

    .gallery-grid {
        gap: 8px;
    }

    /* 그리드 이미지: 2열로 크게 */
    .gallery-grid a {
        width: calc(50% - 4px);
    }

    .gallery-grid img {
        width: 100%;
        border-radius: var(--radius-sm);
    }

    .gallery-grid-caption {
        font-size: 16px;
        margin-bottom: 28px;
    }

    .divider {
        margin: 32px 0;
    }

    .review-text {
        padding: 20px 16px;
        margin-top: 32px;
        border-radius: var(--radius-md);
    }

    .review-text p {
        font-size: 17px;
        margin-bottom: 18px;
        line-height: 1.85;
    }

    .footer {
        padding: 20px 0;
    }

    .footer a {
        font-size: 14px;
    }

    /* Lightbox 스마트폰 */
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-nav-bar {
        gap: 12px;
    }

    .lightbox-caption {
        font-size: 19px;
    }

    .lightbox-counter {
        font-size: 13px;
    }

    .lightbox-info {
        padding: 6px 10px 8px;
    }
}

/* ===== 아주 작은 화면 ===== */
@media (max-width: 360px) {
    :root {
        --font-size-base: 18px;
    }

    .kit-grade {
        font-size: 11px;
        padding: 4px 10px;
    }

    .kit-code {
        font-size: 12px;
        padding: 3px 8px;
    }

    .kit-name {
        font-size: 16px;
    }

    .section-title h1 {
        font-size: 15px;
        padding: 8px 16px;
    }
}

/* ===== Video Section (YouTube 등) ===== */
.video-section {
    text-align: center;
    margin: 20px 0;
}

.video-section iframe {
    width: 100%;
    max-width: 560px;
    height: 315px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 600px) {
    .video-section iframe {
        height: auto;
        aspect-ratio: 16/9;
    }
}

/* ===== Info Table ===== */
.info-table {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    overflow-x: auto;
}

.info-table table {
    border-collapse: collapse;
    font-size: 14px;
    max-width: 100%;
    width: auto !important;
}

.info-table th,
.info-table td {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    text-align: left;
}

.info-table th {
    background-color: var(--color-hover);
    font-weight: 500;
}

/* ===== Part Review (_c) 페이지 전용 스타일 ===== */

/* 파트 네비게이션 - 버튼형 가로 배치 */
.part-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--radius-lg);
}

.part-nav-btn {
    display: inline-block !important;
    padding: 10px 20px !important;
    background: #ffffff !important;
    color: #1a237e !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    border: 2px solid #1a237e !important;
    border-radius: 25px !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
}

.part-nav-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 파트 섹션 */
.part-section {
    margin: 40px 0;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.part-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-white);
}

.part-section-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.part-section-header .top-link {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 15px;
    transition: all 0.2s ease;
}

.part-section-header .top-link:hover {
    background: rgba(255,255,255,0.2);
    color: var(--color-white);
}

.part-section-content {
    padding: 20px;
}

.part-section-content .gallery-section {
    margin-bottom: 20px;
}

/* 반응형 part-nav */
@media (max-width: 600px) {
    .part-nav {
        padding: 15px;
        gap: 8px;
    }
    
    .part-nav-btn {
        padding: 8px 16px;
        font-size: 13px;
        border: 2px solid #1a237e;
        background: #ffffff;
        color: #1a237e;
    }
    
    .part-section-header {
        padding: 12px 15px;
    }
    
    .part-section-header h2 {
        font-size: 16px;
    }
    
    .part-section-content {
        padding: 15px;
    }
}
