/* ==========================================================================
   Property Finder — public site
   Brand: red ribbon "P" + gold ribbon "F" wordmark (see pf-logo.png)
   Signature motif: the logo's angular ribbon/flag cut — reused as a clipped
   parallelogram tag on price badges, card accents and the hero backdrop.
   Font: Sarabun (Thai + Latin) throughout, leaning on weight/tracking for
   hierarchy instead of a second typeface.
   ========================================================================== */

:root {
  /* Brand */
  --red: #C8102E;
  --red-deep: #9B1B1B;
  --red-ink: #7A1420;
  --gold: #C9A24B;
  --gold-soft: #E4C77C;
  --ink: #16181D;
  --ink-soft: #4B4F58;
  --muted: #767C88;
  --line: #E5E7EC;
  --bg: #F5F6F8;
  --bg-sunk: #ECEEF2;
  --white: #FFFFFF;

  /* Status / utility */
  --ok: #1F8A4C;
  --ok-bg: #E9F6EE;
  --danger: #C0392B;
  --danger-bg: #FCEBEA;

  /* Effects */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(22, 24, 29, 0.08);
  --shadow: 0 8px 24px rgba(22, 24, 29, 0.10);
  --shadow-lg: 0 20px 48px rgba(22, 24, 29, 0.16);
  --ribbon-cut: polygon(0 0, 100% 0, 100% 68%, 88% 100%, 0 100%);
  --tag-cut: polygon(0 0, 88% 0, 100% 50%, 88% 100%, 0 100%);

  --container: 1180px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
button { cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.icon { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -0.14em; }
.icon-lg { width: 28px; height: 28px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: var(--white); box-shadow: 0 6px 16px rgba(200, 16, 46, 0.28); }
.btn-primary:hover { background: var(--red-ink); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--red-ink); }
.btn-ghost.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-gold { background: var(--gold); color: #2c2308; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.88rem; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 34px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.02rem; letter-spacing: 0.01em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name b { color: inherit; }   /* ชื่อบริษัทสีดำทั้งชื่อ (feedback 17ต.ค.69 B1) */

.lang-toggle {
  display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg-sunk); flex-shrink: 0;
}
.lang-toggle button {
  border: none; background: transparent; padding: 6px 13px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.03em; color: var(--muted);
  transition: background 0.15s, color 0.15s;
  /* ⭐ พื้นที่กดบนมือถือต้องสูงอย่างน้อย 40px — ของเดิม 29px กดพลาดง่ายมาก */
  min-height: 40px; min-width: 44px;
}
.lang-toggle button.active { background: var(--ink); color: var(--white); }

/* ==========================================================================
   Hero + search card
   ========================================================================== */
.hero {
  position: relative;
  background: linear-gradient(122deg, var(--red-deep) 0%, var(--red) 58%, var(--red-ink) 100%);
  color: var(--white);
  padding: 46px 0 118px;
  overflow: hidden;
}
.hero::before {
  /* signature ribbon backdrop — echoes the logo's clipped flag shape */
  content: "";
  position: absolute; top: -20%; right: -8%;
  width: 46%; height: 150%;
  background: linear-gradient(160deg, rgba(201,162,75,0.32), rgba(201,162,75,0) 70%);
  clip-path: polygon(30% 0, 100% 0, 70% 100%, 0% 100%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute; bottom: -10%; left: -6%;
  width: 30%; height: 60%;
  background: linear-gradient(20deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 70%);
  clip-path: polygon(0 0, 70% 0, 100% 100%, 0% 100%);
  pointer-events: none;
}
/* ── ภาพเมืองยามค่ำ (feedback 17ต.ค.69 B2) — แทนพื้นแดงทึบ ── */
.hero { background: #0b0f26; padding-top: 56px; }
.hero::before, .hero::after { display: none; }
.hero-city { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
/* ม่านเข้มด้านซ้าย/บน ให้ตัวหนังสือสีขาวอ่านชัดบนภาพ */
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(7,11,31,0.62) 0%, rgba(7,11,31,0.3) 55%, rgba(7,11,31,0.05) 100%),
              linear-gradient(180deg, rgba(7,11,31,0.35) 0%, rgba(7,11,31,0) 40%);
}
.hero h1, .hero p.lede { text-shadow: 0 2px 12px rgba(0,0,0,0.45); }
.hero-city .hc-tw { animation: hc-twinkle 4s ease-in-out infinite; }
.hero-city .hc-win { opacity: 0.85; animation: hc-window 9s steps(1, end) infinite; }
.hero-city .hc-far { animation: hc-drift 48s ease-in-out infinite alternate; }
.hero-city .hc-car-a { animation: hc-road 7s linear infinite; }
.hero-city .hc-car-b { animation: hc-road 11s linear infinite reverse; }
@keyframes hc-twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes hc-window { 0%, 62% { opacity: 0.9; } 63%, 80% { opacity: 0.08; } 81%, 100% { opacity: 0.9; } }
@keyframes hc-drift { from { transform: translateX(0); } to { transform: translateX(-60px); } }
@keyframes hc-road { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -332; } }
@media (prefers-reduced-motion: reduce) {
  .hero-city .hc-tw, .hero-city .hc-win, .hero-city .hc-far, .hero-city .hc-car-a, .hero-city .hc-car-b { animation: none !important; }
}
.hero-inner { position: relative; z-index: 1; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-soft); margin: 0 0 10px;
}
.hero-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--gold); display: inline-block; }
.hero h1 {
  font-size: clamp(1.7rem, 4.4vw, 2.7rem);
  font-weight: 800; letter-spacing: -0.01em; line-height: 1.25;
  margin: 0 0 10px; max-width: 640px;
}
.hero p.lede {
  margin: 0; color: rgba(255,255,255,0.86); font-size: 1.02rem; max-width: 520px;
}

