@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

/* -------------------------------------
    0. 폰트 및 기본 스타일
------------------------------------- */
* {
    font-family: 'Pretendard', sans-serif;
    box-sizing: border-box;
}
body {
    overflow-x: hidden;
    margin: 0;
}
:root {
    /* [반영] 헤더 높이 PC: 65px */
    --header-height-pc: 80px;
    /* [반영] 헤더 높이 모바일: 55px */
    --header-height-mobile: 55px;
}

/* -------------------------------------
    1. 헤더 기본 구조 및 초기화
------------------------------------- */

header {
    width: 100%;
    /* [반영] 보더 제거 */
    border-bottom: none;
    background-color: transparent;
    /* [반영] 그림자 제거 */
    box-shadow: none;
    z-index: 100;
    position: fixed;
    top: 0;
    transition: background-color 0.3s, top 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* -------------------------------------
    1.1 페이지 로드 애니메이션 (조건부 지연 후 시작)
------------------------------------- */

/* 초기 상태: 헤더 높이만큼 위로 숨김 */
header.initial-hidden {
    top: calc(var(--header-height-pc) * -1);
    /* [반영] 초기 상태일 때 보더 제거 */
    border-bottom: none !important;
}
/* 로드 후 상태: top: 0 으로 복귀 */
header.header-loaded {
    top: 0 !important;
    /* [반영] transition 시간을 1.2s로 늘려 부드럽게 내려오도록 조정 */
    transition: background-color 0.3s, top 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (max-width: 900px) {
    header.initial-hidden {
        top: calc(var(--header-height-mobile) * -1);
    }
}


/* -------------------------------------
    1.2 동적 스타일 (스크롤 반응)
------------------------------------- */

/* 스크롤 시: 배경 검은색, 글자 흰색 (메인 페이지에만 동적으로 적용) */
header.main-page.header-fixed {
    /* [반영] 배경색 검은색 */
    background-color: #000;
    /* [반영] 보더 제거 */
    border-bottom: none;
    /* [반영] 그림자 제거 */
    box-shadow: none;
    /* [반영] 블러 처리 제거 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
header.main-page.header-fixed .logo a,
header.main-page.header-fixed .desktop-nav .menu-item > a {
    /* [반영] 글자색 흰색 */
    color: #fff !important;
}
header.main-page.header-fixed .hamburger-menu span {
    /* [반영] 햄버거 메뉴 색상 흰색 */
    background: #fff !important;
}
header.main-page.header-fixed .desktop-nav .menu-item > a::after {
    /* [반영] 호버 선 색상 흰색 */
    background-color: #fff;
}

/* 스크롤 다운 시 헤더 숨김 */
header.header-hidden {
    top: calc(var(--header-height-pc) * -1);
    /* [반영] 블러 처리 제거 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* [반영] 보더 및 그림자 제거 */
    border-bottom: none !important;
    box-shadow: none !important;
}

@media (max-width: 900px) {
    header.header-hidden {
        top: calc(var(--header-height-mobile) * -1);
        border-bottom: none !important;
        box-shadow: none !important;
    }
}


/* -------------------------------------
    1.3 메인 페이지 초기 스타일 (배경 투명, 텍스트 흰색)
------------------------------------- */
header.main-page {
    background-color: #000;
    border-bottom: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
header.main-page .logo a {
    color: var(--title, #fff);
}
header.main-page .hamburger-menu span {
    background: #fff;
}
header.main-page .desktop-nav .menu-item > a {
    color: #fff;
}
header.main-page .desktop-nav .menu-item > a::after {
    background-color: #fff;
}

@media (max-width: 900px) {
    header.main-page.menu-active .logo a {
        /* [유지] 모바일 메뉴 활성화 시 로고 색상 검은색 (오버레이가 흰색이므로) */
        color: #fff !important;
    }
    .menu-item > a {
        color: #fff !important;
    }
}

/* -------------------------------------
    1.4 서브 페이지 스타일 (기본 배경 검은색, 텍스트 흰색)
------------------------------------- */
header:not(.main-page),
header:not(.main-page).header-fixed {
    /* [반영] 배경색 검은색 */
    background-color: #000;
    /* [반영] 보더 제거 */
    border-bottom: none;
    /* [반영] 그림자 제거 */
    box-shadow: none;
    /* [반영] 블러 처리 제거 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
header:not(.main-page) .logo a {
    /* [반영] 서브페이지 로고 텍스트 흰색 */
    color: #fff;
}
header:not(.main-page) .hamburger-menu span {
    /* [반영] 서브페이지 햄버거 메뉴 색상 흰색 */
    background: #fff;
}
header:not(.main-page) .desktop-nav .menu-item > a {
    /* [반영] PC 메뉴 텍스트 흰색 */
    color: #fff;
}
header:not(.main-page) .desktop-nav .menu-item > a::after {
    /* [반영] 호버 선 색상 흰색 */
    background-color: #fff;
}


header:not(.main-page).menu-active .hamburger-menu span {
    /* [유지] 메뉴 활성화 시 햄버거 메뉴 색상 검은색 (오버레이가 흰색이므로) */
    background: #222 !important;
}

.header-wrap {
    max-width: 1280px;
    width: 100%;
    padding: 0 5%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    /* [반영] PC 헤더 높이 적용 */
    height: var(--header-height-pc);
    position: relative;
    background-color: transparent;
    border-bottom: none;
}
/* PC에서 max-width 설정 */
@media (min-width: 901px) {
    .header-wrap {
        width: 90%;
        max-width: 1280px;
        padding: 0;
    }
}
@media (max-width: 900px) {
    .header-wrap {
        /* [반영] 모바일 헤더 높이 적용 */
        height: var(--header-height-mobile);
    }
}

/* -------------------------------------
    2. 로고, 인증, PC 메뉴 기본 설정
------------------------------------- */

.logo a {
    font-size: 23px;
    font-weight: 800;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
}
/* 추가된 로고 아이콘 스타일 */
.logo-icon {
    width: 45px;
    height: 40px;
    margin-right: 8px;
    position: relative;
    top: -1px;
}

#auth-status {
    display: none;
}

.desktop-nav {
    display: none;
}

@media (min-width: 901px) {
    .menu-overlay.active + header .header-wrap .logo {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }
}

/* -------------------------------------
    3. 햄버거 메뉴 - 모바일
------------------------------------- */

.hamburger-menu {
    display: block;
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 15px;
    cursor: pointer;
    z-index: 1;
}
.hamburger-menu span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    /* [반영] 기본 햄버거 메뉴 색상 흰색 */
    background: #fff;
    left: 0;
    transition: transform 0.3s ease, top 0.3s ease;
}
.hamburger-menu span:nth-child(1) {
    top: 0;
}
.hamburger-menu span:nth-child(2) {
    top: 13px;
}

@media (min-width: 901px) {
    .hamburger-menu {
        display: none;
    }
}

@media (max-width: 900px) {
    .hamburger-menu {
        right: 5%;
        height: 10px;
    }

    /* 모바일 헤더 높이(55px)에 맞춰 햄버거 선의 중앙 위치 조정 */
    .hamburger-menu span:nth-child(2) {
        top: 10px;
    }

    /* [유지] 모바일 메뉴 활성화 시 햄버거 메뉴 색상 검은색 (오버레이가 흰색이므로) */
    .hamburger-menu.active span {
        background: #fff !important;
    }

    /* X자 변환 시 위치를 햄버거 메뉴 중앙(5px)으로 조정 */
    .hamburger-menu.active span:nth-child(1) {
        top: 5px;
        transform: rotate(45deg);
    }
    .hamburger-menu.active span:nth-child(2) {
        top: 5px;
        transform: rotate(-45deg);
    }
}


/* -------------------------------------
    4. 모바일 메뉴 오버레이 (ASIDE)
------------------------------------- */

.menu-overlay {
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: #000; /* 모바일 오버레이 배경은 흰색 유지 */
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-header-bar {
    /* [반영] PC 헤더 높이 적용 */
    height: var(--header-height-pc);
    width: 100%;
    background-color: white; /* 모바일 오버레이 상단 바 배경은 흰색 유지 */
    border-bottom: 1px solid var(--line, #e0e0e0);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 5%;
    max-width: 1280px;
    margin: 0 auto;
    position: sticky;
    top: 0;
    z-index: 100;
}
.mobile-header-bar .logo {
    margin-right: auto;
    padding-right: 50px;
}
.mobile-header-bar .logo a {
    color: #222 !important; /* 모바일 오버레이 로고 텍스트는 검은색 */
}

@media (max-width: 900px) {
    .mobile-header-bar {
        /* [반영] 모바일 헤더 높이 적용 */
        height: var(--header-height-mobile);
    }
    .menu-overlay.active .mobile-header-bar .logo {
        display: none;
    }
    .menu-overlay .mobile-header-bar {
        justify-content: flex-start;
    }
    .menu-item > a {
        color: #fff;
    }
}

.mobile-nav-content {
    max-width: 1280px;
    margin: 0 auto;
    overflow-x: hidden;
}

.main-menu-list {
    display: block;
    padding: 0 5%;
    list-style: none;
}

.menu-item {
    border-bottom: 1px solid var(--line, #e0e0e0);
    width: 100%;
    position: relative;
}
.menu-item.show-submenu {
    border-bottom: none;
}
.menu-item > a {
    display: block;
    padding: 20px 0;
    font-size: 16px;
    font-weight: 700;
    color: #000; /* 모바일 메뉴 텍스트는 검은색 */
    text-align: left;
    text-decoration: none;
    position: relative;
}
.menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #fff;/* 모바일 메뉴 호버 선 색상 유지 */
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease-out;
}
.menu-item.show-submenu > a::after {
    transform: scaleX(1);
}

.sub-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    background-color: #000000; /* 서브 메뉴 배경 흰색 유지 */
}
.menu-item.show-submenu .sub-menu-list {
    max-height: 400px;
    padding: 10px 0 15px;
}
.sub-menu-list li a {
    font-weight: 500;
    font-size: 15px !important;
    padding: 10px 10px;
    display: block;
    text-decoration: none;
    color: #fff;
    transition: color 0.2s;
}
.sub-menu-list li a:hover {
    font-weight: 700;
}

/* -------------------------------------
    5. PC 반응형 (901px 이상)
------------------------------------- */

@media (min-width: 901px) {
    .header-wrap {
        justify-content: flex-start;
        gap: 50px;
    }

    .desktop-nav {
        display: block;
        margin-left: auto;
        position: relative;
        height: 100%;
    }
    .desktop-menu-list {
        display: flex;
        list-style: none;
        padding: 0;
        margin: 0;
        height: 100%;
        align-items: stretch;
    }
    .desktop-nav .menu-item {
        position: relative;
        border-bottom: none;
        padding: 0 20px;
        display: flex;
        align-items: center;
        white-space: nowrap;
    }

    .desktop-nav .menu-item > a {
        position: relative;
        display: flex;
        align-items: center;
        height: 100%;
        font-size: 18px;
        font-weight: 600;
        text-align: center;
        padding: 0;
        text-decoration: none;
        transition: color 0.2s;
    }

    /* 호버 시 선 애니메이션 - 서브메뉴 박스의 너비를 따라감 */
    .desktop-nav .menu-item > a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 0;
        height: 2px;
        transform: translateX(-50%);
        transition: width 0.3s ease-out;
    }

    .desktop-nav .menu-item:hover > a::after {
        width: var(--sub-menu-width, 100%);
    }

    /* 서브 메뉴 드롭다운 스타일 */
    .desktop-nav .sub-menu-list {
        --sub-menu-width: 170px;

        position: absolute;
        top: var(--header-height-pc);
        left: 50%;
        transform: translateX(-50%);
        min-width: var(--sub-menu-width);

        /* [유지] 약간 투명한 배경색 (RGBA 사용) */
        background-color: rgba(0, 0, 0, 0.95);

        /* [반영] 보더 및 그림자 제거 */
        border: none;
        box-shadow: none;
        z-index: 10;
        list-style: none;
        padding: 10px 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        /* [반영] 블러 처리 제거 */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out;
    }
    .desktop-nav .menu-item.show-submenu .sub-menu-list {
        max-height: 500px;
        opacity: 1;
    }

    .desktop-nav .sub-menu-list li a {
        font-weight: 500;
        font-size: 17px !important;
        padding: 15px 15px;
        text-align: center;
        color: #fff; /* 서브 메뉴 텍스트 색상 유지 */
        display: block;
        text-decoration: none;
        white-space: nowrap;
    }
    .desktop-nav .sub-menu-list li a:hover {
        background-color: #fff;
        font-weight: 700;
        color: #000;
    }

    .mobile-header-bar {
        display: none;
    }
    .menu-overlay {
        display: none;
    }
    .mobile-nav-content {
        display: none;
    }
}

/* -------------------------------------
    6. 모바일 (900px 이하)
------------------------------------- */

@media (max-width: 900px) {
    .header-wrap {
        height: var(--header-height-mobile);
        justify-content: space-between;
        gap: 0;
        padding: 0 5%;
    }
    .header-wrap .logo a {
        font-size: 16px;
    }
    /* 모바일 로고 아이콘 크기 조정 (필요하다면) */
    .header-wrap .logo-icon {
        width: 18px;
        height: 18px;
        top: 0px;
    }

    .hamburger-menu {
        right: 5%;
    }

    .mobile-header-bar {
        height: var(--header-height-mobile);
        display: flex;
    }
    .mobile-header-bar .logo {
        padding-right: 40px;
    }
    /* 모바일 오버레이의 로고는 항상 검은색 */
    .mobile-header-bar .logo a {
        color: #222 !important;
    }

    .menu-item > a {
        font-size: 16px;
        padding: 20px 0;
    }
    .menu-item > a::after {
        bottom: 10px;
    }
    .sub-menu-list li a {
        font-size: 14px !important;
        padding: 14px 10px;
    }
}