/* =====================================================================
   공개 페이지 정리 (2026-11-15) — 메인(index.html · index_ssr.php)·검색(search.php) 공통 보정
   시안: docs/mockups/public-pages.html (결정: 모바일 카드는 B안=2열 유지·카드 정리)
   ⚠️ 이 파일은 각 페이지의 인라인 <style> "뒤에" 불러와서(</head> 직전) 같은 선택자를 덮어씀.
      카드(.lcard)는 서버 렌더(PHP)·브라우저 렌더(JS) 마크업이 같아서 CSS만으로 모양을 바꿈 —
      마크업 구조(.thumb > .tagrow/.fav-btn/.cmp-btn/.call-btn, .body > .price-row/.t/.promo-line/.loc)를 바꾸면 여기도 같이 고칠 것.
   ===================================================================== */

/* ───────── 1. 모바일 매물 카드 — B안: 2열은 그대로 두고 카드 안만 정리 ─────────
   (사용자 결정 2026-11-15: 가로형 A안 대신 B안.) 가격은 잘리면 안 되므로 줄바꿈은 허용하되 글자를 한 단계 줄이고,
   제목 1줄·위치/면적 2줄로 눌러 담고, 한 줄 광고문구(.promo-line)는 모바일 카드에선 숨김. 찜·비교·전화 버튼은 사진 위 기존 자리 그대로. */
@media (max-width:700px){
  body .cardgrid{gap:10px;}
  body .lcard .thumb{height:104px;}
  body .lcard .body{padding:9px 10px 11px;}
  body .lcard .body .price-row{padding:0; margin:0 0 4px; border:0;}
  body .lcard .body .price{font-size:var(--fs-md); line-height:1.3;}
  body .lcard .body .t{margin:0 0 3px; min-height:0; font-size:var(--fs-sm); line-height:1.35; -webkit-line-clamp:1;}
  body .lcard .body .promo-line{display:none;}
  body .lcard .body .loc{padding-top:0; border-top:0; font-size:var(--fs-xs); line-height:1.4;}
  body .lcard .body .loc span{min-width:0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
}
/* 아주 좁은 폰(≈375px 이하)·카드가 더 좁은 중개사 프로필에서 가격이 두 줄로 꺾이던 것 — 글자·태그를 한 단계 더 줄임 */
@media (max-width:400px){
  body .lcard .body .price{font-size:var(--fs-sm);}
  body .lcard .body .price .deal-tag{padding:1px 5px; margin-right:3px;}
}

/* ───────── 2. 메인 PC — 추천/최신 매물 5열 → 4열 ───────── */
@media (min-width:1101px){
  #recommendGrid, #latestGrid{grid-template-columns:repeat(4,1fr);}
  #recommendGrid > *:nth-child(n+9){display:none;}   /* 10개 중 8개(4열×2줄)만 — 빈칸 없이 꽉 채움 */
  #latestGrid > *:nth-child(n+5){display:none;}      /* 6개 중 4개(4열×1줄) */
}

/* ───────── 3. 메인 — 히어로 줄이기 (사진 배경 → 단색, 긴 설명문·통계 패널 → 한 줄) ───────── */
.quicksearch{padding:24px 0 16px;}
.hero-bg{background-image:linear-gradient(135deg, var(--ink-navy) 0%, var(--brand-dark) 145%) !important; filter:none; transform:none;}   /* 실제 매물 사진(JS가 인라인으로 입힘) 대신 브랜드 그라데이션 */
.hero-copy{margin-bottom:12px;}
.hero-copy h1{font-size:22px; line-height:1.35;}
.hero-copy p{display:none;}
.hero-stats{margin-top:8px; padding:0; gap:8px; background:none; border:0; border-radius:0; justify-content:center; flex-wrap:wrap; align-items:center;}
.hero-stats .hstat-ic, .hero-stats .div{display:none;}
.hero-stats .hstat{gap:0;}
.hero-stats .hstat-num{display:flex; align-items:baseline; gap:3px;}
.hero-stats .hstat-label{order:-1; margin:0 3px 0 0; font-size:var(--fs-xs); color:rgba(255,255,255,.9);}
.hero-stats b{font-size:var(--fs-md);}
.hero-stats .hstat-unit{font-size:var(--fs-xs); color:rgba(255,255,255,.9); margin:0;}
.hero-stats .hstat:not(:last-child)::after{content:'·'; color:rgba(255,255,255,.7); margin-left:8px;}
/* PC — 왼쪽 제목+통계 / 오른쪽 검색 2단 */
@media (min-width:1001px){
  .quicksearch{padding:28px 0;}
  .hero-inner{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.5fr); gap:32px; align-items:center;}
  .hero-copy{text-align:left; margin:0;}
  .hero-copy h1{font-size:var(--fs-2xl);}
  .hero-copy p{display:block; font-size:var(--fs-sm); margin-top:6px;}
  .hero-stats{justify-content:flex-start;}
}
/* 거래유형 칩 — 모바일은 한 줄 가로 스크롤 */
@media (max-width:700px){
  .qs-v2 #qsDealPills, #sDealPills{flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;}
  .qs-v2 #qsDealPills::-webkit-scrollbar, #sDealPills::-webkit-scrollbar{display:none;}
  .qs-v2 #qsDealPills .qs-pill, #sDealPills .qs-pill{flex:none;}
}

