:root {
  --warm-white: #fbf8f1;
  --paper: #fffdf8;
  --charcoal: #262521;
  --muted: #756f64;
  --gold: #b98b45;
  --terracotta: #a4563f;
  --beige: #e8dcc9;
  --line: rgba(38, 37, 33, 0.14);
  --shadow: 0 22px 70px rgba(38, 37, 33, 0.15);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--warm-white);
  color: var(--charcoal);
  line-height: 1.65;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(185, 139, 69, 0.75); outline-offset: 3px; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--charcoal);
  color: white;
  padding: .75rem 1rem;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 0 4vw;
  background: rgba(251, 248, 241, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: clamp(.7rem, 1.4vw, 1.4rem);
  font-size: .95rem;
}

.main-nav a { color: #454139; }
.main-nav a:hover { color: var(--terracotta); }

.header-actions {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.language {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--muted);
  font-size: .85rem;
  white-space: nowrap;
}
.language button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: .2rem;
}
.language .active { color: var(--charcoal); font-weight: 700; }

.btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .75rem 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font-weight: 700;
}
.btn-primary {
  color: #fff;
  background: var(--charcoal);
}
.btn-primary:hover { background: #11100e; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--charcoal);
}
.btn-light {
  background: var(--paper);
  color: var(--charcoal);
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 5px auto;
  background: var(--charcoal);
}

.hero {
  position: relative;
  min-height: calc(100vh - 76px);
  display: grid;
  align-items: end;
  overflow: hidden;
  color: white;
}
.hero-media, .hero-overlay {
  position: absolute;
  inset: 0;
}
.hero-media {
  background: url("../assets/images/hero-thai-residence.png") center/cover no-repeat;
  transform: scale(1.01);
}
.hero-overlay {
  background:
    linear-gradient(90deg, rgba(28, 26, 22, .76), rgba(28, 26, 22, .28) 48%, rgba(28, 26, 22, .08)),
    linear-gradient(0deg, rgba(28, 26, 22, .68), rgba(28, 26, 22, 0) 55%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: 14vh 0 9vh;
}
.eyebrow {
  margin: 0 0 .8rem;
  color: var(--gold);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: 5.4rem;
  line-height: 1.05;
  font-weight: 760;
}
.hero-copy {
  max-width: 560px;
  margin: 1rem 0 2rem;
  font-size: 1.28rem;
  color: rgba(255, 255, 255, .88);
}

.search-panel {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr .9fr auto;
  gap: .7rem;
  padding: .7rem;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

label span {
  display: block;
  margin-bottom: .3rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--charcoal);
  padding: .82rem .9rem;
}
textarea { resize: vertical; }
.search-panel input, .search-panel select { border-color: transparent; background: white; }

.hero-note {
  position: absolute;
  right: 4vw;
  bottom: 3.5vh;
  z-index: 2;
  display: grid;
  gap: .2rem;
  max-width: 270px;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(38, 37, 33, .72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .18);
}
.hero-note span { color: rgba(255, 255, 255, .76); font-size: .92rem; }

.section {
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  margin-bottom: 2rem;
}
.section-head.narrow {
  display: block;
  max-width: 650px;
}
h2 {
  margin: 0;
  font-size: 3rem;
  line-height: 1.12;
}
.section-head p:not(.eyebrow), .trust-copy p, .owner-cta p, .contact-info p {
  color: var(--muted);
  margin: .6rem 0 0;
}
.result-tools {
  display: flex;
  align-items: center;
  gap: .8rem;
  white-space: nowrap;
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.property-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(38, 37, 33, .07);
}
.property-card img {
  width: 100%;
  aspect-ratio: 1.35;
  object-fit: cover;
}
.property-body { padding: 1.1rem; }
.tag {
  display: inline-flex;
  margin-bottom: .7rem;
  padding: .22rem .55rem;
  border: 1px solid rgba(185, 139, 69, .35);
  color: #7b5723;
  background: #f8efe0;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
}
.property-card h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
}
.location-line { color: var(--muted); margin: .45rem 0; }
.price { font-size: 1.35rem; color: var(--terracotta); font-weight: 800; margin: .2rem 0 .6rem; }
.facts {
  color: #5f594f;
  font-size: .92rem;
  margin-bottom: 1rem;
}
.empty-state {
  margin: 2rem 0 0;
  padding: 1.25rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.location-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .85rem;
}
.location-tile {
  min-height: 210px;
  border: 0;
  border-radius: var(--radius);
  color: white;
  background:
    linear-gradient(0deg, rgba(38, 37, 33, .74), rgba(38, 37, 33, .12)),
    url("../assets/images/hero-thai-residence.png") center/cover no-repeat;
  display: flex;
  align-items: end;
  padding: 1rem;
  text-align: left;
  box-shadow: 0 14px 34px rgba(38, 37, 33, .12);
}
.location-tile:nth-child(2) { background-position: 35% center; }
.location-tile:nth-child(3) { background-position: 62% center; }
.location-tile:nth-child(4) { background-position: 78% center; }
.location-tile:nth-child(5) { background-position: 18% center; }
.location-tile:nth-child(6) { background-position: 88% center; }
.location-tile strong { font-size: 1.2rem; }

