/* 매물 상세 전용 */

/* ---------- 사진 갤러리 ---------- */
.gallery-wrap {
  position: relative;
  margin-top: 8px;
  border-radius: var(--r-lg);
  overflow: hidden;
}

.gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery::-webkit-scrollbar {
  display: none;
}

/* blur-fill — 사진은 contain으로 전부 보이고, 여백은 같은 사진을 흐리게 확대해 채운다 */
.gallery-slide {
  position: relative;
  overflow: hidden;
  min-width: 100%;
  height: 250px;
  scroll-snap-align: start;
  background-size: cover;
  background-position: center;
}

/* 뒷배경 — 같은 사진을 꽉 채워 흐리게 */
.gallery-slide::before {
  content: '';
  position: absolute;
  inset: -6%;                  /* blur로 가장자리가 비는 것을 덮는다 */
  background-image: inherit;
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(0.82);
}

/* 배경이 아니라 img — 구글 이미지 검색은 CSS 배경을 색인하지 않는다 */
.gallery-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 넓은 화면에선 갤러리도 시원하게 */
@media (min-width: 768px) {
  .gallery-slide {
    height: 360px;
  }
}

.gallery-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: var(--fs-sm);
  padding: 3px 10px;
  border-radius: var(--r-md);
}

/* ---------- 가격 헤더 ---------- */
.detail-header {
  padding: 14px 2px 4px;
  position: relative;
}

.detail-header .badge {
  position: static;
  margin-right: 6px;
}

.detail-price {
  margin-top: 6px;
}

/* h1 하나 안에서 위계 — 지역·종류는 작게, 금액은 크게 */
.detail-price-context {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}

.detail-price-amount {
  display: block;
  font-size: var(--fs-2xl);
  font-weight: 900;
  color: var(--navy);
}

.detail-desc {
  font-size: var(--fs-md);
  margin-top: 4px;
}

.detail-meta {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- 아이콘 요약 바 ---------- */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 6px;
  margin: 12px 0;
}

.summary-item {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* 라벨(종류·면적·층…). <small>의 브라우저 기본 0.83em을 그대로 두면
   부모가 12px이라 10px이 된다 — 손님 화면에서 제일 작은 글자였다 */
.summary-item small {
  font-size: var(--fs-xs);
}

.summary-item b {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text);
  margin: 2px 0 1px;
}

.summary-icon {
  font-size: var(--fs-xl);
}

/* ---------- sticky 앵커 탭 ---------- */
.anchor-tabs {
  position: sticky;
  top: 52px;   /* sticky 헤더(52px) 아래 — top:0이면 헤더 뒤로 숨는다 */
  z-index: 5;
  display: flex;
  gap: 4px;
  background: var(--background);
  padding: 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.anchor-tabs a {
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: var(--r-lg);
  font-size: var(--fs-sm);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  color: var(--text);
}

/* ---------- 정보 섹션 ---------- */
.section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 10px 0;
  scroll-margin-top: 56px; /* 앵커 점프 시 sticky 탭에 안 가리게 */
}

.section h2 {
  font-size: var(--fs-md);
  color: var(--navy);
  margin-bottom: 10px;
}

.section p {
  font-size: var(--fs-md);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

/* 중개보수 표의 '(환산)' 같은 꼬리표 — 같은 이유로 11.7px가 되던 것 */
.detail-table th small {
  font-size: var(--fs-xs);
}

.detail-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 7px 0;
  width: 38%;
  vertical-align: top;
}

.detail-table td {
  padding: 7px 0;
}

.cost-box {
  margin-top: 10px;
  background: #f0f7f3;
  border: 1px solid #cfe5da;
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-size: var(--fs-sm);
}

.cost-box strong {
  color: var(--green);
  font-size: var(--fs-md);
}

.cost-box small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  margin-top: 2px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.option-item {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text);
}

.option-icon {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto 3px;
  opacity: 0.75;   /* 순검정 SVG를 본문 톤에 맞춤 */
}