/* Search card floats over hero/results boundary */
.search-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  margin: 26px auto 0;
  position: relative; z-index: 2;
}

.pill-toggle {
  display: inline-flex; gap: 4px;
  background: var(--bg-sunk); border-radius: 999px; padding: 4px; margin-bottom: 18px;
}
.pill-toggle button {
  border: none; background: transparent; padding: 10px 26px; min-height: 42px;
  border-radius: 999px; font-size: 0.95rem; font-weight: 700; color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}
.pill-toggle button.active { background: var(--red); color: var(--white); box-shadow: 0 4px 12px rgba(200,16,46,0.3); }

.search-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px; align-items: end;
}
@media (min-width: 760px) {
  .search-grid { grid-template-columns: 1.1fr 0.85fr 0.95fr 0.75fr 0.75fr auto; }
}
.field { min-width: 0; }
.field label {
  display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px;
}
.field .input-wrap { position: relative; }
.field .input-wrap .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 8px 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); background: var(--white); color: var(--ink); appearance: none;
}
.field .input-wrap input { padding-left: 38px; }
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23767C88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px;
}
.field input:focus, .field select:focus { border-color: var(--red); }
.search-grid .btn-primary { min-height: 46px; }

/* รายชื่อโครงการใต้ช่อง "ทำเล / โครงการ" — ลอยทับ (absolute) จึงไม่ดันเลย์เอาต์
   🚨 .hero เดิม overflow:hidden จะตัดรายการที่ยื่นเลยขอบล่างของ hero → เปิดเป็น visible
      (ภาพเมืองเป็น svg ที่ตัดขอบตัวเองอยู่แล้ว) และยก hero ให้อยู่เหนือเนื้อหาถัดไป (ใต้หัวเว็บ z-index 40) */
