/* 단지 목록(/complexes)·단지 상세(/complexes/:slug) 전용 스타일(VIEW-B). base.css 의 토큰·버튼·차트·빈 상태를 그대로 쓴다.
   모바일 우선(390px) → 600px → 900px. 동적 위치(게이지)는 SVG 퍼센트 속성으로만 그린다(인라인 style 없음). */

/* ───────── 상단 ───────── */
.cx-head { background: var(--bg-soft); }
.cx-head__inner { padding-top: 24px; }
.cx-head--index .cx-head__inner { padding-bottom: 32px; }
.cx-head__row {
  margin-top: 14px;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 48px;
}
.cx-head__text { min-width: 0; }
.cx-head__title { font-size: 32px; line-height: 1.25; }
.cx-head--index .cx-head__title { margin-top: 14px; }
.cx-head__lead { margin-top: 12px; max-width: 640px; font-size: 15px; line-height: 1.8; color: var(--ink-2); }
.cx-head__cta { width: 100%; gap: 8px; font-size: 15px; }

.cx-tags { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.cx-tag {
  padding: 5px 11px; border-radius: var(--radius-pill);
  background: #FFFFFF; border: 1px solid var(--line); color: var(--ink-2);
}
.cx-tag--blue { background: var(--chip-bg); border-color: var(--chip-bg); color: var(--brand); font-weight: 600; }
.cx-tag--strong { background: var(--chip-bg); border-color: var(--chip-bg); color: var(--brand); font-weight: 700; }

.cx-stats { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cx-stat { min-width: 0; padding: 16px; border-radius: 16px; background: #FFFFFF; border: 1px solid var(--line); }
.cx-stat__label { font-size: 12px; line-height: 1.5; color: var(--muted); word-break: keep-all; }
.cx-stat__value { margin-top: 6px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.cx-stat__value--brand { color: var(--brand); }
.cx-stat__na { color: var(--muted); }
.cx-stat__meta { margin-top: 6px; font-family: var(--font-mono); font-size: 11px; line-height: 1.5; color: var(--muted); }
/* 숫자가 아닌 안내 문장('비교할 1년 전 거래가 없어요')은 본문 글꼴로 */
.cx-stat__meta--text { font-family: var(--font-sans); font-size: 12px; word-break: keep-all; }

.cx-tabs { margin-top: 18px; overflow-x: auto; scrollbar-width: none; }
.cx-tabs::-webkit-scrollbar { display: none; }
.cx-tabs__list { display: flex; gap: 4px 24px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.cx-tabs__link {
  display: inline-flex; align-items: center; min-height: 48px;
  border-bottom: 2px solid transparent; color: var(--muted);
  transition: color .2s ease, border-color .2s ease;
}
.cx-tabs__link:hover { color: var(--ink); border-color: var(--ink); }

/* ───────── 본문 + 오른쪽 대표 카드 ───────── */
.cx-body { padding-top: 36px; padding-bottom: 64px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 40px; }
.cx-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 48px; }
.cx-aside { flex: 1 1 300px; min-width: 0; }
.cx-sec, .cx-check { scroll-margin-top: 16px; }

.cx-sec__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.cx-sec__title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.4; }
.cx-sec__count { color: var(--brand); }
.cx-sub { font-size: 16px; font-weight: 700; }
.cx-note { margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--muted); }

/* 진행 매물 */
.cx-units { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.cx-unit {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
  padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: #FFFFFF;
}
/* 제목 링크가 줄 전체를 덮는다(매물 상세) */
.cx-unit__title-link { color: var(--ink); }
.cx-unit__title-link:hover { color: var(--ink); }
.cx-unit__title-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.cx-unit:hover .cx-unit__link { border-color: var(--ink-2); }
.cx-unit__info { flex: 1 1 360px; min-width: 0; display: flex; align-items: flex-start; gap: 14px; }
.cx-unit__info .badge { flex: 0 0 auto; }
.cx-unit .badge--jeonse { box-shadow: inset 0 0 0 1px var(--chip-line); }
.cx-unit__text { min-width: 0; }
.cx-unit__title { font-size: 17px; font-weight: 700; line-height: 1.45; }
.cx-unit__spec { margin-top: 4px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.cx-unit__side { flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cx-unit__value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.cx-unit__price .price-change { margin-top: 2px; }
.cx-unit__link { flex: 0 0 auto; }
.cx-sec .empty { margin-top: 16px; }

/* 호가 위치 게이지 */
.gauge-box { margin: 20px 0 0; padding: 20px; border-radius: 16px; background: var(--bg-soft); }
.gauge-box__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; }
.gauge-box__title { font-size: 16px; font-weight: 700; }
.gauge-box__sub { font-size: 13px; color: var(--muted); }
.gauge { display: block; margin-top: 16px; overflow: visible; }
.gauge__track { fill: #E1E6EF; }
.gauge__band { fill: #B9C8EC; }
.gauge__trade { fill: #FFFFFF; stroke: var(--brand); stroke-width: 4; }
.gauge__ask { fill: var(--accent-point); stroke: #FFFFFF; stroke-width: 3; }
.gauge__trade, .gauge__ask {
  transform-box: fill-box; transform-origin: center;
  animation: gauge-pop .6s var(--ease-out) .3s backwards;
}
.gauge__ask { animation-delay: .45s; }
.gauge text { font-family: var(--font-sans); font-size: 12px; font-weight: 700; }
.gauge__label--trade { fill: var(--brand); }
.gauge__label--ask { fill: var(--accent-text); }
.gauge .gauge__ticks text { font-family: var(--font-mono); font-weight: 400; fill: var(--muted); }
@keyframes gauge-pop { from { opacity: 0; transform: scale(.4); } }

/* 실거래 추이 */
.cx-seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-cmp); }
.cx-seg__opt {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.cx-seg__opt:hover { color: var(--ink); }
.cx-seg__opt[aria-current="true"] { background: #FFFFFF; color: var(--ink); box-shadow: 0 1px 3px rgba(14, 23, 38, .16); }

.cx-chart { margin: 16px 0 0; padding: 16px; border-radius: 18px; border: 1px solid var(--line); }
.cx-chart__caption { margin-top: 12px; font-size: 13px; line-height: 1.6; color: var(--muted); }

.cx-table-head { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.cx-table-head__meta { font-size: 13px; color: var(--muted); }
.cx-table-wrap { margin-top: 12px; overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); }
.cx-table-wrap:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* 휴대폰에서도 네 칸(계약일·면적·층·거래금액)이 가로 스크롤 없이 한 화면에 들어오게 최소 폭을 두지 않고 여백을 줄인다 */
.cx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cx-table th {
  padding: 12px 8px; background: var(--bg-soft); text-align: left;
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.cx-table td { padding: 12px 8px; border-top: 1px solid var(--line-2); white-space: nowrap; }
@media (max-width: 599px) {
  .cx-table th:first-child, .cx-table td:first-child { padding-left: 14px; }
  .cx-table th:last-child, .cx-table td:last-child { padding-right: 14px; }
}
/* 아주 좁은 화면(360px 미만): 표 제목·면적 탭에 이미 적힌 전용면적 칸을 접어 거래금액이 늘 보이게 한다 */
@media (max-width: 359px) {
  .cx-table .cx-table__area { display: none; }
}
.cx-table__date { font-family: var(--font-mono); font-size: 13px; }
.cx-table td.cx-table__num { text-align: right; font-weight: 700; }
.cx-table th.cx-table__num { text-align: right; }

/* 단지 정보: 칸마다 왼쪽·위쪽 선을 그림자로 그려, 마지막 줄이 비어도 회색 칸이 남지 않는다 */
.cx-info {
  margin-top: 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 1px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #FFFFFF;
}
.cx-info__item { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; box-shadow: -1px -1px 0 var(--line); }
.cx-info dt { font-size: 13px; color: var(--muted); }
.cx-info dd { font-size: 16px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }

/* 학교·교통·공원 */
.cx-around { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.cx-around__card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 18px; background: var(--bg-soft); }
.cx-around__title { font-size: 16px; font-weight: 700; }
.cx-around__list { display: flex; flex-direction: column; gap: 10px; }
.cx-around__item { display: flex; flex-direction: column; gap: 2px; }
.cx-around__name { font-size: 15px; font-weight: 600; color: var(--ink); }
.cx-around__detail { font-size: 13px; line-height: 1.5; color: var(--muted); }

/* 권리분석사 체크리스트(다크) */
.cx-check { padding: 24px 20px; border-radius: var(--radius-card-lg); background: var(--deep); color: #FFFFFF; }
.cx-check__title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.4; }
.cx-check__lead { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--dark-sub); }
.cx-check__list { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.cx-check__item { display: flex; gap: 14px; padding: 18px; border-radius: 16px; background: var(--dark-card); border: 1px solid var(--dark-line); }
.cx-check__no { flex: 0 0 auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; color: var(--light-blue); }
.cx-check__name { font-size: 16px; font-weight: 700; }
.cx-check__body { margin-top: 6px; font-size: 14px; line-height: 1.65; color: var(--dark-sub); }

/* 대표 카드 */
.cx-ceo {
  display: flex; flex-direction: column; gap: 18px;
  padding: 24px; border-radius: 22px; border: 1px solid var(--line); background: #FFFFFF;
}
.cx-ceo__head { display: flex; align-items: center; gap: 16px; }
.cx-ceo__img {
  flex: none; width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover; object-position: 50% 12%; background: var(--placeholder);
}
.cx-ceo__name { font-size: 18px; font-weight: 700; }
.cx-ceo__role { margin-top: 4px; font-size: 13px; color: var(--muted); }
.cx-ceo__text { font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.cx-ceo__actions { display: flex; flex-direction: column; gap: 8px; }

/* ───────── 단지 목록 ───────── */
.cx-index { padding-top: 28px; padding-bottom: 64px; }
.cx-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.cx-cards__item { display: flex; }
.cx-card {
  flex: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 22px; border-radius: var(--radius-card); border: 1px solid var(--line); background: #FFFFFF; color: var(--ink);
}
.cx-card:hover { color: var(--ink); }
.cx-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.cx-card__dong { font-size: 13px; color: var(--muted); }
.cx-card__name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.35; }
.cx-card__trade { padding: 14px 16px; border-radius: 14px; background: var(--bg-cmp); }
.cx-card__label { font-family: var(--font-mono); font-size: 12px; color: var(--brand); }
.cx-card__price { margin-top: 4px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.cx-card__meta { margin-top: 2px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.cx-card__na { margin-top: 4px; font-size: 14px; color: var(--muted); }
.cx-card__foot {
  margin-top: auto; padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line-2); font-size: 14px; font-weight: 600;
}
.cx-card__count { color: var(--ink-2); }
.cx-card__more { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); }
.cx-card__more .icon { transition: transform .28s var(--ease-out); }
.cx-card:hover .cx-card__more .icon { transform: translateX(4px); }

/* ───────── 600px 이상 ───────── */
@media (min-width: 600px) {
  .cx-head__inner { padding-top: 48px; }
  .cx-head--index .cx-head__inner { padding-bottom: 44px; }
  .cx-head__row { margin-top: 18px; gap: 24px 48px; }
  .cx-head__title { font-size: clamp(36px, 4vw, 56px); line-height: 1.2; }
  .cx-head__lead { font-size: 16px; }
  .cx-head__cta { width: auto; min-height: 52px; padding: 0 22px; }
  .cx-tags { margin-top: 16px; font-size: 14px; }
  .cx-tag { padding: 6px 12px; }

  .cx-stats { margin-top: 36px; gap: 12px; }
  .cx-stat { padding: 22px 24px; border-radius: 18px; }
  .cx-stat__label { font-size: 13px; }
  .cx-stat__value { margin-top: 8px; font-size: 30px; }
  .cx-stat__meta { font-size: 12px; }
  .cx-tabs { margin-top: 36px; }
  .cx-tabs__list { gap: 4px 28px; }

  .cx-sec__title { font-size: 24px; }
  .cx-units { margin-top: 20px; gap: 12px; }
  .cx-unit { padding: 22px 24px; border-radius: 18px; }
  .cx-unit__info { align-items: center; gap: 18px; }
  .cx-unit__side { flex: 0 0 auto; gap: 20px; }
  .cx-unit__price { text-align: right; }
  .cx-unit__value { font-size: 24px; }
  .gauge-box { padding: 24px; border-radius: 18px; }
  .cx-chart { margin-top: 20px; padding: 28px; border-radius: 20px; }
  .cx-chart__caption { margin-top: 14px; }
  .cx-table { font-size: 15px; }
  .cx-table th, .cx-table td { padding: 14px 20px; }
  .cx-table__date { font-size: 14px; }
  .cx-info, .cx-around { margin-top: 20px; }
  .cx-info__item { padding: 20px 22px; }
  .cx-info dd { font-size: 17px; }
  .cx-around__card { padding: 22px 24px; }
  .cx-check { padding: 36px; }
  .cx-check__title { font-size: 28px; }
  .cx-check__list { margin-top: 28px; gap: 14px; }
  .cx-check__item { padding: 20px; }
  .cx-ceo { padding: 28px; }

  .cx-index { padding-top: 40px; }
  .cx-cards { gap: 20px; }
  .cx-card { padding: 26px; }
}

/* ───────── 900px 이상 ───────── */
@media (min-width: 900px) {
  .cx-body { padding-top: 48px; padding-bottom: 96px; }
  .cx-main { gap: 64px; }
  .cx-aside { position: sticky; top: 24px; }
  .cx-index { padding-bottom: 96px; }
}

/* ───────── 1000px 이상: 요약 4칸을 한 줄로(3+1 로 깨지지 않게) ───────── */
@media (min-width: 1000px) {
  .cx-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cx-stat__value { font-size: clamp(24px, 2.2vw, 30px); }
}
