/* ============================================================
   Carlo Batara · public property pages
   Styled to match the costaricacarlo.automatedelevation.com site:
   flat, airy, square-ish corners, uppercase buttons, teal labels.
   Colours were sampled from screenshots of the live site.
   NOTE: no vh units anywhere. These pages are auto-resized inside
   an iframe, and vh would feed back into the iframe height.
   ============================================================ */
:root {
  /* brand colours (sampled) */
  --blue: #63b3ed;          /* primary button */
  --blue-deep: #4a9fe0;     /* primary button hover */
  --line: #cbd5e0;          /* outline button + input borders */
  --teal: #2e879f;          /* labels, icons, links */
  --teal-deep: #236b80;
  --teal-light: #e6f1f4;
  --page: #f4f3ef;          /* warm section background */
  --white: #ffffff;
  --head: #2f312d;          /* headings on the warm background */
  --ink: #4a4a4a;           /* body copy */
  --ink-muted: #7b7d78;
  --black: #0b0b14;         /* outline-button text */
  --line-soft: #e4e1da;     /* hairlines on white cards */
  --card-border: #d8dbe0;   /* light grey outline around the contact card */
  --sand: #ebe8e1;          /* skeletons / photo placeholders */

  /* type */
  --display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --label: 'Montserrat', 'Source Sans 3', system-ui, sans-serif;

  /* shape */
  --r: 4px;
  --r-btn: 6px;
  --sh-hover: 0 14px 34px rgba(47, 49, 45, .13);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--page-bg, var(--page));
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; }
.ico {
  width: 1em; height: 1em; flex: none;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Playfair's default old-style numerals look uneven in prices and stats; use lining figures */
.card-price, .p-price, .fact b, .count { font-variant-numeric: lining-nums; }

/* ── Buttons (same look as the live site) ────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 17px 40px; border-radius: var(--r-btn); border: 1px solid transparent;
  font-family: var(--body); font-weight: 400; font-size: 17px; letter-spacing: .03em;
  text-transform: uppercase; line-height: 1.1; white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn-ghost { background: #fff; color: var(--black); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: wait; }
.btn:focus-visible, .card:focus-visible, .thumb:focus-visible, .g-btn:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}

/* ── Browse: heading + search ────────────────────────────── */
.hero { color: var(--head); }
.hero-text { text-align: center; margin-bottom: 30px; }
.hero h1 {
  font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.18; letter-spacing: .06em; text-transform: uppercase; color: var(--head);
}
.hero h1 em { font-style: normal; color: var(--teal); }
.hero-text p { max-width: 640px; margin: 14px auto 0; font-size: 19px; font-weight: 300; color: var(--ink); }
html.no-hero .hero-text { display: none; }

.search {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr .8fr auto; gap: 0;
  background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r); padding: 8px;
}
.field { display: flex; flex-direction: column; gap: 1px; padding: 8px 16px; min-width: 0; transition: background .2s; }
.field + .field { border-left: 1px solid var(--line-soft); }
.field:focus-within { background: var(--teal-light); }
.field label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.field input, .field select { border: 0; outline: 0; background: transparent; font-size: 17px; font-weight: 600; color: var(--head); padding: 2px 0; width: 100%; min-width: 0; }
.field input::placeholder { color: #9aa0a6; font-weight: 400; }
.field select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232e879f' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E") no-repeat right 2px center;
}
.search .btn { margin-left: 8px; align-self: stretch; padding: 0 36px; }

/* ── Browse: results ─────────────────────────────────────── */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 36px 0 20px; }
.count { font-family: var(--display); font-weight: 500; font-size: 26px; line-height: 1.2; color: var(--head); }
.count small { font: 400 15px var(--body); color: var(--ink-muted); margin-left: 10px; }
.sort { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.sort select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--line); border-radius: var(--r-btn); background: #fff;
  padding: 10px 36px 10px 16px; font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--head); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232e879f' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }

.card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden;
  transition: transform .28s ease, box-shadow .28s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sh-hover); }
