/* =========================================
   Variables & Reset
   ========================================= */
:root {
    --primary-color: #0056b3; 
    --primary-hover: #004494;
    --text-dark: #111111;
    --text-light: #555555;
    --bg-white: #ffffff;
    --nav-height: 90px;
    --nav-scrolled-height: 90px; 
    --transition-speed: 0.3s;
    --shadow-sm: 0 4px 20px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 40px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.no-scroll {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ============================================
   기본 설정 및 폰트
   ============================================ */
@font-face {
    font-family: 'GmarketSansMedium';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansMedium.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'GmarketSansLight';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansLight.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'GmarketSansBold';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansBold.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* 영문/숫자 영역 (Basic Latin: U+0020-007F) 에 Pretendard woff2 서브셋 적용 */
@font-face {
    font-family: 'GmarketSansLight';
    src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/static/woff2/Pretendard-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0020-007F;
}

@font-face {
    font-family: 'GmarketSansMedium';
    src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/static/woff2/Pretendard-Medium.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0020-007F;
}

@font-face {
    font-family: 'GmarketSansBold';
    src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/static/woff2/Pretendard-Medium.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0020-007F;
}

body {
    font-family: 'GmarketSansMedium', sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
}

/* =========================================
   Header & Navigation
   ========================================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: transparent;
    transition: all var(--transition-speed) cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1000;
}

.header.scrolled {
    background-color: rgba(255, 255, 255, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px) saturate(150%);
    -webkit-backdrop-filter: blur(15px) saturate(150%);
    height: var(--nav-scrolled-height);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

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

/* Logo */
.logo img {
    height: 35px;
    width: auto;
    transition: transform var(--transition-speed) ease, filter var(--transition-speed) ease;
}

.logo:hover img {
    transform: scale(1.02);
}

/* Mobile Menu Toggle (Hamburger) */
.menu-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px; /* Breathing room */
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001; /* Above drawer */
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 16px; /* Elegant slim ratio */
}

.menu-text {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--text-dark);
    display: none; /* Hidden on mobile */
    transition: color 0.3s ease;
}

@media (min-width: 1024px) {
    .menu-toggle {
        padding: 14px 20px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 4px;
        gap: 12px;
        transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .header.scrolled .menu-toggle {
        border-color: rgba(0, 0, 0, 0.15);
    }

    .hamburger-icon {
        width: 38px;
        height: 18px;
    }

    .menu-text {
        display: block;
        font-size: 0.75rem;
        letter-spacing: 2px;
    }

    /* Premium invert hover effect */
    .menu-toggle:hover {
        background-color: var(--text-dark);
        border-color: var(--text-dark);
    }
    
    .menu-toggle:hover .menu-text {
        color: var(--bg-white);
    }
    
    .menu-toggle:hover .hamburger-icon .line {
        background-color: var(--bg-white);
    }
}

.hamburger-icon .line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-dark);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: center;
    border-radius: 2px;
}

/* Ensure lines remain dark when drawer is open and overlaying white background */
.menu-toggle.active .hamburger-icon .line {
    background-color: var(--text-dark) !important;
}

@media (min-width: 1024px) {
    .menu-toggle.active:hover .hamburger-icon .line {
        background-color: var(--bg-white) !important;
    }
}

/* Elegant asymmetry with middle line shorter, aligned to right */
.hamburger-icon .line:nth-child(2) {
    width: 60%;
    margin-left: auto;
}

/* Expands on hover to create a slight animation */
.menu-toggle:hover .hamburger-icon .line:nth-child(2) {
    width: 100%;
}

.menu-toggle.active .hamburger-icon .line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active .hamburger-icon .line:nth-child(2) {
    opacity: 0;
    width: 100%;
}

.menu-toggle.active .hamburger-icon .line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* =========================================
   Mobile Drawer Navigation
   ========================================= */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--bg-white);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: right 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.mobile-drawer.active {
    right: 0;
}

/* 모바일 드로워 배경 오버레이 */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1090;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    display: block;
    opacity: 1;
}

/* 헤더 영역 */
.drawer-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eef1f6;
}

/* 닫기 버튼 */
.drawer-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.drawer-close-btn:hover {
    transform: rotate(90deg);
}

/* 바디 영역 (좌우 분할) */
.drawer-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 좌측 주메뉴 탭 */
.drawer-main-menu {
    width: 40%;
    background-color: #f4f6f9;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eef1f6;
    overflow-y: auto;
}

.drawer-main-menu .main-menu-btn {
    padding: 20px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.95rem;
    font-family: 'GmarketSansMedium', sans-serif;
    color: var(--text-dark);
    border-bottom: 1px solid #eef1f6;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1.4;
    word-break: keep-all;
}

.drawer-main-menu .main-menu-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
    font-weight: 700;
}

/* 우측 서브메뉴 리스트 */
.drawer-sub-menu {
    width: 60%;
    background-color: var(--bg-white);
    padding: 10px 20px 20px 20px;
    overflow-y: auto;
}

