/* 昆明买房情报台 - 手机优先 · 深色夜视 · 无外链字体 */
/* Design: trust-first / calm / mobile editorial · VARIANCE 4 / MOTION 2 / DENSITY 6 */
:root {
  --bg: #0f1115;
  --bg-elev: #171b22;
  --bg-card: #1c2129;
  --bg-card-hover: #232933;
  --border: #2e3540;
  --border-strong: #3d4654;
  --text: #e8e6e1;
  --text-dim: #a8a59c;
  --text-mute: #7a776e;
  --accent: #d4a054;
  --accent-dim: #a67c3a;
  --accent-soft: rgba(212, 160, 84, 0.14);
  --warn: #c9a227;
  --danger: #c46b5a;
  --ok: #6b9e7a;
  --focus: #f0c674;
  --radius: 10px;
  --pad: 1rem;
  --header-h: 3rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --touch: 44px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC",
    "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
  --max: 42rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--safe-top) + 0.5rem);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus {
  outline: none;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #111;
  padding: 0.65rem 0.9rem;
  z-index: 100;
  min-height: var(--touch);
}

.skip-link:focus {
  left: calc(0.75rem + var(--safe-left));
  top: calc(0.75rem + var(--safe-top));
}

/* ---- 顶栏：紧凑单行 ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 17, 21, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding-top: var(--safe-top);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.55rem var(--pad);
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1;
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  display: none;
}

.header-meta {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
  line-height: 1.2;
}

.badge.accent {
  border-color: var(--accent-dim);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.badge-date {
  display: none;
}

/* ---- 挂牌横幅：扁、可折叠 ---- */
.price-banner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.5rem var(--pad) 0;
}

.price-banner details {
  background: rgba(201, 162, 39, 0.1);
  border: 1px solid rgba(201, 162, 39, 0.32);
  border-radius: 8px;
  overflow: hidden;
}

.price-banner summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--touch);
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  color: #e8d48a;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.price-banner summary::-webkit-details-marker {
  display: none;
}

.price-banner summary::after {
  content: "";
  margin-left: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--warn);
  border-bottom: 2px solid var(--warn);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.price-banner details[open] summary::after {
  transform: rotate(-135deg);
}

.price-banner-label {
  color: var(--warn);
  letter-spacing: 0.02em;
}

.price-banner-hint {
  color: var(--text-mute);
  font-weight: 400;
  font-size: 0.75rem;
}

.price-banner-body {
  padding: 0 0.75rem 0.65rem;
  font-size: 0.8125rem;
  color: #d8c98a;
  line-height: 1.45;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem var(--pad) calc(2rem + var(--safe-bottom));
}

.section {
  margin-top: 1.35rem;
}

.section:first-child {
  margin-top: 0.75rem;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}

.section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.section-note {
  margin: 0;
  color: var(--text-mute);
  font-size: 0.8125rem;
}

/* ---- chips：横向滑动一行 ---- */
.toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  margin: 0 calc(-1 * var(--pad)) 0.85rem;
  padding: 0 var(--pad) 0.15rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

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

.chip,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.chip:active,
.btn:active {
  transform: scale(0.98);
}

.chip:hover,
.btn:hover {
  background: var(--bg-card-hover);
  text-decoration: none;
  color: var(--text);
}

.chip[aria-pressed="true"],
.chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.btn-primary {
  border-color: var(--accent-dim);
  background: var(--accent);
  color: #1a1408;
  font-weight: 700;
}

.btn-primary:hover {
  background: #e0b56a;
  color: #1a1408;
}

.btn-ghost {
  background: transparent;
}

/* ---- 网格：手机单列 ---- */
.grid-districts,
.grid-compounds,
.advice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  box-shadow: var(--shadow);
}

.card-district {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-district .name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-district h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.priority {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
}

.priority.p1 {
  color: var(--text-mute);
}

.priority.p2 {
  color: #c9b07a;
}

.meta-line {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.card-district .why {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
}

.card-compound {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  width: 100%;
  font: inherit;
  min-height: var(--touch);
}

a.card-compound:hover,
button.card-compound:hover {
  border-color: var(--accent-dim);
  background: var(--bg-card-hover);
  text-decoration: none;
  color: inherit;
}

a.card-compound:active {
  transform: scale(0.995);
}

.card-compound .top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 0.6rem;
}

.card-compound h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
}

.tag.shortlist {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.price-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text);
}

.price-hint strong {
  color: var(--accent);
  font-weight: 600;
}

.pros-cons {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8125rem;
}

.pros-cons .pro {
  color: var(--ok);
}

.pros-cons .con {
  color: var(--danger);
}

