/* ============================================================
   mobile-fix.css — 모바일(768px 이하) 화면 수정 묶음 (2026-11-27, W7)
   기존 CSS 변수(--lx-*)만 쓴다. 새 디자인 없음. 데스크톱(769px 이상)은 바뀌지 않는다.
   점검 D2: ①게시판 검색창 ②오른쪽 아래 버튼 ③입력칸 16px ④터치 44px ⑤메뉴 서랍 접기 ⑥/community/naver 가로 넘침
   이 파일은 lumex.css 보다 "뒤에" 읽혀야 한다 (조각/header.php_조각.md 참고).
   ============================================================ */

/* ⑥ /community/naver 가로 12px 넘침 — 원인: community/hub.php 의 .hb-side 가
      grid-template-columns:1fr(= minmax(auto,1fr)) 라서 사이드 배너 그림(390px)이 칸을 밀어 넓혔다.
      칸 최소폭을 0 으로 풀어 준다. */
.hb-side{min-width:0}
.hb-side > *{min-width:0;max-width:100%}
.hb-side img{max-width:100%;height:auto}
@media (max-width:900px){
  .hb-body{grid-template-columns:minmax(0,1fr)}
  .hb-side{grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr))}
}

/* ② 맨위로 버튼 중복 방어 — main.js 가 따로 만든 두 번째 버튼(#scrollTopBtn 이 아닌 것)은 숨긴다.
      (main.js 의 중복 생성 코드는 메인 PC 가 따로 지운다. 지워지면 이 줄은 아무 일도 안 한다.) */
