/* ====================================================
   common.css — 사이트 공통 스타일 (헤더/푸터/색상/타이포)
   ==================================================== */

:root {
    /* 브랜드 컬러 (현재 사이트 컨셉 유지) */
    --color-primary: #003366;       /* 윤진 파랑 */
    --color-primary-light: #0066aa;
    --color-accent: #ffaa00;        /* 오렌지 (포인트) */

    /* 중립 컬러 */
    --color-text: #222;
    --color-text-light: #666;
    --color-text-muted: #999;
    --color-border: #e5e5e5;
    --color-bg: #ffffff;
    --color-bg-soft: #f8f9fa;
    --color-bg-dark: #1a1a1a;

    /* 레이아웃 */
    --container-max: 1400px;
    --header-height: 80px;
    --header-height-mobile: 60px;

    /* 폰트 */
    --font-sans: 'Pretendard', 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;

    /* 그림자 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

    /* 트랜지션 */
    --transition: 0.25s ease;
}

/* 정부 권장 한글 폰트 - Pretendard 웹폰트 */
@font-face {
    font-family: 'Pretendard Variable';
    font-weight: 45 920;
    font-style: normal;
    font-display: swap;
    src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/variable/woff2/PretendardVariable.woff2') format('woff2-variations');
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    font-size: 16px;
}

/* 공통 컨테이너 */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* ============== 헤더 ============== */
.site-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    z-index: 100;
    transition: var(--transition);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    height: 40px;
    width: auto;
}

.site-nav {
    display: flex;
    gap: 80px;
    height: var(--header-height);
    align-items: center;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}


.nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.nav-item:hover::after,
.nav-item:has(> a.active)::after {
    transform: scaleX(1);
}

.nav-item > a {
    font-weight: 500;
    color: var(--color-text);
    padding: 6px 0;
    transition: var(--transition);
    display: block;
    white-space: nowrap;
}

.nav-item > a:hover,
.nav-item > a.active {
    color: var(--color-primary);
}

.nav-item > a.active {
    font-weight: 700;
}

/* 메가 메뉴 - 전체 폭 흰색 바 (헤더 아래) */
.site-header::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 280px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-top: 1px solid var(--color-border);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 99;
    pointer-events: none;
}

.site-header:has(.site-nav:hover)::after,
.site-header:has(.site-nav:focus-within)::after {
    opacity: 1;
    visibility: visible;
}

/* 드롭다운 서브메뉴 - 메가 바 위에 컬럼으로 배치 */
.nav-submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: transparent;
    box-shadow: none;
    border: none;
    width: 160px;       /* 고정 너비로 겹침 방지 */
    padding: 24px 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    z-index: 110;
    text-align: center;
}

.site-nav:hover .nav-submenu,
.site-nav:focus-within .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-submenu a {
    display: block;
    padding: 10px 8px;
    color: var(--color-text);
    white-space: normal;
    word-break: keep-all;
    line-height: 1.5;
    font-size: 14px;
    font-weight: 400;
    transition: var(--transition);
    border-bottom: none;
}

.nav-submenu a:hover,
.nav-submenu a.active {
    color: var(--color-primary);
}

.site-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.site-header-right a {
    color: var(--color-text-light);
    transition: var(--transition);
}

.site-header-right a:hover {
    color: var(--color-primary);
}

.lang-divider {
    color: var(--color-border);
}

/* 모바일 메뉴 버튼 */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-text);
}

/* ============== 푸터 ============== */
.site-footer {
    background: var(--color-primary);
    color: #aaa;
    padding: 60px 0 30px;
    margin-top: 80px;
}

