/* ===== CSS Reset & Base Styles ===== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

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

ul {
    list-style: none;
}
.notion-page-content{min-width:320px;}

/* ===== Skip Navigation Link ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    z-index: 2000;
    border-radius: 0 0 4px 0;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

.notion-header,
.notion-scroller >div:has(.notion-page-controls),
.notion-app .gnb{display:none !important}

/* ===== Sticky Navigation Bar ===== */
.gnb {
    position: sticky;
    top: 0;
    min-width:320px;
    z-index: 1000;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gnb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

/* ===== Logo ===== */
h1.gnb-logo{
    font-size: 16px;
    margin:0;
}
.gnb-logo a {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

/* ===== Navigation Menu (공통 스타일) ===== */
.gnb-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.gnb-menu-item {
    position: relative;
}
.gnb-menu-item:before,
.gnb-menu-item > a {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 0;
    display: block;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.gnb-menu-item > a:hover {
    color: #007bff;
}

/* 활성화된 메뉴 스타일 */
.gnb-menu-item > a.current {
    color: #007bff;
    font-weight: 700;
}

/* 포커스 스타일 */
.gnb-menu a:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ===== Submenu Styles (기본 - 드롭다운용) ===== */
.gnb-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 12px 0;
    min-width: 180px;
    z-index: 100;
}

.gnb-submenu li a {
    color: #555;
    font-size: 14px;
    padding: 10px 20px;
    display: block;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.gnb-submenu li a:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

/* 서브메뉴 활성화 스타일 */
.gnb-submenu li a.current {
    color: #007bff;
    font-weight: 600;
}

/* ===== Hamburger Button (기본 숨김) ===== */
.gnb-hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 10px;
}

.gnb-hamburger:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

.gnb-hamburger span {
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 3px;
    display: block;
    transform-origin: center;
}

/* Hamburger → X 애니메이션 */
/* 상단 선: 기본 → 가운데로 이동 → 회전 */
@keyframes hamburgerTop {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(8.5px) rotate(0deg);
    }
    100% {
        transform: translateY(8.5px) rotate(45deg);
    }
}

/* 중간 선: 바로 사라짐 */
@keyframes hamburgerMiddle {
    0% {
        opacity: 1;
    }
    1% {
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

/* 하단 선: 기본 → 가운데로 이동 → 회전 */
@keyframes hamburgerBottom {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8.5px) rotate(0deg);
    }
    100% {
        transform: translateY(-8.5px) rotate(-45deg);
    }
}

/* Active 상태일 때 애니메이션 적용 (0.4초로 빠르게) */
.gnb-hamburger.active span:nth-child(1) {
    animation: hamburgerTop 0.4s ease forwards;
}

.gnb-hamburger.active span:nth-child(2) {
    animation: hamburgerMiddle 0.4s ease forwards;
}

.gnb-hamburger.active span:nth-child(3) {
    animation: hamburgerBottom 0.4s ease forwards;
}

/* X → 햄버거 역방향 애니메이션 */
@keyframes hamburgerTopReverse {
    0% {
        transform: translateY(8.5px) rotate(45deg);
    }
    50% {
        transform: translateY(8.5px) rotate(0deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

@keyframes hamburgerMiddleReverse {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

@keyframes hamburgerBottomReverse {
    0% {
        transform: translateY(-8.5px) rotate(-45deg);
    }
    50% {
        transform: translateY(-8.5px) rotate(0deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* Active 클래스가 제거될 때 역방향 애니메이션 (0.4초로 빠르게) */
.gnb-hamburger:not(.active) span:nth-child(1) {
    animation: hamburgerTopReverse 0.4s ease forwards;
}

.gnb-hamburger:not(.active) span:nth-child(2) {
    animation: hamburgerMiddleReverse 0.4s ease forwards;
}

.gnb-hamburger:not(.active) span:nth-child(3) {
    animation: hamburgerBottomReverse 0.4s ease forwards;
}

/* ===== Overlay (기본 숨김) ===== */
.gnb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}

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

/* ===== 모바일 스타일 (< 768px) ===== */
@media (max-width: 767px) {
    /* 로고 중앙 정렬 */
    .gnb-container {
        justify-content: center;
        position: relative;
    }

    .gnb-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* 햄버거 버튼 표시 (오른쪽 끝) */
    .gnb-hamburger {
        display: flex;
        position: absolute;
        right: 10px;
    }

    /* 메뉴를 사이드바로 변환 */
    .gnb-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background-color: #fff;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 80px 0 20px 0;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
        margin:0;
    }

    .gnb-menu.active {
        transform: translateX(0);
    }

    /* 메뉴 아이템 스타일 */
    .gnb-menu-item {
        width: 100%;
        border-bottom: 1px solid #eee;
        display: flex;
        flex-direction: column;
    }

    .gnb-menu-item > a {
        padding: 16px 24px;
        font-size: 18px;
        position: relative;
    }

    /* 아코디언 스타일 - 서브메뉴가 있는 항목에 자동 적용 */
    .gnb-menu-item:has(.gnb-submenu) > a::after {
        content: '+';
        position: absolute;
        right: 24px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 24px;
        line-height: 1;
        transition: transform 0.3s ease;
    }

    .gnb-menu-item.active:has(.gnb-submenu) > a::after {
        content: '-';
        transform: translateY(-50%);
    }

    /* 서브메뉴 아코디언 */
    .gnb-submenu {
        position: static !important;
        display: flex;
        max-height: 0;
        overflow: hidden;
        flex-direction: column;
        gap: 0;
        padding: 0;
        background-color: #f8f9fa;
        box-shadow: none;
        border-radius: 0;
        min-width: auto;
        transition: max-height 0.3s ease;
    }

    .gnb-menu-item.active .gnb-submenu {
        max-height: 500px;
    }

    .gnb-submenu li {
        width: 100%;
        border-bottom: 1px solid #eee;
    }

    .gnb-submenu li a {
        padding: 12px 24px 12px 48px;
        display: block;
        font-size: 16px;
    }

    /* 모바일에서 오버레이는 기본적으로 숨김, active 시에만 표시 */

    /* Body 스크롤 방지 */
    body.menu-open {
        overflow: hidden;
    }
}

/* ===== 태블릿/PC 스타일 (>= 768px) ===== */
@media (min-width: 768px) {
    /* 컨테이너: 로고 왼쪽, 메뉴 오른쪽 */
    .gnb-container {
        justify-content: space-between;
    }

    .gnb-logo {
        flex-shrink: 0;
    }

    /* 메뉴 오른쪽 정렬 */
    .gnb-menu {
        display: flex;
        align-items: center;
        gap: 30px;
        margin-left: auto;
    }

    .gnb-menu-item {
        position: relative;
    }

    /* PC에서만 활성 메뉴에 하단 테두리 표시 */
    .gnb-menu-item > a.current {
        border-bottom: 3px solid #007bff;
        padding-bottom: 5px;
    }

    /* 호버 시 드롭다운 표시 */
    .gnb-menu-item:hover .gnb-submenu {
        display: block;
    }

    /* 서브메뉴를 세로로 표시 */
    .gnb-submenu {
        display: none;
        flex-direction: column;
        gap: 0;
    }
}

/* ===== Respect User Preferences ===== */
@media (prefers-reduced-motion: reduce) {
    .gnb-menu,
    .gnb-submenu,
    .gnb-overlay,
    .gnb-hamburger span,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}