/* 기존 CSS들... */


/* ===================== */
/* 여기부터 반응형 CSS 추가 */
/* ===================== */

@media (max-width: 900px) {
   ...
}

/* =========================
   KAPS Mobile Responsive Patch
   for XE 1.4.x / CROM iXE2 layout
   Paste into: Layout Admin > CSS
   ========================= */

/* 0) 기본: 박스가 화면을 넘치지 않게 */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* 이미지/배너가 화면에 맞게 */
img, .slideShow img, .iXEvisualBox img {
  max-width: 100%;
  height: auto;
}

/* 혹시 테이블이 많은 구형 게시물 대비 */
table {
  max-width: 100%;
}
.iXEvisualBox, .iXEcontentBody, .iXEcontentBox {
  overflow-x: hidden;
}

/* =========================================
   1) 모바일 구간
   ========================================= */
@media (max-width: 900px) {

  /* 전체 컨테이너 폭을 화면에 맞춤 */
  #rootContainer,
  .iXEcontainer,
  .iXEbody,
  .menuLineBg,
  #menuBox,
  #footBox,
  .iXEcontentBox {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* 상단 상자/정렬이 깨질 때 대비 */
  .topBox,
  .topMenuBox,
  .loginBox {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* 로고 영역: 배경사진은 그대로 두되, 모바일에선 높이 자동/축소 */
  #logoBox {
    height: auto !important;
    min-height: 0 !important;
    background-size: cover !important;
    background-position: center center !important;
    padding: 10px 12px !important;
    box-sizing: border-box;
    text-align: right;
  }

  /* 로고 이미지(우측 KAPS 로고) 크기 조정 */
  #logoBox img {
    width: 170px !important;   /* 필요하면 150~220 사이로 조절 */
    height: auto !important;
    margin: 0 !important;
  }

  /* 로고 좌/우 공지(미니공지) 영역은 모바일에서 공간 차지하면 숨김 */
  .logoLeftImg, .logoRightImg,
  .logoLeft, .logoRight {
    display: none !important;
  }

  /* 메뉴 줄: 한 줄 고정 메뉴는 모바일에서 줄바꿈 허용 */
  .ixeMenu {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 8px !important;
    padding: 8px 10px !important;
    margin: 0 !important;
  }

  /* 홈 버튼 포함 메뉴 아이템이 너무 커지지 않게 */
  .ixeMenu > li {
    float: none !important;
    display: block !important;
  }

  /* 메뉴 링크를 “버튼”처럼 */
  .ixeMenu > li > div > a {
    display: block !important;
    padding: 8px 10px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    border: 1px solid rgba(0,0,0,0.10) !important;
    border-radius: 10px !important;
    background: #fff !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }

  /* 2차 메뉴(드롭다운)는 모바일에서 hover가 잘 안 먹어서
     기본적으로 숨기고, 필요하면 아래 “확장형” 방식으로 바꾸는 게 좋아.
     일단은 기존대로 두되, 화면 밖으로 튀지 않게만 제한. */
  .subMenu {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .subMenu li a {
    display: block !important;
    padding: 8px 10px !important;
  }

  /* 검색 영역: 있으면 아래로 내려가게 */
  .searchBox {
    width: 100% !important;
    box-sizing: border-box;
    padding: 8px 10px !important;
  }
  .searchForm input.inputTypeText {
    width: 100% !important;
    box-sizing: border-box;
    font-size: 16px !important; /* 모바일에서 확대 방지 */
  }

  /* 메인 배너: 폭 100% */
  .slideShow {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box;
  }
  .slideShow .slides,
  .slideShow .slide {
    width: 100% !important;
  }

  /* 본문 영역: 좌측 메뉴가 있는 sub 레이아웃은 1열로 */
  .leftNavBox {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10px 12px !important;
    box-sizing: border-box;
  }
  .iXEcontentBody {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10px 12px !important;
    box-sizing: border-box;
  }

  /* 서브메뉴 박스 링크 터치 영역 확장 */
  .subMenuBox li a {
    display: block !important;
    padding: 10px 8px !important;
    font-size: 14px !important;
  }

  /* 푸터도 1열 */
  .footLeft, .footRight {
    float: none !important;
    width: 100% !important;
    box-sizing: border-box;
    padding: 10px 12px !important;
  }

  /* 맨 아래 TOP 버튼/앵커 너무 크면 */
  .iXEbtnTop {
    right: 10px !important;
  }
}

/* =========================================
   2) 더 작은 폰(600 이하)에서 추가 다이어트
   ========================================= */
@media (max-width: 600px) {
  .ixeMenu > li > div > a {
    font-size: 13px !important;
    padding: 7px 9px !important;
  }
  #logoBox img {
    width: 150px !important;
  }
}

/* =========================================
   3) 초소형(420 이하)에서 로고/메뉴 압축
   ========================================= */
@media (max-width: 420px) {
  #logoBox {
    padding: 8px 10px !important;
  }
  #logoBox img {
    width: 135px !important;
  }
  .ixeMenu {
    gap: 5px 6px !important;
  }
  .ixeMenu > li > div > a {
    padding: 6px 8px !important;
  }
}