.location-note,
.fee-note {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 8px;
}

/* ---------- 동영상 플레이어 ---------- */
.video-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #0d1520;      /* 영상은 blur-fill이 불가해 어두운 배경으로 */
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;      /* 잘림 없이 전체 표시 */
  display: block;
}

/* ---------- 갤러리 더보기·라이트박스 (전 계층) ---------- */
.gallery-more {
  display: none;   /* 모바일은 스와이프가 담당 */
  position: absolute;
  right: 14px;
  bottom: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-family: inherit;
  color: var(--navy);
  padding: 8px 14px;
  cursor: pointer;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 18, 28, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-photo {
  position: relative;
  overflow: hidden;
  max-width: 88vw;
  max-height: 84vh;
  border-radius: var(--r-md);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 88vw;
  height: 84vh;
}

/* 라이트박스도 blur-fill */
.lightbox-photo::before {
  content: '';
  position: absolute;
  inset: -6%;
  z-index: -1;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.6);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  border: none;
  background: none;
  color: #fff;
  font-size: var(--fs-3xl);
  cursor: pointer;
}

.lightbox-previous,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: var(--fs-2xl);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-previous { left: 22px; }
.lightbox-next { right: 22px; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #dfe7ef;
  font-size: var(--fs-md);
}

/* PC 전용 문의 카드 — 모바일은 본문 가격 헤더가 담당 */
.detail-aside {
  display: none;
}

/* PC(≥1024): 갤러리 그리드 · 본문 2단(콘텐츠｜sticky 문의 카드) */
@media (min-width: 1024px) {
  /* 스와이프 트랙 → 대표 1장 + 서브 2×2, 6장째부터 숨김 */
  .gallery {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    border-radius: var(--r-lg);
    overflow: hidden;
    height: 430px;
    scroll-snap-type: none;
  }

  .gallery-slide {
    width: auto;
    height: auto;
    min-width: 0;
    scroll-snap-align: none;
    cursor: zoom-in;
  }

  .gallery-slide:first-child {
    grid-row: span 2;
  }

  /* 장수별 격자 — 빈 칸이 남으면 깨져 보인다 */
  .gallery:has(.gallery-slide:only-child) {
    grid-template-columns: 1fr;             /* 1장: 전체 폭 */
  }

  .gallery:has(.gallery-slide:first-child:nth-last-child(2)) {
    grid-template-columns: 1fr 1fr;         /* 2장: 반반 */
  }

  .gallery:has(.gallery-slide:first-child:nth-last-child(2)) .gallery-slide {
    grid-row: span 2;                       /* 둘 다 전체 높이 */
  }

  .gallery:has(.gallery-slide:first-child:nth-last-child(3)) {
    grid-template-columns: 2fr 1fr;         /* 3장: 대표 1 + 우측 세로 2 */
  }

  .gallery:has(.gallery-slide:first-child:nth-last-child(4)) {
    grid-template-columns: 1fr 1fr;         /* 4장: 2×2 균등 */
  }

  .gallery:has(.gallery-slide:first-child:nth-last-child(4)) .gallery-slide:first-child {
    grid-row: auto;
  }

  .gallery-slide:nth-child(n+6) {
    display: none;
  }

  .gallery-count {
    display: none;   /* 스와이프 카운터는 PC 그리드에선 무의미 */
  }

  .gallery-more {
    display: block;
  }

  /* 본문 2단 */
  .detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
    margin-top: 22px;
  }

  /* 좌측 섹션을 카드로 */
  .detail-main .section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 20px 24px;
    margin-bottom: 14px;
  }

  .detail-aside {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--sh-lg);
  }

  .aside-badge {
    position: static;   /* 카드 배지의 absolute를 해제하고 제자리 배치 */
    align-self: flex-start;
  }

  .aside-price {
    font-size: var(--fs-3xl);
    font-weight: 900;
    color: var(--navy);
    margin-top: 8px;
  }

  .aside-desc {
    font-size: var(--fs-sm);
    margin-top: 2px;
  }

  .aside-meta {
    font-size: var(--fs-sm);
    color: var(--muted);
    margin-top: 4px;
  }

  .aside-summary {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 12px;
    font-size: var(--fs-sm);
  }

  .aside-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
  }

  .aside-summary-row b {
    color: var(--muted);
    font-weight: 600;
    flex-shrink: 0;
  }

  .aside-call {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: linear-gradient(135deg, var(--navy), var(--navy-dark));
    color: #fff;
    border-radius: var(--r-md);
    padding: 12px 0;
    margin-top: 16px;
    box-shadow: var(--sh-md);
    transition: transform 0.15s;
  }

  .aside-call:hover {
    transform: translateY(-2px);
  }

  .aside-call b {
    font-size: var(--fs-xl);
    font-weight: 900;
  }

  .aside-call small {
    font-size: var(--fs-xs);
    color: #b9c8d8;
  }

  .aside-kakao {
    display: block;
    text-align: center;
    background: #fee500;
    color: #3c1e1e;
    font-size: var(--fs-md);
    font-weight: 800;
    border-radius: var(--r-md);
    padding: 12px 0;
    margin-top: 8px;
    transition: transform 0.15s;
  }

  .aside-kakao:hover {
    transform: translateY(-2px);
  }

  .aside-agent {
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 14px;
  }

  .aside-agent img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 20%;
  }

  .aside-agent b {
    display: block;
    font-size: var(--fs-sm);
    color: var(--navy);
  }

  .aside-agent small {
    font-size: var(--fs-xs);
    color: var(--muted);
  }

  /* 비슷한 매물 그리드는 components.css가 담당 */
}

