/* === 컨테이너 === */
.borom-mega-nav {
    position: relative;
    /*width: 100%;
    background: #fff;
    border-bottom: 1px solid #eee;
    */
    z-index: 999;
}

/* === 메뉴 리스트 (ul) === */
.borom-mega-nav .borom-nav-list {
    display: flex;
    flex-wrap: nowrap;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    height: 80px;
    align-items: stretch;
    width: 100%;
    /* [옵션] 최대 너비 */
    max-width: var(--mega-max-width, 100%);
}

/* 정렬 옵션 */
.borom-mega-nav.pos-center .borom-nav-list {
    justify-content: center;
}

.borom-mega-nav.pos-left .borom-nav-list {
    justify-content: flex-start;
}

.borom-mega-nav.pos-right .borom-nav-list {
    justify-content: flex-end;
}

.borom-mega-nav.pos-between .borom-nav-list {
    justify-content: space-between;
}

/* === 1-Depth 메뉴 아이템 (li) === */
.borom-mega-nav .borom-nav-item {
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    transition: background-color 0.2s;
}

header.wp-block-template-part::before {
    content: '';
    top: 0;
    left: 0;
    visibility: hidden;
    position: fixed;
    width: 0;
    height: 0;
    opacity: 0;
    z-index: 99;
    /* 딤 레이어 */
    -webkit-transition: opacity .5s linear;
    transition: opacity .5s linear;
}

.is-full-drop-on header.wp-block-template-part::before {
    width: 100dvw;
    height: 100dvh;
    background: #000000b0;
    visibility: visible;
    opacity: 1;
}

/* 헤더 내부 콘텐츠가 딤 레이어 위에 표시되도록 */
header.wp-block-template-part>*:not(.is-position-sticky) {
    position: relative;
}

header.wp-block-template-part>* {
    z-index: 100;
}

/* FSE Sticky 호환: 내부에 is-position-sticky가 있으면 header 자체를 sticky로 */
header.wp-block-template-part:has(.is-position-sticky) {
    position: sticky;
    z-index: 100;
}

.admin-bar header.wp-block-template-part:has(.is-position-sticky) {
    top: 32px;
}

body:not(.admin-bar) header.wp-block-template-part:has(.is-position-sticky) {
    top: 0;
}

.subBox-inner div {
    margin-bottom: 0;
}

.borom-mega-nav.active .subBox,
.borom-mega-nav.force-active-view .subBox {
    opacity: 1;
    visibility: visible;
    transition: opacity ease 0.25s;
}

.borom-mega-nav.pos-between .borom-nav-item {
    padding: 0;
    flex-grow: 1;
    justify-content: center;
}