.scroll-top-btn:not(#scrollTopBtn){display:none !important}

@media (max-width:768px){

  /* ② 오른쪽 아래 버튼 정리 — 카톡(아래) · 맨위로(위), 사이 10px, 같은 줄.
        글 안의 버튼(부스트·공유)을 덜 가리도록 가장자리에 붙이고 조금 작게. */
  :root{--lx-rail-r:10px;--lx-rail-b:16px;--lx-rail-w:46px}
  html body .kakao-channel-float{
    right:var(--lx-rail-r) !important;
    bottom:calc(var(--lx-rail-b) + env(safe-area-inset-bottom,0px)) !important;
    width:var(--lx-rail-w) !important;height:var(--lx-rail-w) !important;
  }
  html body .scroll-top-btn,html body #scrollTopBtn{
    right:calc(var(--lx-rail-r) + 1px) !important;
    bottom:calc(var(--lx-rail-b) + var(--lx-rail-w) + 10px + env(safe-area-inset-bottom,0px)) !important;
    width:44px !important;height:44px !important;
  }
  /* 메뉴 서랍이 열리면 두 버튼은 숨긴다 (서랍 글자를 가림) */
  body.mf-drawer-open .kakao-channel-float,
  body.mf-drawer-open .scroll-top-btn,
  body:has(.mobile-nav.active) .kakao-channel-float,
  body:has(.mobile-nav.active) .scroll-top-btn{display:none !important}

  /* ① 게시판 목록 검색창 — 타원 테두리를 풀고 2줄: [선택칸 | 검색어] / [검색 버튼 전폭] */
  html body .board-toolbar{flex-direction:column;align-items:stretch;gap:10px}
  html body .board-toolbar .search-form{
    display:grid;grid-template-columns:minmax(92px,34%) minmax(0,1fr);gap:8px;
    width:100%;border:0 !important;border-radius:0 !important;overflow:visible;
    box-shadow:none !important;background:transparent !important;padding:0;
  }
  html body .board-toolbar .search-form:focus-within{border:0 !important;box-shadow:none !important}
  html body .board-toolbar .search-form select,
  html body .board-toolbar .search-form input[type="text"]{
    width:100%;min-width:0;min-height:44px !important;box-sizing:border-box;
    border:1px solid var(--lx-line) !important;background:#fff !important;
    border-radius:999px !important;padding:0 16px !important;
  }
  html body .board-toolbar .search-form .btn-search{
    grid-column:1 / -1;width:100%;min-height:44px !important;
  }
  html body .board-toolbar > a.btn{width:100%;min-height:44px;justify-content:center;text-align:center;box-sizing:border-box}

  /* ③ 입력칸 글자 16px — 아이폰이 16px 보다 작으면 눌렀을 때 화면을 확대한다 (관리자 화면 제외) */
  html body:not(.admin-body) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),select,textarea){
    font-size:16px !important;
  }

  /* ④ 터치 버튼 44px — 눌러야 하는 것만 (본문 속 글자 링크는 건드리지 않는다) */
  html body :is(
    .mobile-menu-toggle,.mobile-nav-close,
    .btn,button[type="submit"],input[type="submit"],
    .share-btn,.btn-like,
    .bl-pf a,.bf-b,.channel-chips a,.hb-switch a,.hb-subs a,.hb-tabs a,.hb-page a,.hb-sort a,
    .ps-cat,.mx-cat,.mx-more,.ps-more,.dh-more,.mx-live-more,.more-link,.dh-pfs a,.mx-panel-h a,
    .pagination a,.pagination span,.page-link,
    .footer-links-bottom a,.footer-social a,.breadcrumb a,.au-links a,.post-chan a,.info-item a
  ){min-height:44px;box-sizing:border-box}
  html body :is(
    .bl-pf a,.bf-b,.channel-chips a,.hb-switch a,.hb-subs a,.hb-tabs a,.hb-page a,.hb-sort a,
    .ps-cat,.mx-cat,.mx-more,.ps-more,.dh-more,.mx-live-more,.more-link,.dh-pfs a,.mx-panel-h a,
    .footer-links-bottom a,.footer-social a,.breadcrumb a,.au-links a,.post-chan a,.info-item a
  ){display:inline-flex;align-items:center;justify-content:center}
  html body .mobile-menu-toggle{min-width:44px}
  html body .mobile-nav-close{min-width:44px}
  html body .share-btn{min-width:44px}
  html body .footer-social a{min-width:44px}
  html body .logo > a{display:inline-flex;align-items:center;min-height:44px}
  /* 체크박스는 글자까지 눌리게 (로그인 유지 등) */
  html body label:has(> input[type="checkbox"]),html body label:has(> input[type="radio"]){
    display:inline-flex;align-items:center;gap:8px;min-height:44px;
  }

  /* ⑤ 메뉴 서랍 — 묶음 접기 (assets/js/mobile-fix.js 가 .mf-on / .mf-head 를 붙인다)
        라벨(채널·게시판…)을 누르면 그 묶음이 펼쳐진다. 맨 위 '홈'과 계정 메뉴는 늘 보인다. */
  html body .mobile-nav-menu li a{justify-content:flex-start !important;text-align:left !important;min-height:48px}
  .mobile-nav-menu.mf-on .mobile-nav-divider{display:none}
  .mobile-nav-menu.mf-on li.mobile-nav-label.mf-head{
    display:flex;align-items:center;justify-content:space-between;
    min-height:48px;margin:0;padding:0 20px;
    font-size:14px;letter-spacing:0;text-transform:none;font-weight:800;
    color:var(--lx-ink,#0c0c12);border-top:0;border-bottom:1px solid var(--lx-line,#e4e5ec);
    cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation;
  }
  .mobile-nav-menu.mf-on li.mf-head::after{
    content:"";width:8px;height:8px;margin-right:4px;flex:none;
    border-right:2px solid var(--lx-sub,#5b6070);border-bottom:2px solid var(--lx-sub,#5b6070);
    transform:rotate(45deg);transition:transform .2s;
  }
  .mobile-nav-menu.mf-on li.mf-head[aria-expanded="true"]::after{transform:rotate(-135deg)}
  .mobile-nav-menu.mf-on li.mf-head:focus-visible{outline:2px solid var(--lx-v,#8b5cf6);outline-offset:-2px}
  .mobile-nav-menu.mf-on li.mf-item[hidden]{display:none}
}