/* 앵커 목적지가 고정 바에 가리지 않게 */
.section {
  scroll-margin-top: 112px;
}

/* 평↔㎡ 토글 — 라벨은 "누르면 바뀔 단위"(JS가 채움) */
.area-toggle {
  margin-left: 8px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: #f4f7fb;
  color: var(--navy);
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 1.4;
  cursor: pointer;
  vertical-align: 1px;
  transition: background 0.15s, border-color 0.15s;
}

.area-toggle:hover {
  background: #eaf0f8;
  border-color: var(--navy);
}

/* 동 단위 지도 — 정확한 주소는 노출하지 않는다 */
.map-link {
  display: inline-block;
  margin: 6px 0 4px;
  padding: 10px 16px;
  border: 1.5px solid var(--navy);
  border-radius: var(--r-md);
  color: var(--navy);
  font-size: var(--fs-md);
  font-weight: 800;
  text-decoration: none;
}

@media (min-width: 1024px) {
  .anchor-tabs {
    top: 64px;   /* PC 헤더 높이 */
  }

  .section {
    scroll-margin-top: 128px;
  }
}

/* 실거래 표 — 헤더 행이 있는 유일한 detail-table.
   공통 규칙(th width:38%)이 4칸에 각각 걸리면 표가 벌어져 고정 레이아웃으로 직접 배분 */
.real-deal-table {
  table-layout: fixed;
}

