/* ==========================================================================
   DAMDA 2026 공용 헤더 — Figma header-main(271:5915) 기반
   배경 #F5F5F5 위 흰 메뉴 카드(고정폭 462u, 가이드 701u 연그린) 우측 정렬.
   호버: 그린 박스 + 연그린 텍스트 + (가이드) 곰 아이콘 / 로고: 그린 전환.

   단위 --uh = 4K(3840) 시안 px → 화면 px.
   공용 페이지는 >1920에서 base.css가 #body-wrapper에 zoom(100vw÷1920)을 걸어
   전체를 확대하므로, 그 구간은 0.5px 상수(0.5 × zoom = 100vw÷3840)로 둔다.
   (ssabari 랜딩은 zoom을 무효화하므로 ssabari.css가 비례값으로 재정의)
   base.css 뒤에 로드되어 기존 #header2026 규칙을 덮어쓴다.

   기준 폭 --damda-vw: inc_header.html의 스크립트가 스크롤바를 제외한 실제
   콘텐츠 폭(clientWidth)을 넣어준다. 100vw는 스크롤바를 포함해, 그대로 쓰면
   우측 정렬(메뉴)과 좌측 기준(--uh) 요소가 스크롤바 폭만큼 어긋난다
   (로고-메뉴 사이 16u 틈 소멸, 아래 행들과 정렬 붕괴). JS 미동작 시 100vw 폴백. */
:root { --uh: calc(var(--damda-vw, 100vw) / 3840); }

@media (min-width: 1921px) {
    :root { --uh: 0.5px; }
}

/* 시안 FIXED — 헤더는 스크롤과 무관하게 상단 고정, 본문은 헤더 높이만큼 하강 */
#header2026 {
    /* 메뉴 폰트 = 시안(4K 22u) 비례값과 하한 14px 중 큰 값 (푸터 --ft-fs와 같은 방식).
       >1920 구간은 #body-wrapper zoom이 CSS px까지 확대하므로 하한을 zoom으로 나눠
       화면상 크기를 유지하고, 폭이 커지면 비례값이 이겨 4K에서 22px가 된다 */
    --hd-fs: max(calc(var(--uh) * 22), calc(14px / var(--wide-zoom)));

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #F5F5F5;
    border: 0;
    box-shadow: none;
}

#body-wrapper { padding-top: calc(var(--uh) * 162); }

#header2026 .hd-inner {
    position: relative;
    display: block;
    max-width: none;
    width: auto;
    height: calc(var(--uh) * 162);
    margin: 0;
    padding: 0;
}

/* ---------- 로고 — 흰 카드(16,16 / 1179×130) 안 좌측 40, 세로 중앙 ---------- */
#header2026 .hd-logo {
    position: absolute;
    left: calc(var(--uh) * 16);
    top: calc(var(--uh) * 16);
    transform: none;
    display: flex;
    align-items: center;
    width: calc(var(--uh) * 1179);
    height: calc(var(--uh) * 130);
    padding: 0 0 0 calc(var(--uh) * 40);
    margin: 0;
    background: #fff;
    border: 0;
}

#header2026 .hd-logo img {
    display: block;
    width: calc(var(--uh) * 380);
    height: auto;
    transition: opacity .25s ease;
}

#header2026 .hd-logo .hd-logo-hover {
    position: absolute;
    left: calc(var(--uh) * 40);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
}

/* ---------- GNB — 흰 메뉴 카드, 우측 정렬(16u), 간격 16u ---------- */
#header2026 .hd-gnb {
    position: absolute;
    left: auto;
    right: calc(var(--uh) * 16);
    top: calc(var(--uh) * 16);
    transform: none;
    display: flex;
    flex-direction: row;
    gap: calc(var(--uh) * 16);
    width: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

#header2026 .hd-menu {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    /* 시안 462u를 최소폭으로 — 하한 폰트가 적용되는 좁은 폭에서 글자가 넘치면 카드가 늘어난다 */
    width: auto;
    min-width: calc(var(--uh) * 462);
    flex: 0 0 auto;
    height: calc(var(--uh) * 130);
    margin: 0;
    padding: calc(var(--uh) * 16) calc(var(--uh) * 40) calc(var(--uh) * 24);
    background: #fff;
    border: 0;
    border-radius: 0;
    font-family: var(--font-kr);
    font-size: var(--hd-fs);
    font-weight: 500;
    line-height: 1.65;
    letter-spacing: 0;
    text-transform: none;
    color: #4A4A4A;
    white-space: nowrap;
    transition: color .25s ease, background-color .25s ease;
}

