/* Menu Page Styles */

/* Menu Page Body */
.menu-page {
    overflow: hidden;
    height: 100vh;
}

/* Menu Overlay - display 전환 제거로 레이아웃 안정화 */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
    display: flex; /* 항상 flex 유지 */
    align-items: center;
    justify-content: center;
    visibility: hidden; /* display 대신 visibility 사용 */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-overlay.active,
body.menu-active .menu-overlay {
    visibility: visible; /* display 전환 제거 */
    opacity: 1;
    pointer-events: all;
}

/* Background Overlay */
.menu-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Darker semi-transparent background - keep 0.8 opacity, change color */
    background: rgba(7, 13, 23, 0.8);
    z-index: -1;
}

/* Close Button - Mobile First */
.menu-close {
    position: absolute;
    /* Mobile default (375px base): 38px top, 24px right */
    top: 38px;
    right: 24px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: none;
    /* Animation - 위치는 유지하면서 opacity와 scale만 애니메이션 */
    opacity: 0;
    transform: scale(0.8);
    transform-origin: top right; /* 중요: 우측 상단 기준으로 스케일 */
    animation: popIn 0.4s ease-out 0.2s forwards;
}

.menu-close:hover {
    transform: scale(1.1); /* hover 시 살짝 확대 */
    transform-origin: top right;
    opacity: 1;
}

.close-icon {
    width: 24px;
    height: 24px;
}

/* Menu Navigation - Mobile First */
.menu-navigation {
    position: absolute;
    /* Mobile default (375px base) */
    top: 120px;
    bottom: 40px;
    left: 48px;
    right: 48px;
    width: auto;
    overflow: visible;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Scrollbar styling removed - no scrolling needed */

.menu-list {
    display: flex;
    flex-direction: column;
    gap: clamp(38.4px, 3.75vw, 60px);
    list-style: none;
    margin: 0;
    padding: clamp(25.6px, 2.5vw, 40px) 0;
    width: 100%;
    height: auto;
    flex-shrink: 0;
}

.menu-item {
    width: 100%;
}

.menu-link {
    display: block;
    text-decoration: none;
    color: var(--color-white);
    transition: none;
    position: relative;
    padding: 8px 0;
}

.menu-link:hover { opacity: 1; transform: none; }

.menu-link:focus {
    outline: none;
}

.menu-text {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-black);
    font-size: clamp(40.96px, 4vw, 64px);
    line-height: clamp(40.96px, 4vw, 64px);
    display: block;
    white-space: nowrap;
}

/* Menu Link Hover Effect */
/* Disable old full-width underline */
.menu-link::after { display: none; }

/* Underline that matches text width */
.menu-text {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-black);
    font-size: clamp(40.96px, 4vw, 64px);
    line-height: clamp(40.96px, 4vw, 64px);
    display: inline-block; /* shrink to text width */
    white-space: nowrap;
    position: relative;
}

.menu-text::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0; /* match text width */
    bottom: -2px;
    height: 2px;
    background: currentColor;
    opacity: 0;
}

.menu-link:hover .menu-text::after { opacity: 1; }

/* Animation Effects */
.menu-overlay.active,
body.menu-active .menu-overlay {
    animation: fadeIn 0.5s ease-out forwards;
}

.menu-item {
    opacity: 0;
    transform: translateX(30px);
    animation: slideInRight 0.6s ease-out forwards;
}

.menu-item:nth-child(1) {
    animation-delay: 0.1s;
}

.menu-item:nth-child(2) {
    animation-delay: 0.2s;
}

.menu-item:nth-child(3) {
    animation-delay: 0.3s;
}

.menu-item:nth-child(4) {
    animation-delay: 0.4s;
}

.menu-item:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Close Button Animation - 중복 정의 제거됨 (위 45줄로 통합) */

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 작은 화면 높이 대응 - 메뉴 항목이 잘리지 않도록 */
@media (max-height: 800px) {
    .menu-navigation {
        top: clamp(40px, 5vh, 80px);
        bottom: clamp(20px, 2.5vh, 40px);
    }
    
    .menu-list {
        gap: clamp(20px, 2.5vh, 40px);
        padding-top: clamp(10px, 1.25vh, 20px);
        padding-bottom: clamp(10px, 1.25vh, 20px);
    }
}

@media (max-height: 600px) {
    .menu-navigation {
        top: clamp(30px, 5vh, 60px);
        bottom: clamp(15px, 2.5vh, 30px);
    }
    
    .menu-list {
        gap: clamp(12px, 2vh, 24px);
        padding-top: clamp(8px, 1.33vh, 16px);
        padding-bottom: clamp(8px, 1.33vh, 16px);
    }
    
    .menu-text {
        font-size: clamp(32px, 5.33vw, 48px);
        line-height: clamp(40px, 6.67vw, 56px);
    }
}