.card-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--sand); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card-media::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 55%; background: linear-gradient(to top, rgba(20, 28, 30, .72), transparent); pointer-events: none; }
.card-price { position: absolute; z-index: 2; left: 20px; bottom: 16px; color: #fff; font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.card-price.poa { font: 600 14px var(--body); letter-spacing: .12em; text-transform: uppercase; }
.card-tag { position: absolute; z-index: 2; top: 14px; left: 14px; padding: 5px 11px; border-radius: 2px; background: rgba(255, 255, 255, .95); color: var(--teal); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.card-photos { position: absolute; z-index: 2; top: 14px; right: 14px; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 2px; background: rgba(20, 28, 30, .62); color: #fff; font-size: 12px; font-weight: 600; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 22px; flex: 1; }
.card-title { font-family: var(--display); font-size: 21px; line-height: 1.3; font-weight: 500; color: var(--head); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-loc { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.card-loc .ico { color: var(--teal); font-size: 14px; }
.card-view { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); }
.card-stats { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 16px; color: var(--head); }
.card-stats span { display: inline-flex; align-items: center; gap: 7px; }
.card-stats .ico { font-size: 18px; color: var(--teal); }

.sk { aspect-ratio: 4 / 5; border-radius: var(--r); background: linear-gradient(90deg, #efece5 25%, #e6e2da 50%, #efece5 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.more { display: flex; justify-content: center; margin-top: 44px; }
.empty { grid-column: 1 / -1; text-align: center; padding: 70px 24px; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r); }
.empty h3 { font-family: var(--display); font-size: 28px; font-weight: 500; color: var(--head); margin-bottom: 10px; }
.empty p { color: var(--ink); margin: 0 auto 24px; max-width: 520px; }

/* ── Property page ───────────────────────────────────────── */
.crumbs { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.back:hover { color: var(--teal-deep); }
.pill-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--black); border-radius: var(--r-btn); padding: 10px 18px; font-size: 13px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; transition: border-color .2s; }
.pill-btn:hover { border-color: var(--blue); }

.prop { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 48px; align-items: start; }
.prop > main, .prop > aside { min-width: 0; }

.gallery { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; }
.stage { position: relative; aspect-ratio: 3 / 2; overflow: hidden; touch-action: pan-y; background: var(--sand); }
.stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.stage > img.is-loading { opacity: .35; }
.stage .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 64px; color: #d8d3c8; }
.g-btn { position: absolute; z-index: 2; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--head); transition: background .2s, transform .2s; font-size: 22px; }
.g-btn:hover { background: #fff; transform: scale(1.06); }
.g-prev { left: 16px; top: 50%; margin-top: -23px; }
.g-next { right: 16px; top: 50%; margin-top: -23px; }
.g-fs { right: 16px; top: 16px; width: 42px; height: 42px; font-size: 18px; }
.g-count { position: absolute; z-index: 2; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 2px; background: rgba(20, 28, 30, .72); color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .06em; }
.thumbs { display: flex; gap: 8px; padding: 12px; overflow-x: auto; scrollbar-width: thin; border-top: 1px solid var(--line-soft); }
.thumb { flex: none; width: 96px; height: 66px; padding: 0; border: 2px solid transparent; border-radius: 3px; overflow: hidden; background: var(--sand); opacity: .7; transition: all .2s; }
.thumb:hover { opacity: 1; }
.thumb.active { border-color: var(--blue); opacity: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery.is-fs { border-radius: 0; display: flex; flex-direction: column; background: #000; }
.gallery.is-fs .stage { flex: 1; aspect-ratio: auto; background: #000; }
.gallery.is-fs .stage > img { object-fit: contain; }
.gallery.is-fs .thumbs { background: #000; border-color: #222; }

.p-head { margin: 32px 0 4px; }
.p-eyebrow { margin-bottom: 14px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.p-eyebrow span { white-space: nowrap; }
.p-eyebrow i { font-style: normal; font-weight: 400; color: var(--line); margin: 0 .8em; }
.p-title { font-family: var(--display); font-size: clamp(30px, 3.8vw, 46px); line-height: 1.16; font-weight: 500; color: var(--head); }
.p-loc { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--ink); font-size: 17px; }
.p-loc .ico { color: var(--teal); }
.p-price { margin-top: 20px; font-family: var(--display); font-size: clamp(36px, 4.2vw, 52px); font-weight: 600; line-height: 1; color: var(--head); }
.p-price.poa { font: 600 18px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.p-cta { display: none; gap: 10px; margin-top: 20px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 30px 0 0; }
.fact { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r); padding: 20px 20px 18px; }
.fact .ico { font-size: 24px; color: var(--teal); margin-bottom: 10px; }
.fact b { font-family: var(--display); font-size: 26px; font-weight: 500; line-height: 1.1; color: var(--head); }
.fact span { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }

.sec { margin-top: 48px; }
.sec h2 { font-family: var(--display); font-size: clamp(26px, 3vw, 34px); font-weight: 500; line-height: 1.2; color: var(--head); margin-bottom: 18px; }
.desc { color: #33352f; font-size: 18px; font-weight: 300; line-height: 1.85; }
.desc p { margin: 0 0 1.2em; }
.desc p:last-child { margin-bottom: 0; }
.desc.clamped { max-height: 11.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.link-btn { margin-top: 14px; padding: 0; border: 0; background: none; color: var(--teal); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; }

.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.dl-row { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); font-size: 16.5px; }
.dl-row dt { color: var(--ink-muted); }
.dl-row dd { font-weight: 600; text-align: right; color: var(--head); }
.cl-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.cl { padding: 8px 15px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--head); font-size: 14.5px; }

.aside { position: static; }   /* the card is moved by initSticky() in property.html (CSS sticky can't work inside an auto-height iframe) */
.aside-card { background: #fff; border: 1px solid var(--card-border); border-radius: var(--r); overflow: hidden; }
@media (min-width: 961px) { .aside-card { will-change: transform; transition: transform .14s ease-out; } }
/* "compact": used by the sticky card on shorter windows so the whole form stays in view */
.aside-card.compact .aside-body { padding: 18px 24px 20px; }
.aside-card.compact .agent-id { margin-bottom: 12px; }
.aside-card.compact .agent-id b { font-size: 24px; }
.aside-card.compact .agent-id small { margin-top: 4px; font-size: 14px; }
.aside-card.compact .acts { margin-bottom: 16px; }
.aside-card.compact .acts .btn { padding: 12px 10px; font-size: 14px; }
.aside-card.compact h3 { font-size: 19px; margin-bottom: 10px; }
.aside-card.compact .form { gap: 8px; }
.aside-card.compact .form input, .aside-card.compact .form textarea { padding: 10px 14px; font-size: 15px; }
.aside-card.compact .form textarea { height: 76px; min-height: 76px; }
.aside-card.compact .form .btn { padding: 13px 10px; }
.aside-card.compact .note { display: none; }
.aside-card.no-portrait .portrait { display: none; }
.portrait { position: relative; aspect-ratio: 3 / 4; background: linear-gradient(160deg, var(--teal-deep), var(--teal) 55%, var(--blue)); }
.portrait-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 84px; font-weight: 600; color: rgba(255, 255, 255, .88); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.portrait.has-img .portrait-ph { display: none; }
.aside-body { padding: 26px 28px 30px; }
.agent-id { margin-bottom: 20px; }
.agent-id b { display: block; font-family: var(--label); font-size: 27px; font-weight: 300; letter-spacing: .08em; text-transform: uppercase; line-height: 1.2; color: #000; }
.agent-id small { display: block; margin-top: 8px; font-size: 15px; color: var(--ink); }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 26px; }
.acts .btn { padding: 15px 10px; font-size: 15px; }
.aside-card h3 { font-family: var(--display); font-size: 22px; font-weight: 500; color: var(--head); margin-bottom: 14px; }
.form { display: grid; gap: 10px; position: relative; }
.form input, .form textarea { width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; outline: 0; font-size: 16px; transition: border-color .2s, box-shadow .2s; }
.form input::placeholder, .form textarea::placeholder { color: #9aa0a6; }
.form input:focus, .form textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(99, 179, 237, .25); }
.form textarea { resize: vertical; min-height: 116px; }
.hp { position: absolute !important; left: -9999px !important; width: 0 !important; height: 0 !important; opacity: 0; }
.note { font-size: 13px; color: var(--ink-muted); text-align: center; }
.alert { padding: 14px 16px; border-radius: var(--r); font-size: 15px; }
.alert-ok { background: var(--teal-light); color: var(--teal-deep); }
.alert-err { background: #fce8e8; color: #9b2c2c; }
.banner { margin-bottom: 20px; padding: 16px 20px; border-radius: var(--r); background: var(--teal-light); color: var(--teal-deep); font-weight: 600; }

.state { text-align: center; padding: 90px 20px; }
.state h1 { font-family: var(--display); font-size: 36px; font-weight: 500; color: var(--head); margin-bottom: 12px; }
.state p { color: var(--ink); margin: 0 auto 28px; max-width: 520px; }

.mbar { display: none; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .prop { grid-template-columns: minmax(0, 1fr) 330px; gap: 36px; }
  .search { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .search .field:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line-soft); }
  .search .field:nth-child(2) { border-left: 0; }
  .search .btn { grid-column: 1 / -1; margin: 8px 0 0; padding: 16px; }
}
@media (max-width: 960px) {
  .prop { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .aside { margin-top: 40px; }
  .portrait { aspect-ratio: 4 / 5; max-height: 560px; }
  .p-cta { display: grid; grid-template-columns: 1fr 1fr; }
  .p-cta .btn { padding: 16px 10px; }
  .dl { grid-template-columns: 1fr; }
  html:not(.embedded) .mbar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--line-soft);
  }
  .mbar .btn { padding: 15px 10px; font-size: 15px; }
  html:not(.embedded) body { padding-bottom: 82px; }
  html:not(.embedded) .p-cta { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px 14px 48px; }
  .search { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px; }
  .field { padding: 8px 12px; }
  .field + .field { border-left: 0; }
  .search .field:nth-child(2), .search .field:nth-child(3) { border-bottom: 1px solid var(--line-soft); }   /* area | type */
  .search .field:nth-child(3), .search .field:nth-child(5) { border-left: 1px solid var(--line-soft); }     /* type, bedrooms */
  .grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .g-btn { width: 40px; height: 40px; font-size: 19px; }
  .thumb { width: 78px; height: 54px; }
  .aside-body { padding: 22px 20px 26px; }
  .agent-id b { font-size: 24px; }
  .count { font-size: 22px; }
  .sec { margin-top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
