/* ===== Header Styles ===== */
/* 상단 네비게이션 헤더 스타일 */

.site-header {
    position: fixed;
    top: var(--header-top-inset, 20px);
    left: 0;
    right: 0;
    z-index: 100;
    transition: top 0.3s ease, box-shadow 0.3s ease;
    background: transparent;
}

.header-inner {
    width: 100%;
    max-width: calc(100% - 80px);
    margin: 0 auto;
    background: #1f1d20;
    border-radius: 14px;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.12);
    border: none;
    transition: box-shadow 0.3s ease, background 0.3s ease;
    min-height: var(--header-height, 70px);
    height: var(--header-height, 70px);
    display: flex;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 10px 10px 30px #0000000d;
    border-bottom: 1px solid #ffffff1a;
    background: #1f1d20;
    padding: 0 36px;
}

.header-container {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-5);
    position: relative;
}


/* ===== Logo Section ===== */
.header-logo {
    flex-shrink: 0;
    margin-left: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-image {
    height: 22px;
    width: auto;
    object-fit: contain;
}

/* ===== Navigation Menu (Desktop) ===== */
.header-nav {
    display: none;
    flex: 1;
    justify-content: center;
    align-items: center;
    margin: 0 24px;
}


.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    list-style: none;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    height: 100%;
    color: var(--white);
    text-decoration: none;
    font-size: var(--fs-sm);
    font-weight: 500;
    padding: var(--space-3) 0; /* balanced vertical padding for center alignment */
    position: relative;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center; /* vertically center trigger text */
    padding-bottom: 0;
}

/* Hover bridge under parent item to keep dropdown open while moving cursor */
.nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0; /* disable bridge to avoid blocking sibling hover */
    background: transparent;
    pointer-events: none;
}

.has-submenu .nav-submenu-label {
    display: inline-flex;
    align-items: center;
    height: 100%;
    gap: var(--space-2);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-3) 0; /* align with nav-link vertical padding */
    color: var(--white);
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.has-submenu .nav-submenu-label:hover {
    color: var(--primary-color);
}

.nav-chevron {
    display: none;
}

.nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    background: #1a1823;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
    padding: var(--space-2) 0;
    z-index: 9999; /* ensure dropdown stays above other UI including progress bar */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

.has-submenu:hover .nav-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Hover bridge to prevent flicker when moving into submenu */
.nav-submenu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 24px;
    background: transparent;
    pointer-events: none;
}

.nav-submenu-link {
    display: block;
    padding: var(--space-3) var(--space-4);
    color: var(--white);
    text-decoration: none;
    font-size: var(--fs-sm);
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.nav-submenu-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary-color);
}

/* ===== Header Actions (Right Section) ===== */
.header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Hamburger Button (Mobile) */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    gap: 4px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 102;
}


.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
    flex-shrink: 0;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.hamburger-btn:hover span {
    background: var(--primary-color);
}

/* ===== Mobile Menu Overlay ===== */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 101;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding-top: calc(var(--header-top-inset, 20px) + var(--header-height, 70px) + 24px);
    overflow-y: auto;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-5);
    position: relative;
}

.mobile-nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    list-style: none;
}

.mobile-nav-link {
    color: var(--white);
    text-decoration: none;
    font-size: var(--fs-md);
    font-weight: 500;
    padding: var(--space-4) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: block;
}

.mobile-nav-link:hover {
    color: var(--primary-color);
    padding-left: 16px;
    border-bottom-color: var(--primary-color);
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-menu-close {
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    z-index: 2;
}

.mobile-menu-close span {
    position: absolute;
    width: 18px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.mobile-menu-close span:first-child {
    transform: rotate(45deg);
}

.mobile-menu-close span:last-child {
    transform: rotate(-45deg);
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.mobile-menu-close:hover span {
    background: var(--accent-color);
}

/* ===== Header Scroll Effect ===== */
.site-header.scrolled .header-inner {
    background: #1a1823;
    box-shadow: 10px 10px 36px rgba(0, 0, 0, 0.18);
}

/* ===== Section Padding Adjustment ===== */
/* 플로팅 헤더(상단 inset + 바 높이) 아래로 본문 시작 */
.section {
    padding-top: calc(var(--header-top-inset, 20px) + var(--header-height, 70px) + 20px);
}

/* ===== Responsive Adjustments ===== */

@media (max-width: 1024px) {
    .header-inner {
        max-width: calc(100% - 40px);
        padding: 0 24px;
    }

    .header-nav {
        margin: 0 12px;
    }

    .nav-menu {
        gap: var(--space-6);
    }

    .nav-submenu {
        min-width: 190px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --header-top-inset: 20px;
    }

    .header-inner {
        padding: 0 36px;
        max-width: calc(100% - 24px);
    }
    .logo-image{height: 16px;}

    .header-container {
        padding: 0;
    }
    .mobile-menu-content {
        padding: var(--space-8) var(--space-4);
    }

    .mobile-nav-menu {
        gap: var(--space-3);
    }

    .mobile-nav-link,
    .mobile-nav-item.has-submenu .mobile-nav-link {
        font-size: var(--fs-sm);
        padding: var(--space-3) 0;
    }
    
    /* .hamburger-btn {
        width: 32px;
        height: 32px;
        padding: 5px;
        gap: 3px;
    }
    
    .hamburger-btn span {
        height: 2.5px;
    } */
    
    /* .hamburger-btn.active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    
    .hamburger-btn.active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    } */
}

.mobile-nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-item:last-child {
    border-bottom: none;
}

.mobile-nav-item.has-submenu .mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    color: var(--white);
    font-size: var(--fs-md);
    font-weight: 500;
    padding: var(--space-4) 0;
    text-align: left;
    cursor: pointer;
}

.mobile-chevron {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.mobile-nav-item.open .mobile-chevron {
    transform: rotate(-135deg);
}

.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: transparent; /* remove background color in mobile submenu area */
    border: none;
    margin: 4px 0 8px;
    padding: 4px 0;
}

.mobile-submenu-link {
    display: block;
    color: var(--white);
    text-decoration: none;
    font-size: var(--fs-sm);
    padding: var(--space-3) 0 var(--space-3) var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-submenu-link:hover {
    color: var(--primary-color);
}

.mobile-submenu-link:last-child {
    border-bottom: none;
}

/* ===== Animation Support ===== */
/* For potential future animations */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes flipLeft {
    from {
        transform: rotateY(-90deg);
        opacity: 0;
    }
    to {
        transform: rotateY(0);
        opacity: 1;
    }
}

@keyframes flipUp {
    from {
        transform: rotateX(-90deg);
        opacity: 0;
    }
    to {
        transform: rotateX(0);
        opacity: 1;
    }
}

/* Apply animations to elements if needed */
.header-logo {
    animation: flipLeft 0.7s ease;
}

.nav-link {
    animation: fadeInLeft 0.7s ease;
}

.hamburger-btn {
    animation: flipUp 0.7s ease;
}