/* ===== 모바일 상단 정리 ===== */
@media (max-width: 900px) {

  /* 상단 배경이미지 영역 정리 */
  #logoBox {
    background-size: cover !important;
    background-position: center center !important;
    height: 160px !important;
    text-align: center !important;
    padding-top: 20px !important;
  }

  /* 로고 가운데 정렬 */
  #logoBox img {
    display: block !important;
    margin: 0 auto !important;
  }

  /* 상단 메뉴 중앙 정렬 */
  .ixeMenu {
    justify-content: center !important;
  }

  /* SNS 아이콘 간격 넓히기 */
  .snsIcon img,
  .topIcon img,
  .iXEvisualBox img {
    margin: 6px !important;
  }

  /* 카카오, 유튜브, 블로그 아이콘 정렬 */
  .iXEvisualBox ul,
  .iXEvisualBox .iconBox {
    text-align: center !important;
  }

}

/* 기본 PC용 */
#logoBox.mainLogo{
  background: url('http://www.koreananimals.or.kr/images/front14-top.jpg') no-repeat;
  height: 312px;
  text-align: right;
  background-size: cover;
}

/* 모바일용 */
@media (max-width: 900px){

  #logoBox.mainLogo{
    height: 160px !important;
    text-align: center !important;
    padding: 16px 10px 0 !important;
    background-size: cover !important;
    background-position: center center !important;
  }

  #logoBox.mainLogo img{
    width: 180px !important;
    margin: 0 auto !important;
    display: block !important;
  }

}

/* 모바일: 2차 메뉴 항상 표시 */
@media (max-width: 900px){
  #menuBox .ixeMenu > li > div{ 
    display:block !important;
    position:static !important;
    height:auto !important;
    overflow:visible !important;
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
    margin:6px 0 14px !important;
    padding:0 !important;
  }

  /* 2차 메뉴 링크 스타일(원하면 조정) */
  #menuBox .ixeMenu > li > div a{
    display:block !important;
    padding:10px 0 !important;
    text-align:center !important;
    font-size:14px !important;
  }
}
/* 메뉴를 항상 최상단에 보이게 */
#menuBox,
.ixeMenu,
.menuLeft {
  position: relative;
  z-index: 9999;
}

/* 메뉴 아래 위젯이 위로 올라오지 않게 */
#ixEbody,
.iXEcontentBox,
.snsWrap {
  position: relative;
  z-index: 1;
}

/* ===== 모바일에서 상단 메뉴가 2개만 보이는 문제 해결 ===== */
@media (max-width: 900px){

  /* 1차 메뉴를 가로 나열 + 줄바꿈 */
  #menuBox ul.ixeMenu{
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  /* 1차 메뉴를 2열(필요하면 3열로 바꿀 수 있음) */
  #menuBox ul.ixeMenu > li{
    flex: 0 0 50% !important;   /* 2열 */
    width: 50% !important;
    box-sizing: border-box !important;
  }

  /* 1차 메뉴 링크 영역 */
  #menuBox ul.ixeMenu > li > div > a{
    display: block !important;
    text-align: center !important;
    padding: 12px 0 !important;
  }

  /* 모바일에서 hover 대신 탭(포커스)도 서브메뉴가 열리게 */
  #menuBox ul.ixeMenu2{
    display: none;
    position: static !important;   /* 화면 밖으로 튀는 것 방지 */
    width: 100% !important;
  }

  #menuBox ul.ixeMenu > li:hover ul.ixeMenu2,
  #menuBox ul.ixeMenu > li:focus-within ul.ixeMenu2{
    display: block !important;
  }
}



/* 메뉴 잘림 문제 해결 */
#menuBox .ixeMenu {
  height: auto !important;
  overflow: visible !important;
}

/* =========================
   모바일에서 2차메뉴(서브메뉴) 펼치기
   ========================= */

/* 모바일/태블릿 구간에서만 적용 */
@media (max-width: 900px){

  /* 1) 메뉴가 잘리는 원인(높이 고정/overflow hidden) 제거 */
  #menuBox ul.ixeMenu{
    height: auto !important;
    overflow: visible !important;
  }

  /* 2) 각 1차메뉴를 세로 버튼처럼 보이게 (이미 적용돼 있다면 유지됨) */
  #menuBox ul.ixeMenu > li{
    width: 100% !important;
    display: block !important;
    position: relative !important;
  }

  /* 1차메뉴 링크 영역 */
  #menuBox ul.ixeMenu > li > div:first-child > a{
    display: block !important;
    text-align: center !important;
  }

  /* 3) XE 메뉴 구조상 "2차메뉴"가 보통 li 안의 두번째 div에 들어감 */
  #menuBox ul.ixeMenu > li > div:nth-of-type(2){
    display: none;               /* 기본은 접어두기 */
    position: static !important; /* 겹쳐뜨리기 말고 아래로 밀리게 */
    width: 100% !important;
    margin: 6px 0 0 0 !important;
    padding: 6px 0 !important;
    background: #fff !important;
    border: 1px solid #e6e6e6 !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    z-index: 9999 !important;
  }

  /* 4) 모바일에서 탭하면 포커스가 잡히면서(:focus-within) 서브메뉴 펼쳐짐 */
  #menuBox ul.ixeMenu > li:focus-within > div:nth-of-type(2){
    display: block !important;
  }

  /* 서브메뉴 링크 스타일 */
  #menuBox ul.ixeMenu > li > div:nth-of-type(2) a{
    display: block !important;
    padding: 12px 10px !important;
    text-align: center !important;
    text-decoration: none !important;
    color: #333 !important;
    line-height: 1.3 !important;
  }

  /* 서브메뉴 구분선(옵션) */
  #menuBox ul.ixeMenu > li > div:nth-of-type(2) a + a{
    border-top: 1px solid #f0f0f0 !important;
  }
}