.card-foot {
  margin-top: auto;
  padding-top: 0.25rem;
  color: var(--text-mute);
  font-size: 0.75rem;
}

.list-plain {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.list-plain li {
  margin-bottom: 0.4rem;
}

.list-plain li::marker {
  color: var(--accent-dim);
}

.advice-item {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.advice-item h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.advice-item p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* ---- 风险：卡片堆叠（无横滑） ---- */
.risk-stack {
  display: grid;
  gap: 0.55rem;
}

.risk-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.risk-card .risk-name {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.risk-card .risk-check,
.risk-card .risk-entries {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.risk-card .risk-entries {
  margin-top: 0.3rem;
  color: var(--text-mute);
}

.risk-card .risk-k {
  color: var(--text-mute);
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--pad) calc(1.75rem + var(--safe-bottom));
  border-top: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 0.75rem;
}

.site-footer p {
  margin: 0.3rem 0;
}

.disclaimer-box {
  margin-top: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-elev);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.disclaimer-box ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

/* ---- 次要区块：默认折叠 ---- */
.fold {
  margin-top: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}

.fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--touch);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::after {
  content: "";
  margin-left: auto;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid var(--text-mute);
  border-bottom: 2px solid var(--text-mute);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.fold[open] > summary::after {
  transform: rotate(-135deg);
}

.fold[open] > summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.fold-body {
  padding: 0.75rem 0.85rem 0.9rem;
}

.fold .section-note {
  margin-bottom: 0.65rem;
}

.section-priority .section-title {
  font-size: 1.1rem;
}

.section-priority .advice-item {
  border-color: var(--accent-dim);
  background: var(--bg-card);
}

.section-priority .advice-item h3 {
  font-size: 0.95rem;
  color: var(--accent);
}

.next-dive {
  margin-top: 0.75rem;
  padding-left: 1.1rem;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.muted-block {
  color: var(--text-mute);
}

/* ---- 详情页 ---- */
.detail-nav {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top));
  z-index: 40;
  margin: 0 calc(-1 * var(--pad));
  padding: 0.4rem var(--pad);
  background: rgba(15, 17, 21, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.detail-nav .btn {
  min-height: var(--touch);
  font-size: 0.875rem;
}

.detail-hero {
  margin: 0.9rem 0 1rem;
}

.detail-hero h1 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 700;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.detail-grid {
  display: grid;
  gap: 0.65rem;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 0.95rem;
}

.panel h2 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 700;
}

.panel ul {
  margin: 0;
  padding-left: 1.1rem;
}

.panel li {
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
}

.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.source-list li {
  margin: 0;
}

.source-list a {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elev);
  font-size: 0.875rem;
}

.source-list a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-height: var(--touch);
  padding: 0.6rem 0.7rem;
  background: var(--bg-elev);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 0;
}

.check-mark {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  border: 2px solid var(--accent-dim);
  border-radius: 4px;
}

.status {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

/* ---- 门禁：键盘友好 ---- */
body.is-locked {
  overflow: hidden;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(12vh + var(--safe-top)) calc(1rem + var(--safe-right))
    calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.gate[hidden] {
  display: none !important;
}

.gate-card {
  width: min(22rem, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 1.25rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 30vh; /* 给软键盘留空，避免输入框被挡 */
}

.gate-title {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  color: var(--text);
}

.gate-sub {
  margin: 0 0 1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.gate-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.gate-input {
  width: 100%;
  min-height: var(--touch);
  font-size: 1rem; /* ≥16px 避免 iOS 自动放大 */
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 0.65rem;
}

.gate-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.gate-error {
  color: var(--danger);
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
}

.gate-btn {
  width: 100%;
  min-height: var(--touch);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #111;
  cursor: pointer;
}

.gate-btn:hover {
  filter: brightness(1.05);
}

.gate-btn:active {
  transform: scale(0.98);
}

.site-shell[hidden] {
  display: none !important;
}

/* ---- 平板+：略放大、可双列 ---- */
@media (min-width: 640px) {
  html {
    font-size: 16.5px;
  }

  :root {
    --pad: 1.15rem;
    --max: 44rem;
  }

  .brand-sub {
    display: block;
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    color: var(--text-mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .badge-date {
    display: inline-flex;
  }

  .grid-districts,
  .grid-compounds {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    flex-wrap: wrap;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: visible;
    scroll-snap-type: none;
  }
}

@media (min-width: 900px) {
  html {
    font-size: 17px;
  }

  :root {
    --max: 52rem;
  }

  .grid-compounds {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-hero h1 {
    font-size: 1.55rem;
  }
}

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