/* =====================================================================
   아파트 실거래 지도

   지도 타일이 밝고 채도가 높으므로 주변 크롬을 어둡게 눌러
   지도가 앞으로 나오게 한다. 강조색은 하나뿐이고 거래가에만 쓴다.
   폐쇄망이라 웹폰트를 받을 수 없어 시스템 글꼴을 쓰되,
   숫자는 tabular-nums 로 자릿수를 고정해 세로로 읽히게 한다.
   ===================================================================== */

:root {
  --shell:      #14181d;   /* 최상위 배경 */
  --panel:      #1b2027;   /* 패널 */
  --raised:     #232932;   /* 패널 위에 올라온 것 */
  --edge:       #2e353f;   /* 경계선 */
  --edge-soft:  #242a32;   /* 행 구분선 */
  --text:       #e6eaef;
  --text-dim:   #8e99a6;
  --text-faint: #5f6975;
  --gold:       #d9a441;   /* 거래가. 이 화면의 유일한 강조색 */
  --alert:      #d2705c;

  --bar-h:      52px;
  --ledger-w:   380px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
          "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--shell);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   상단 바
   --------------------------------------------------------------------- */
.bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 18px;
  background: var(--shell);
  border-bottom: 1px solid var(--edge);
}

.wordmark {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--text);
}

/* 기간 선택. 낱개 버튼이 흩어지지 않도록 하나의 띠로 묶는다 */
.periods {
  display: flex;
  border: 1px solid var(--edge);
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel);
}

.periods button {
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border: 0;
  border-left: 1px solid var(--edge);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.periods button:first-child { border-left: 0; }
.periods button:hover { color: var(--text); background: var(--raised); }

.periods button[aria-pressed="true"] {
  background: var(--gold);
  color: #17191c;
  font-weight: 600;
}

.bar-status {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-status.is-alert { color: var(--alert); }

/* ---------------------------------------------------------------------
   본문
   --------------------------------------------------------------------- */
.stage {
  height: calc(100% - var(--bar-h));
  display: grid;
  grid-template-columns: 1fr var(--ledger-w);
}

.map {
  width: 100%;
  height: 100%;
  background: var(--panel);
}

/* ---------------------------------------------------------------------
   거래 내역
   --------------------------------------------------------------------- */
.ledger {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
  border-left: 1px solid var(--edge);
}

.ledger-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--edge);
}

.ledger-title {
  margin: 0 0 3px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  word-break: keep-all;
}

.ledger-where {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.45;
}

/* 요약 세 칸 */
.ledger-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-bottom: 1px solid var(--edge);
  background: var(--shell);
}

.ledger-stats > div {
  padding: 11px 14px;
  border-left: 1px solid var(--edge-soft);
}

.ledger-stats > div:first-child { border-left: 0; }

.ledger-stats dt {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.ledger-stats dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.ledger-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.note {
  margin: 0;
  padding: 26px 18px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}

/* 거래 한 건. 표 대신 장부처럼 줄로 읽히게 한다 */
.deal {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--edge-soft);
}

.deal:hover { background: var(--raised); }

.deal-date {
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.deal-price {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-align: right;
}

.deal-spec {
  font-size: 12.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.deal-kind {
  font-size: 12px;
  color: var(--text-faint);
  text-align: right;
}

/* 해제된 거래는 값을 지우되 기록은 남긴다 */
.deal.is-canceled .deal-price {
  color: var(--text-faint);
  font-weight: 500;
  text-decoration: line-through;
}

.deal-canceled {
  color: var(--alert);
  font-size: 12px;
  text-align: right;
}

/* ---------------------------------------------------------------------
   좁은 화면
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 45%;
  }
  .ledger {
    border-left: 0;
    border-top: 1px solid var(--edge);
  }
  .bar { gap: 14px; overflow-x: auto; }
  .bar-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
