/* 공개몰 메인 칸 — public/home.html 에서만 불러온다(10/5 디자인 (나) + 메인 구성 정본 v2).
   ★규칙은 두 자리에서만 푼다: 카드뉴스 칸 모서리 8px · 분류 뜻에 맞춘 파스텔 바탕(대표님 10/5 «둥글게 예쁘게», 색 키는
     services/home_sections.CARD_TONES) · MD 추천상품관 대표 칸(배너 자리 예외 — 바탕 = 배너 밝은 6색 site.css .bn-th-<키>, 사진 칸 12px)
     과 그 아래 «테마 모아보기» 타일(카드뉴스 모양 8px, 바탕은 무채색 한 가지).
     나머지(상품 카드·탭·순위 띠·글 칸·공급사 타일)는 디자인 기준 v2 그대로: 모서리 0 · 그림자 0 · 그라데이션 0 · 1px 선.
   ★가로로 넘치는 것은 그 칸 안에서만 밀어 본다(탭 줄) — 쪽 전체가 옆으로 밀리지 않게. */

/* 탭 줄(인기 TOP · 분류별 상품 · 셀러 관심 · 배송 조건 · 가격대) — 모양은 site.css .s-tabs, 여기는 자리와 넘침만 */
.hm-tabbar { margin: -2px 0 18px; }
.hm-tabbar .s-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: thin; vertical-align: top; }
.hm-tabbar .s-tabs button { flex: none; }
.hm-note { margin: -6px 0 14px; font-size: 12.5px; color: var(--g3); }

/* 인기 TOP 순위 — 1·2·3위만 사진 오른쪽 위 직각 띠(왼쪽 위는 상품 카드의 품절·베스트 띠 자리) */
.hm-rk { position: relative; display: flex; flex-direction: column; min-width: 0; }
.hm-rk > .pcard { flex: 1; }
.hm-rk-n { position: absolute; right: 0; top: 0; z-index: 2; height: 24px; line-height: 24px; padding: 0 8px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 800; pointer-events: none; }

/* MD 추천상품관 — 테마 이름 밑줄 탭(디자인 기준 5절 .seg 모양: 선택 = 남색 2px 밑줄, 누를 때만 바뀜) */
.hm-ul { display: flex; border-bottom: 1px solid var(--g4); overflow-x: auto; scrollbar-width: thin; }
.hm-ul button { flex: none; position: relative; height: 42px; padding: 0 18px; border: 0; border-radius: 0; background: none; font-size: 15px; font-weight: 600; color: var(--g2); cursor: pointer; }
.hm-ul button:hover { color: var(--g1); }
.hm-ul button.on { color: var(--g1); font-weight: 800; }
.hm-ul button.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--navy); }

/* 판 = 대표 칸 1(폭 약 1/5, 높이 = 상품 두 줄) + 상품 4열×2줄. 대표 칸 바탕·글자색은 site.css .bn-th-<키>(밝은 6색) · 칸 전체가 테마 화면 링크 */
.hm-md { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 24px; align-items: stretch; }
body.site .hm-md .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hm-md-cv { display: flex; flex-direction: column; min-width: 0; padding: 26px 22px 22px; }
.hm-md-cv strong { display: block; font-size: 23px; font-weight: 400; line-height: 1.32; letter-spacing: -.045em; word-break: keep-all; }
.hm-md-cv strong em { font-style: normal; font-weight: 800; color: var(--bn-ac); }
.hm-md-cv p { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--g2); word-break: keep-all; }
.hm-md-cv small { display: block; margin-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--g2); }
/* 대표 칸 사진 = 카드에 없는 상품 1~2장을 세로로(services/md_hall — 두 줄 판이면 2장). ★10/5 검사: 사진 1장을 바닥에 붙여 글과 사진 사이
   242px 가 비었다(AI 티 18번) → 2장으로 칸을 채움. 흰 바탕 테마도 사진 칸에 선을 두르지 않는다(테두리 상자 안 테두리 상자 — AI 티 7번) */
