/* 홈 (D-115) — 대형 히어로 배너 → 분야 칩 → 광고 세무사 → 인기 세무사 → 바로가기.
   앱 홈(D-110)과 같은 우선순위이고, 구조 수치는 opensea.io 라이트 실측을 따른다.
   색·타이포는 tokens.css(토스톤) 그대로 — 여기서 새 색을 만들지 않는다. */

/* ── 히어로 배너 ────────────────────────────────────── */
/* ── 히어로 배너: 양옆 미리보기(peek) 캐러셀 (D-128) ──────────────
   슬라이드를 트랙보다 좁게 잡고 좌우 패딩으로 이웃 카드를 살짝 노출한다.
   "옆에 더 있다"가 보여야 사용자가 넘긴다 — 꽉 찬 슬라이드는 한 장짜리로 오해된다.
   가운데가 아닌 카드는 살짝 줄이고 흐리게 해서 깊이를 준다(.is-active는 JS가 붙인다). */
.hero-wrap { position: relative; --hero-w: min(920px, 84%); --hero-peek: 12px; }
.hero-track {
  display: flex; gap: var(--hero-peek); overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-inline: calc((100% - var(--hero-w)) / 2);
  padding-block: 10px;   /* 확대된 카드의 그림자가 잘리지 않게 */
}
.hero-track::-webkit-scrollbar { display: none; }

.hero-card {
  position: relative; flex: 0 0 var(--hero-w); scroll-snap-align: center;
  min-height: 320px; border-radius: var(--r-xl); overflow: hidden;
  box-shadow: var(--shadow-card); display: flex; align-items: center;
  transform: scale(.94); opacity: .55;
  transition: transform .28s ease, opacity .28s ease, box-shadow .28s ease;
}
.hero-card.is-active {
  transform: scale(1); opacity: 1;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}