.drawer-sub-menu .sub-menu-panel {
    display: none;
}

.drawer-sub-menu .sub-menu-panel.active {
    display: block;
}

.drawer-sub-menu .sub-menu-item {
    display: block;
    padding: 16px 0;
    font-size: 0.9rem;
    font-family: 'GmarketSansLight', sans-serif;
    color: #000000;
    text-decoration: none;
    border-bottom: 1px solid #eef1f6;
    transition: all 0.2s ease;
    line-height: 1.3;
}

.drawer-sub-menu .sub-menu-item:hover {
    color: var(--primary-color);
    padding-left: 5px;
}


/* =========================================
   Footer (hmgroup style)
   ========================================= */
.site-footer {
    margin-top: 0;
    background-color: #212529;
    border-top: 1px solid #343a40;
    padding: 60px 0 40px;
    font-size: 0.9rem;
    color: #f8f9fa;
}

.footer-inner {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 30px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.footer-info p {
    font-family: 'GmarketSansLight', sans-serif;
    margin: 0 0 8px 0;
    color: #ced4da;
    line-height: 1.6;
    font-size: 0.95rem;
}

.footer-info .divider {
    margin: 0 8px;
    color: #6c757d;
    font-weight: 300;
}

.footer-copyright {
    font-family: 'GmarketSansLight', sans-serif;
    color: #868e96;
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* ============================================
   상단으로 이동 버튼 (Scroll to Top)
   ============================================ */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: rgba(0, 86, 179, 0.55);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.scroll-to-top.visible {
    display: flex;
}

.scroll-to-top:hover {
    background-color: rgba(0, 86, 179, 0.85);
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.scroll-to-top i {
    font-size: 20px;
    color: #fff;
}

/* =========================================
   공통 반응형 스타일 (헤더, 푸터 등)
   ========================================= */
@media (max-width: 768px) {
    :root {
        --nav-scrolled-height: 70px;
    }

    .header-inner {
        padding: 0 20px;
    }
    
    .logo img {
        height: 28px;
    }

    .hamburger-icon {
        width: 26px;
        height: 18px;
    }
    
    .hamburger-icon .line:nth-child(2) {
        width: 100%;
        margin-left: 0;
    }
    
    .menu-toggle.active .hamburger-icon .line:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .menu-toggle.active .hamburger-icon .line:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Footer Mobile */
    .site-footer {
        padding: 40px 0 30px;
    }
    
    .footer-inner {
        padding: 0 20px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 30px;
    }

    .footer-info p {
        font-size: 0.85rem;
    }

    .footer-copyright {
        font-size: 0.65rem;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 15px;
        width: 45px;
        height: 45px;
    }

    .scroll-to-top i {
        font-size: 18px;
    }
}

/* =========================================
   공통 서브페이지 섹션 & 구분선 스타일
   ========================================= */
.hero-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 0;
    width: 100%;
}

.hero-section {
    padding-bottom: 60px;
}

@media (max-width: 767.98px) {
    .hero-section {
        padding-bottom: 30px;
    }
}

/* =========================================
   데스크톱 헤더 네비게이션 스타일 (중앙 관리)
   ========================================= */
.desktop-nav {
    display: none;
}

@media (min-width: 1024px) {
    .header-inner {
        justify-content: flex-start !important;
        gap: 60px !important;
    }

    .desktop-nav {
        display: block;
    }

    .menu-toggle {
        display: none !important;
    }

    .desktop-nav-list {
        display: flex;
        align-items: center;
        gap: clamp(20px, 3.2vw, 48px);
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .desktop-nav-item {
        position: relative;
    }

    .desktop-nav-link {
        font-family: 'GmarketSansMedium', sans-serif;
        font-size: 0.9375rem;
        font-weight: 500;
        color: rgba(17, 17, 17, 0.85); /* 서브페이지 기본 어두운 텍스트 */
        display: inline-flex;
        align-items: center;
        position: relative;
        cursor: pointer;
        transition: color 0.3s cubic-bezier(0.25, 1, 0.5, 1);
        letter-spacing: 0.3px;
    }

    .desktop-nav-link:hover {
        color: var(--primary-color);
    }

    .nav-text {
        position: relative;
        padding-bottom: 2px;
    }

    /* Chevron Down Arrow Icon */
    .nav-arrow {
        font-size: 0.75rem;
        margin-left: 6px;
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
        opacity: 0.8;
    }

    .desktop-nav-item:hover .nav-arrow {
        transform: rotate(180deg);
    }

/* ==========================================================================
   Mega Menu (Desktop Only) - Global Style Overrides (including subpages)
   ========================================================================== */
    /* Light Header Styling for Subpages */
    .header.header-light {
        background-color: #ffffff !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05) !important;
    }

    /* Logo is black (using brightness filter) and text is dark */
    .header.header-light .logo img {
        filter: brightness(0) !important;
    }

    .header.header-light .desktop-nav-link {
        color: #111111 !important;
        text-shadow: none !important;
    }

    .header.header-light .desktop-nav-link:hover {
        color: var(--primary-color) !important;
    }

    /* Mega Menu Panel positioning and style */
    .desktop-nav-item .megamenu-panel {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        width: 100vw;
        background-color: #ffffff;
        border-top: 1px solid #d1d5db;
        border-bottom: 3px solid var(--primary-color);
        padding: 45px 10% 45px 16%; /* Substantial left padding to align with navigation items */
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        z-index: 1050;
    }

    /* Hover Bridge to keep menu open when moving cursor down */
    .desktop-nav-item .megamenu-panel::before {
        content: '';
        position: absolute;
        top: -24px;
        left: 0;
        width: 100%;
        height: 24px;
        background: transparent;
    }

    /* Hover effect on dropdown trigger */
    .desktop-nav-item.has-dropdown:hover .megamenu-panel {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* Mega Menu Inner Layout */
    .megamenu-inner {
        max-width: 1400px;
        margin: 0; /* Left align layout inside the padded container */
        display: flex;
        align-items: stretch;
    }

    /* Left Section: Title and Description */
    .megamenu-left {
        width: 30%;
        border-right: 1px solid #d1d5db;
        padding-right: 50px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: left;
    }

    .megamenu-title {
        font-family: 'GmarketSansMedium', sans-serif;
        font-size: 1.2rem;
        font-weight: 500;
        color: #111111;
        margin-bottom: 16px;
        line-height: 1.3;
    }

    .megamenu-desc {
        font-family: 'GmarketSansLight', sans-serif;
        font-weight: 300;
        font-size: 0.95rem;
        color: #333333;
        line-height: 1.65;
        margin: 0;
    }

    /* Right Section: Sub Link columns */
    .megamenu-right {
        width: 70%;
        padding-left: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: left;
    }

    .megamenu-category {
        width: 100%;
        max-width: 800px;
    }

    .megamenu-category-title {
        font-family: 'GmarketSansMedium', sans-serif;
        font-size: 1.1rem;
        font-weight: 500;
        color: #222222;
        margin-bottom: 20px;
        text-align: left;
    }

    /* Sub list layout */
    .megamenu-sub-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    /* Adjust column count based on item count to look premium */
    .desktop-nav-item:nth-child(3) .megamenu-sub-list {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }

    /* Box link style */
    .megamenu-sub-link-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 20px;
        background-color: #ffffff;
        border: 1px solid #b8c2cc;
        border-radius: 8px;
        text-decoration: none;
        color: #111111;
        font-family: 'GmarketSansMedium', sans-serif;
        font-size: 0.94rem;
        transition: all 0.2s ease;
    }

    .megamenu-sub-link-box .megamenu-arrow {
        font-size: 0.8rem;
        color: #444444;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    /* Hover state */
    .megamenu-sub-link-box:hover {
        background-color: var(--primary-color) !important;
        border-color: var(--primary-color) !important;
        color: #ffffff !important;
        box-shadow: 0 6px 15px rgba(0, 86, 179, 0.15);
    }

    .megamenu-sub-link-box:hover .megamenu-arrow {
        color: #ffffff !important;
        transform: translateX(3px);
    }

    /* Accent underline for main nav links */
    .desktop-nav-link::after {
        content: '';
        position: absolute;
        left: 0;
        bottom: -22px;
        width: 0;
        height: 4px;
        background-color: var(--primary-color) !important;
        transition: width 0.25s ease !important;
    }

    .desktop-nav-item:hover .desktop-nav-link::after {
        width: 100% !important;
    }

    .desktop-nav-item:hover .desktop-nav-link {
        color: var(--primary-color) !important;
    }
}

/* ============================================
   Galaxy Z Fold8 Portrait (704px) Responsive Layout
   ============================================ */
@media (min-width: 600px) and (max-width: 768px) {
    :root {
        --nav-scrolled-height: 90px;
    }

    .header-inner {
        padding: 0 80px;
    }
    
    .logo img {
        height: 35px;
    }

    .hamburger-icon {
        width: 32px;
        height: 16px;
    }
    
    .hamburger-icon .line:nth-child(2) {
        width: 60%;
        margin-left: auto;
    }

    /* Footer Restore to 932px values */
    .site-footer {
        padding: 60px 0 40px;
    }
    
    .footer-inner {
        padding: 0 30px;
    }

    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
    }

    .footer-info p {
        font-size: 0.95rem;
    }

    .footer-copyright {
        font-size: 0.75rem;
    }
    
    .scroll-to-top {
        bottom: 30px;
        right: 30px;
        width: 50px;
        height: 50px;
    }

    .scroll-to-top i {
        font-size: 20px;
    }
}

@media (min-width: 600px) and (max-width: 767.98px) {
    .hero-section {
        padding-bottom: 60px;
    }
}

@media (min-width: 600px) and (max-width: 1023.98px) {
    .header-inner {
        padding-left: 60px;
        padding-right: 80px;
    }

    .footer-copyright {
        font-size: 0.65rem;
    }

    .footer-bottom {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .footer-info p:last-child {
        margin-bottom: 0 !important;
    }
}
