/* 公開頁：手機一欄＋底部聯絡列；電腦 960 以上改頂部導覽、三欄卡片、物件頁右側固定聯絡卡 */
:root {
  --bg: #ffffff; --fg: #1f2624; --sub: #5e6b68; --line: #e2e7e5; --soft: #f3f6f5;
  --brand: #0a806f; --line-green: #06c755; --line-green-fg: #ffffff; --price: #c0392b;
  --toast-bg: #1f2624; --toast-fg: #ffffff; --shadow: rgba(0, 0, 0, .06);
  --font: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141918; --fg: #e8eeec; --sub: #9aa8a4; --line: #2b3432; --soft: #1d2423;
    --brand: #3cc0a9; --line-green: #06b04c; --price: #ff7a6b; --toast-bg: #e8eeec; --toast-fg: #141918;
    --shadow: rgba(0, 0, 0, .4); color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
body {
  font-family: var(--font); color: var(--fg); background: var(--bg);
  line-height: 1.7; font-size: 16px;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wrap {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 11px 18px;
  border-radius: 10px; cursor: pointer; border: 1px solid var(--line); background: var(--bg);
  color: var(--fg); font: inherit; font-weight: 700; text-align: center;
}
.btn.line { background: var(--line-green); color: var(--line-green-fg); border-color: var(--line-green); }

.topbar { border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.logo { font-weight: 700; font-size: 17px; }
.logo small { color: var(--sub); font-weight: 400; font-size: 13px; margin-left: 8px; }
.top-actions { display: none; gap: 20px; align-items: center; font-size: 15px; }
.top-actions a.nav { color: var(--sub); }
.top-actions .btn { padding: 7px 14px; font-size: 14px; }
.tel-text { font-variant-numeric: tabular-nums; font-weight: 700; }

/* 首頁 */
.hero { padding-block: 28px 8px; }
.profile { display: flex; gap: 16px; align-items: center; }
.avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.profile h1 { font-size: 24px; line-height: 1.3; }
.profile .title { color: var(--sub); font-size: 14px; }
.intro { color: var(--sub); margin-top: 16px; max-width: 40em; }
.intro p + p { margin-top: 6px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tags span { background: var(--soft); border-radius: 999px; padding: 2px 12px; font-size: 13px; }
.hero-btns { display: none; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

h2 { font-size: 19px; margin: 32px 0 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-wrap: balance; scroll-margin-top: 16px; }
h2 small { font-size: 13px; color: var(--sub); font-weight: 400; }
.empty { color: var(--sub); background: var(--soft); border-radius: 12px; padding: 18px; }

.cards { display: grid; gap: 14px; }
.card { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card:hover { box-shadow: 0 4px 16px var(--shadow); }
.card-img { width: 100%; height: 100%; min-height: 100px; object-fit: cover; background: var(--soft); }
.card-body { padding: 10px 12px 10px 0; min-width: 0; }
.card-title { font-weight: 700; line-height: 1.4; }
.card-meta { color: var(--sub); font-size: 13px; }
.card-meta span { white-space: nowrap; }
.price { color: var(--price); font-weight: 700; font-variant-numeric: tabular-nums; }
.card .price { font-size: 18px; }
.price small { font-size: 13px; color: var(--sub); font-weight: 400; margin-left: 6px; }

.videos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.video img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--soft); }
.video p { font-size: 14px; margin-top: 6px; line-height: 1.4; }

/* 物件頁 */
.back { display: inline-block; padding-block: 14px 8px; color: var(--brand); font-size: 15px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "gallery" "info" "main"; }
.detail-gallery { grid-area: gallery; min-width: 0; position: relative; }
.detail-info { grid-area: info; min-width: 0; }
.detail-main { grid-area: main; min-width: 0; }

.g-scroll { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.g-scroll::-webkit-scrollbar { display: none; }
.g-scroll img { flex: 0 0 100%; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; scroll-snap-align: center; background: var(--soft); }
.g-count { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; padding: 2px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.g-desk { display: none; }

.p-title { font-size: 22px; line-height: 1.4; margin: 16px 0 4px; text-wrap: balance; }
.p-addr { color: var(--sub); font-size: 14px; }
.detail .price { font-size: 28px; margin-block: 8px 16px; display: block; }
.detail .price small { font-size: 14px; }
.info-btns { display: none; }
.agent { display: none; }

.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.specs div { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.specs div:nth-child(odd) { border-right: 1px solid var(--line); }
.specs dt, .around dt { font-size: 12px; color: var(--sub); }
.specs dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.note { background: var(--soft); border-radius: 12px; padding: 14px 16px 14px 36px; }
.desc p + p { margin-top: 8px; }
.around div + div { margin-top: 10px; }
.around dd { white-space: pre-line; }
.yt { aspect-ratio: 16 / 9; }
.yt iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; }

.gone { padding-block: 32px 0; }
.gone h1 { font-size: 24px; }
.gone p { color: var(--sub); margin-top: 8px; }

.legal { font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); margin-top: 40px; padding-block: 16px; }

.contact-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--bg); border-top: 1px solid var(--line); display: flex; gap: 10px;
  padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.contact-bar .btn { flex: 1; padding-inline: 8px; }
.contact-bar .btn.share { flex: 0 0 auto; padding-inline: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-fg); padding: 8px 16px; border-radius: 8px; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* 電腦版 */
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .contact-bar { display: none; }
  .top-actions { display: flex; }
  .toast { bottom: 32px; }

  .hero { padding-block: 48px 16px; }
  .avatar { width: 120px; height: 120px; }
  .profile { gap: 24px; }
  .profile h1 { font-size: 32px; }
  .profile .title { font-size: 16px; }
  .intro { font-size: 17px; }
  .hero-btns { display: flex; }
  h2 { font-size: 22px; margin-top: 48px; }

  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .card { grid-template-columns: 1fr; gap: 0; align-content: start; }
  .card-img { aspect-ratio: 4 / 3; height: auto; }
  .card-body { padding: 14px 16px 16px; }
  .card-title { font-size: 17px; }
  .videos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

  .detail { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 40px; grid-template-areas: "gallery info" "main info"; align-items: start; }
  .g-scroll, .g-count { display: none; }
  .g-desk { display: block; }
  .g-main { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: var(--soft); }
  .g-thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
  .g-thumb { border: 2px solid transparent; border-radius: 8px; overflow: hidden; padding: 0; background: none; cursor: pointer; }
  .g-thumb.on { border-color: var(--brand); }
  .g-thumb img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
  .specs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .specs div:nth-child(odd) { border-right: 0; }
  .specs div:not(:nth-child(3n)) { border-right: 1px solid var(--line); }
  .detail-info { position: sticky; top: 24px; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: 0 4px 20px var(--shadow); }
  .detail-info .p-title { margin-top: 0; font-size: 21px; }
  .info-btns { display: grid; gap: 10px; }
  .agent { display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; font-size: 14px; }
  .agent img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
  .agent small { color: var(--sub); display: block; }
}