/* JS가 못 붙었을 때(스크립트 실패)도 첫 카드는 온전히 보여야 한다. */
.hero-track:not(:has(.is-active)) .hero-card:first-child { transform: scale(1); opacity: 1; }
/* 이미지가 없거나 로드에 실패해도 이 그라디언트가 남아 레이아웃이 깨지지 않는다. */
.hero-g0 { background: linear-gradient(120deg, #5A97F8, #2F6BF0 55%, #1544A8); }
.hero-g1 { background: linear-gradient(120deg, #15C47E, #059862 55%, #04664A); }
.hero-g2 { background: linear-gradient(120deg, #7C6BF6, #5A45E0 55%, #3A2AA8); }
.hero-g3 { background: linear-gradient(120deg, #FF9F45, #FF6B00 55%, #C24E00); }

.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* 인물 사진 — 오른쪽에 붙이고 왼쪽 가장자리를 투명으로 흘려 배경에 녹인다.
   마스크가 없으면 사각형이 오려 붙은 것처럼 보인다(D-114에서 실측 확인). */
.hero-photo {
  position: absolute; right: 0; top: 0; bottom: 0; width: 46%; max-width: 420px;
  object-fit: cover; object-position: 50% 30%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
}
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.58), rgba(0,0,0,.06) 62%); }
.hero-scrim-strong { background: linear-gradient(90deg, rgba(0,0,0,.78), rgba(0,0,0,.05) 62%); }

.hero-body {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 0 48px; max-width: 620px; color: #fff;
}
.hero-label {
  align-self: flex-start; padding: 4px 10px; border-radius: var(--r-full);
  background: rgba(255,255,255,.22); font-size: 12px; font-weight: 700;
}
.hero-title { font-size: 32px; font-weight: 800; line-height: 1.25; letter-spacing: -.5px; }
.hero-sub { font-size: 15px; color: rgba(255,255,255,.88); }
.hero-cta {
  align-self: flex-start; margin-top: 6px;
  display: inline-flex; align-items: center; gap: 3px;
  height: 44px; padding: 0 20px; border-radius: var(--r-full);
  background: #fff; color: var(--text-primary); font-weight: 800; font-size: 14px;
}
.hero-cta::after { content: '›'; font-size: 16px; line-height: 1; }
/* 카드 전체를 덮는 클릭 영역 — 링크 없는 배너는 이 요소만 빠진다. */
.hero-tap { position: absolute; inset: 0; }

.hero-dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.hero-dots button {
  width: 22px; height: 4px; border-radius: 2px; border: 0; padding: 0;
  background: var(--grey300); cursor: pointer;
}
.hero-dots button[aria-current="true"] { background: var(--primary); }

/* ── 분야 칩 ────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 4px; }
.chip {
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  display: inline-flex; align-items: center;
}
.chip:hover { background: var(--surface-alt); }
.chip-on { background: var(--text-primary); border-color: var(--text-primary); color: #fff; }
.chip-on:hover { background: var(--text-primary); }

/* ── 섹션 공통 ──────────────────────────────────────── */
.section { margin-top: 34px; }
.sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { font-size: 20px; font-weight: 800; white-space: nowrap; }
.sec-head .sub { font-size: 13px; color: var(--text-tertiary); }
.sec-head .more { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* 아바타(광고·인기 공용) */
.avatar {
  position: relative; flex: 0 0 auto; width: 52px; height: 52px; border-radius: var(--r-md);
  background: var(--primary-light); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; overflow: visible;
}
.avatar img { width: 100%; height: 100%; border-radius: var(--r-md); object-fit: cover; }
/* 아바타에 붙는 접속 점. ⚠ app.css의 `.presence`는 '접속중' **텍스트 배지**라 이름이
   겹치면 디렉토리·상세·빠른상담의 상태 표시가 깨진다 — 그래서 `.av-dot`으로 분리했다. */
.avatar .av-dot {
  position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid var(--surface); background: var(--presence-offline);
}
.av-dot.dot-online { background: var(--presence-online); }
.av-dot.dot-away { background: var(--presence-away); }
.av-dot.dot-busy { background: var(--presence-busy); }

/* 디렉토리 카드의 광고 라벨 줄 — 셸 개편 전 home.css에 있던 규칙을 그대로 가져온다
   (directory.html이 여전히 쓴다). */
.ad-row { margin-bottom: 4px; }

/* ── 광고 세무사 카드 ───────────────────────────────── */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ad-card {
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px;
  background: var(--surface); transition: box-shadow .15s, transform .15s;
}
.ad-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.ad-top { display: flex; align-items: center; gap: 12px; }
.ad-id { min-width: 0; }
.ad-name { font-size: 16px; font-weight: 700; }
.ad-office { font-size: 13px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-meta { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--text-tertiary); }
.ad-meta .star { color: var(--warning); font-weight: 700; }
/* '광고' 라벨은 표시 의무다(D-013 · 약관 제6조) — 끄는 옵션을 만들지 마라. */
.ad-label {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text-tertiary);
  background: var(--surface-alt); border-radius: 6px; padding: 2px 7px; white-space: nowrap;
}
.ad-price { margin-top: 10px; font-weight: 800; color: var(--primary); font-size: 15px; }

/* ── 인기 세무사: 플랫 리스트 ───────────────────────── */
.rank-list { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--divider); }
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover { background: var(--surface-alt); }
.rank-no { width: 20px; text-align: center; font-weight: 800; color: var(--text-disabled); font-variant-numeric: tabular-nums; }
.rank-row .avatar { width: 42px; height: 42px; font-size: 16px; }
.rank-id { min-width: 0; }
.rank-name { font-weight: 700; }
.rank-sub { font-size: 13px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-right { margin-left: auto; text-align: right; white-space: nowrap; }
.rank-price { font-weight: 700; color: var(--primary); font-size: 14px; }
.rank-rating { font-size: 12.5px; color: var(--text-tertiary); }

/* ── 바로가기 타일 ──────────────────────────────────── */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; gap: 4px; padding: 18px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.tile:hover { box-shadow: var(--shadow-card); }
.tile-ic {
  width: 40px; height: 40px; border-radius: var(--r-md); margin-bottom: 6px;
  background: var(--primary-light); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.tile-ic svg {
  width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.tile-t { font-weight: 700; }
.tile-s { font-size: 13px; color: var(--text-tertiary); }

/* ── 모바일 ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-card { min-height: 240px; }
  .hero-body { padding: 0 22px; }
  .hero-title { font-size: 23px; }
  .hero-photo { width: 52%; }
  .ad-grid, .tile-grid { grid-template-columns: 1fr; }
}

/* ── 광고 상품 표현 (D-124) ─────────────────────────────────────
   광고주가 산 '한 줄 멘트'와 '강조'. 강조를 늘리면 여기와 관리자 select,
   admin-ad-preview.js 를 함께 늘려야 한다.
   ⚠ 어떤 강조를 써도 '광고' 라벨은 그대로 붙는다(D-013) — 강조로 라벨을 가리지 말 것. */
.ad-tagline {
  margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

.ad-hl-outline { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.ad-hl-tint { background: var(--primary-light); }
/* 리본 — 카드 우상단 모서리에 얇게. 카드가 overflow:hidden 이 아니어도 삐져나오지 않게 안쪽에 둔다. */
.ad-hl-ribbon { position: relative; overflow: hidden; }
.ad-hl-ribbon::after {
  content: 'AD'; position: absolute; top: 10px; right: -26px;
  transform: rotate(45deg); width: 96px; padding: 3px 0;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-align: center;
}
.ad-hl-none { /* 기본 카드 그대로 */ }

/* ── 카테고리 (D-128) ───────────────────────────────────────────
   기능을 '글 목록'이 아니라 **아이콘 타일**로 늘어놓는다. 한 줄에 여러 개가 들어와
   전체 구성이 한눈에 잡히고, 이미지가 라벨보다 먼저 읽혀 분류가 빨라진다. */
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px 8px; }
.cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-primary); text-align: center;
}
.cat-ic {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center; background: var(--surface-alt);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat-item:hover .cat-ic { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.cat-ic svg {
  width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
/* 분류가 색으로도 구분되게 — 라벨을 읽기 전에 덩어리로 인지된다. */
.cat-ic.c1 { background: #E8F3FF; color: #2F6BF0; }
.cat-ic.c2 { background: #E7F8F1; color: #059862; }
.cat-ic.c3 { background: #FFF1E5; color: #E06A00; }
.cat-ic.c4 { background: #F0EDFE; color: #5A45E0; }
.cat-ic.c5 { background: #FFECEF; color: #D93A4E; }
.cat-label { font-size: 13px; font-weight: 600; line-height: 1.35; }

/* ── 이용 후기 (D-128) ─────────────────────────────────────────── */
.review-track {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none; padding-bottom: 4px;
}
.review-track::-webkit-scrollbar { display: none; }
.review-card {
  flex: 0 0 min(340px, 82%); scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 10px;
}
.review-quote {
  font-size: 17px; font-weight: 700; line-height: 1.45; letter-spacing: -.2px; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.review-body {
  font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.review-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.review-foot .avatar { width: 32px; height: 32px; font-size: 13px; }
.review-who { font-size: 13px; font-weight: 600; }
.review-stars { font-size: 13px; color: var(--warning); font-weight: 700; }

@media (max-width: 768px) {
  .hero-wrap { --hero-w: 86%; }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .cat-ic { width: 56px; height: 56px; border-radius: 18px; }
  .region-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── 우리 지역 (D-129) ──────────────────────────────────────────
   17개 시도가 한눈에 들어와야 해서 촘촘한 칩 격자로. 세무사가 없는 지역도 자리를 지키되
   흐리게 — 자기 지역이 아예 없으면 목록 자체를 의심하게 된다. */
.region-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.region-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 12px 6px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-primary);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.region-item:hover { border-color: var(--primary); box-shadow: var(--shadow-card); }
.region-name { font-size: 14px; font-weight: 700; }
.region-count { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.region-item.is-empty { opacity: .5; }
.region-item.is-empty:hover { border-color: var(--border); box-shadow: none; }

/* 카테고리 선택 상태 — 지금 아래 목록이 어떤 분야로 좁혀져 있는지 보이게. */
.cat-item.is-on .cat-ic { outline: 2px solid var(--primary); outline-offset: 2px; }
.cat-item.is-on .cat-label { color: var(--primary); }

/* ── 지금 상담 가능 (D-129) ─────────────────────────────────── */
.live-dot {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: var(--success, #059862);
}
.live-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 3px rgba(5, 152, 98, .16);
}
.online-empty { margin-top: 12px; text-align: center; padding: 28px 20px; }
