:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #18201d;
  --muted: #59635e;
  --faint: #8a938e;
  --line: #e1e6e2;
  --accent: #0c6e62;
  --accent-ink: #084b43;

  --en-fg: #0f7b3f;   --en-bg: #e6f4ea;
  --some-fg: #8a5a00; --some-bg: #faf0d6;
  --loc-fg: #9b2c2c;  --loc-bg: #f7e3e1;
  --front-fg: #1d5fa8; --front-bg: #e5eef9;

  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.homes-active { --accent: #a44f2a; --accent-ink: #723319; }
a { color: var(--accent-ink); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }

/* header */
.site {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(12,110,98,.04);
}
.site .wrap { display: grid; grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr); align-items: center; gap: 20px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.mark { font-size: 23px; letter-spacing: -.02em; color: var(--ink); }
.mark strong { color: var(--accent); font-weight: 800; }
.tagline { font-size: 12.5px; color: var(--muted); letter-spacing: .01em; }
.stat { font-size: 12.5px; color: var(--muted); text-align: right; }
.stat b { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.surface-switch { justify-self: center; display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.surface { border: 0; background: transparent; color: var(--muted); font: 700 13px var(--sans); padding: 8px 17px; border-radius: 999px; cursor: pointer; }
.surface:hover { color: var(--accent-ink); }
.surface.is-active { color: #fff; background: var(--accent); box-shadow: 0 1px 3px rgba(10, 54, 48, .16); }
.is-hidden { display: none !important; }

/* layout */
.layout { display: grid; grid-template-columns: 248px 1fr; gap: 28px; padding-top: 26px; padding-bottom: 40px; align-items: start; }

/* filters */
.filters {
  position: sticky; top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.field.search { gap: 0; }
input[type=search], select {
  width: 100%; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 14px; font-family: var(--sans);
}
input[type=search]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.toggles { display: flex; flex-direction: column; gap: 9px; padding: 4px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.reset { margin-top: 2px; padding: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.reset:hover { border-color: var(--accent); color: var(--accent-ink); }

/* results */
.mode-bar { display: flex; gap: 6px; margin-bottom: 9px; flex-wrap: wrap; }
.mode { font-size: 13.5px; font-weight: 600; padding: 8px 15px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; color: var(--muted); cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease; }
.mode:hover { border-color: var(--accent); color: var(--accent-ink); }
.mode.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mode-n { font-variant-numeric: tabular-nums; opacity: .7; font-weight: 500; }
.mode.is-active .mode-n { opacity: .9; }
.mode-hint { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; line-height: 1.5; max-width: 72ch; }
.results-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.count { font-size: 15px; font-weight: 600; }
.count b { color: var(--accent); font-variant-numeric: tabular-nums; }
.enrich-note { font-size: 12px; color: var(--faint); }
.job-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.card:hover { border-color: #cdd6d1; box-shadow: 0 4px 16px rgba(20,32,29,.05); }
.card h3 { margin: 0 0 4px; font-size: 16.5px; line-height: 1.3; letter-spacing: -.01em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent-ink); text-decoration: underline; }
.meta-line { font-size: 13px; color: var(--muted); margin-bottom: 9px; }
.meta-line .company { color: var(--ink); font-weight: 600; }
.summary { font-size: 13.5px; color: #3c453f; margin: 0 0 11px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { font-size: 11.5px; padding: 2.5px 8px; border-radius: 999px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.badge.lang-english_ok { color: var(--en-fg); background: var(--en-bg); }
.badge.lang-some_local_helpful { color: var(--some-fg); background: var(--some-bg); }
.badge.lang-local_required { color: var(--loc-fg); background: var(--loc-bg); }
.badge.lang-unknown { color: var(--muted); background: #eef1ef; }
.badge.front { color: var(--front-fg); background: var(--front-bg); font-family: var(--mono); }
.badge.plain { color: var(--muted); background: #eef1ef; }
.badge.role { color: var(--accent-ink); background: #e3efed; }
.badge.reqlang { color: #475569; background: #eef1f5; font-family: var(--mono); letter-spacing: .03em; }
.mono { font-family: var(--mono); font-size: 12px; }
.spacer { flex: 1; }
.apply { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.apply:hover { text-decoration: underline; }

/* pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 22px; }
.pager button { padding: 8px 14px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--accent); color: var(--accent-ink); }
.empty { text-align: center; color: var(--muted); padding: 50px 0; }

.site-foot { padding: 24px 22px 40px; color: var(--faint); font-size: 12.5px; }

/* homes */
.homes-panel { --accent: #a44f2a; --accent-ink: #723319; --bg: #f5f1ea; --surface: #fffdf9; --line: #e5ddd1; background: var(--bg); min-height: calc(100vh - 82px); }
.homes-hero { max-width: 1120px; display: grid; grid-template-columns: 1fr 310px; align-items: end; gap: 60px; padding-top: 42px; padding-bottom: 26px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .13em; }
.homes-hero h1 { margin: 0; max-width: 700px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 5vw, 54px); font-weight: 500; line-height: 1.02; letter-spacing: -.035em; color: #292019; }
.homes-hero > div > p:last-child { max-width: 700px; margin: 15px 0 0; color: #685e55; font-size: 15px; line-height: 1.6; }
.criteria-card { border-left: 3px solid var(--accent); padding: 4px 0 4px 17px; display: flex; flex-direction: column; align-items: flex-start; }
.criteria-card span { color: var(--faint); text-transform: uppercase; letter-spacing: .09em; font-size: 10.5px; }
.criteria-card strong { margin: 4px 0; color: #38281e; font-size: 19px; }
.criteria-card small { color: var(--muted); line-height: 1.45; }
.homes-layout { padding-top: 10px; }
.homes-filters { border-color: #e5ddd1; box-shadow: 0 8px 30px rgba(72, 49, 31, .04); }
.home-list-switch .mode.is-active { background: var(--accent); border-color: var(--accent); }
.homes-results .count b { color: var(--accent); }
.home-list { display: flex; flex-direction: column; gap: 17px; transition: opacity .15s ease; }
.home-list.is-loading { opacity: .5; }
.home-card { display: grid; grid-template-columns: 235px 1fr; min-height: 265px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 5px 18px rgba(60, 44, 31, .035); transition: transform .15s ease, box-shadow .15s ease; }
.home-card:hover { transform: translateY(-1px); box-shadow: 0 9px 26px rgba(60, 44, 31, .075); }
.home-image { display: block; min-height: 100%; background: #ded6ca; overflow: hidden; position: relative; }
.home-image img { width: 100%; height: 100%; min-height: 265px; object-fit: cover; display: block; transition: transform .35s ease; }
.home-card:hover .home-image img { transform: scale(1.018); }
.image-placeholder, .home-image.image-failed { display: grid; place-items: center; background: linear-gradient(145deg, #e6ddd0, #cbbcab); text-decoration: none; color: #715f50; }
.home-image.image-failed img { display: none; }
.home-image.image-failed::after { content: "View source photos ↗"; font-size: 12px; }
.image-placeholder span { font-size: 12px; }
.home-body { padding: 18px 20px 17px; min-width: 0; }
.home-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.rank-number { padding: 2px 7px; border-radius: 999px; background: #f1e5dc; color: var(--accent-ink); font-weight: 800; }
.source-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.home-title-row h2 { margin: 0; font: 600 20px/1.2 Georgia, "Times New Roman", serif; letter-spacing: -.012em; }
.home-title-row h2 a { color: #30241d; text-decoration: none; }
.home-title-row h2 a:hover { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.score { flex: none; display: inline-flex; align-items: baseline; color: var(--faint); font: 10px var(--mono); }
.score b { color: var(--accent); font-size: 20px; }
.home-location { margin: 4px 0 1px; color: var(--muted); font-size: 12.5px; }
.home-price { color: var(--accent-ink); font: 750 17px var(--sans); }
.property-metrics { display: grid; grid-template-columns: repeat(4, minmax(80px, 1fr)); gap: 7px; margin: 12px 0; }
.property-metrics > div { min-width: 0; padding: 7px 9px; background: #f7f2eb; border-radius: 8px; }
.property-metrics span { display: block; color: var(--faint); font-size: 9.5px; text-transform: uppercase; letter-spacing: .065em; }
.property-metrics strong { display: block; margin-top: 1px; color: #47372b; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-summary { margin: 0 0 10px; color: #574b42; font-size: 13px; line-height: 1.5; }
.features { display: flex; flex-wrap: wrap; gap: 5px; }
.feature { padding: 3px 7px; border-radius: 5px; background: #eef0e5; color: #4e5d3d; font-size: 10.5px; }
.home-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; margin-top: 10px; }
.home-bottom details { color: var(--muted); font-size: 11.5px; }
.home-bottom summary { cursor: pointer; color: #84614c; }
.home-bottom ul { margin: 7px 0 0; padding-left: 17px; max-width: 450px; }
.view-listing { flex: none; color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; }
.view-listing:hover { text-decoration: underline; }
.faint { color: var(--faint); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .site .wrap { grid-template-columns: 1fr auto; gap: 9px 15px; }
  .brand { min-width: 0; }
  .surface-switch { justify-self: end; }
  .stat { grid-column: 1 / -1; text-align: left; }
  .homes-hero { grid-template-columns: 1fr; gap: 20px; padding-top: 30px; }
  .criteria-card { max-width: 500px; }
  .home-card { grid-template-columns: 180px 1fr; }
  .property-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 590px) {
  .wrap { padding-left: 15px; padding-right: 15px; }
  .tagline { display: none; }
  .surface { padding: 7px 12px; }
  .site .wrap { padding-top: 11px; padding-bottom: 11px; }
  .homes-hero h1 { font-size: 36px; }
  .home-card { grid-template-columns: 1fr; }
  .home-image, .home-image img { min-height: 210px; max-height: 250px; }
  .home-body { padding: 16px; }
  .home-title-row h2 { font-size: 19px; }
  .home-bottom { align-items: flex-start; flex-direction: column; }
}

/* ---- homes map view ---- */
.view-switch { margin-bottom: 0; margin-left: auto; }
.results-head .spacer { flex: 1; }
#home-map-wrap { margin-bottom: 14px; }
#home-map { height: 72vh; min-height: 430px; border-radius: 12px; border: 1px solid var(--line); }
.map-note { font-size: 12.5px; color: var(--faint, #777); margin: 8px 2px 0; }
.map-pop a { font-weight: 650; display: block; margin-bottom: 2px; }
.map-pop div { font-size: 12.5px; line-height: 1.45; }
.map-pop .faint { color: #888; margin-top: 3px; }
.leaflet-container { font: inherit; }