/* 사진 칸은 글 아래 남은 높이를 나눠 채운다(흰 칸 안 사진은 비율 그대로 가운데) — 셀러 화면·1024 폭처럼 카드가 높아져도 빈 띠가 안 생기게 */
.hm-md-cv .ph { flex: 1 1 0; min-height: 150px; display: grid; grid-auto-rows: minmax(0, 1fr); gap: 10px; padding-top: 16px; }
.hm-md-cv .ph img { display: block; width: 100%; height: 100%; min-height: 0; align-self: stretch; box-sizing: border-box; padding: 10px; border-radius: 12px; background: #fff; object-fit: contain; }
a.hm-md-cv:hover em { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.hm-md-more { display: none; }

/* 테마 모아보기 — 판 아래 테마 타일 한 줄(테마 수만큼 칸, 최대 6). 누르면 그 테마 화면. 바탕은 무채색 한 가지(테마 색을 늘어놓으면
   무지개 돌림색 — AI 티 16번) · 사진은 카드·대표 칸에 없는 상품(services/md_hall tile_imgs) */
.hm-mdt { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.hm-mdt.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hm-mdt.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hm-mdt.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hm-mdt.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.hm-mdt a { display: flex; flex-direction: column; min-width: 0; padding: 14px 14px 12px; border-radius: 8px; background: var(--g6); color: var(--g1); }
.hm-mdt b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.03em; line-height: 1.3; word-break: keep-all; }
.hm-mdt small { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--g2); }
.hm-mdt .ph { display: grid; grid-template-columns: repeat(2, minmax(0, 88px)); gap: 8px; margin-top: auto; padding-top: 12px; }
.hm-mdt .ph img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; box-sizing: border-box; padding: 5px; border-radius: 8px; background: #fff; object-fit: contain; }
.hm-mdt a:hover b { color: var(--blue); }

/* 카드뉴스 '분류별 모음' — 연한 바탕 + 분류 이름 + 판매 중 수 + 그 분류 상품 사진 3장(칸 아래 폭 가득, 겹침 없음).
   ★10/5 검사 뒤: 사진이 오른쪽에만 있어 왼쪽 아래 40%가 비던 것 → 아래 한 줄 · 바탕 8색 → 3색(뜻으로 묶음, CARD_TONES).
   사진은 사람이 본 후보 목록 안에서만이라 모자라면 적거나 없다(없으면 칸이 낮아짐). */
.hm-cn { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hm-cn a { display: flex; flex-direction: column; min-width: 0; padding: 18px 18px 16px; border-radius: 8px; background: var(--cn-bg, var(--g6)); color: var(--g1); }
.hm-cn b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.03em; line-height: 1.3; word-break: keep-all; }
.hm-cn small { display: block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--cn-ink, var(--g2)); }
.hm-cn a:hover b { color: var(--cn-ink, var(--blue)); }
.hm-cn .ph { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: auto; padding-top: 14px; }
.hm-cn .ph img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; box-sizing: border-box; padding: 6px; border-radius: 8px; background: #fff; object-fit: contain; }

/* 바탕(연한 색) / 글자(같은 계열 진한 색 — 바탕 위 대비 4.5 이상). 세 가지만: 집 · 일과 기계 · 몸에 쓰는 것 */
.hm-t-mint { --cn-bg: #DDF4EC; --cn-ink: #0B7A55; }
.hm-t-sky  { --cn-bg: #E3F0FF; --cn-ink: #1D4FCF; }
.hm-t-sand { --cn-bg: #F4EDE2; --cn-ink: #8A5A1F; }

/* 공급사 모아보기 — 칸선으로 붙인 타일(모서리 0). 공급사는 코드 명판(굵은 코드 + 아래 남색 줄, 디자인 기준 11번) */
.hm-st { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--g1); border-left: 1px solid var(--g5); }
.hm-st a { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 18px 18px 16px; border-right: 1px solid var(--g5); border-bottom: 1px solid var(--g5); color: var(--g1); }
.hm-st .nm { font-size: 17px; font-weight: 800; letter-spacing: .02em; padding-bottom: 3px; border-bottom: 2px solid var(--navy); font-variant-numeric: tabular-nums; }
.hm-st small { margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--g2); }
.hm-st .chips { margin-top: 4px; }
.hm-st .ph { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-self: stretch; margin-top: auto; padding-top: 14px; }
.hm-st .ph img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; box-sizing: border-box; padding: 4px; border: 1px solid var(--g5); background: #fff; object-fit: contain; }
.hm-st a:hover { background: var(--g6); }
.hm-st a:hover .nm { color: var(--blue); }

/* 세부 분류 바로가기 — 대분류 칸 4열, 칸 안 소분류 글 링크 + 판매 중 수(모서리 0, 1px 선) */
.hm-sub { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--g1); border-left: 1px solid var(--g5); }
.hm-sub > div { min-width: 0; padding: 16px 18px 18px; border-right: 1px solid var(--g5); border-bottom: 1px solid var(--g5); }
.hm-sub .t { display: block; margin-bottom: 10px; font-size: 15px; font-weight: 800; color: var(--g1); }
.hm-sub .t:hover { color: var(--blue); }
.hm-sub ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hm-sub li a { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--g2); }
.hm-sub li a span { flex: none; color: var(--g3); font-variant-numeric: tabular-nums; }
.hm-sub li a:hover { color: var(--blue); }
.hm-sub .more { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--g3); text-decoration: underline; text-underline-offset: 3px; }
.hm-sub .more:hover { color: var(--blue); }

