/* =========================================================================
   반응형 페이지 시험버전 전용 오버라이드 (homeResponsive, noteIntroResponsive,
   paperIntroResponsive, bizIntroResponsive 공용)
   - 2026-07-20 생성. 원본 CSS(k_layout.css, main_layout.css 등)는 건드리지 않고
     이 파일에서 @media 쿼리로 필요한 부분만 덮어씀.
   - 원본 레이아웃은 1110px 고정폭 기준으로 만들어져 있음.
   - home.jsp(재사용 중인 원본 콘텐츠 fragment) 안에 k_default/k_layout/k_sub/main.css를
     다시 불러오는 중복 <link>가 있어, 문서 순서상 이 파일보다 "나중에" 다시 적용된다.
     동일 우선순위(specificity) 규칙은 나중 것이 이기므로, 원본을 덮어써야 하는
     선언에는 !important를 붙여 순서와 무관하게 항상 이기도록 한다.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box !important; }

img { max-width: 100% !important; }

/* ---- 공통 컨테이너: 고정폭(1110px) -> 유동폭 ---- */
#topArea,
#gnb .gnb_wrap,
#gnb .gnb_wrap > ul > li div.dep02 .sub_nav,
#container #contentWrap,
#container #service .visual .visual_wrap,
.etc_contents,
.rollingbanner,
#footer .footWrap {
    width: 100% !important;
    max-width: 1110px !important;
}