/* ───────── 4. 메인 — 모바일 첫 화면 더 압축 (히어로·띠·섹션 머리) ───────── */
@media (max-width:640px){
  .quicksearch{padding:14px 0 12px;}
  .hero-copy{margin-bottom:8px;}
  .hero-copy h1{font-size:18px; line-height:1.35;}
  .hero-stats{margin-top:4px;}
  .quicksearch-inner.qs-v2{padding:6px;}
  .qs-v2 .qs-step{margin:0;}
  .callstrip .wrap{padding-top:8px; padding-bottom:8px;}
  .callstrip .ticker-track{height:46px;}
  section.block{padding:16px 0;}
  .block-head{margin-bottom:8px;}
}

/* ───────── 5. 검색 — 모바일 필터 시트 · 결과 줄 (search.php) ─────────
   PC(≥701px)는 시트 묶음이 display:contents라 지금 모양 그대로. 모바일은 "⚙ 필터"로 여는 바텀시트(내물건장 #mpFilterSheet와 같은 방식). */
.fsheet-head, .fsheet-apply, .fsheet-backdrop, .qs-filterbtn{display:none;}
.fsheet{display:contents;}
.maptoggle .m{display:none;}
@media (max-width:700px){
  .qs-deal-row{display:flex; align-items:center; gap:6px; padding-bottom:10px;}
  .qs-deal-row .qs-pills{flex:1; min-width:0;}
  .qs-filterbtn{display:flex; align-items:center; flex:none; height:36px; padding:0 12px; border:1.5px solid var(--brand); border-radius:100px; background:#fff; color:var(--brand-dark); font-weight:800; font-size:var(--fs-sm); font-family:inherit; cursor:pointer;}
  .qs-filterbtn i{font-style:normal; background:var(--brand); color:#fff; border-radius:100px; font-size:var(--fs-xs); padding:0 6px; margin-left:5px; line-height:18px;}
  .qs-filterbtn.has-filter{background:var(--brand-tint);}
  .hero.map-compact .qs-filterbtn{display:none;}   /* 지도 보기에선 필터 줄 자체가 접혀 있음(기존 동작) */
  .fsheet{
    display:block; position:fixed; left:0; right:0; bottom:0; max-height:82vh; overflow-y:auto; background:#fff;
    border-radius:16px 16px 0 0; padding:14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); z-index:120;
    transform:translateY(105%); visibility:hidden; transition:transform .2s ease, visibility 0s linear .2s; box-shadow:0 -10px 30px rgba(0,0,0,.28);
  }
  .fsheet.open{transform:none; visibility:visible; transition:transform .2s ease;}
  .fsheet-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; font-size:var(--fs-lg);}
  .fsheet-head button{background:none; border:none; font-size:var(--fs-xl); width:44px; height:44px; cursor:pointer;}
  .fsheet-apply{display:block; width:100%; min-height:46px; margin-top:12px; background:var(--brand); color:#fff; border:none; border-radius:10px; font-weight:800; font-size:var(--fs-md); cursor:pointer; font-family:inherit;}
  .fsheet-backdrop{display:block; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:119; opacity:0; pointer-events:none; transition:opacity .2s;}
  .fsheet-backdrop.open{opacity:1; pointer-events:auto;}
  body.fs-open{overflow:hidden;}
  .hero.map-compact .fsheet{display:none;}

  /* 결과 줄 — "총 N건 · 정렬" 과 "목록 | 지도 | 🔔"를 한 줄로(아래 격자 배치라 DOM 순서와 무관), 스크롤해도 위에 붙음 */
  .layout:not(.map-mode) > div:first-child{display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:8px; align-items:center;}
  .layout:not(.map-mode) > div:first-child > .section-head{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); margin:0;}   /* 제목은 화면에서만 숨김(검색엔진·스크린리더용 유지) */
  .layout:not(.map-mode) > div:first-child > .sortbar{grid-column:1; grid-row:1; margin:0; position:sticky; top:0; z-index:15; background:var(--bg); padding:8px 0;}
  .layout:not(.map-mode) > div:first-child > .maptoggle{grid-column:2; grid-row:1; margin:0; position:sticky; top:0; z-index:15; background:var(--bg); padding:8px 0; gap:0;}
  .layout:not(.map-mode) > div:first-child > .map-split{grid-column:1 / -1; grid-row:2;}
  .layout:not(.map-mode) > div:first-child > .cardgrid{grid-column:1 / -1; grid-row:3;}
  .maptoggle .d{display:none;}
  .maptoggle .m{display:inline;}
  .maptoggle button{padding:8px 11px !important; font-size:var(--fs-sm) !important; min-height:36px; border-radius:0 !important; margin:0 !important;}
  .maptoggle button:first-child{border-radius:8px 0 0 8px !important;}
  .maptoggle button:last-child{border-radius:0 8px 8px 0 !important;}
  .sortbar{min-width:0;}
  .sortbar select{max-width:100%; min-width:0; padding:6px 8px; font-size:var(--fs-sm);}   /* [2026-11-15] max-width:none이라 칸보다 7px 넓어져 옆 버튼과 맞닿았음 */
  .sortbar .sort-total{font-size:var(--fs-sm); white-space:nowrap;}
  .hero{padding:12px 0;}
  .hero h1{font-size:var(--fs-lg); margin-bottom:8px;}
}