/* 서비스 안내 — 글 칸 4열×2줄(1px 선 · 모서리 0 · 아이콘 0), 칸마다 이름 + 그 화면이 하는 일 한 줄 */
.hm-svc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--g4); border-left: 1px solid var(--g4); }
.hm-svc a { display: block; min-width: 0; padding: 18px 20px 17px; border-right: 1px solid var(--g4); border-bottom: 1px solid var(--g4); color: var(--g1); }
.hm-svc b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.03em; }
.hm-svc span { display: block; margin-top: 5px; font-size: 12.5px; line-height: 1.5; color: var(--g3); word-break: keep-all; }
.hm-svc a:hover { background: var(--g6); }
.hm-svc a:hover b { color: var(--blue); }

/* S21 공지사항란(10/5 대표님 «메인페이지에 공지사항란» — 카테고리 줄 바로 아래, 도매매처럼 큰 배너 아래 게시판 칸).
   왼쪽 넓은 칸 = 공지(제목 줄 .s-sec + 줄 목록) · 오른쪽 좁은 칸 = 이용 안내(자기 제목). 두 칸의 2px 윗선·줄 높이를 맞춘다.
   .hm-nt 는 display: contents — 안의 공지 목록·이용 안내가 구역 격자에 바로 놓인다(제목 줄은 왼쪽 칸 위에만, 이용 안내는 두 줄에 걸침).
   공지가 없으면 '등록된 공지가 없습니다' 한 줄을 칸 가운데에(칸은 보이게). 모서리 0 · 상자 1겹(윗선 + 줄)만.
   두 칸 모두 아래 1px 선으로 닫는다. 공지 목록은 제 줄 수만큼만(10/5 검사: 공지가 1~4줄이면 이용 안내 5줄 높이에 맞춰 늘린 칸 아래가
   빈 흰 면으로 남았다) — 공지가 5줄이면 두 칸 아랫선이 맞고, 적으면 공지 칸이 먼저 닫힌다. 공지 0개 안내 칸만 이용 안내 높이에 맞춘다. */
.hm-sec[data-sec="notice"] { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 32px; margin-top: 32px; }
.hm-sec[data-sec="notice"] > .s-sec { grid-column: 1; grid-row: 1; align-items: center; min-height: 30px; margin: 0 0 10px; }
.hm-nt { display: contents; }
.hm-nt ul { list-style: none; margin: 0; padding: 0; }
.hm-nt .nt { grid-column: 1; grid-row: 2; margin: 0; border-top: 2px solid var(--g1); border-bottom: 1px solid var(--g5); }
.hm-nt ul.nt { align-self: start; }
.hm-nt .nt li { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 2px; border-bottom: 1px solid var(--g5); font-size: 14px; }
.hm-nt .nt li:last-child, .hm-nt .gd li:last-child { border-bottom: 0; }
.hm-nt .nt a { flex: 1; display: flex; gap: 8px; min-width: 0; color: var(--g1); }
.hm-nt .nt a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-nt .nt a:hover span { color: var(--blue); }
.hm-nt .nt b { flex: none; font-size: 13px; font-weight: 800; color: var(--navy); }
.hm-nt .nt time { flex: none; font-size: 12.5px; color: var(--g3); font-variant-numeric: tabular-nums; }
.hm-nt .nt-empty { display: grid; place-items: center; min-height: 138px; font-size: 14px; color: var(--g3); }
.hm-nt .gd { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; min-width: 0; }
.hm-nt .gd h2 { display: flex; align-items: center; min-height: 30px; margin: 0 0 10px; font-size: 20px; font-weight: 800; }
.hm-nt .gd ul { flex: 1; border-top: 2px solid var(--g1); border-bottom: 1px solid var(--g5); }
.hm-nt .gd li { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 2px; border-bottom: 1px solid var(--g5); font-size: 14px; }
.hm-nt .gd li a { flex: none; font-weight: 700; color: var(--g1); }
.hm-nt .gd li a:hover { color: var(--blue); }
.hm-nt .gd li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--g3); }

