/* Praiya Pattaya Property — public site (visual v2). The admin keeps its own base in /admin/base.css. */
:root {
  --sea: #0E3A3A;
  --sea-2: #12514E;
  --sea-deep: #0B201F;
  --paper: #F1F3F0;
  --surface: #FFFFFF;
  --ink: #17221E;
  --muted: #59685F;
  --sand: #B4854A;
  --sand-ink: #8A6232; /* sand tone dark enough for small text on white */
  --wa: #128A43;
  --wa-2: #0E7439;
  --line: #DCE0DA;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 18px 50px -30px rgba(14, 58, 58, .55);
  --mast-h: 68px;
  --gutter: clamp(16px, 4vw, 54px);
  --serif: Fraunces, Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--mast-h) + 12px); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body.sheet-open { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.primary-button, .secondary-button, .wa-button, .wa-cta, .wa-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; font-weight: 700; transition: background-color .2s ease, border-color .2s ease;
}
.primary-button { background: var(--sea); color: #fff; border-radius: var(--r-sm); padding: 0 20px; }
.primary-button:hover { background: var(--sea-2); }
.secondary-button { background: var(--surface); color: var(--sea); border: 1px solid var(--line); border-radius: 99px; padding: 0 24px; }
.secondary-button:hover { border-color: var(--sea); }
.wa-button, .wa-cta, .wa-pill { background: var(--wa); color: #fff; }
.wa-button:hover, .wa-cta:hover, .wa-pill:hover { background: var(--wa-2); }
.wa-button { border-radius: var(--r-md); padding: 0 20px; }
.wa-button .icon, .wa-cta .icon, .wa-pill .icon { stroke: none; }

/* Masthead */
.masthead {
  position: sticky; top: 0; z-index: 30; min-height: var(--mast-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 9px; min-height: 44px; align-self: center; padding-top: 8px; }
.brand-word { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; line-height: 1; color: var(--sea); }
.brand-sub { font-size: .7rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.segmented, .f-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.segmented { background: var(--paper); }
.segmented button, .f-seg button { min-height: 38px; padding: 0 16px; border-radius: 99px; font-size: .86rem; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background-color .2s ease, color .2s ease; }
.segmented button:hover, .f-seg button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"], .f-seg button[aria-pressed="true"] { background: var(--sea); color: #fff; }
.mast-tools { display: flex; align-items: center; gap: 10px; }
.language-picker select {
  min-height: 44px; max-width: 150px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  padding: 0 14px; font-size: .84rem; font-weight: 600; color: var(--muted);
}
.wa-pill { border-radius: 99px; padding: 0 16px; font-size: .86rem; }

/* Hero */
.hero { position: relative; min-height: min(76vh, 640px); display: flex; align-items: flex-end; overflow: hidden; color: #fff; background: var(--sea-deep); }
.hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9, 32, 31, .2) 0%, rgba(9, 32, 31, .05) 38%, rgba(9, 32, 31, .8) 100%); }
.hero-tag {
  position: absolute; top: 18px; inset-inline-start: var(--gutter); z-index: 2;
  padding: 6px 13px; border-radius: 99px; font-size: .78rem; font-weight: 600;
  background: rgba(9, 32, 31, .45); border: 1px solid rgba(255, 255, 255, .4);
}
.hero-inner { position: relative; z-index: 2; width: 100%; padding: clamp(28px, 5vw, 64px) var(--gutter); display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: end; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 4.6vw, 4rem); line-height: 1.05; letter-spacing: -.01em; max-width: 18ch; overflow-wrap: break-word; }
.hero-lede { margin-top: 14px; max-width: 46ch; font-size: clamp(1rem, 1.4vw, 1.18rem); color: #EAF1EC; }
.hero-search { background: rgba(255, 255, 255, .96); color: var(--ink); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.hero-search-label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.hero-search-row { display: flex; gap: 10px; }
.hero-search input { flex: 1; min-width: 0; min-height: 46px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 14px; background: var(--surface); font-size: .95rem; }

/* Trust strip */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--sea); color: #DCEAE2; }
.trust li { display: flex; gap: 12px; padding: 22px clamp(16px, 3vw, 30px); }
.trust .icon { width: 22px; height: 22px; margin-top: 1px; stroke: var(--sand); }
.trust strong { display: block; color: #fff; font-weight: 700; }
.trust p { margin-top: 4px; font-size: .85rem; line-height: 1.5; color: #B5CBC1; }

/* Collection */
.collection { padding: clamp(28px, 4vw, 52px) var(--gutter) 72px; }
.collection-head { margin-bottom: 20px; }
.collection-head h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.15; }
.collection-count { margin-top: 4px; color: var(--muted); }
.filter-open { display: none; }
.filterbar {
  position: sticky; top: calc(var(--mast-h) + 8px); z-index: 20; margin-bottom: 26px; padding: 14px;
  display: grid; grid-template-columns: auto minmax(200px, 1.2fr) repeat(3, minmax(140px, 1fr)); gap: 12px; align-items: end;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.filterbar-home { display: contents; }
.f-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f-label { font-size: .76rem; font-weight: 700; color: var(--muted); }
.f-seg { background: var(--surface); }
.f-seg button { padding: 0 14px; font-size: .84rem; }
.f-seg .n { margin-inline-start: 6px; font-size: .76rem; opacity: .75; }
.control { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; background: var(--surface); font-size: .9rem; font-weight: 500; }
.range { display: flex; align-items: center; gap: 8px; }
.range span { color: var(--muted); }
.range .control { min-width: 0; }

/* Cards */
.property-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.property-card { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); transition: box-shadow .25s ease, transform .25s ease; }
.property-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card-media { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #DFE4DE; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.property-card:hover .card-media img { transform: scale(1.04); }
.badge { position: absolute; top: 12px; inset-inline-start: 12px; padding: 5px 11px; border-radius: 99px; font-size: .74rem; font-weight: 700; color: #fff; background: rgba(23, 34, 30, .86); }
.badge.rent { background: var(--sand-ink); }
.photo-count { position: absolute; bottom: 12px; inset-inline-end: 12px; display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: .74rem; font-weight: 600; color: #fff; background: rgba(9, 20, 19, .72); }
.photo-count .icon { width: 14px; height: 14px; stroke: none; color: #fff; }
.save-button { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 1.2rem; line-height: 1; color: var(--sea); background: rgba(255, 255, 255, .92); }
.save-button[aria-pressed="true"] { color: #B03A2E; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 16px 17px 18px; }
.card-location { font-size: .8rem; font-weight: 600; color: var(--muted); }
.card-title { font-family: var(--serif); font-weight: 500; font-size: 1.18rem; line-height: 1.22; }
.card-title button { padding: 0; text-align: start; }
.card-title button::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-price { margin-top: 2px; font-weight: 800; font-size: 1.06rem; color: var(--sea); }
.card-price small, .sheet-price small { font-weight: 600; font-size: .8em; color: var(--muted); }
.card-facts { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .84rem; }
.card-facts li { display: flex; align-items: center; gap: 6px; }
.card-facts .icon { width: 16px; height: 16px; color: var(--muted); }
.card-facts b { font-weight: 700; }

.empty-state { padding: 60px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--surface); }
.empty-state h3 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin-bottom: 8px; }
.empty-state p { max-width: 48ch; margin: 0 auto 18px; color: var(--muted); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.load-more { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.load-more p { font-size: .88rem; color: var(--muted); }

/* Footer */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 34px var(--gutter); background: var(--sea); color: #B5CBC1; font-size: .88rem; }
.footer-mark { font-family: var(--serif); font-size: 1.15rem; color: #fff; }
.footer-contact { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: #fff; font-weight: 700; }
.footer-contact .icon { stroke: none; }
.footer-admin { min-height: 44px; display: inline-flex; align-items: center; color: #B5CBC1; text-decoration: underline; text-underline-offset: 3px; }

/* Detail dialog */
.property-sheet { width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; position: fixed; inset: 3vh 3vw; border: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); color: var(--ink); box-shadow: 0 40px 120px -40px rgba(0, 0, 0, .6); }
.property-sheet[open] { display: flex; flex-direction: column; }
.property-sheet::backdrop, .filter-sheet::backdrop { background: rgba(9, 20, 19, .55); }
.property-sheet[open] { animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.sheet-close { position: absolute; top: 14px; inset-inline-end: 16px; z-index: 5; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 1.5rem; line-height: 1; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.sheet-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.15fr .85fr; }
.sheet-gallery { display: flex; flex-direction: column; min-height: 0; background: var(--sea-deep); }
.gallery-frame { position: relative; flex: 1; min-height: 0; }
.gallery-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery-nav { position: absolute; top: 50%; z-index: 3; width: 44px; height: 44px; transform: translateY(-50%); display: grid; place-items: center; border-radius: 50%; font-size: 1.6rem; line-height: 1; color: var(--ink); background: rgba(255, 255, 255, .92); }
.gallery-nav.previous { inset-inline-start: 14px; }
.gallery-nav.next { inset-inline-end: 14px; }
[dir="rtl"] .gallery-nav { transform: translateY(-50%) scaleX(-1); }
.image-count { position: absolute; bottom: 14px; inset-inline-start: 14px; z-index: 3; padding: 5px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600; color: #fff; background: rgba(9, 20, 19, .75); }
.gallery-strip { display: flex; gap: 8px; padding: 10px; overflow-x: auto; background: var(--sea-deep); }
.gallery-strip button { flex: 0 0 auto; width: 76px; height: 58px; padding: 0; border: 2px solid transparent; border-radius: 7px; overflow: hidden; opacity: .6; }
.gallery-strip button[aria-pressed="true"] { opacity: 1; border-color: var(--sand); }
.gallery-strip button:hover { opacity: 1; }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; }
.sheet-details { min-height: 0; overflow-y: auto; padding: 26px 28px 32px; }
.sheet-reference { font-size: .8rem; font-weight: 700; color: var(--sand-ink); }
.sheet-details h2 { margin: 6px 0 4px; padding-inline-end: 48px; font-family: var(--serif); font-weight: 500; font-size: 1.75rem; line-height: 1.15; }
.sheet-place { font-size: .92rem; font-weight: 600; color: var(--muted); }
.sheet-price { margin: 14px 0; font-weight: 800; font-size: 1.5rem; color: var(--sea); }
.wa-cta { width: 100%; min-height: 52px; border-radius: var(--r-md); font-size: 1rem; font-weight: 800; }
.cta-note { margin-top: 8px; text-align: center; font-size: .8rem; color: var(--muted); }
.facts-grid { margin: 20px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.facts-grid div { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.facts-grid dt { font-size: .74rem; font-weight: 600; color: var(--muted); }
.facts-grid dd { margin-top: 2px; font-weight: 700; }
.ownership { margin-top: 20px; display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.ownership .icon { width: 22px; height: 22px; margin-top: 2px; color: var(--sea); }
.ownership p { margin-top: 2px; font-size: .88rem; color: var(--muted); }
.ownership-terms { white-space: pre-line; color: var(--ink) !important; }
.detail-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-block h3 { margin-bottom: 8px; font-family: var(--serif); font-weight: 500; font-size: 1.12rem; }
.detail-block p { font-size: .94rem; line-height: 1.65; color: var(--muted); }
.amenities { display: flex; flex-wrap: wrap; gap: 8px; }
.amenities li { padding: 6px 13px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); font-size: .84rem; font-weight: 600; }
.sheet-footer { display: none; }

/* Mobile filter sheet */
.filter-sheet { width: 100%; max-width: 520px; max-height: 88vh; margin: auto auto 0; padding: 20px 18px 24px; border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); overflow-y: auto; }
.filter-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.filter-sheet-head h2 { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; }
.filter-sheet .sheet-close { position: static; box-shadow: none; background: var(--paper); }
.filter-sheet .filterbar { position: static; margin: 0; padding: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
.filter-sheet .f-seg { display: flex; }
.filter-sheet .f-seg button { flex: 1; }
.filter-apply { width: 100%; min-height: 50px; margin-top: 22px; border-radius: var(--r-md); }
.filter-badge { min-width: 24px; padding: 2px 8px; border-radius: 99px; font-size: .78rem; background: var(--sea); color: #fff; }

/* Tablet */
@media (max-width: 1100px) {
  .property-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filterbar .f-group:first-child { grid-column: 1 / -1; }
  .trust { grid-template-columns: repeat(2, 1fr); }
  .brand-sub { display: none; }
}

/* Mobile */
@media (max-width: 760px) {
  :root { --mast-h: 64px; }
  .masthead { gap: 10px; }
  .mast-nav { display: none; }
  .language-picker select { max-width: 112px; padding: 0 10px; }
  .wa-pill { padding: 0 12px; }
  .hero { min-height: 70vh; }
  .hero-inner { grid-template-columns: 1fr; gap: 22px; padding-top: 72px; }
  .hero h1 { font-size: clamp(1.75rem, 8vw, 2.2rem); line-height: 1.1; }
  .hero-lede { font-size: .98rem; }
  .hero-search { padding: 14px; }
  .trust li { padding: 16px; }
  .trust p { font-size: .8rem; }
  .filterbar-home { display: none; }
  .filter-open {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 52px; margin-bottom: 20px; padding: 0 16px;
    border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-weight: 700; box-shadow: var(--shadow);
    position: sticky; top: calc(var(--mast-h) + 8px); z-index: 20;
  }
  .filter-open-label { display: flex; align-items: center; gap: 10px; }
  .property-grid { grid-template-columns: 1fr; gap: 18px; }

  .property-sheet { inset: 0; border-radius: 0; overflow-y: auto; }
  .property-sheet[open] { display: block; }
  .sheet-layout { display: block; }
  .sheet-close { position: fixed; top: 12px; }
  .gallery-frame { flex: none; aspect-ratio: 4 / 3; }
  .sheet-details { overflow: visible; padding: 20px 18px 28px; }
  .sheet-details h2 { padding-inline-end: 0; font-size: 1.5rem; }
  .sheet-footer {
    position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 12px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
  }
  .sheet-footer-copy { flex: 1; min-width: 0; }
  .sheet-footer-copy strong { display: block; color: var(--sea); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-footer-copy small { color: var(--muted); font-size: .78rem; }
  .sheet-footer .wa-button { min-height: 48px; font-weight: 800; }
}

@media (max-width: 380px) {
  .brand-word { font-size: 1.3rem; }
  .wa-pill span { display: none; }
  .trust { grid-template-columns: 1fr; }
  .facts-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .property-card:hover { transform: none; }
  .property-card:hover .card-media img { transform: none; }
}