/* ───────── 6. 칸·비율 점검 보정 (2026-11-15) ───────── */
/* 찜·비교 원형 버튼 — 안의 이모지가 22px 원보다 커서 삐져나왔음 */
.lcard .thumb .fav-btn, .lcard .thumb .cmp-btn{width:24px; height:24px; font-size:12px; line-height:1;}
/* 메인 "전체보기 ›" — 화살표가 칸 밖으로 6px 나갔음 */
.block-head .more{flex:none; white-space:nowrap;}

/* ───────── 7. 공개 화면 점검 — 접근성·카드 사진 (2026-11-22) ───────── */
/* 매물 카드 사진: 예전엔 .thumb의 CSS 배경(background-image)이라 대체 텍스트·이미지 검색·지연 로딩이 안 됐음 → <img class="thumb-img">를 .thumb 안 첫 줄에 넣음.
   위에 올라가는 태그·찜·비교·전화 버튼은 z-index:2(각 페이지 CSS)라 사진 위에 그대로 보임. 마크업은 서버(PHP)·브라우저(JS)가 같아서 카드 구조를 바꾸면 이 규칙도 같이. */
.lcard .thumb{position:relative; overflow:hidden;}
.lcard .thumb > .thumb-img{position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; z-index:0;}
/* 메인 카드는 예전에 <div onclick=location.href>라 링크가 아니었음(키보드 이동·검색엔진 내부링크 없음) → <a href>로 바꿔도 모양이 그대로이도록 */
a.lcard{display:block; color:inherit; text-decoration:none;}
/* 카드 위 아이콘 버튼은 키보드로 닿으니 포커스가 보여야 함 */
.fav-btn:focus-visible, .cmp-btn:focus-visible, .call-btn:focus-visible, a.lcard:focus-visible{outline:3px solid #1E5FCE; outline-offset:2px;}
/* "본문으로 건너뛰기" — 평소엔 화면 밖, Tab으로 닿으면 왼쪽 위에 나타남 */
.skip-link{position:absolute; left:8px; top:-48px; z-index:9999; background:#1E5FCE; color:#fff; padding:10px 14px; border-radius:8px; font-weight:800; font-size:var(--fs-sm); text-decoration:none;}
.skip-link:focus{top:8px;}