.hero { overflow: visible; z-index: 3; }
.hero-city { overflow: hidden; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: 4px; list-style: none; text-align: left;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 336px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
@media (min-width: 760px) {
  /* ช่องบนจอใหญ่แคบ (~230px) — ให้รายการกว้างกว่าช่องได้ ชื่อโครงการยาวจะได้ไม่ถูกตัด */
  .suggest-list { right: auto; min-width: 100%; width: max-content; max-width: min(420px, 80vw); }
}
.suggest-list li {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 48px; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.suggest-list li:hover, .suggest-list li[aria-selected="true"] { background: var(--bg-sunk); }
.suggest-list .sg-main { font-size: 0.95rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-list .sg-sub { font-size: 0.78rem; color: var(--muted); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Category tiles
   ========================================================================== */
.categories { padding: 46px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 1.3rem; font-weight: 800; margin: 0; color: var(--ink); }
.section-head .hint { color: var(--muted); font-size: 0.88rem; }

.category-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
@media (min-width: 560px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .category-grid { grid-template-columns: repeat(5, 1fr); } }

.category-tile {
  position: relative;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 16px 16px; text-align: center; overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.category-tile::before {
  content: ""; position: absolute; top: 0; left: 0; width: 46px; height: 6px;
  background: var(--gold); clip-path: var(--tag-cut);
}
.category-tile:hover { border-color: var(--gold); box-shadow: var(--shadow); transform: translateY(-2px); }
.category-tile .icon-lg { color: var(--red); margin: 4px 0 10px; }
.category-tile span { display: block; font-weight: 700; font-size: 0.92rem; color: var(--ink); }

/* ==========================================================================
   Results
   ========================================================================== */
.results-section { padding: 40px 0 60px; }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.results-count { font-size: 1rem; }
.results-count b { color: var(--red); font-size: 1.15rem; }
.view-toggle { display: flex; gap: 8px; }
.view-toggle .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }

.state-msg { display: none; text-align: center; padding: 60px 16px; color: var(--muted); font-size: 0.98rem; }
.state-msg.error { color: var(--danger); }
.state-msg.visible { display: block; }
.spinner {
  width: 30px; height: 30px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 20px;
}
#results-map { display: none; height: 520px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.view-map #results-grid { display: none; }
.view-map #results-map { display: block; }

.card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line);
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

/* รูปทุกใบอัตราส่วนเดียวกัน (B4) — รูปจริงสูง/กว้างแค่ไหนก็ถูกครอปเต็มกรอบ ไม่ดันความสูงการ์ด */
.card-cover { position: relative; aspect-ratio: 4 / 3; background: var(--bg-sunk); overflow: hidden; }
.card-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-cover .no-image { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.82rem; gap: 6px; }

.badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--ok-bg); color: var(--ok); font-size: 0.72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; letter-spacing: 0.02em;
}
.badge-type {
  position: absolute; top: 10px; left: 0;
  background: var(--ink); color: var(--white); font-size: 0.72rem; font-weight: 700;
  padding: 5px 14px 5px 12px; clip-path: var(--tag-cut);
}

.card-price-tag {
  position: absolute; left: 0; bottom: 12px;
  background: var(--gold); color: #2c2308; font-weight: 800; font-size: 0.98rem;
  padding: 7px 18px 7px 14px; clip-path: var(--tag-cut); box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
/* การ์ดประกาศ (B5): ราคาใหญ่ · หัวประกาศ 2 บรรทัดสูงเท่ากันทุกใบ · โซน · คนเห็น/ตร.ม. · ห้อง/ชั้น */
.card-price { font-size: 1.28rem; font-weight: 800; color: var(--red); margin: 0; line-height: 1.25; }
.card-title { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin: 0; line-height: 1.4; min-height: 2.8em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-location { font-size: 0.84rem; color: var(--muted); display: flex; align-items: center; gap: 5px; margin: 0; min-width: 0; }
.card-location > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-location .icon { flex: 0 0 auto; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.8rem; color: var(--muted); }
.card-meta span { display: inline-flex; align-items: center; gap: 5px; }
/* ทรัพย์เช่าแล้ว/ขายแล้ว ในหน้ารวมโครงการ (B9) — จาง + ตราประทับ · ไม่ใช่ลิงก์ */
.card.is-closed { opacity: 0.55; filter: grayscale(0.6); }
.card.is-closed:hover { box-shadow: var(--shadow-sm); transform: none; }
.card-stamp {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg);
  border: 3px solid var(--red); color: var(--red); background: rgba(255,255,255,0.82);
  font-weight: 800; font-size: 1.25rem; letter-spacing: 0.04em; padding: 4px 16px; border-radius: 8px;
  white-space: nowrap;
}
.project-head { margin: 4px 0 18px; }
.project-head h2 { margin: 4px 0 0; font-size: 1.3rem; font-weight: 800; }
.project-head h2 span { color: var(--red); }
.project-back { font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.project-back:hover { color: var(--red); }
.project-link { display: inline-block; margin-top: 6px; font-size: 0.9rem; font-weight: 700; color: var(--red); }
.project-link:hover { text-decoration: underline; }
.card-specs { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; color: var(--ink-soft); margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }
.card-specs span { display: inline-flex; align-items: center; gap: 5px; }
.card-avail { font-size: 0.78rem; color: var(--red-ink); font-weight: 600; }

.load-more-wrap { text-align: center; margin-top: 28px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--ink); color: rgba(255,255,255,0.68); padding: 34px 0; margin-top: 20px; }
.site-footer .container { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.site-footer .foot-brand { color: var(--white); font-weight: 700; }
.site-footer .foot-brand b { color: var(--gold-soft); }
.site-footer small { font-size: 0.8rem; }

/* ==========================================================================
   Listing detail page
   ========================================================================== */
.detail-header { background: var(--white); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 14px 0; font-size: 0.85rem; color: var(--muted); }
/* ลิงก์ในเส้นทางนำทางสูงแค่ 22px บนมือถือ — เพิ่มพื้นที่กดให้พอนิ้ว */
.breadcrumb a { display: inline-flex; align-items: center; min-height: 32px; }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb .sep { color: var(--line); }
/* ชื่อประกาศตรงนี้ทำหน้าที่เป็นหัวเรื่องของหน้า (h1 ตัวใหญ่ถูกซ่อนจากสายตาแล้ว) — ใหญ่กว่าลิงก์รอบข้างนิดเดียวพอ */
.breadcrumb .current { color: var(--ink); font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }

.detail-main { padding: 24px 0 60px; }
.detail-layout { display: grid; grid-template-columns: 1fr; gap: 28px; }
/* 🚨 ลูกของ grid มี min-width:auto เป็นค่าเริ่มต้น = ยุบเล็กกว่าเนื้อในไม่ได้
   คำอธิบายทรัพย์ที่ย้ายมาจากเว็บเดิมมีทั้งลิงก์ยาวและแฮชแท็กไทยติดกันยาว ๆ (ภาษาไทยไม่มีเว้นวรรค
   เบราว์เซอร์จึงถือเป็นคำเดียว) → คอลัมน์ถูกดันกว้าง 636px บนจอ 390px เนื้อหาหายไปครึ่งจอ */
.detail-layout > * { min-width: 0; }
@media (min-width: 1024px) { .detail-layout { grid-template-columns: 1fr 340px; align-items: start; } }

.detail-title-block { margin-bottom: 18px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }
.detail-meta span { display: inline-flex; align-items: center; gap: 5px; }
.detail-location { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 0.98rem; }

/* ป้ายประเภท + ป้ายราคา = คู่เดียวกัน ต้องสูงเท่ากันและอยู่บนเส้นเดียวกัน
   ⭐ align-items: stretch ทำให้ทั้งคู่สูงเท่าแถว — ของเดิมป้ายประเภทเป็น flex-start
   เลยลอยชิดบนขณะที่ป้ายราคาสูงกว่า มองแล้วเบี้ยว */
.price-block { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 16px 0 4px; }
.price-badge {
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(135deg, var(--red), var(--red-ink));
  color: var(--white); border-radius: var(--radius-sm); padding: 12px 20px;
  box-shadow: 0 8px 20px rgba(200,16,46,0.22);
}
.price-badge .lbl { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; margin-bottom: 2px; }
.price-badge .amt { font-size: 1.35rem; font-weight: 800; line-height: 1.25; }
/* "ราคาติดต่อสอบถาม" ไม่ใช่ตัวเลขราคา — ใช้ขนาดเท่าข้อความปกติ ไม่ใช่ขนาดตัวเลขราคา
   ไม่งั้นจะกลายเป็นแผ่นแดงใหญ่กว่าราคาจริงของใบอื่น ทั้งที่ไม่ได้บอกอะไรเลย */
.price-badge.is-ask { padding: 10px 18px; box-shadow: 0 4px 12px rgba(200,16,46,0.16); }
.price-badge.is-ask .amt { font-size: 1.02rem; font-weight: 700; }
.type-chip {
  background: var(--gold); color: #2c2308; font-weight: 700; font-size: 0.85rem;
  padding: 8px 16px; border-radius: var(--radius-sm); display: inline-flex; align-items: center;
}

/* Gallery */
.gallery { margin-bottom: 24px; min-width: 0; }
.gallery-main {
  position: relative; aspect-ratio: 16 / 10; background: var(--bg-sunk); border-radius: var(--radius-lg);
  overflow: hidden; cursor: zoom-in; box-shadow: var(--shadow-sm);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .no-image, .gallery-main .zoom-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.gallery-main .zoom-hint {
  inset: auto 10px 10px auto; top: auto; left: auto; width: auto; height: auto;
  background: rgba(22,24,29,0.6); color: var(--white); font-size: 0.78rem; padding: 6px 12px; border-radius: 999px; gap: 5px;
}
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs .thumb {
  flex: 0 0 auto; width: 84px; height: 62px; border-radius: 8px; overflow: hidden;
  background: var(--bg-sunk); border: 2px solid transparent; padding: 0;
}
.gallery-thumbs .thumb.active { border-color: var(--red); }
.gallery-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; }

.lightbox {
  position: fixed; inset: 0; background: rgba(10,10,12,0.92); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.14); color: var(--white); border-radius: 50%; width: 48px; height: 48px; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lightbox .lightbox-nav.prev { left: 16px; }
.lightbox .lightbox-nav.next { right: 16px; }
.lightbox .lightbox-nav:hover { background: rgba(255,255,255,0.26); }
.lightbox .lightbox-nav[hidden], .lightbox .lightbox-count[hidden] { display: none; }
.lightbox .lightbox-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: var(--white); font-size: 0.9rem; background: rgba(0,0,0,0.45); padding: 4px 12px; border-radius: 999px; }
@media (max-width: 640px) { .lightbox .lightbox-nav { width: 44px; height: 44px; } .lightbox .lightbox-nav.prev { left: 6px; } .lightbox .lightbox-nav.next { right: 6px; } }
.lightbox .lightbox-close { position: absolute; top: 18px; right: 22px; background: rgba(255,255,255,0.12); color: var(--white); border-radius: 50%; width: 40px; height: 40px; border: none; display: flex; align-items: center; justify-content: center; }

/* Video */
.video-section { margin-bottom: 24px; }
.video-embed { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: var(--ink); box-shadow: var(--shadow-sm); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Specs card */
.card-section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); padding: 20px; margin-bottom: 20px; }
.card-section h2 { font-size: 1.08rem; font-weight: 800; margin: 0 0 14px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card-section h2 .icon { color: var(--red); }

.specs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
@media (min-width: 480px) { .specs-grid { grid-template-columns: repeat(3, 1fr); } }
.spec-item { display: flex; align-items: flex-start; gap: 10px; }
.spec-item .icon { color: var(--red); flex-shrink: 0; margin-top: 2px; width: 20px; height: 20px; }
.spec-item .spec-label { display: block; font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.spec-item .spec-value { font-weight: 700; font-size: 0.95rem; color: var(--ink); }

.description { white-space: pre-line; color: var(--ink-soft); font-size: 0.98rem; line-height: 1.75;
  /* 🚨 คำอธิบายที่ย้ายมาจากเว็บเดิมมีลิงก์ยาวและแฮชแท็กไทยติดกันยาว ๆ
     ภาษาไทยไม่มีเว้นวรรค เบราว์เซอร์จึงตัดบรรทัดเองไม่ได้ ต้องสั่งให้ตัดกลางคำได้ */
  overflow-wrap: anywhere;
}

#map { height: 320px; border-radius: var(--radius); overflow: hidden; position: relative; }
#map iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-external-link {
  position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--white); color: var(--red-ink); font-weight: 700; font-size: 0.82rem;
  padding: 7px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.map-external-link:hover { border-color: var(--gold); }
.map-external-link .icon { width: 16px; height: 16px; }

.chips-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--bg-sunk); color: var(--ink); font-size: 0.85rem; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
}
.chips-note { margin: 12px 0 0; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.6; white-space: pre-line; }
.chips-note.hidden { display: none; }

