/* ========================================
   Header Menu (Dynamic Scroll Header)
======================================== */

/* 서브페이지일 경우 바디에 상단 패딩 부여 (주로 JS가 서브페이지 헤더 감지 시 추가함) */
body.sub-page {
    padding-top: 70px;
}

@media (max-width: 767px) {
    body.sub-page {
        padding-top: 52px;
    }
}

/* ===== 헤더 기본 상태 (기본 스크롤 0: 투명 배경, 흰색 텍스트/로고) ===== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9998;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.header-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    position: relative;
}

/* 로고 이미지 스위칭 설정 */
.header .logo {
    text-decoration: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.header .logo img.logo-img {
    height: 36px;
    width: auto;
    transition: opacity 0.3s ease;
}

/* 기본 상태: 흰색 로고 노출, 컬러 로고 숨김 */
.header .logo img.logo-white {
    display: block;
}

.header .logo img.logo-color {
    display: none;
}

/* 네비게이션 */
.header .nav {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: auto;
}

.header .nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 40px;
}

.header .nav-list__item {
    position: relative;
}

.header .nav-list__item .link {
    color: #ffffff; /* 기본 상태: 흰색 글씨 */
    text-decoration: none;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    transition: color 0.3s ease;
    letter-spacing: -0.02em;
}

/* ===== [공통 밑줄 구조 정의 (기본 & 스크롤 상태 공통)] ===== */
.header .nav-list__item .link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    transition: width 0.25s ease, left 0.25s ease;
}

.header .nav-list__item .link:hover::after {
    width: 100%;
    left: 0;
}

/* ===== [초기 투명 배경 상태] 마우스 호버 효과 ===== */
.header:not(.scrolled) .nav-list__item .link:hover {
    color: #ffffff; /* 어두운 이미지 위에선 가독성을 위해 흰색 글씨 유지 */
    text-decoration: none;
    opacity: 0.9;
}

.header:not(.scrolled) .nav-list__item .link::after {
    background-color: #ffffff; /* 흰색 투명 헤더일 때는 흰색 밑줄 */
}

/* 모바일 햄버거 버튼 (기본 상태: 흰색) */
.nav-mobile__btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.nav-mobile__btn:hover {
    color: #2F3389;
}

/* ===== 스크롤 다운 상태 (Header Scrolled: 흰색 배경, 어두운 텍스트/컬러 로고) ===== */
#header.scrolled {
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* 스크롤 시 로고 스위칭: 흰색 로고 숨김, 컬러 로고 노출 */
#header.scrolled .logo img.logo-white {
    display: none !important;
}

#header.scrolled .logo img.logo-color {
    display: block !important;
}

/* 스크롤 시 메뉴 글씨 색상 변경 */
#header.scrolled .nav-list__item .link {
    color: #333333;
}

/* 스크롤 시 마우스 호버 효과 및 밑줄 색상 변경 */
#header.scrolled .nav-list__item .link:hover {
    color: #2F3389; /* 흰색 배경 헤더일 때는 브랜드 블루 글씨 */
}

#header.scrolled .nav-list__item .link::after {
    background-color: #2F3389; /* 흰색 배경 헤더일 때는 브랜드 블루 밑줄 */
}

/* 스크롤 시 모바일 햄버거 버튼 색상 변경 */
#header.scrolled .nav-mobile__btn {
    color: #333333;
}

#header.scrolled .nav-mobile__btn:hover {
    color: #2F3389;
}


/* ===== 모바일 햄버거 메뉴 오버레이 ===== */
.mobile_menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #ffffff; /* 시안과 정합하는 깔끔하고 선명한 화이트 배경 */
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.35s ease;
    display: flex;
    flex-direction: column;
}

.mobile_menu.active {
    opacity: 1;
    visibility: visible;
}

.mobile_menu_header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px;
    height: 70px;
    z-index: 10;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05); /* 상단 경계선 */
}

.mobile_logo {
    display: flex;
    align-items: center;
}

.mobile_logo img {
    height: 36px;
    width: auto;
}

.mobile_menu_close {
    background: none;
    border: none;
    color: #333333; /* 다크 차콜로 가독성 및 선명도 대폭 부여 */
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile_menu_close:hover {
    color: #2F3389;
    transform: rotate(90deg); /* 호버/터치 시 90도 스핀 애니메이션 */
}

.mobile_menu_content {
    padding: 120px 40px 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.mobile_menu_list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.mobile_menu_item {
    margin-bottom: 25px;
}

.mobile_menu_item:last-child {
    margin-bottom: 0;
}

.mobile_menu_item a {
    display: block;
    padding: 12px 0;
    color: #333333; /* 선명한 차콜 텍스트 */
    text-decoration: none;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 22px;
    position: relative;
    padding-left: 0;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 호버 시 우아하게 생성되는 세로 브랜드 컬러 바 */
.mobile_menu_item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background-color: #2F3389;
    transition: height 0.25s ease;
}

.mobile_menu_item a:hover {
    color: #2F3389; /* 흰색 배경에서 최상의 정합성을 자랑하는 브랜드 블루 */
    padding-left: 18px; /* 우측으로 자연스럽게 미끄러지는 모션 */
}

.mobile_menu_item a:hover::before {
    height: 18px; /* 세로바 높이 확장 */
}

/* Header 반응형 디자인 */

/* 1. 데스크탑 (1200px 이상) */
@media (min-width: 1200px) {
    .header-wrap {
        height: 70px;
        padding: 0;
    }
    
    .header .logo img.logo-img {
        height: 36px;
    }
    
    .header .nav {
        display: flex;
    }
    
    .nav-mobile__btn {
        display: none;
    }
}

/* 2. 태블릿 (768px ~ 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .header-wrap {
        height: 70px;
        padding: 0 25px;
    }
    
    .header .logo img.logo-img {
        height: 32px;
    }
    
    .header .nav {
        display: none;
    }
    
    .nav-mobile__btn {
        display: flex;
    }
}

/* 3. 모바일 (480px ~ 767px) */
@media (max-width: 767px) and (min-width: 480px) {
    .header-wrap {
        height: 52px;
        padding: 0 20px;
    }
    
    .mobile_menu_header {
        height: 52px;
    }
    
    .header .logo {
        display: flex;
        align-items: center;
        height: 100%;
    }
    
    .header .logo img.logo-img {
        height: 26px;
    }
    
    .header .nav {
        display: none;
    }
    
    .nav-mobile__btn {
        display: flex;
        right: 20px;
    }
}

/* 4. 작은 모바일 (480px 이하) */
@media (max-width: 479px) {
    .header-wrap {
        height: 52px;
        padding: 0 15px;
    }
    
    .mobile_menu_header {
        height: 52px;
    }
    
    .header .logo {
        display: flex;
        align-items: center;
        height: 100%;
    }
    
    .header .logo img.logo-img {
        height: 24px;
    }
    
    .header .nav {
        display: none;
    }
    
    .nav-mobile__btn {
        display: flex;
        right: 15px;
    }
}