/* 햄버거 버튼 (새 요소, 데스크톱에서는 숨김) */
#gnbToggle {
    display: none;
    position: absolute;
    top: 14px;
    right: 16px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 260;
}
#gnbToggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    margin: 6px auto;
    transition: transform .25s ease, opacity .25s ease;
}
#gnbToggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#gnbToggle.active span:nth-child(2) { opacity: 0; }
#gnbToggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 1180px) {
    #topArea, #gnb .gnb_wrap, .etc_contents, .rollingbanner,
    #container #service .visual .visual_wrap {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* ---- 헤더 / GNB: 가로 메뉴 -> 햄버거 버튼으로 여닫는 슬라이드 메뉴 ---- */
    #header { height: auto !important; overflow: visible !important; }
    #topArea { position: relative !important; height: 60px !important; }
    #header h1.logo { position: absolute !important; top: 14px !important; left: 16px !important; width: 140px !important; float: none !important; }
    #header h1.logo img { width: 100% !important; height: auto !important; }
    #header div.etc { display: none !important; } /* 상단 글로벌 메뉴(로그인/마이페이지 등)는 전체메뉴로 대체 */

    #gnbToggle { display: block !important; }

    #gnb { height: auto !important; line-height: normal !important; overflow: visible !important; }
    #gnb .gnb_wrap { display: block !important; padding: 0 !important; }

    /* #gnb_menu: 평소엔 max-height:0으로 접혀있다가, 햄버거 클릭 시 gnbOpen 클래스가 붙으면
       max-height가 늘어나며 자연스럽게 슬라이드 다운/업 됨 (transition으로 애니메이션 처리) */
    #gnb_menu {
        float: none !important; width: 100% !important;
        max-height: 0 !important; overflow: hidden !important;
        transition: max-height .35s ease !important;
    }
    #gnb_menu.gnbOpen { max-height: 240px !important; }
    #gnb_menu > li {
        float: none !important; width: 100% !important; height: auto !important; line-height: normal !important;
        text-align: left !important; border-bottom: 1px solid #eee;
    }
    #gnb_menu > li > a.dep01 { display: block !important; padding: 14px 4px !important; font-size: 16px !important; height: auto !important; line-height: normal !important; }

    /* 서브메뉴(dep02)는 모바일에서 항상 숨김 — 각 서브페이지 진입 후 좌측메뉴(#snb)로 접근 */
    #gnb_menu > li div.dep02 { display: none !important; }

    /* ---- 비주얼 배너 ---- */
    #container #service .visual { height: auto !important; padding: 32px 0 !important; background-position: center !important; }
    #container #service .visual .visual_wrap {
        flex-direction: column !important; flex-wrap: nowrap !important;
        gap: 24px !important; padding-top: 32px !important; padding-bottom: 0 !important;
    }
    #container #service .visual .visual_title { font-size: 26px !important; }
    #container #service .visual .menu_box_wrap { width: 100% !important; flex-direction: column !important; }
    #container #service .visual .menu_box { width: 100% !important; }

    /* ---- 공지사항/자료실/Q&A + 연구노트소식 배너: 가로 배치 -> 세로 배치 ---- */
    .etc_contents { margin: 24px auto !important; }
    .main_notic, .banner_service { float: none !important; width: 100% !important; }
    .main_notic { margin-bottom: 16px !important; height: auto !important; }
    /* float:left였던 li가 float:none이 되면서 <li> 기본 list-item 마커가 다시 나타나
       커스텀 불릿 이미지와 충돌하므로, list-style을 명시적으로 없애고 불릿 배경을 다시 지정 */
    .main_notic ul.list { list-style: none !important; }
    /* li를 flex row로 바꿔 제목(.ellipsis)은 남는 폭만큼 줄어들며 말줄임표로 잘리고,
       날짜는 항상 제 폭만큼 오른쪽에 고정되도록 함 — 화면이 좁아져도 가로 스크롤 없이 자연스럽게 대응 */
    .main_notic ul.list li {
        display: flex !important; align-items: center !important;
        width: 100% !important; float: none !important; box-sizing: border-box !important;
        padding: 6px 0 6px 16px !important; margin: 0 0 8px !important;
        background: url('../images/bullet_black.png') no-repeat left center !important;
    }
    .main_notic ul.list li a {
        float: none !important; width: auto !important;
        flex: 1 1 auto !important; min-width: 0 !important; /* flex item이 내용 크기 이하로도 줄어들 수 있게 함 */
    }
    /* .ellipsis에 inline style="width:365px"가 박혀있어(홈페이지 JS가 그렇게 렌더링) !important로 덮어써야 함 */
    .main_notic ul.list li .ellipsis {
        float: none !important; width: 100% !important; max-width: 100% !important;
    }
    .main_notic ul.list li > span {
        float: none !important; flex: 0 0 auto !important; margin-left: 8px !important; color: #aaa !important;
    }
    .banner_service { width: 100% !important; height: auto !important; top: 1.5rem; }
    .banner_service .visual_list { width: 100% !important; }

    /* ---- 패밀리사이트 배너 ---- */
    .rollingbanner { height: auto !important; margin-top: 3rem !important;}
    .rollingbanner > div.rollingArea { width: 100% !important; }
    /* ---- 푸터: 가로 스크롤 안 생기게 + 로고/주소 위치 정리 ---- */
    #footer { height: auto !important; padding: 24px 16px !important; background: #111 !important; }
    #footer .footWrap { padding: 0 !important; }
    #footer div.logo {
        position: static !important; width: auto !important; height: auto !important;
        text-align: center !important; margin: 0 0 16px !important;
    }
    #footer div.ftool { text-align: center !important; }
    #footer div.ftool div.link ul { display: flex !important; flex-wrap: wrap !important; justify-content: center !important; width: auto !important; }
    #footer div.address { margin: 16px 0 0 !important; text-align: center !important; }

    /* ---- 서브페이지 공통(layoutResponsive.jsp): 좌측메뉴 + 본문 ---- */
    .sub_visual { height: 60px !important; }

    #snb {
        float: none !important; width: 100% !important; margin-bottom: 16px !important;
        background: #f7f7f8 !important; border: 1px solid #e5e5e5 !important; border-radius: 6px !important;
    }
    #snb h2.title {background-size: cover; height: 80px; line-height: 80px;} /* 큰 타이틀 배너 대신 상단 탭 메뉴로 대체 */
    #snb nav.nav ul { display: flex !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
    #snb nav.nav ul li { border-bottom: none !important; border-right: 1px solid #e5e5e5 !important; flex: 0 0 auto !important; }
    #snb nav.nav ul li:last-child { border-right: none !important; }
    #snb nav.nav ul li a {
        display: block !important; height: auto !important; line-height: normal !important;
        padding: 14px 18px !important; white-space: nowrap !important; font-size: 15px !important;
        color: #555 !important; font-weight: 600 !important;
    }
    #snb nav.nav ul li:hover a { background: #eef6f5 !important; color: #01524c !important; }
    #snb nav.nav ul li.selected a {
        background: #ffffff !important; color: #01524c !important; font-weight: 700 !important;
        box-shadow: inset 0 -3px 0 #01524c !important;
    }

    #content { float: none !important; width: 90% !important; margin: 0 auto;}
    #content section.content_info { height: auto !important; padding-bottom: 12px !important; }
    #content section.content_info nav.location { position: static !important; margin-bottom: 8px !important; }
    #content section.content_info nav.location::after { content: ''; display: block; clear: both; }
    #content section.content_info nav.location ul li { float: left !important; }
    #content section.content_info h3.title {
        position: static !important; top: auto !important;
        font-size: 24px !important; margin-top: 4px !important; clear: both !important;
    }
}

@media (max-width: 640px) {
    /* 공지사항/자료실/Q&A 목록: 640px 이하에서는 제목/날짜를 한 줄에 나란히 두지 않고 세로로 쌓음 */
    .main_notic ul.list li {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .main_notic ul.list li > span {
        margin-left: 0 !important;
        margin-top: 2px !important;
    }
}

@media (max-width: 480px) {
    #container #service .visual .visual_title { font-size: 22px !important; }
    #container #service .visual .menu_box ul { flex-wrap: wrap !important; gap: 16px 8px !important; justify-content: center !important; }
    #container #service .visual .menu_box ul li { width: 30% !important; }

    .main_notic ul.TabM li a { font-size: 14px !important; }

    #snb nav.nav ul li a { padding: 10px 12px !important; font-size: 14px !important; }
    #content section.content_info h3.title { font-size: 20px !important; }
}
