/* =========================================
   Header Styles
   ========================================= */

.header {
    --font-korean: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease;
    font-family: "Montserrat", var(--font-korean);
}

/* Top Bar */
.top-bar {
    height: 45px; /* Reduced by 10% from 50px */
    background-color: var(--color-primary);
    width: 100%;
    display: flex;
    align-items: center;
    transition: height 0.3s ease;
}

.top-bar-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 80px 0 35px; /* Replaced constant 2cm with 80px (~2cm on typical desktop) */
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* SNS Icons in Top Bar */
.sns-icons {
    display: flex;
    gap: 12px;
}

.sns-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--color-white);
    transition: all 0.3s ease;
}

.sns-link:hover {
    background-color: var(--color-secondary);
    color: var(--color-primary);
}

.sns-icon {
    width: 16px;
    height: 16px;
    display: block;
}

/* 스크롤 시 헤더를 위로 밀어올림 */
.header-scrolled {
    transform: translateY(-45px); /* Match top-bar height */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 35px;
}

.logo {
    flex-shrink: 0;
    cursor: pointer;
}

.logo-image {
    display: block;
    height: 35px; /* Increased by 10% from 32px */
    width: auto;
}

/* Desktop Navigation */
.desktop-nav {
    display: flex;
    gap: 10px;
    height: 100%;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-link {
    font-size: 19px; /* Requested 2px increase (from 17px to 19px) */
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0 25px;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.nav-item:hover .nav-link {
    background-color: var(--color-secondary);
}

.icon-wrapper {
    margin-left: 12px;
    display: flex;
    align-items: center;
}

.icon-default,
.icon-hover {
    overflow: visible;
}

.icon-default {
    width: 15px;
    height: 9px;
    display: block;
}

.icon-hover {
    width: 9px;
    height: 15px;
    display: none;
}

.nav-item:hover .icon-default {
    display: none;
}

.nav-item:hover .icon-hover {
    display: block;
}

/* Submenu */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-secondary);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    list-style: none;
}

.nav-item:hover .submenu {
    opacity: 1;
    visibility: visible;
}

.submenu-item {
    list-style: none;
}

.submenu-link {
    display: block;
    padding: 10px 30px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Mobile Controls */
.mobile-controls,
.bottom-nav,
.bottom-hamburger {
    display: none;
}

/* Mobile Menu Overlay */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--color-white);
    z-index: 1001;
    padding: 40px 40px 120px; /* 상단 여백 축소(80->40), 하단 여백 추가(120) */
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    overflow-y: auto;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    font-family: "Montserrat", var(--font-korean);
}

.mobile-menu::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.mobile-menu-open {
    right: 0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay-visible {
    opacity: 1;
    visibility: visible;
}

/* Tablet (769px ~ 1100px) */
@media (max-width: 1100px) and (min-width: 769px) {
    .header-container {
        padding: 0 15px;
    }
    .logo-image {
        height: 35px; /* Increased by 10% from 32px */
        width: auto;
    }
    .nav-link {
        font-size: 18px; /* Refined for tablet */
        padding: 0 10px;
    }
    .top-bar-container {
        padding: 0 15px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        position: fixed;
        top: 0;
        height: auto;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    }
    .top-bar {
        display: none;
    }
    .header-scrolled {
        transform: none;
    }
    .header-container {
        height: 60px;
        justify-content: center;
    }
    .logo-image {
        height: 31px; /* Increased by 10% from 28px */
        width: auto;
    }
    .desktop-nav {
        display: none;
    }

    /* Bottom Navigation Bar */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px; /* Increased height from 60px to 70px for better visibility */
        background-color: var(--color-primary);
        z-index: 1002;
        padding: 0 20px env(safe-area-inset-bottom, 10px); /* Add padding for safe areas (gesture bar) */
        justify-content: flex-end;
        align-items: center;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    /* 2-line Hamburger */
    .bottom-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        width: 30px;
        height: 30px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        position: relative;
    }
    .bottom-hamburger span {
        display: block;
        width: 24px;
        height: 2px;
        background-color: var(--color-white);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        margin: 0 auto;
    }
    .bottom-hamburger.active span:nth-child(1) {
        transform: translateY(4px) rotate(45deg);
    }
    .bottom-hamburger.active span:nth-child(2) {
        transform: translateY(-4px) rotate(-45deg);
    }

    /* Mobile spacer */
    .top-spacer {
        height: 60px !important;
    }

    .mobile-nav-item {
        margin-bottom: 25px;
    }
    .mobile-nav-link {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--color-primary);
        text-transform: uppercase;
        display: block;
        margin-bottom: 10px;
    }
    .mobile-submenu {
        border-left: 1px solid var(--color-secondary);
        padding-left: 20px;
    }
    .mobile-submenu-link {
        display: block;
        padding: 8px 0;
        font-size: 0.9rem; /* 폰트 사이즈를 줄여 한 줄에 나오도록 조정 */
        color: var(--color-text);
        white-space: nowrap; /* 줄바꿈 방지 */
    }
}

/* Spacer Styles */
.top-spacer {
    height: 125px; /* 45px (top-bar) + 80px (header-container) */
    width: 100%;
    background-color: #ffffff;
    transition: height 0.3s ease;
}

.header-scrolled ~ .top-spacer {
    height: 80px;
}