.footer-grid {
    display: block;
    margin-bottom: 40px;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-info h3 {
    color: white;
    font-size: 20px;
    margin-bottom: 0;
}

.footer-info p {
    color: #ffffff;
    line-height: 1.8;
    font-size: 14px;
    margin: 0;
}

.footer-menu h4 {
    color: white;
    font-size: 16px;
    margin-bottom: 16px;
}

.footer-menu ul li {
    margin-bottom: 8px;
    font-size: 14px;
}

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

.footer-bottom {
    border-top: 1px solid #333;
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #777;
}

.footer-catalog-btn {
    display: inline-block;
    margin-top: 0;
    padding: 10px 20px;
    background: var(--color-accent);
    color: white !important;
    border-radius: 4px;
    font-weight: 500;
}

.footer-catalog-btn:hover {
    background: #cc8800;
}

/* ============== 라이트박스 (이미지 확대) ============== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 40px;
    cursor: zoom-out;
    animation: lightboxFade 0.2s ease;
}

.lightbox-overlay.open {
    display: flex;
}

@keyframes lightboxFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.lightbox-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 80%;
    text-align: center;
}

/* 이전/다음 버튼 */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding-bottom: 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev { left: 30px; }
.lightbox-next { right: 30px; }

/* 현재 위치 표시 (예: 3 / 13) */
.lightbox-counter {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

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

@media (max-width: 768px) {
    .lightbox-overlay {
        padding: 16px;
    }
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .lightbox-prev,
    .lightbox-next {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-counter {
        top: 14px;
        font-size: 12px;
        padding: 4px 12px;
    }
}

/* ============== 좁은 데스크탑 (1025px ~ 1280px): 메뉴 간격 축소 ============== */
@media (min-width: 1025px) and (max-width: 1280px) {
    .site-nav {
        gap: 60px;
    }

    .nav-item > a {
        font-size: 15px;
    }

    .site-logo img {
        height: 36px;
    }

    /* 서브메뉴 폭 축소 (인접 서브메뉴 겹침 방지) */
    .nav-submenu {
        width: 115px;
        padding: 20px 0;
    }

    .nav-submenu a {
        font-size: 13px;
        padding: 8px 6px;
        line-height: 1.4;
        word-break: keep-all;
    }
}

/* ============== 모바일/태블릿 반응형 (1024px 이하 = 햄버거 메뉴) ============== */
@media (max-width: 1024px) {
    .site-header .container {
        height: var(--header-height-mobile);
    }

    .site-logo img {
        height: 32px;
    }

    .site-nav {
        display: none;
        position: fixed;
        top: var(--header-height-mobile);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: white;
        box-shadow: var(--shadow-md);
        padding: 20px 0;
        height: auto;
        max-height: calc(100vh - var(--header-height-mobile));
        max-height: calc(100dvh - var(--header-height-mobile));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        align-items: stretch;
    }

    .site-nav.open {
        display: flex;
    }

    .nav-item {
        flex-direction: column;
        align-items: stretch;
        height: auto;
    }

    /* 모바일에서는 데스크탑용 강조 막대 숨김 (아래 a::after 화살표만 사용) */
    .nav-item::after {
        display: none;
    }

    .nav-item > a {
        padding: 14px 24px;
        border-bottom: 1px solid var(--color-border);
        border-radius: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        user-select: none;
    }

    /* 현재 페이지가 속한 카테고리: 글자만 강조 (밑줄·배경 없음) */
    .nav-item > a.active {
        color: var(--color-primary);
        font-weight: 600;
        /* 데스크톱의 파란 border-bottom 오버라이드 → 회색 구분선 유지 */
        border-bottom-color: var(--color-border);
    }

    /* 호버 또는 펼친 아코디언: 배경색으로 구분 */
    .nav-item > a:hover,
    .nav-item.open > a {
        background: var(--color-bg-soft);
        /* 호버 시에도 파란선 안 보이게 */
        border-bottom-color: var(--color-border);
    }

    /* 부모 항목 오른쪽에 ▾ 화살표 (아코디언 표시) */
    .nav-item > a::after {
        content: '▾';
        font-size: 12px;
        color: var(--color-text-muted);
        margin-left: 8px;
        transition: transform 0.3s ease;
    }

    .nav-item.open > a::after {
        transform: rotate(180deg);
        color: var(--color-primary);
    }

    /* 모바일에서는 메가 바 숨김 */
    .site-header::after {
        display: none;
    }

    /* 모바일 서브메뉴 - 기본은 접힘 (아코디언) */
    .nav-submenu,
    .site-nav:hover .nav-submenu,
    .site-nav:focus-within .nav-submenu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        background: var(--color-bg-soft);
        width: 100%;
        min-width: 0;
        max-width: 100%;
        max-height: 0;
        overflow: hidden;
        text-align: left;
        transition: max-height 0.35s ease;
    }

    .nav-item.open .nav-submenu {
        max-height: 600px;
    }

    .nav-submenu a {
        display: block;
        padding: 12px 24px 12px 48px;
        font-size: 14px;
        text-align: left;
        white-space: normal;
    }

    .site-header-right {
        font-size: 12px;
        gap: 8px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}