.leaflet-popup-content { font-family: 'Sarabun', sans-serif; }
.map-pin-price { font-weight: 700; color: var(--red-ink); }

/* Contact / sidebar */
.contact-card {
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 22px; position: static;
}
@media (min-width: 1024px) { .contact-card { position: sticky; top: calc(var(--header-h) + 16px); } }
.contact-card h2 { font-size: 1.05rem; font-weight: 800; margin: 0 0 4px; }
.contact-card .contact-sub { color: var(--muted); font-size: 0.86rem; margin: 0 0 16px; }
.contact-channels { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.channel-btn {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--white); font-weight: 700; font-size: 0.92rem; color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.channel-btn:hover { border-color: currentColor; }
.channel-btn .ch-icon {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--white); flex-shrink: 0;
}
.channel-btn.ch-phone .ch-icon { background: var(--red); }
.channel-btn.ch-line .ch-icon { background: #06C755; }
.channel-btn.ch-whatsapp .ch-icon { background: #25D366; }
.channel-btn.ch-wechat { cursor: pointer; width: 100%; text-align: left; font-family: inherit; }   /* ปุ่มคัดลอก WeChat ID (B7) */
.channel-btn.ch-wechat .ch-icon { background: #07C160; }
.channel-btn small { display: block; font-weight: 500; color: var(--muted); font-size: 0.76rem; }

.divider-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; margin: 4px 0 16px; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.inquiry-form .field { margin-bottom: 12px; }
.inquiry-form textarea {
  width: 100%; min-height: 80px; padding: 10px 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); resize: vertical;
}
.inquiry-form textarea:focus, .inquiry-form input:focus { border-color: var(--red); }
.inquiry-msg { margin-top: 10px; font-size: 0.88rem; font-weight: 600; }
.inquiry-msg.success { color: var(--ok); }
.inquiry-msg.error { color: var(--danger); }

.mobile-cta-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--white); border-top: 1px solid var(--line); padding: 10px 16px;
  gap: 10px; box-shadow: 0 -6px 18px rgba(0,0,0,0.08);
}
@media (max-width: 1023px) { .mobile-cta-bar { display: flex; } }
.mobile-cta-bar .btn { flex: 1; }