/* ── 좁은 화면 ───────────────────────────────────────────── */
@media (max-width: 1180px) {
  .hm-md { grid-template-columns: 210px minmax(0, 1fr); gap: 18px; }
  body.site .hm-md .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hm-md .pgrid > :nth-child(n+7), .hm-md.one .pgrid > :nth-child(n+4) { display: none; }   /* 3열이면 채운 줄만(두 줄 6개 · 한 줄 3개) */
  /* 4열(site.css)에서 자동 줄은 한 줄 4칸 단위로만(10개 → 8개 · 5개 → 4개) — 마지막 줄에 1~2칸만 남지 않게(정본 1-4) */
  .hm-sec .pgrid > :nth-child(n+9), .hm-sec .pgrid > :nth-child(5):last-child { display: none; }
}
@media (max-width: 860px) {
  .hm-cn { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hm-cn a { padding: 14px 14px 12px; }
  .hm-cn b { font-size: 15px; }
  .hm-cn small { font-size: 12px; margin-top: 3px; }
  .hm-cn .ph { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 10px; }
  .hm-cn .ph img { padding: 5px; }
  .hm-cn .ph img:nth-child(3) { display: none; }                    /* 폰: 사진 2장을 크게 */
  .hm-tabbar { margin-bottom: 14px; }
  .hm-rk-n { height: 22px; line-height: 22px; padding: 0 6px; font-size: 11.5px; }
  /* 폰 MD관: 대표 칸이 위 가로 띠(사진 오른쪽 72px) + 상품 2열×2줄 + '이 테마 상품 N개 모두 보기' */
  .hm-ul button { height: 40px; padding: 0 14px; font-size: 14px; }
  .hm-md { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hm-md-cv { display: grid; grid-template-columns: minmax(0, 1fr) 72px; column-gap: 14px; align-items: start; padding: 16px 16px 14px; }
  .hm-md-cv > * { grid-column: 1; }
  .hm-md-cv strong { font-size: 18px; }
  .hm-md-cv p { margin-top: 6px; font-size: 13px; }
  .hm-md-cv small { margin-top: 8px; }
  .hm-md-cv .ph { grid-column: 2; grid-row: 1 / span 3; display: block; min-height: 0; margin: 0; padding: 0; align-self: center; }
  .hm-md-cv .ph img { width: 72px; height: auto; aspect-ratio: 1 / 1; padding: 6px; }
  .hm-md-cv .ph img:nth-child(n+2) { display: none; }                 /* 폰 가로 띠: 대표 사진 1장만 */
  body.site .hm-md .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-md .pgrid > :nth-child(n+5) { display: none; }
  .hm-md-more { display: block; margin-top: 14px; padding: 11px 0; border: 1px solid var(--g4); text-align: center; font-size: 13.5px; font-weight: 700; color: var(--g1); }
  /* 폰 테마 모아보기: 한 줄 가로로 밀어 보기(그 칸 안에서만 — 쪽 전체는 안 밀림) */
  .hm-mdt { display: flex; gap: 10px; margin-top: 18px; margin-right: -16px; padding-right: 16px; overflow-x: auto; scrollbar-width: none; }
  .hm-mdt::-webkit-scrollbar { display: none; }
  .hm-mdt a { flex: 0 0 42%; padding: 12px 12px 10px; }
  .hm-mdt b { font-size: 14px; }
  /* 폰 2열: 자동 줄은 3줄(6개)까지 — 10/5 검사: 10개 줄이 2열×5줄이라 메인이 PC 의 1.7~1.9배(1만3천~1만7천px). 나머지는 '전체 보기'·탭으로 */
  .hm-sec .pgrid > :nth-child(n+7) { display: none; }
  .hm-st, .hm-sub, .hm-svc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-st a { padding: 14px 14px 12px; }
  .hm-st .nm { font-size: 15px; }
  .hm-sub > div { padding: 14px 14px 16px; }
  .hm-svc a { padding: 14px 14px 13px; }
  .hm-svc b { font-size: 14px; }
  /* 폰 공지사항란: 한 줄로 쌓음(공지 → 이용 안내) · 줄 높이 44px · 빈 공지 칸은 낮게 */
  .hm-sec[data-sec="notice"] { display: block; margin-top: 28px; }
  .hm-sec[data-sec="notice"] > .s-sec { margin: 0 0 8px; }
  .hm-nt .nt li, .hm-nt .gd li { height: 44px; }
  .hm-nt .nt-empty { min-height: 88px; }
  .hm-nt .gd { margin-top: 24px; }
  .hm-nt .gd h2 { min-height: 0; margin-bottom: 8px; font-size: 18px; }
}
