:root {
  --plum: #6a2c9c;
  --plum-dark: #3f1663;
  --plum-soft: #f3ecfa;
  --gold: #c99a3e;
  --ink: #1f1a26;
  --muted: #6e6779;
  --line: #e7e1ee;
  --bg: #fbf9fd;
  --card: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 20, 60, .06), 0 8px 24px rgba(40, 20, 60, .06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Plus Jakarta Sans", "Noto Sans Thai", system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; }
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 18px; color: var(--plum-dark); }
.brand img { width: 40px; height: 40px; border-radius: 50%; }
.brand em { font-style: normal; color: var(--gold); }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { text-decoration: none; font-weight: 600; font-size: 15px; color: var(--muted); }
.nav a:hover { color: var(--plum); }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--plum); color: #fff !important; border: 0; border-radius: 999px; padding: 12px 22px; font: 600 15px inherit; font-family: inherit; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--plum-dark); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-ghost { background: #fff; color: var(--plum) !important; border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--plum-soft); }
.btn-line { background: #06c755; }
.btn-line:hover { background: #05a647; }

/* hero */
.banner { width: 100%; max-height: 520px; object-fit: cover; object-position: center; }
.hero { color: #fff; background: linear-gradient(120deg, var(--plum-dark), var(--plum)); }
.hero-in { padding: 48px 20px 52px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.08; margin: 0 0 16px; max-width: 640px; letter-spacing: -.02em; }
.hero p { font-size: 18px; max-width: 520px; opacity: .9; margin: 0 0 30px; }
.hero-search { display: flex; gap: 8px; background: #fff; padding: 8px; border-radius: 999px; max-width: 620px; box-shadow: var(--shadow); }
.hero-search input { flex: 1; border: 0; outline: 0; padding: 0 16px; font: inherit; font-size: 16px; min-width: 0; color: var(--ink); }
.hero-search select { border: 0; background: var(--plum-soft); border-radius: 999px; padding: 0 14px; font: inherit; color: var(--plum-dark); }
.hero-stats { display: flex; gap: 40px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 30px; }
.hero-stats span { opacity: .8; font-size: 14px; }

/* sections */
.section { padding: 64px 0; }
.section h2 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
.eyebrow { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 22px; }
.filters input, .filters select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; background: #fff; color: var(--ink); }
.filters input[type=search] { flex: 1 1 220px; }
.seg { display: inline-flex; background: var(--plum-soft); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font: 600 14px inherit; font-family: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--plum); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.result-count { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); text-decoration: none; display: flex; flex-direction: column; transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card-img { position: relative; aspect-ratio: 4/3; background: var(--plum-soft); overflow: hidden; }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; }
.badge { background: rgba(255,255,255,.95); color: var(--plum-dark); font-size: 11px; font-weight: 700; letter-spacing: .05em; padding: 5px 9px; border-radius: 6px; }
.badge.sale { background: var(--gold); color: #fff; }
.badge.pet { background: #e9f8ee; color: #1b7a3d; }
.photo-count { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-price { font-weight: 800; font-size: 20px; color: var(--plum); }
.card-price small { font-weight: 500; font-size: 13px; color: var(--muted); }
.card-title { font-weight: 700; font-size: 16px; }
.card-loc { color: var(--muted); font-size: 13px; }
.facts { display: flex; gap: 14px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.facts span b { color: var(--ink); }

.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 34px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 16px; font: inherit; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }

/* detail */
.back { display: inline-block; margin: 24px 0 16px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 220px 220px; gap: 8px; border-radius: var(--radius); overflow: hidden; }
.gallery button { padding: 0; border: 0; cursor: zoom-in; background: var(--plum-soft); position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery button:first-child { grid-row: span 2; }
.gallery .more { position: absolute; inset: 0; background: rgba(40,10,70,.55); color: #fff; display: grid; place-items: center; font-weight: 700; }
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 40px; padding: 30px 0 60px; }
.detail h1 { font-size: 32px; margin: 6px 0 4px; letter-spacing: -.01em; }
.detail .loc { color: var(--muted); margin: 0 0 20px; }
.keyfacts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 30px; }
.keyfacts div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.keyfacts b { display: block; font-size: 20px; }
.keyfacts span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.detail h3 { font-size: 19px; margin: 32px 0 12px; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.dl div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }
.desc { white-space: pre-line; color: #3a3442; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--plum-soft); color: var(--plum-dark); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; }
.side { position: sticky; top: 90px; align-self: start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.side .price { font-size: 28px; font-weight: 800; color: var(--plum); }
.side .price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.side .agent { display: flex; gap: 12px; align-items: center; margin: 18px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.side .agent img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.side .agent small { color: var(--muted); display: block; font-size: 12px; }
.side .btn { width: 100%; justify-content: center; margin-top: 10px; }

/* about / team / contact */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 50px; align-items: start; }
.about-grid p { color: #3a3442; }
.glance { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.glance .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.member { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; text-align: center; }
.member img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 14px; border: 3px solid var(--plum-soft); }
.member small { color: var(--muted); }
.contact-band { background: linear-gradient(120deg, var(--plum-dark), var(--plum)); color: #fff; border-radius: 22px; padding: 44px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; align-items: center; }
.contact-band h2 { color: #fff; }
.contact-list { display: grid; gap: 10px; }
.contact-list a { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.1); border-radius: 12px; padding: 14px 18px; text-decoration: none; font-weight: 600; }
.contact-list a:hover { background: rgba(255,255,255,.18); }
.contact-list small { display: block; font-weight: 400; opacity: .75; font-size: 12px; }

.footer { background: #1d1328; color: #cbbfd8; padding: 40px 0; margin-top: 40px; font-size: 14px; }
.footer-in { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer a { color: #fff; text-decoration: none; margin-right: 16px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(15,8,22,.95); z-index: 50; display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 28px; cursor: pointer; }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; }
.lb-next { right: 18px; top: 50%; }
.lb-count { position: absolute; bottom: 20px; color: #fff; opacity: .8; }

@media (max-width: 900px) {
  .detail, .about-grid, .contact-band { grid-template-columns: 1fr; }
  .side { position: static; }
  .gallery { grid-template-columns: 1fr 1fr; grid-template-rows: 240px 120px; }
  .gallery button:first-child { grid-column: span 2; grid-row: auto; }
  .gallery button:nth-child(n+4) { display: none; }
  .keyfacts { grid-template-columns: repeat(2, 1fr); }
  .dl { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .nav a:not(.btn) { display: none; }
  .hero-in { padding: 36px 16px 40px; }
  .hero-search select { display: none; }
  .wrap { padding: 0 16px; }
  .contact-band { padding: 28px 22px; }
}