/* generic states reused on both pages */
.hidden { display: none !important; }

@media (max-width: 1023px) {
  .detail-main { padding-bottom: 92px; }
}

/* ==========================================================================
   Shortlist / favorites — heart toggle, floating button, drawer panel
   ========================================================================== */
.heart-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; border: none; padding: 0;
  background: rgba(255,255,255,0.92); color: var(--ink-soft);
  box-shadow: var(--shadow-sm); transition: transform 0.15s, color 0.15s, background 0.15s;
}
.heart-btn:hover { transform: scale(1.08); color: var(--red); }
.heart-btn .icon { width: 18px; height: 18px; }
.heart-btn.saved { color: var(--red); }
.heart-btn.saved .icon { fill: currentColor; }

.card-heart-btn { position: absolute; right: 10px; bottom: 12px; z-index: 2; }

/* แถวบนสุดของหน้าประกาศ: วันที่อยู่ซ้าย ปุ่มหัวใจอยู่ขวา (ชื่อประกาศตัวใหญ่ถูกซ่อนจากสายตา เหลือเป็น h1.sr-only) */
.detail-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.detail-title-row .detail-meta { flex: 1; min-width: 0; margin-bottom: 0; }
.detail-heart-btn { flex-shrink: 0; width: 40px; height: 40px; margin-left: auto; }