/* =========================
   2차메뉴(서브메뉴) PC/모바일 공통 보이기
   - PC: hover로 열림
   - Mobile: 탭(포커스)로 열림
   ========================= */

/* 2차메뉴(보통 li 안의 두번째 div) 기본은 숨김 */
#menuBox ul.ixeMenu > li > div:nth-of-type(2){
  display: none;
  z-index: 9999;
}

/* ===== PC(데스크탑): hover 시 보이기 ===== */
@media (min-width: 901px){
  #menuBox ul.ixeMenu > li{
    position: relative; /* 서브메뉴 absolute 기준 */
  }

  #menuBox ul.ixeMenu > li > div:nth-of-type(2){
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e6e6e6;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  }

  /* 마우스 올리면 2차메뉴 표시 */
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2){
    display: block !important;
  }

  /* 2차메뉴 링크 */
  #menuBox ul.ixeMenu > li > div:nth-of-type(2) a{
    display: block;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
  }
}

/* ===== Mobile/Tablet: 탭(포커스)로 열기 + 잘림 방지 ===== */
@media (max-width: 900px){
  #menuBox ul.ixeMenu{
    height: auto !important;
    overflow: visible !important;
  }

  #menuBox ul.ixeMenu > li{
    width: 100% !important;
    display: block !important;
    position: relative !important;
  }

  #menuBox ul.ixeMenu > li > div:nth-of-type(2){
    position: static !important;
    width: 100% !important;
    margin: 6px 0 0 0 !important;
    padding: 6px 0 !important;
    background: #fff !important;
    border: 1px solid #e6e6e6 !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  /* 탭해서 포커스 잡히면 열림 */
  #menuBox ul.ixeMenu > li:focus-within > div:nth-of-type(2){
    display: block !important;
  }

  #menuBox ul.ixeMenu > li > div:nth-of-type(2) a{
    display: block !important;
    padding: 12px 10px !important;
    text-align: center !important;
    color: #333 !important;
    text-decoration: none !important;
  }
}

/* === PC 메뉴/서브메뉴 복구: 1번째 div(링크)는 보이게, 2번째 div(서브메뉴)만 제어 === */
@media (min-width: 901px){

  /* 메뉴 잘림 방지 */
  #menuBox, #menuBox *{ overflow: visible !important; }

  /* li 기준 */
  #menuBox ul.ixeMenu > li{ position: relative !important; }

  /* ✅ 1차메뉴(첫번째 div)는 무조건 보이게 */
  #menuBox ul.ixeMenu > li > div:first-of-type{
    display: block !important;
  }
  #menuBox ul.ixeMenu > li > div:first-of-type > a{
    display: inline-block !important;
  }

  /* ✅ 서브메뉴(두번째 div)만 기본 숨김 */
  #menuBox ul.ixeMenu > li > div:nth-of-type(2){
    display: none !important;
  }

  /* hover 시 서브메뉴 표시 */
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2){
    display: block !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 99999 !important;
    background: #fff !important;
    border: 1px solid #e6e6e6 !important;
    box-shadow: 0 6px 18px rgba(0,0,0,.08) !important;
    min-width: 180px !important;
  }

  /* 서브메뉴 링크 모양 */
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2) a{
    display: block !important;
    padding: 10px 12px !important;
    color: #333 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }
}

/* === PC 서브메뉴 모양/정렬 다듬기 === */
@media (min-width: 901px){

  /* 서브메뉴 박스 */
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2){
    min-width: 140px !important;   /* 너무 커진 박스 줄이기 */
    width: auto !important;
    padding: 6px 0 !important;     /* 위아래 여백만 */
    text-align: center !important; /* 가운데 정렬(지금 사이트 느낌) */
  }

  /* 서브메뉴 항목(링크) */
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2) a{
    padding: 8px 14px !important;  /* 글씨가 박스 가운데 오도록 */
    line-height: 1.3 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
  }

  /* 혹시 li 기본 스타일(불릿/여백) 튀면 정리 */
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2) ul,
  #menuBox ul.ixeMenu > li:hover > div:nth-of-type(2) li{
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }
}