.real-deal-table th {
  width: auto;
  font-weight: 800;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* 4컬럼 균등 25% (사용자 확정) */
.real-deal-table th:nth-child(1) { width: 25%; }   /* 계약일 */
.real-deal-table th:nth-child(2) { width: 25%; }   /* 구분 */
.real-deal-table th:nth-child(3) { width: 25%; }   /* 내용 */
.real-deal-table th:nth-child(4) { width: 25%; }   /* 거래금액 */

.real-deal-table th,
.real-deal-table td {
  padding: 7px 8px 7px 0;
}

.real-deal-table td:first-child {
  white-space: nowrap;
  color: var(--muted);
}

/* 금액은 우측 정렬 + 개행 금지 */
.real-deal-table th:last-child,
.real-deal-table td:last-child {
  text-align: right;
  white-space: nowrap;
  padding-right: 0;
}

/* 25% 셀(~99px)에 "2억 6,000만 원"이 들어가도록 표만 한 급 작게 */
@media (max-width: 767px) {
  .real-deal-table {
    font-size: var(--fs-sm);
  }

  .real-deal-table th {
    font-size: var(--fs-xs);
  }
}


/* 주변 시설 표 — 거리 칸 우측 정렬·강조 */
.facility-table .facility-distance {
  text-align: right;
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
}

/* 매물번호 — 전화로 부를 이름. 정보 위계상 보조지만 찾기 쉬워야 한다 */
.detail-listing-no {
  margin: 4px 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.detail-listing-no b {
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}

/* 사이드 문의 카드에선 전화 버튼 바로 위 — 걸기 직전 눈에 들어오게 */
.detail-aside .detail-listing-no {
  margin: 8px 0 0;
}

/* 섹션 제목 — 아이콘과 글자를 한 축에. gap이 이모지 뒤 공백을 대신한다 */
.section-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-head .ico {
  color: var(--navy);
  width: 1.15em;
  height: 1.15em;
  vertical-align: baseline;
}

/* 요약 바 — 아이콘이 값 위에 큼직하게 (이모지 17px 자리) */
.summary-item .ico {
  width: 21px;
  height: 21px;
  color: var(--navy);
  margin-bottom: 2px;
}

/* 본문·사이드 위치 마커, 지도 버튼 — 옆 글자와 같은 크기·색 */
.detail-meta .ico,
.aside-meta .ico {
  color: var(--muted);
}

.map-link .ico {
  margin-right: 6px;
}

/* ---------- 결정 카드 (상세 첫 화면) ---------- */
/* 사진 위로 20px 겹쳐 올린다 — 사진과 정보가 한 덩어리로 읽히고 첫 화면 밀도가 올라간다 */
.hero-card {
  position: relative;
  z-index: 2;
  margin: -20px 4px 0;
  padding: 13px 14px 15px;
  background: var(--card-background);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--sh-md);
}

/* 카드 안이라 자체 여백을 줄인다 */
.hero-card .detail-header {
  padding: 0;
}

/* 카드 안에서는 요약바가 테두리를 따로 가질 이유가 없다 — 위 구분선만 */
.hero-card .summary-bar {
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 12px 0 0;
  margin: 12px 0 0;
}

/* 카드가 사진을 덮으므로 장수 표시를 그만큼 올린다 */
.gallery-count {
  bottom: 30px;
}

/* ---------- 연락 버튼 (모바일·태블릿) ---------- */
.hero-cta {
  display: flex;
  gap: 8px;
  margin-top: 13px;
}

.hero-tel,
.hero-kakao {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 11px 8px;
  border-radius: var(--r-md);
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
}

/* 전화가 주(主) — 카카오보다 넓게 */
.hero-tel {
  flex: 1.7;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--sh-sm);
}

.hero-tel b {
  font-size: var(--fs-lg);
  font-weight: 900;
  letter-spacing: -0.2px;
}

.hero-tel small {
  font-size: var(--fs-xs);
  font-weight: 500;
  opacity: 0.82;
  margin-top: 1px;
}

.hero-kakao {
  flex: 1;
  background: #fee500;
  color: #3c1e1e;
  font-size: var(--fs-md);
}

/* PC(≥1024) — 이 블록은 반드시 위 기본 규칙 '뒤'에 있어야 한다.
   미디어 쿼리는 특이도를 올리지 않아서, 앞에 두면 뒤의 평범한 규칙에 밀린다 */
@media (min-width: 1024px) {
  /* 갤러리가 430px 그리드로 본문(636px)보다 넓다 — 겹치면 어긋나 보인다 */
  .hero-card {
    margin: 0;
    border-radius: var(--r-lg);
  }

  .gallery-count {
    bottom: 10px;
  }

  /* 연락은 sticky 문의 카드(.detail-aside)가 담당 — 같은 화면에 두 벌 두지 않는다 */
  .hero-cta {
    display: none;
  }
}
