:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --ink: #12302c;
  --ink-2: #3e5753;
  --muted: #7d8c89;
  --line: #e3e9e7;
  --line-2: #d3ddda;
  --accent: #2f6f68;
  --accent-soft: #e6f0ee;
  --sand: #d8b98a;
  --warn: #a8743a;
  --good: #2f6f68;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  --r: 12px;
  --hover: #edf2f0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(245, 247, 246, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
body.in-results .topbar { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 500 24px/1 var(--serif); letter-spacing: -0.02em; }
.region-pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px 10px; }
.topnav { margin-left: auto; display: flex; gap: 20px; }
.linklike { background: none; border: 0; padding: 0; color: var(--ink-2); }
.linklike:hover { color: var(--accent); }
.linklike.small { font-size: 13px; color: var(--muted); }

/* home */
.home { max-width: 760px; margin: 0 auto; padding: 9vh 24px 60px; }
.hero h1 { font: 400 clamp(38px, 5.6vw, 58px)/1.06 var(--serif); letter-spacing: -0.025em; margin: 0 0 22px; }
.hero h1 em { color: var(--accent); font-style: italic; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 620px; margin: 0 0 34px; }
.brief { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px 18px 14px; box-shadow: 0 1px 2px rgba(30, 38, 38, 0.04), 0 12px 32px -18px rgba(30, 38, 38, 0.18); transition: border-color 0.2s; }
.brief:focus-within { border-color: #9fbfba; }
.brief textarea { width: 100%; border: 0; outline: 0; resize: none; font: 17px/1.55 var(--sans); color: var(--ink); background: transparent; }
.brief textarea::placeholder { color: #a7aba7; }
.brief-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.hint { font-size: 13px; color: var(--muted); }
.btn-primary { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 11px 22px; font-weight: 500; transition: background 0.15s, transform 0.15s; }
.btn-primary:hover { background: #255a54; }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 18px; font-weight: 500; }
.btn-ghost:hover { border-color: var(--ink); }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 18px; font-size: 14px; color: var(--muted); }
.example { background: none; border: 0; padding: 0; color: var(--ink-2); border-bottom: 1px dashed #c9c2b5; }
.example:hover { color: var(--accent); border-color: var(--accent); }
.stats { display: flex; gap: 40px; margin-top: 70px; padding-top: 26px; border-top: 1px solid var(--line); }
.stat b { display: block; font: 400 28px/1.1 var(--serif); }
.stat span { font-size: 13px; color: var(--muted); }

/* results layout */
.results { display: grid; grid-template-columns: 470px 1fr; height: calc(100vh - 60px); }
.panel { overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); }
.panel-head { padding: 22px 24px 10px; }
.summary { font: 400 20px/1.35 var(--serif); margin: 0 0 14px; letter-spacing: -0.01em; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); white-space: nowrap; }
.chip.must { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.must::after { content: ''; width: 5px; height: 5px; border-radius: 9px; background: var(--sand); }
.chip:hover { border-color: var(--ink); }
.chip.add { border-style: dashed; color: var(--muted); background: transparent; }
.unsupported { font-size: 12.5px; color: var(--muted); margin: 10px 0 6px; }
.unsupported:empty { display: none; }

.insights { padding: 6px 24px 4px; display: grid; gap: 8px; }
.insight { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; width: 100%; background: var(--accent-soft); border: 0; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); }
.insight b { color: var(--ink); font-weight: 600; }
.insight .go { color: var(--accent); font-weight: 600; white-space: nowrap; }
.insight:hover { filter: brightness(0.98); }

.tabs { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 14px 24px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.tab { white-space: nowrap; background: none; border: 0; padding: 8px 0 11px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab span { font-weight: 400; color: var(--muted); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.sort { margin-left: auto; border: 0; background: transparent; color: var(--ink-2); font: 13px var(--sans); padding: 4px 0; cursor: pointer; }

.list { padding: 8px 14px 40px; }
.card { display: grid; grid-template-columns: 112px 1fr auto; gap: 14px; align-items: center; padding: 12px 10px; border-radius: var(--r); cursor: pointer; transition: background 0.12s; }
.card:hover, .card.hl { background: var(--hover); }
.card .illo { width: 112px; height: 80px; border-radius: 10px; overflow: hidden; }
.card .illo svg { display: block; width: 100%; height: 100%; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.card .where { font-size: 13px; color: var(--muted); }
.card .facts { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.card .price { font-weight: 600; font-size: 15px; margin-top: 3px; }
.card .note { font-size: 12.5px; margin-top: 2px; color: var(--muted); }
.card .note.miss { color: var(--warn); }
.ring { width: 46px; height: 46px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13.5px; font-weight: 600; }
.more { display: block; margin: 14px auto 0; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty h4 { font: 400 20px var(--serif); color: var(--ink); margin: 0 0 6px; }

.place { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 10px; border-radius: var(--r); cursor: pointer; }
.place:hover { background: var(--hover); }
.place h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.place .where { font-size: 13px; color: var(--muted); }
.place .tags { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.place .count { text-align: right; font-size: 13px; color: var(--muted); }
.place .count b { display: block; font: 400 22px/1 var(--serif); color: var(--ink); }

/* map */
.mapwrap { position: relative; isolation: isolate; z-index: 0; }
#map { position: absolute; inset: 0; background: #eef0ec; }




.poi-icon { background: #fff; border: 1px solid var(--line-2); border-radius: 99px; width: 26px !important; height: 26px !important; display: grid; place-items: center; font-size: 13px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.map-toggle { display: none; }

/* drawer */
.drawer { position: fixed; top: 60px; right: 0; bottom: 0; width: min(540px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -24px 0 48px -32px rgba(30, 38, 38, 0.35); overflow-y: auto; z-index: 40; animation: slidein 0.22s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.d-illo { height: 230px; position: relative; }
.d-illo svg { width: 100%; height: 100%; display: block; }
.d-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 99px; border: 0; background: rgba(255,255,255,.92); font-size: 18px; line-height: 1; }
.d-body { padding: 22px 28px 40px; }
.d-body h2 { font: 400 27px/1.15 var(--serif); margin: 0 0 4px; letter-spacing: -0.015em; }
.d-where { color: var(--muted); font-size: 14px; }
.d-price { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 4px; }
.d-price > b { font: 400 30px var(--serif); }
.d-facts { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.d-sec { padding: 20px 0; border-bottom: 1px solid var(--line); }
.d-sec:last-child { border-bottom: 0; }
.d-sec h4 { margin: 0 0 12px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.fit { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 8px; font-size: 14px; align-items: baseline; }
.fit .ok { color: var(--good); }
.fit .no { color: var(--warn); }
.fit .meh { color: #b08a3a; }
.fit .val { color: var(--muted); font-size: 13px; text-align: right; }
.near-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; font-size: 13.5px; }
.near-grid div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted var(--line-2); padding-bottom: 6px; }
.near-grid span { color: var(--muted); }
.bars { display: grid; gap: 11px; }
.bar { display: grid; grid-template-columns: 150px 1fr 70px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar .track { height: 6px; background: #e9efed; border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--ink-2); border-radius: 99px; }
.bar .v { text-align: right; color: var(--muted); font-size: 13px; }
.spark { display: flex; align-items: flex-end; gap: 18px; margin-top: 16px; }
.spark svg { flex: 1; height: 54px; }
.spark-cap { font-size: 12.5px; color: var(--muted); }
.d-actions { display: flex; gap: 10px; margin-top: 22px; }
.provenance { font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 12px 14px; margin-top: 20px; line-height: 1.5; }
.dpe { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; color: #fff; font-weight: 600; font-size: 12px; margin-right: 6px; }

/* popover */
.pop { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 18px 40px -16px rgba(30,38,38,.3); padding: 14px; width: 270px; font-size: 14px; }
.pop .seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--hover); border-radius: 99px; padding: 3px; margin-bottom: 12px; }
.pop .seg button { border: 0; background: transparent; border-radius: 99px; padding: 6px; font-size: 13px; }
.pop .seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.pop label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.pop input[type=range] { width: 100%; accent-color: var(--accent); }
.pop .row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.pop .menu { display: grid; gap: 2px; max-height: 320px; overflow-y: auto; }
.pop .menu button { text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 8px; }
.pop .menu button:hover { background: var(--hover); }

/* loading, modal, toast */
.loading { position: fixed; inset: 0; z-index: 90; background: rgba(251, 248, 243, 0.86); backdrop-filter: blur(4px); display: grid; place-items: center; }
.loading-card { text-align: center; }
.loading-card p { font: 400 20px var(--serif); margin-top: 16px; color: var(--ink-2); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateY(-6px); } }
.modal { position: fixed; inset: 0; z-index: 95; background: rgba(30, 38, 38, 0.32); display: grid; place-items: center; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 18px; max-width: 560px; width: 100%; padding: 28px 30px; max-height: 86vh; overflow-y: auto; }
.modal-card h3 { font: 400 26px var(--serif); margin: 0 0 10px; }
.modal-card p, .modal-card li { color: var(--ink-2); font-size: 14.5px; }
.modal-card textarea, .modal-card input { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font: 15px var(--sans); margin: 4px 0 12px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 99; background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 99px; font-size: 14px; }

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .region-pill, #aboutBtn { display: none; }
  .home { padding-top: 6vh; }
  .stats { gap: 22px; flex-wrap: wrap; }
  .results { grid-template-columns: 1fr; }
  .mapwrap { position: fixed; inset: 60px 0 0 0; z-index: 30; transform: translateX(100%); transition: transform .25s; }
  body.show-map .mapwrap { transform: none; }
  .map-toggle { display: block; position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 35; background: var(--ink); color: #fff; border: 0; border-radius: 10px; padding: 11px 22px; font-weight: 500; }
  .tabs { gap: 14px; padding: 10px 16px 0; }
  .tab { font-size: 14px; }
  .sort { font-size: 12px; max-width: 86px; }
}
@media (max-width: 480px) {
  .sort { display: none; }
  .panel-head, .insights { padding-left: 16px; padding-right: 16px; }
  .list { padding: 6px 6px 80px; }
  .card { grid-template-columns: 92px 1fr auto; }
  .card .illo { width: 92px; height: 70px; }
  .bar { grid-template-columns: 120px 1fr 60px; }
}

/* ---- v2: language switch, photos, gallery, MapLibre ---- */
.lang { display: inline-flex; border: 1px solid var(--line-2); border-radius: 99px; padding: 2px; }
.lang button { border: 0; background: none; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; color: var(--muted); }
.lang button.on { background: var(--accent); color: #fff; }
.topnav { align-items: center; }
.card .illo img, .card .illo svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.note.good { color: var(--good); }
.m-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.d-gallery { position: relative; height: 280px; overflow: hidden; background: #ece6dc; }
.d-gallery .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .35s; }
.d-gallery .slide.on { opacity: 1; z-index: 1; }
.d-gallery .slide > img, .d-gallery .slide > svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-gallery .badge { position: absolute; left: 14px; bottom: 14px; background: rgba(30, 38, 38, .62); color: #fff; font-size: 11.5px; padding: 4px 10px; border-radius: 99px; backdrop-filter: blur(4px); }
.d-gallery .dots { position: absolute; z-index: 2; right: 14px; bottom: 16px; display: flex; gap: 6px; }
.d-gallery .dots button { width: 8px; height: 8px; padding: 0; border-radius: 99px; border: 0; background: rgba(255,255,255,.55); }
.d-gallery .dots button.on { background: #fff; width: 20px; }
.d-gallery .d-close { z-index: 3; }
.aerial { overflow: hidden; }
.aerial-inner { position: absolute; width: 768px; height: 768px; }
.aerial-inner img { position: absolute; width: 256px; height: 256px; }
.maplibregl-popup.mtip .maplibregl-popup-content { background: var(--ink); color: #fff; border-radius: 8px; padding: 4px 9px; font: 12.5px var(--sans); box-shadow: none; }
.maplibregl-popup.mtip .maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-group { border-radius: 12px !important; box-shadow: 0 2px 10px rgba(30,38,38,.12) !important; }
.poi-icon { background: #ffffff; border: 1px solid var(--line-2); border-radius: 99px; width: 24px; height: 24px; display: grid; place-items: center; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.08); cursor: default; }
@media (max-width: 900px) { .hide-sm { display: none; } .d-gallery { height: 230px; } }

.head-actions { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.linklike.accent { color: var(--accent); }
a.linklike { text-decoration: none; font-size: 15px; }
a.btn-primary { text-decoration: none; display: inline-block; }

/* ---- Atlantic Light: detail sections as cards, small caps labels, sticky phone CTA ---- */
.drawer { background: var(--bg); }
.d-body { padding: 20px 20px 28px; }
.d-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-top: 12px; border-bottom: 1px solid var(--line); }
.d-sec:last-child { border-bottom: 1px solid var(--line); }
.d-sec h4 { font: 400 19px var(--serif); letter-spacing: 0; text-transform: none; color: var(--ink); margin-bottom: 12px; }
.d-facts { border-bottom: 0; padding-bottom: 6px; }
.d-price { margin-top: 14px; }
.d-price > b { font: 500 32px var(--serif); }
.d-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 6px; margin-top: 8px; }
.d-actions .btn-primary { flex: 1; }
.eyebrow { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.insight { border-radius: 10px; }
.summary { font-weight: 400; }
.hero h1 em { color: var(--accent); }
.stat b { font-weight: 400; }