.category-grid, .trust-grid, .step-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.category-grid {
  grid-template-columns: repeat(5, 1fr);
}
.category-grid button, .trust-grid article, .step-grid article {
  min-height: 176px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  padding: 1.2rem;
  text-align: left;
}
.category-grid strong, .trust-grid h3, .step-grid h3 {
  display: block;
  margin: .3rem 0 .45rem;
  font-size: 1.2rem;
}
.category-grid span, .trust-grid p, .step-grid p { color: var(--muted); }
.trust {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 3rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.trust-grid article span, .step-grid article span {
  color: var(--gold);
  font-weight: 800;
}
.steps h2 { margin-bottom: 1.4rem; }

.owner-cta {
  width: min(1180px, 92vw);
  margin: 1rem auto;
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  border-radius: var(--radius);
  color: white;
  background:
    linear-gradient(100deg, rgba(38, 37, 33, .94), rgba(164, 86, 63, .85)),
    url("../assets/images/hero-thai-residence.png") center/cover no-repeat;
}
.owner-cta h2 { color: white; }
.owner-cta p { color: rgba(255, 255, 255, .78); }

.contact {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  gap: 3rem;
}
.email-link {
  display: inline-flex;
  margin-top: 1.2rem;
  color: var(--terracotta);
  font-weight: 800;
  word-break: break-word;
}
dl {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}
dl div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line);
}
dt { color: var(--muted); }
dd { margin: 0; }
.contact-form, .owner-form {
  display: grid;
  gap: .9rem;
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.form-status { margin: 0; color: var(--terracotta); font-weight: 700; }

.site-footer {
  display: grid;
  gap: 1rem;
  padding: 3rem 4vw;
  color: #ddd6ca;
  background: #22211e;
}
.site-footer strong { color: white; letter-spacing: 0; }
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem 1.2rem;
}
.site-footer a:hover { color: white; }
.site-footer p { margin: 0; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(20, 19, 17, .7);
}
.modal[hidden] { display: none; }
.modal-panel {
  position: relative;
  width: min(920px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-panel.small { width: min(560px, 96vw); padding: 1.3rem; }
.modal-close {
  position: absolute;
  top: .8rem;
  right: .8rem;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 248, .92);
  font-size: 1.7rem;
}
.modal-image {
  width: 100%;
  aspect-ratio: 1.9;
  object-fit: cover;
}
.modal-body { padding: 1.4rem; }
.modal-body h2 { font-size: 2.35rem; }
.modal-meta, .facility-list {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin: 1rem 0;
}
.modal-meta span, .facility-list span {
  padding: .45rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--warm-white);
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.3rem;
}

.sticky-contact {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  display: none;
  border-radius: 999px;
  padding: .8rem 1rem;
  color: white;
  background: var(--terracotta);
  box-shadow: 0 10px 30px rgba(164, 86, 63, .32);
  font-weight: 800;
}

@media (max-width: 1060px) {
  .site-header { grid-template-columns: auto auto; }
  .menu-toggle { display: block; justify-self: end; }
  .main-nav, .header-actions {
    display: none;
    grid-column: 1 / -1;
  }
  .site-header.open .main-nav,
  .site-header.open .header-actions {
    display: flex;
  }
  .site-header.open .main-nav {
    flex-direction: column;
    align-items: flex-start;
    padding: .5rem 0;
  }
  .site-header.open .header-actions {
    justify-content: space-between;
    padding-bottom: 1rem;
  }
  .search-panel { grid-template-columns: repeat(2, 1fr); }
  .search-panel .btn { grid-column: 1 / -1; }
  .property-grid, .trust, .contact { grid-template-columns: 1fr; }
  .location-grid { grid-template-columns: repeat(3, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .hero { min-height: 820px; }
  .hero-inner { padding-bottom: 7rem; }
  .hero h1 { font-size: 3.1rem; }
  .hero-copy { font-size: 1.08rem; }
  h2 { font-size: 2.25rem; }
  .modal-body h2 { font-size: 1.8rem; }
  .search-panel { grid-template-columns: 1fr; }
  .hero-note {
    left: 4vw;
    right: 4vw;
    bottom: 1rem;
    max-width: none;
  }
  .section-head, .owner-cta {
    display: grid;
    align-items: start;
  }
  .result-tools {
    align-items: stretch;
    flex-direction: column;
  }
  .property-grid, .location-grid, .category-grid, .trust-grid, .step-grid { grid-template-columns: 1fr; }
  .location-tile { min-height: 150px; }
  .contact { gap: 1.5rem; }
  .sticky-contact { display: inline-flex; }
  .modal-panel { max-height: 94vh; }
  .modal-image { aspect-ratio: 1.25; }
}