/* === 1-Depth 링크 텍스트 === */
.borom-mega-nav .borom-nav-link {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    height: 100%;
    white-space: nowrap;
    text-decoration: none;
    color: var(--m-c1, #14181f);
    font-size: var(--m-fs1, 20px);
    font-weight: var(--m-fw1, 700);
    line-height: var(--m-lh1, 1.5);
    letter-spacing: var(--m-ls1, 0px);
    padding: 0 var(--m-gap1, 25px);
}

/* === 1-Depth Hover & Active === */
/* 배경색 */
.borom-mega-nav .borom-nav-item:hover,
.borom-mega-nav .borom-nav-item.current-menu-item {
    background-color: var(--m-hbg1, transparent);
}

/* 텍스트 색상 */
.borom-mega-nav .borom-nav-item:hover .borom-nav-link,
.borom-mega-nav .borom-nav-item.current-menu-item .borom-nav-link {
    color: var(--m-hc1, #0e4280);
}

/* 밑줄 효과 */
.borom-mega-nav .borom-nav-item:hover .borom-nav-link::after,
.borom-mega-nav .borom-nav-item.current-menu-item .borom-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--m-hc1, #0e4280);
}

/* === 풀드롭 배경 패널 (.subBg) === */
.borom-mega-nav .subBg {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 0;
    border-bottom: 1px solid #ddd;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 990;
    transition: background-color 0.3s;
    background-color: var(--m-sub-bg, #ffffff);
    background-image: var(--m-bg-img, none) !important;
    background-position: left bottom !important;
    background-repeat: no-repeat !important;
    background-size: 300px 100% !important;
}

/* [기능] 1-Depth 호버 시 서브 배경색 변경 (:has 선택자 사용) */
.borom-mega-nav .borom-nav-item:hover .subBox {
    background-color: var(--m-sub-hbg, #ffffff);
}

/* === 서브 콘텐츠 박스 (.subBox) === */
.borom-mega-nav .subBox {
    position: absolute;
    top: 100%;
    left: 0;
    width: auto;
    /* Changed from 100% to auto */
    min-width: 100%;
    /* Ensure it's at least as wide as the parent */
    opacity: 0;
    visibility: hidden;
    z-index: 995;
    display: flex;
    justify-content: center;
    padding: var(--m-subbox-pd, 30px 0);
    box-sizing: border-box;
    /* height 설정 시 padding 포함 */
}

/* 내부 콘텐츠 래퍼 */
.borom-mega-nav .subBox-inner {
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    max-width: var(--mega-max-width, 100%);
}

/* 활성화 상태 (JS가 붙여줌) */
.borom-mega-nav.active .subBg,
.borom-mega-nav.force-active-view .subBg {
    opacity: 1;
    pointer-events: auto;
}

/* === 서브 메뉴 타이포그래피 (InnerBlocks 공통) === */
.borom-mega-nav .subBox ul,
.borom-mega-nav .subBox li {
    list-style: none;
    padding: 0;
    margin: 0;
}

.borom-mega-nav .subBox ul a,
.borom-mega-nav .subBox p,
.borom-mega-nav .subBox li {
    text-decoration: none;
    /* [옵션] 서브 스타일 변수 적용 */
    color: var(--m-c2, #666);
    font-size: var(--m-fs2, 16px);
    font-weight: var(--m-fw2, 400);
    line-height: var(--m-lh2, 1.5);
    letter-spacing: var(--m-ls2, 0px);
    padding: var(--m-pd2, 5px 0);
    display: block;
}

.borom-mega-nav .subBox ul a:hover {
    color: var(--m-hc2, #0e4280);
    text-decoration: none;
}

/* === 3-Depth (Nested Menu) === */
.borom-mega-nav .subBox ul ul {
    width: 100%;
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    padding-left: 15px !important;
    margin-top: 0 !important;
    overflow: hidden;
    transition: grid-template-rows 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    height: 0;
}

.borom-mega-nav .subBox ul ul>li {
    min-height: 0;
}

.borom-mega-nav .subBox li.open>ul {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 5px !important;
}

.borom-mega-nav .subBox li.open>ul {
    display: block;
    opacity: 1;
    height: auto;
}

.borom-mega-nav .subBox ul>li {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Ensure link/text takes available space */
.borom-mega-nav .subBox li>a,
.borom-mega-nav .subBox li>span:not(.has-3depth) {
    flex: 1;
}

/* Toggle Icon (+) */
.borom-mega-nav .has-3depth {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    margin-left: 5px;
    font-size: 16px;
    line-height: 1;
    color: var(--m-c2, #666);
    cursor: pointer;
    transition: transform 0.2s;
    /* Ensure visibility if injected directly into LI */
    vertical-align: middle;
}

/* Rotation */
.borom-mega-nav .subBox li.open>a>.has-3depth,
.borom-mega-nav .subBox li.open>.has-3depth {
    transform: rotate(45deg);
}

.borom-mega-nav .has-3depth:hover {
    color: var(--m-hc2, #0e4280);
}

/* 3-Depth Links */
.borom-mega-nav .subBox ul ul a {
    opacity: 0.8;
    font-size: 0.9em;
    padding: 3px 0;
}