#header2026 .hd-menu strong { font-weight: inherit; }

/* 현재 페이지 표시 — 흰 카드 유지 + 그린 텍스트 (구 base.css 그린 박스 무효화) */
#header2026 .hd-menu.is-active {
    background: #fff;
    color: #1F8E56;
    align-items: flex-end;
    padding-bottom: calc(var(--uh) * 24);
}

#header2026 .hd-menu.is-note.is-active { background: #E8F5EE; }

/* 패키지디자인 가이드 — 연그린 카드(701u) + 그린 텍스트 + 호버 시 곰 */
#header2026 .hd-menu.is-note {
    position: relative;
    width: auto;
    min-width: calc(var(--uh) * 701);
    flex: 0 0 auto;
    background: #E8F5EE;
    color: #1F8E56;
}

#header2026 .hd-menu.is-note::after {
    content: "";
    position: absolute;
    top: 0;
    right: calc(var(--uh) * 16);
    bottom: 0;
    width: calc(var(--uh) * 132);
    background: url("../../img2026/common/note-bear.svg") right center / contain no-repeat;
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}

#header2026 .hd-menu .hd-menu-txt {
    position: relative;
    z-index: 1;
}

/* 좁은 데스크톱: 메뉴 5개 + 로고 카드가 한 줄에 들어가도록 하한을 낮춘다
   (901px에서 11px면 로고 카드와 겹침 — 실측 기준 1000 미만 10px, 1200까지 11px) */
@media (min-width: 1001px) and (max-width: 1200px) {
    #header2026 { --hd-fs: max(calc(var(--uh) * 22), 11px); }
}

@media (min-width: 901px) and (max-width: 1000px) {
    #header2026 { --hd-fs: max(calc(var(--uh) * 22), 10px); }
}

/* ---------- 호버 (데스크톱 전용) ---------- */
@media (hover: hover) and (min-width: 901px) {
    #header2026 .hd-menu:hover {
        background: #1F8E56;
        color: #E8F5EE;
        align-items: center;
        padding-bottom: calc(var(--uh) * 16);
    }

    #header2026 .hd-menu.is-note:hover { color: #E8F5EE; }

    #header2026 .hd-menu.is-note:hover::after { opacity: 1; }

    #header2026 .hd-logo:hover img { opacity: 0; }

    #header2026 .hd-logo:hover .hd-logo-hover { opacity: 1; }
}

/* ---------- 모바일 (≤900) — [MO] 시안: h48, 로고 77, 그린 토글 ---------- */
@media (max-width: 900px) {
    #header2026 { background: #fff; }

    #body-wrapper { padding-top: 48px; }

    #header2026 .hd-inner {
        height: 48px;
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        padding: 0 0 0 24px;
        align-items: center;
    }

    #header2026 .hd-logo {
        position: static;
        transform: none;
        flex: 0 0 auto;
        width: auto;
        height: auto;
        padding: 0;
        background: transparent;
    }

    #header2026 .hd-logo img { width: 77px; }

    #header2026 .hd-toggle {
        display: flex;
        width: 62px;
        height: 48px;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin-left: auto;
        background: #fff;
        border: 0;
        color: #1F8E56;
    }

    #header2026 .hd-toggle-ico { width: 25px; height: 22px; }

    /* 펼침 메뉴 */
    #header2026 .hd-gnb {
        display: none;
        position: static;
        transform: none;
        width: 100%;
        flex-direction: column;
        gap: 8px;
        padding: 8px 15px 12px;
        background: #fff;
    }

    #header2026.is-open .hd-gnb { display: flex; }

    #header2026 .hd-menu,
    #header2026 .hd-menu.is-note {
        width: auto;
        flex: none;
        height: auto;
        padding: 14px 16px;
        font-size: 16px;
        align-items: center;
    }

    #header2026 .hd-menu.is-note::after { display: none; }
}