.shortlist-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red); color: var(--white); border: none;
  padding: 12px 20px; border-radius: 999px; font-weight: 700; font-size: 0.92rem;
  box-shadow: 0 10px 24px rgba(200,16,46,0.35);
  transition: transform 0.15s, background 0.15s;
}
.shortlist-fab:hover { background: var(--red-ink); transform: translateY(-2px); }
.shortlist-fab .icon { width: 18px; height: 18px; fill: currentColor; }
.shortlist-fab.hidden { display: none; }

.shortlist-overlay { position: fixed; inset: 0; background: rgba(10,10,12,0.5); z-index: 70; }
.shortlist-overlay.hidden { display: none; }

.shortlist-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 420px;
  background: var(--white); z-index: 71; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; padding: 22px; overflow-y: auto;
}
.shortlist-panel.hidden { display: none; }

.shortlist-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.shortlist-panel-head h2 { font-size: 1.1rem; font-weight: 800; margin: 0; color: var(--ink); }
.shortlist-close {
  background: var(--bg-sunk); border: none; border-radius: 50%; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft); flex-shrink: 0;
}
.shortlist-close:hover { color: var(--red); }
.shortlist-close .icon { width: 16px; height: 16px; }

.shortlist-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.shortlist-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.shortlist-item-thumb { width: 64px; height: 52px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg-sunk); }
.shortlist-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shortlist-item-thumb .no-image.sm { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.shortlist-item-body { flex: 1; min-width: 0; }
.shortlist-item-title {
  display: block; font-weight: 700; font-size: 0.9rem; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shortlist-item-price { margin: 2px 0 0; font-size: 0.85rem; color: var(--red-ink); font-weight: 700; }
.shortlist-item-loc { margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.shortlist-item-remove {
  flex-shrink: 0; background: transparent; border: none; color: var(--muted);
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.shortlist-item-remove:hover { background: var(--bg-sunk); color: var(--danger); }
.shortlist-item-remove .icon { width: 14px; height: 14px; }

.shortlist-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 0.92rem; }
.shortlist-empty.hidden { display: none; }

.shortlist-send { margin-top: 14px; }
.shortlist-send.hidden { display: none; }
.shortlist-send form .field { margin-bottom: 12px; }

/* ==========================================================================
   Star ratings — used by shortlist-adjacent review UI
   ========================================================================== */
.stars { display: inline-flex; align-items: center; gap: 2px; }
.star-icon { width: 16px; height: 16px; stroke: var(--line); fill: var(--line); }
.star-icon.filled { stroke: var(--gold); fill: var(--gold); }
.stars-lg .star-icon { width: 22px; height: 22px; }

.star-picker { display: inline-flex; gap: 4px; }
.star-pick { background: transparent; border: none; padding: 2px; }
.star-pick .star-icon { width: 26px; height: 26px; }

/* ==========================================================================
   Customer reviews
   ========================================================================== */
.reviews-section { padding: 10px 0 54px; }
.reviews-summary { margin-bottom: 18px; min-height: 1px; }
.reviews-avg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reviews-avg-num { font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.reviews-count { color: var(--muted); font-size: 0.9rem; }

.reviews-list { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 24px; }
@media (min-width: 760px) { .reviews-list { grid-template-columns: repeat(2, 1fr); } }
.review-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.review-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.review-name { font-weight: 700; color: var(--ink); }
.review-comment { margin: 0 0 8px; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.6; white-space: pre-line; }
.review-date { margin: 0; color: var(--muted); font-size: 0.78rem; }

.review-form-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 520px; }
.review-form-card h3 { margin: 0 0 14px; font-size: 1.02rem; font-weight: 800; color: var(--ink); }
.review-form .field { margin-bottom: 12px; }
.review-form textarea {
  width: 100%; min-height: 80px; padding: 10px 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); resize: vertical;
}
.review-form textarea:focus, .review-form input:focus { border-color: var(--red); }

/* ลายน้ำถอดออกจากชั้น CSS แล้ว (11 ก.ย. 69) — ฝังอยู่ในตัวไฟล์รูปทั้งคลังแล้ว
   ชั้นทับกันได้แค่คนก๊อปหน้าจอ ไม่กันคนเซฟไฟล์ · เก็บไว้จะเป็นลายน้ำ 2 ชั้นทับกัน */
.lightbox-stage { position: relative; display: inline-flex; max-width: 100%; max-height: 100%; }
.lightbox-stage img { display: block; }

/* ── ปุ่มลอยติดต่อหน้าแรก (บรีฟ 3ก.ย.69 A3) ──────────────────────────────── */
.float-contact { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.float-contact.hidden { display: none; }
.fc-menu { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; max-height: 62vh; overflow-y: auto; padding: 2px; }
.fc-menu.hidden { display: none; }
.fc-item {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 14px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); border-radius: 999px; box-shadow: var(--shadow);
  font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer; max-width: min(78vw, 320px);
}
.fc-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.fc-ic { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--white); }
.fc-ic .icon { width: 15px; height: 15px; }
/* 🚨 ป้ายชื่อบัญชีไทยยาว ห้ามตัดกลางคำจนอ่านไม่ออก — ตัดด้วย ellipsis บรรทัดเดียว */
.fc-tx { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.fc-tx small { font-weight: 500; color: var(--muted); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-phone .fc-ic { background: #d92d3c; }
.fc-line .fc-ic { background: #06c755; }
.fc-whatsapp .fc-ic { background: #25d366; }
.fc-messenger .fc-ic { background: #0084ff; }
.fc-wechat .fc-ic { background: #2dc100; }
.fc-toggle {
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: #06c755; color: var(--white); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.fc-toggle .icon { width: 24px; height: 24px; }
.fc-close-ic { display: none; }
.float-contact.open .fc-toggle { background: var(--text); }
.float-contact.open .fc-toggle > .icon { display: none; }
.float-contact.open .fc-close-ic { display: flex; }
@media (max-width: 640px) {
  .float-contact { right: 12px; bottom: 78px; }   /* เหนือแถบปุ่มล่างของหน้าประกาศ */
  .fc-toggle { width: 48px; height: 48px; }
}
