@charset "utf-8";

/* Header Container */
header {
    width: 100%;
    z-index: 1000;
}

/* Main Page Header (Overlay) */
header.header-main-page {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
}

/* Fix: Center GNB on Main Page */
header.header-main-page .content-center {
    justify-content: center;
}
header.header-main-page .gnb > ul {
    justify-content: center;
}

/* Sub Page Header (Background Image) */
header.header-sub-page {
    position: relative;
    background: url('../images/common/top-bg.png') no-repeat center top / 100% 100%;
    height: 130px;
}

.header-inner {
    width: 100%;
}

.inner-container {
    max-width: 1550px;
    margin: 0 auto;
    padding: 0px; /* PC 여백 확보 */
    display: flex;
    align-items: center;
    height: 100%;
}

/* Row 1: Top Utility */
.top-util {
    height: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header.header-sub-page .top-util {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.util-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 30px;
}

.util-menu a, .util-menu span {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 14px;
    color: #FFF;
    font-weight: 400;
}

header.header-sub-page .util-menu a, 
header.header-sub-page .util-menu span {
    color: #fff;
}

.util-menu a img {
    height: 18px;
    margin-right: 8px; /* SPEC보다 실용적 간격 조정, 25px은 너무 멀어 보일 수 있음. 디자인 문서는 25px 명시되어 있으나 시각적으로 조정 필요시 확인 */
}

/* Row 2: Header Content */
.header-content {
    height: 85px;
}

.header-content .inner-container {
    justify-content: space-between;
    gap: 20px;
}

.logo {
    flex-shrink: 0; /* 로고 크기 유지 */
}

.logo a {
    display: block;
}

.logo img {
    width: 244px;
    height: auto;
    object-fit: contain;
    vertical-align: middle;
}

.content-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.gnb {
    height: 100%;
}

.gnb > ul {
    display: flex;
    gap: 100px; /* 1440px 기준 gap 조정 (80px은 너무 넓어 레이아웃 깨짐 발생 가능) */
    height: 100%;
}

/* Dep1 Menu Item */
.dep1 {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dep1 > a {
    display: block;
    padding: 10px 0;
    font-size: 20px;
    font-weight: bold;
    color: #fefefe;
    text-decoration: none;
    transition: color 0.3s;
    white-space: nowrap;
}

header.header-sub-page .dep1 > a {
    color: #fefefe;
}

/* GNB Hover Effect */
.dep1:hover > a {
    color: #fff !important;
}

.dep1 > a::after {
    content: '';
    position: absolute;
    bottom: 0px; /* 초기 위치 */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: #fff;
    transition: all 0.3s;
}

.dep1:hover > a::after {
    /* SPEC: 언더라인은 메인 메뉴의 가로 길이보다 4px이 김 */
    width: calc(100% + 4px);
    /* SPEC: 메인 메뉴와 언더라인의 간격 12px -> 텍스트 하단 여백 감안하여 조정 */
    bottom: -2px; 
}

/* Submenu Dropdown */
.submenu-wrap {
    display: block; /* Render for height calculation, hide visually */
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 140px;
    background: transparent;
    box-shadow: none;
    padding: 20px 0;
   	padding-top: 36px;
    z-index: 1001;
    border-top: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gnb:hover .submenu-wrap,
.gnb.active .submenu-wrap {
    opacity: 1;
    visibility: visible;
}

.dep2-list {
    display: block;
    list-style: none;
    padding: 0;
    margin: 0;
}

.dep2-list li a {
    display: block;
    padding: 10px 0;
    font-size: 18px;
    color: #000; /* off : 검정색 */
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    line-height: 2.22;
    font-weight: 600;
}

.dep2-list li a:hover {
    color: #442c93; /* on : 보라색 */
}

/* Mega Menu Background */
.header-content {
    position: relative;
}

.gnb-bg {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    transition: height 0.3s ease;
    z-index: 1000;
    pointer-events: none; /* Prevent blocking */
}
.gnb-bg.active {
    pointer-events: auto;
    background: #FFF;
}

/* Header Icons */
.content-right {
    flex-shrink: 0;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* header.header-main-page .header-icons button img {
    filter: brightness(0) invert(1);
} */

.btn-menu {
    display: inline-block; /* Show on PC too */
}

.header-icons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #FFF !important;
    border-radius: 12px;
    padding: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-icons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.header-icons button img {
    width: 100%;
    height: 100%;
    filter: none !important; /* Keep original icon color */
}

/* Mobile Menu Wrap (Hidden on PC by default) */
.mobile-menu-wrap {
    display: none;
}

/* Responsive Styles */

/* 1200px ~ 1440px: Gap & Size optimization */
@media screen and (max-width: 1440px) {
    .gnb > ul { gap: 80px; }
    .dep1 > a { font-size: 18px; }
    .logo img { width: 244px; }
}

@media screen and (max-width: 1200px) {
    .gnb > ul { gap: 80px; }
    .dep1 > a { font-size: 17px; }
    .logo img { width: 244px; }
    .inner-container { padding: 0 20px; }
}

/* Tablet & Mobile (Below 1024px) */
@media screen and (max-width: 1024px) {
    header.header-main-page {
        /*background: rgba(0,0,0,0.8);*/ /* 모바일에서는 비주얼 위 가독성을 위해 배경 추가 고려 가능, 현재는 다크모드 대응 */
        position: absolute;
        height:100px;
    }
    
    header.header-sub-page {
        height: 100px; /* 원래 70px이었으나, 유틸리티 메뉴 표시를 위해 높이 확보 */
        /*background: #FFF;*/ 
    }

    .header-inner {
        display: flex;
        flex-direction: column;
    }

    /* Top Utility Bar */
    .top-util {
        display: block; 
        height: 30px;
        padding: 5px 0;
        border-bottom: 1px solid rgba(255,255,255,0.2) !important;
    }
    
    header.header-sub-page .top-util {
        border-bottom: 1px solid rgba(0,0,0,0.1) !important;
    }

    .util-menu {
        width: 100%;
        gap: 0;
        justify-content: space-between;
    }

    .util-menu a, .util-menu span.user-info {
        flex: 1;
        justify-content: center;
        font-size: 12px; /* 폰트 약간 키움 */
        white-space: nowrap;
    }

    .util-menu a img {
        height: 12px;
        margin-right: 4px;
    }

    /* Main Header Content */
    .header-content {
        height: 70px;
    }

    .gnb {
        display: none; /* 모바일 메뉴는 햄버거 버튼으로 대응 */
    }

    .logo img {
        width: 200px;
        height: auto;
    }

    .btn-menu {
        display: inline-block; 
    }
    
     /* 
    .header-icons button img {
        width: 24px;
        height: 24px;
    }
    */
    
    header.header-sub-page .header-icons button img {
        filter: none;
    }

    /* Mobile Menu Implementation */
    .mobile-menu-wrap {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 9999;
        visibility: hidden;
        pointer-events: none;
    }
    .mobile-menu-wrap.active {
        visibility: visible;
        pointer-events: auto;
    }
    
    .mobile-menu-dim {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        opacity: 0;
        transition: opacity 0.3s;
    }
    .mobile-menu-wrap.active .mobile-menu-dim {
        opacity: 1;
    }

    .mobile-menu-panel {
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        max-width: 100%; /* Figma shows full width or very wide */
        height: 100%;
        background: #fff;
        transition: left 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        display: flex;
        flex-direction: column;
        padding: 0 20px;
        box-sizing: border-box;
    }
    .mobile-menu-wrap.active .mobile-menu-panel {
        left: 0;
    }

    .m-header {
        height: 100px; /* Reduced from 130px */
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
        border-bottom: none;
    }
    
    .m-logo img {
        height: 40px;
        width: auto;
    }

    .m-header-icons {
        display: flex;
        align-items: center;
    }
    
    .btn-m-close {
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        position: relative;
        cursor: pointer;
        padding: 0;
    }
    .btn-m-close span {
        display: block;
        width: 34px;
        height: 1px;
        background: #000;
        position: absolute;
        top: 50%;
        left: 50%;
    }
    .btn-m-close span:nth-child(1) {
        transform: translate(-50%, -50%) rotate(45deg);
    }
    .btn-m-close span:nth-child(2) {
        transform: translate(-50%, -50%) rotate(-45deg);
    }

    .m-body {
        flex: 1;
        overflow-y: auto;
        padding-top: 20px;
    }
    .m-gnb {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .m-dep1 {
        position: relative;
        padding-bottom: 20px; /* Reduced from 30px */
    }
    
    .m-dep1-btn {
        display: block;
        width: 100%;
        text-align: left;
        padding: 0 10px 10px 10px;
        font-size: 24px; /* Reduced from 38px */
        font-weight: 700;
        color: #1e1e1e;
        background: none;
        border: none;
        border-bottom: 2px solid #000; /* Underline for Dep1 Title */
        cursor: pointer;
        transition: color 0.3s;
    }
    
    /* Remove the container after border */
    .m-dep1::after {
        display: none;
    }
    
    /* When active, show sub-menu */
    .m-dep2-list {
        display: none;
        background: #fff;
        padding: 10px 10px 0;
        list-style: none;
    }
    
    .m-dep2-list li {
        margin-bottom: 8px;
    }
    
    .m-dep2-list li a {
        display: block;
        font-size: 20px; /* Reduced from 38px */
        font-weight: 500;
        color: #222;
        text-decoration: none;
        transition: color 0.3s;
    }
    
    /* Special styling for active/highlighted items if needed */
    .m-dep1.active .m-dep1-btn {
        color: #1e1e1e;
    }
    
    .m-dep1.active .m-dep2-list {
        display: block;
    }
    
    /* Highlighted Dep2 items (like in Figma screenshot info) */
    .m-dep2-list li.active a,
    .m-dep2-list li a:hover {
        color: #5943a0; /* Purple highlight from Figma (83:26) */
        font-weight: 700;
    }

    /* separator line like in figma (83:23) */
    .m-dep2-list li:not(:last-child) {
        position: relative;
    }
    /*
    .m-dep2-list li:not(:last-child)::after {
        content: '';
        display: block;
        width: 100%;
        height: 1px;
        background: #bdbdbd;
        margin-top: 15px;
    }
    */
}

/* ==========================================================
   High Contrast Mode (Header)
   ========================================================== */
body.high-contrast header,
body.high-contrast header.header-main-page,
body.high-contrast header.header-sub-page {
    background: #000 !important;
    background-image: none !important;
}

body.high-contrast .top-util {
    border-bottom: 1px solid #fff !important;
}

body.high-contrast .gnb-bg.active {
    background: #000 !important;
    border-top: 1px solid #333 !important;
}

body.high-contrast .dep2-list li a {
    color: #fff !important;
}

body.high-contrast .dep2-list li a:hover {
    color: #ffff00 !important;
}

body.high-contrast .mobile-menu-panel {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast .m-dep1-btn,
body.high-contrast .m-dep2-list li a {
    color: #fff !important;
    border-bottom-color: #333 !important;
}

body.high-contrast .m-dep2-list {
    background: #111 !important;
}

body.high-contrast .btn-m-close span {
    background: #fff !important;
}

/* Logo & Icons Inversion for High Contrast */
body.high-contrast .logo img,
body.high-contrast .header-icons button img,
body.high-contrast .btn-quick img,
body.high-contrast .util-menu a img {
    filter: brightness(0) invert(1) !important;
}