/* ───────── 공통 레이아웃 ───────── */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    padding: 0 20px;
    position: relative;
}
.nav-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.nav-logo img {
    height: 50px;
    object-fit: contain;
}

#nav-links {
    display: flex;
    gap: 2rem;
    margin-left: 60px;
}
#nav-links > a,
#nav-links .nav-item > a {
    color: #fff;
    font-size: 0.95rem;
    text-decoration: none;
}

.nav-toggle {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    z-index: 1001;
    position: relative; /* 기준점 */
}

/* 햄버거 버튼이 확장된 상태일 때 X로 보이게 하기 */
.nav-toggle.expanded::before {
    content: '✕';
    font-size: 1.8rem;
    color: #fff;
    position: absolute;
    top: 0;
    left: 0;
}

/* 원래 ☰ 숨김 처리 */
.nav-toggle.expanded {
    color: transparent;
}

.nav-item {
    position: relative;
}

/* ───────── 드롭다운(데스크탑) ───────── */
.has-dropdown .dropdown {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    transform: translateY(-16px);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: center;
    gap: 10rem;
    flex-wrap: wrap;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
    z-index: 998;
}
.has-dropdown .dropdown.show {
    opacity: 1;
    transform: translateY(0);
    max-height: 600px;
    pointer-events: auto;
}

/* ── 컬럼 & 타이틀 ── */
.dropdown-col {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}
.dropdown-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #555;
    cursor: default;
}
.dropdown a {
    color: #fff;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.4rem 0;
    border-bottom: 1px solid #333;
}
.dropdown a:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ───────── 모바일(≤768px) ───────── */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
        margin-left: auto;
    }

    #nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(4px);
        padding: 100px 1.5rem 2rem;
        flex-direction: column;
        align-items: flex-start;
        overflow-y: auto;
        z-index: 1000;

        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.4s ease, opacity 0.4s ease;
        display: flex;
    }

    #nav-links.active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    #nav-links > a,
    #nav-links .nav-item > a {
        width: 100%;
        text-align: left;
        font-size: 1.15rem;
        color: #fff;
        padding: 1rem 0;
        border-bottom: 1px solid #444;
    }

    /* ✅ 모바일 드롭다운 슬라이드 효과 */
    .has-dropdown .dropdown {
        display: flex;
        flex-direction: column;     /* ✅ 세로 정렬 */
        align-items: stretch;       /* ✅ 전체 폭 채우기 */
        gap: 1rem;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, opacity 0.4s ease;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.9);
        z-index: 1002;
        pointer-events: none;
        padding: 100px 1.5rem 2rem;
        visibility: hidden;
    }

    .has-dropdown .dropdown.mobile-open {
        max-height: 1000px;
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }

    .dropdown-col {
        width: 100%;               /* ✅ 한 줄씩 전체 폭 */
        padding: 0.5rem 0;
    }

    .dropdown-col > a {
        font-size: 1rem;
        padding: 0.3rem 0;
        color: #fff;
    }

    .dropdown-title {
        font-weight: bold;
        color: #ddd;
        border-bottom: 1px solid #666;
        margin-bottom: 0.3rem;
    }
}

/* ───────── 데스크톱 전용(>768px) ───────── */
@media (min-width: 769px) {
    .dropdown-col > a {
        max-height: none;
        opacity: 1;
    }

    #nav-links {
        display: flex;
    }
}
