﻿/* [초기화 및 폰트] */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

ul, li {
    list-style: none;
}

a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s;
}

body {
    font-family: 'Pretendard', sans-serif;
    background: #f4f4f4;
}

/* [헤더 공통] */
header {
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #ddd;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

/* 로고 왼쪽 끝, 너비 100% */
.inner {
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    position: relative;
    z-index: 20;
    padding: 0 40px;
}

/* 로고 크기 30px 유지 */
.logo {
    font-size: 30px;
    font-weight: 800;
    color: #007bff;
    z-index: 1001;
}

.mobile-btn {
    display: none;
}

/* =========================================
           [PC 및 태블릿] (769px 이상)
           ========================================= */
@media screen and (min-width: 769px) {
    /* 메뉴 중앙 정렬 */
    nav {
        position: absolute;
        left: 50%;
        top: 0;
        transform: translateX(-50%);
        height: 100%;
    }

    .gnb {
        display: flex;
        height: 100%;
        align-items: center;
    }

        /* ★★★ [수정됨] 메뉴 간격 넓힘 (25px -> 40px) ★★★ */
        .gnb > li {
            height: 100%;
            margin: 0 40px; /* 양쪽 여백을 늘려서 메뉴 사이 간격을 넓힘 */
            position: relative;
        }

            .gnb > li > a {
                font-size: 17px;
                font-weight: 700;
                display: flex;
                align-items: center;
                height: 100%;
                white-space: nowrap;
            }

            .gnb > li:hover > a {
                color: #007bff;
            }

    /* 서브메뉴 (PC) */
    .sub-menu {
        position: absolute;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 160px;
        text-align: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        padding-top: 20px;
    }

        .sub-menu li {
            padding: 8px 0;
            transform: translateY(-15px);
            opacity: 0;
            transition: all 0.4s ease;
        }

            .sub-menu li a {
                font-size: 14px;
                color: #555;
                position: relative;
                display: inline-block;
            }

                .sub-menu li a::after {
                    content: '';
                    position: absolute;
                    bottom: -2px;
                    left: 50%;
                    width: 0;
                    height: 2px;
                    background: #007bff;
                    transition: all 0.3s ease;
                    transform: translateX(-50%);
                }

                .sub-menu li a:hover::after {
                    width: 100%;
                }

    /* 배경판 (PC) */
    .nav-bg {
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        height: 0;
        background: #fff;
        box-shadow: 0 10px 20px rgba(0,0,0,0.05);
        transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        z-index: 10;
        overflow: hidden;
        border-top: 1px solid #eee;
    }

    header.active .nav-bg {
        height: 360px;
    }

    header.active .sub-menu {
        opacity: 1;
        visibility: visible;
    }

        header.active .sub-menu li {
            opacity: 1;
            transform: translateY(0);
        }

            header.active .sub-menu li:nth-child(1) {
                transition-delay: 0.05s;
            }

            header.active .sub-menu li:nth-child(2) {
                transition-delay: 0.10s;
            }

            header.active .sub-menu li:nth-child(3) {
                transition-delay: 0.15s;
            }

            header.active .sub-menu li:nth-child(4) {
                transition-delay: 0.20s;
            }

            header.active .sub-menu li:nth-child(5) {
                transition-delay: 0.25s;
            }

            header.active .sub-menu li:nth-child(6) {
                transition-delay: 0.30s;
            }
}

/* 화면이 좁은 PC/태블릿에서는 간격을 자동으로 좁혀서 깨짐 방지 */
@media screen and (min-width: 769px) and (max-width: 1200px) {
    .gnb > li {
        margin: 0 15px;
    }

        .gnb > li > a {
            font-size: 15px;
        }
}

/* =========================================
           [모바일 전용] (768px 이하)
           ========================================= */
@media screen and (max-width: 768px) {
    .inner {
        padding: 0 20px;
    }

    .nav-bg {
        display: none !important;
    }

    nav {
        position: static;
        transform: none;
        height: auto;
    }

    .mobile-btn {
        display: block;
        width: 32px;
        height: 32px;
        position: relative;
        cursor: pointer;
        z-index: 1002;
        transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    }

        .mobile-btn span {
            position: absolute;
            left: 50%;
            width: 28px;
            height: 2px;
            background: #333;
            border-radius: 2px;
            transform: translateX(-50%);
            transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
        }

            .mobile-btn span:nth-child(1) {
                top: 8px;
            }

            .mobile-btn span:nth-child(2) {
                top: 50%;
                margin-top: -1px;
            }

            .mobile-btn span:nth-child(3) {
                bottom: 8px;
            }

    header.mobile-open .mobile-btn {
        transform: rotate(90deg);
    }

        header.mobile-open .mobile-btn span:nth-child(1) {
            top: 50%;
            margin-top: -1px;
            transform: translateX(-50%) rotate(45deg);
            background: #007bff;
        }

        header.mobile-open .mobile-btn span:nth-child(2) {
            opacity: 0;
        }

        header.mobile-open .mobile-btn span:nth-child(3) {
            bottom: 50%;
            margin-bottom: -1px;
            transform: translateX(-50%) rotate(-45deg);
            background: #007bff;
        }

    .gnb {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 340px;
        height: 100vh;
        background: #f9f9f9;
        flex-direction: column;
        padding: 100px 20px 40px 20px;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        overflow-y: auto;
        display: flex;
    }

    header.mobile-open .gnb {
        right: 0;
    }

    .gnb > li {
        width: 100%;
        margin: 0 0 12px 0;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.03);
        overflow: hidden;
        height: auto;
    }

        .gnb > li > a {
            padding: 18px 20px;
            font-size: 16px;
            font-weight: 700;
            color: #333;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: auto;
        }

            .gnb > li > a::after {
                content: '→';
                display: flex;
                justify-content: center;
                align-items: center;
                width: 28px;
                height: 28px;
                background: #f0f0f0;
                border-radius: 50%;
                font-size: 14px;
                color: #777;
                transition: all 0.3s ease;
            }

        .gnb > li.on > a {
            color: #007bff;
        }

            .gnb > li.on > a::after {
                content: '→';
                background: #007bff;
                color: #fff;
                transform: rotate(90deg);
            }

    .sub-menu {
        position: static;
        width: 100%;
        display: none;
        background: #fff;
        padding: 5px 0 15px 0;
        border-top: 1px solid #f0f0f0;
        transform: none;
        opacity: 1;
        visibility: visible;
    }

        .sub-menu li {
            transform: none;
            opacity: 1;
            padding: 0;
        }

            .sub-menu li a {
                padding: 10px 25px;
                display: block;
                font-size: 15px;
                color: #666;
                font-weight: 500;
            }

                .sub-menu li a::before {
                    content: '';
                    display: inline-block;
                    width: 4px;
                    height: 4px;
                    background: #ddd;
                    border-radius: 50%;
                    margin-right: 8px;
                    vertical-align: middle;
                }

                .sub-menu li a:hover {
                    color: #007bff;
                    background: #f8faff;
                }

                    .sub-menu li a:hover::before {
                        background: #007bff;
                    }

                .sub-menu li a::after {
                    display: none;
                }

    .gnb > li.on .sub-menu {
        display: block;
    }
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 900;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

header.mobile-open + .mobile-overlay {
    display: block;
    opacity: 1;
}
