/* --- 변수 설정 --- */
:root {
    --font-Primary-text-color: #1D212C;
    --main-Primary-color-800: #2C3D5B;
    --White-color: #FFF;
    --Headline-headline5-font-size: 18px;
    --Button-button2-font-size: 14px;
}

/* --- 헤더 기본 레이아웃 --- */
#header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 1560px; /* 가이드에 따른 초기 너비 */
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* 스크롤 시 상단 고정 및 너비 확장 */
#header.scrolled {
    top: 0;
    width: 100%;
}

.header-inner {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 24px 40px;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    position: relative;
}

#header.scrolled .header-inner {
    border-radius: 0;
    background: rgba(255, 255, 255, 0.85);
    padding: 20px 40px; /* 스크롤 시 세로폭 소폭 축소 */
}

/* --- 로고 --- */
.logo {
    margin-right: 60px;
}

.logo a img {
    height: 32px;
    display: block;
}

/* --- PC 메뉴 (GNB) --- */
.gnb > ul {
    display: flex;
    align-items: center;
    gap: 60px;
}

.gnb > ul > li {
    position: relative;
    padding: 10px 0; /* 호버 범위를 넓혀 안정성 확보 */
}

.gnb > ul > li > a {
    color: var(--font-Primary-text-color);
    font-family: 'Pretendard', sans-serif;
    font-size: var(--Headline-headline5-font-size);
    font-weight: 500;
    line-height: 28px;
    letter-spacing: -0.45px;
    text-decoration: none;
    transition: color 0.2s;
}

.gnb > ul > li:hover > a {
    color: var(--main-Primary-color-800);
}

/* --- 서브메뉴 스타일 --- */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%; /* 부모 li 바로 아래 배치 */
    left: 50%;
    transform: translateX(-50%);
    min-width: 240px;
    background: #FFFFFF;
    padding: 24px 16px;
    border-radius: 16px;
    box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: 10px; /* 시각적인 여백 */
}

/* [중요] 호버 끊김 방지 가교 (마우스가 내려가는 통로 메꿈) */
.sub-menu::before {
    content: '';
    position: absolute;
    top: -20px; /* margin-top과 li의 padding 영역을 덮음 */
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.sub-menu-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1D212C;
    margin-bottom: 16px;
    padding-left: 12px;
}

.sub-menu li {
    list-style: none;
    margin-bottom: 4px;
}

.sub-menu li:last-child {
    margin-bottom: 0;
}

/* 서브메뉴 표시 */
.gnb > ul > li:hover .sub-menu {
    display: block;
}

.sub-menu li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    font-size: 16px;
    font-weight: 500;
    color: #808791;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sub-menu li a:hover {
    background: #F1F5FF;
    color: #1D212C;
}

/* 호버 시 나타나는 오른쪽 화살표 (>) */
.sub-menu li a::after {
    content: '';
    width: 8px;
    height: 8px;
    border-top: 2px solid #1D212C;
    border-right: 2px solid #1D212C;
    transform: rotate(45deg);
    opacity: 0;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.sub-menu li a:hover::after {
    opacity: 1;
}

/* --- 우측 버튼 영역 --- */
.header-util {
    margin-left: auto;
}

.btn-inquiry {
    display: flex;
    width: 104px;
    padding: 12px;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    background: var(--main-Primary-color-800);
    color: var(--White-color);
    font-family: 'Pretendard', sans-serif;
    font-size: var(--Button-button2-font-size);
    font-weight: 500;
    line-height: 20px;
    letter-spacing: -0.35px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-inquiry:hover {
    opacity: 0.9;
}

/* --- 햄버거 버튼 (기본 숨김) --- */
.m-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* --- 태블릿 및 모바일 반응형 (1024px 이하) --- */
@media (max-width: 1024px) {
    #header {
        width: calc(100% - 40px);
        top: 10px;
    }

    #header.scrolled {
        width: 100%;
        top: 0;
    }

    .header-inner {
        padding: 16px 20px;
        justify-content: space-between; /* 양 끝 정렬 */
    }

    /* 햄버거 버튼 표시 */
    .m-menu-btn { 
        display: flex; 
        order: 1; 
        justify-content: center;
        align-items: center;
    }
    
    /* 로고 중앙 배치 */
    .logo { 
        order: 2; 
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin-right: 0;
    }

    /* 문의하기 버튼 */
    .header-util { 
        order: 3; 
        margin-left: 0;
    }

    .gnb {
        display: none;
    }

    .logo a img {
        height: 24px;
    }

    .btn-inquiry {
        width: 84px;
        padding: 8px;
        font-size: 13px;
    }
}

/* --- 모바일 대응 (768px 이하) --- */
@media (max-width: 768px) {
    #header {
        width: 100%;
        top: 0;
    }
    .header-inner {
        border-radius: 0;
    }
}