:root {
  --ink: #16231f;
  --muted: #66706c;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #ded8cb;
  --pine: #1f4d40;
  --pine-soft: #dfe9e3;
  --apricot: #f2a46f;
  --shadow: 0 18px 45px rgba(30, 48, 41, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
a { color: inherit; }

.hero {
  position: relative;
  overflow: hidden;
  color: #fdfaf2;
  background:
    radial-gradient(circle at 78% 20%, rgba(242, 164, 111, .38), transparent 25rem),
    linear-gradient(135deg, #173d34 0%, #214e42 55%, #16362f 100%);
}
.hero::after {
  content: "";
  position: absolute;
  right: -6rem;
  bottom: -11rem;
  width: 28rem;
  height: 28rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
}
.hero__inner, .page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero__inner { position: relative; z-index: 1; padding: 34px 0 30px; }
.hero__title-row { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.local-badge { padding: 7px 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: rgba(255,255,255,.74); font: 700 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #e8c6ad; }
.eyebrow--dark { color: var(--pine); }
h1 { max-width: 720px; margin: 0; font: 700 clamp(34px, 5vw, 54px)/1 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
.hero__lead { max-width: 610px; margin: 14px 0 0; color: rgba(255,255,255,.78); font-size: 16px; line-height: 1.5; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 34px; margin-top: 24px; }
.stats div { display: grid; gap: 2px; min-width: 110px; }
.stats strong { font: 700 28px/1 Georgia, serif; }
.stats span { color: rgba(255,255,255,.64); font-size: 13px; }

.page { padding: 30px 0 72px; }
.notice { display: flex; align-items: center; gap: 9px; margin-bottom: 24px; padding: 13px 15px; border: 1px solid #e3c9b6; border-radius: 12px; color: #664a37; background: #fff4eb; font-size: 14px; }
.notice[hidden] { display: none; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font: 700 clamp(30px, 4vw, 44px)/1 Georgia, serif; }
.freshness { margin: 0; color: var(--muted); font-size: 14px; }
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(145px, 1fr)); gap: 12px; align-items: end; margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.72); }
.filter { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 750; }
.filter input, .filter select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #c9c5ba; border-radius: 9px; color: var(--ink); background: white; font: inherit; font-size: 14px; font-weight: 500; }
.check-filter { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.check-filter input { width: 18px; height: 18px; accent-color: var(--pine); }
.result-row { display: flex; align-items: center; justify-content: space-between; min-height: 34px; }
.result-count { margin: 0; color: var(--muted); font-size: 14px; }
.map-panel { margin: 14px 0 28px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.map-panel__header { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 18px 20px; }
.map-panel__header .eyebrow { margin-bottom: 7px; }
.map-panel__header h3 { margin: 0; font: 700 25px/1.15 Georgia, serif; }
.map-panel__count { margin: 0; color: var(--muted); font-size: 13px; font-weight: 750; }
.map-canvas { width: 100%; background: linear-gradient(145deg, #e7eee9, #ccd9d2); }
.map-canvas--overview { height: clamp(360px, 54vh, 620px); }
.map-canvas--detail { height: 390px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.map-canvas.is-unavailable { display: none; }
.property-map-icon-shell { background: transparent; border: 0; }
.property-map-icon { display: block; box-sizing: border-box; width: 30px; height: 30px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; box-shadow: 0 3px 10px rgb(22 40 34 / 35%); transform: rotate(-45deg); }
.property-map-icon--apartment { background: #1d735c; }
.property-map-icon--house { background: #b65f34; }
.property-map-icon::after { content: ''; display: block; width: 8px; height: 8px; margin: 8px; border-radius: 50%; background: rgb(255 255 255 / 92%); }
.map-status { margin: 0; padding: 16px 20px; color: var(--muted); background: #f9f7f1; font-size: 14px; }
.map-status[hidden] { display: none; }
.map-preview { width: 290px; overflow: hidden; color: var(--ink); background: white; }
.map-preview img { width: 100%; height: 132px; display: block; object-fit: cover; }
.map-preview__body { display: grid; gap: 6px; padding: 10px 2px 2px; }
.map-preview__body strong { color: var(--pine); font: 700 19px/1.1 Georgia, serif; }
.map-preview__body span { font-weight: 800; line-height: 1.25; }
.map-preview__body p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.status { min-height: 24px; margin: 0 0 18px; color: var(--muted); }
.status[hidden] { display: none; }
.property-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.property-card { min-width: 0; overflow: hidden; border: 1px solid rgba(80,75,62,.14); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.property-card--bargain { border: 2px solid #298158; }
.bargain-badge { display: inline-block; margin: 10px 0 4px; padding: 6px 10px; border-radius: 8px; background: #dff1e5; color: #175637; font-size: 13px; font-weight: 800; }
.bargain-explanation { padding: 14px; margin-bottom: 16px; border: 1px solid #a6cdb3; border-radius: 12px; background: #edf6ef; color: #244832; }
.bargain-explanation p { font-size: 13px; line-height: 1.5; }
.bargain-peers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.property-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #d9e1db; }
.property-card__media img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease; }
.property-card:hover .property-card__media img { transform: scale(1.025); }
.property-card__media.no-photo img { display: none; }
.photo-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(31,77,64,.5); background: linear-gradient(145deg, #e7eee9, #ccd9d2); }
.photo-placeholder span { display: grid; place-items: center; width: 76px; height: 76px; border: 1px solid currentColor; border-radius: 50%; font: 700 27px Georgia, serif; }
.property-card__media:not(.no-photo) .photo-placeholder { display: none; }
.property-kind, .photo-count { position: absolute; top: 14px; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; backdrop-filter: blur(9px); }
.property-kind { left: 14px; color: var(--pine); background: rgba(255,253,248,.9); }
.photo-count { right: 14px; color: white; background: rgba(19,35,30,.66); }
.property-card__body { padding: 20px; }
.price-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.price { margin: 0; font: 700 27px/1.1 Georgia, serif; letter-spacing: -.02em; }
.translation-state { flex: none; padding: 5px 8px; border-radius: 7px; color: var(--pine); background: var(--pine-soft); font-size: 11px; font-weight: 800; }
.translation-state.is-original { color: #78533b; background: #f7e6d9; }
.facts { margin: 9px 0 18px; color: var(--pine); font-size: 14px; font-weight: 750; }
.property-card h3 { margin: 0; font: 700 21px/1.22 Georgia, serif; }
.location { min-height: 21px; margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.description { display: -webkit-box; min-height: 66px; margin: 18px 0; overflow: hidden; color: #4d5652; font-size: 14px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.source-block { padding-top: 16px; border-top: 1px solid var(--line); }
.source-caption { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.source-links { display: flex; flex-wrap: wrap; gap: 7px; }
.source-links a { min-height: 34px; display: inline-flex; align-items: center; padding: 7px 10px; border: 1px solid #cbd7d0; border-radius: 9px; color: var(--pine); background: #f7faf7; font-size: 12px; font-weight: 800; text-decoration: none; }
.source-links a:hover { border-color: var(--pine); background: white; }
.button { min-height: 42px; padding: 9px 13px; border: 0; border-radius: 9px; color: white; background: var(--pine); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.button:hover { background: #143e32; }
.button--quiet { align-self: end; color: var(--pine); background: var(--pine-soft); }
.button--quiet:hover { background: #ceded5; }
.card-detail { width: 100%; margin-top: 14px; }
:focus-visible { outline: 3px solid var(--apricot); outline-offset: 3px; }

.property-dialog { width: min(1040px, calc(100% - 30px)); max-width: none; max-height: calc(100vh - 30px); padding: 0; overflow: hidden; border: 0; border-radius: 18px; color: var(--ink); background: var(--card); box-shadow: 0 30px 90px rgba(15,31,25,.32); }
.property-dialog::backdrop { background: rgba(13,24,21,.58); backdrop-filter: blur(3px); }
.dialog-shell { max-height: calc(100vh - 30px); overflow: auto; }
.dialog-header { position: sticky; z-index: 3; top: 0; display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 21px 24px; border-bottom: 1px solid var(--line); background: rgba(255,253,248,.96); backdrop-filter: blur(10px); }
.dialog-header h2 { max-width: 820px; margin: 0; font: 700 clamp(25px, 3vw, 36px)/1.1 Georgia, serif; }
.dialog-close { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: white; font-size: 28px; line-height: 1; cursor: pointer; }
.dialog-content { padding: 24px; }
.detail-overview { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(340px, 1.2fr); gap: 24px; }
.detail-photo { position: relative; overflow: hidden; min-height: 280px; border-radius: 14px; background: linear-gradient(145deg, #e7eee9, #ccd9d2); }
.detail-photo img { width: 100%; height: 100%; min-height: 280px; display: block; object-fit: cover; }
.detail-photo.no-photo img { display: none; }
.detail-photo .photo-placeholder { display: grid; }
.detail-photo:not(.no-photo) .photo-placeholder { display: none; }
.detail-price { margin: 0 0 18px; font: 700 34px/1 Georgia, serif; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.fact { min-height: 72px; padding: 12px; background: var(--card); }
.fact span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.fact strong { font-size: 15px; }
.detail-section { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 14px; font: 700 24px/1.2 Georgia, serif; }
.detail-description { max-width: 820px; margin: 0; white-space: pre-line; color: #3f4945; font-size: 16px; line-height: 1.65; }
.detail-map__header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.detail-map__header .map-status { flex: 1; padding: 0; background: transparent; }
.map-external-link { color: var(--pine); font-size: 13px; font-weight: 800; }
.original-details { max-width: 820px; margin-top: 16px; }
.original-details summary { color: var(--pine); font-weight: 800; cursor: pointer; }
.source-list { display: grid; gap: 10px; }
.source-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(110px, .7fr) minmax(160px, 1fr) auto; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.source-row__name { font-weight: 850; }
.source-row__meta { color: var(--muted); font-size: 13px; }
.source-status { font-size: 12px; font-weight: 800; }
.source-status.is-inactive { color: #92513e; }
.source-row a { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 11px; border-radius: 8px; color: white; background: var(--pine); font-size: 13px; font-weight: 800; text-decoration: none; }
.history-summary { margin: -5px 0 15px; color: var(--muted); font-size: 14px; }
.history-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.history-event { position: relative; display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 0 0 18px 22px; border-left: 2px solid #cbd8d1; }
.history-event::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--pine); }
.history-event time { color: var(--muted); font-size: 13px; }
.history-event p { margin: 0; line-height: 1.45; }
.history-event small { display: block; margin-top: 3px; color: var(--muted); }
.empty-panel { padding: 20px; border: 1px dashed #c8c2b5; border-radius: 12px; color: var(--muted); background: #faf7f0; }

@media (max-width: 900px) {
  .property-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter--search { grid-column: 1 / -1; }
  .detail-overview { grid-template-columns: 1fr; }
  .map-canvas--overview { height: 430px; }
}
@media (max-width: 620px) {
  .hero__inner, .page { width: min(100% - 24px, 1180px); }
  .hero__inner { padding: 42px 0 38px; }
  .page { padding-top: 32px; }
  .section-heading { align-items: start; flex-direction: column; gap: 10px; }
  .property-grid { grid-template-columns: 1fr; }
  .hero__title-row { display: block; }
  .local-badge { display: inline-block; margin-top: 14px; }
  .notice { align-items: start; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .filter--search { grid-column: auto; }
  .source-links a { min-height: 44px; }
  .property-dialog { width: 100%; max-height: 100vh; border-radius: 0; }
  .dialog-shell { max-height: 100vh; }
  .dialog-header, .dialog-content { padding: 16px; }
  .source-row { grid-template-columns: 1fr 1fr; }
  .source-row a { grid-column: 1 / -1; }
  .history-event { grid-template-columns: 1fr; gap: 5px; }
  .map-panel__header, .detail-map__header { align-items: start; flex-direction: column; }
  .map-canvas--overview { height: 380px; }
  .map-canvas--detail { height: 310px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Map workspace */
html, body { width: 100%; height: 100%; overflow: hidden; }
body { min-width: 0; }
.map-workspace { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
.map-canvas--overview { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-overlay-status { position: absolute; z-index: 600; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(90vw, 520px); margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(255,253,248,.95); box-shadow: 0 4px 18px rgba(20,35,30,.18); color: #33483f; font-size: 13px; text-align: center; }
.map-overlay-status[hidden] { display: none; }
.search-drawer { position: absolute; z-index: 1000; left: 50%; top: 0; width: min(900px, calc(100% - 32px)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.search-drawer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 14px; }
.drawer-handle { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 16px; border: 1px solid rgba(36,66,54,.16); border-top: 0; border-radius: 0 0 11px 11px; background: rgba(255,253,248,.96); color: #1f4d40; box-shadow: 0 4px 16px rgba(20,35,30,.14); font: 700 13px system-ui,sans-serif; cursor: pointer; }
.drawer-handle span:first-child { font-size: 20px; line-height: 1; }
.drawer-chevron { font-size: 17px; line-height: 1; }
.drawer-content { width: 100%; max-height: calc(100dvh - 45px); overflow: auto; padding: 14px; border: 1px solid rgba(36,66,54,.15); border-radius: 15px; background: rgba(255,253,248,.97); box-shadow: 0 12px 30px rgba(20,35,30,.18); opacity: 0; visibility: hidden; transform: translateY(-12px); transition: opacity .16s ease, transform .16s ease, visibility .16s; }
.search-drawer:hover .drawer-content, .search-drawer:focus-within .drawer-content, .search-drawer.is-open .drawer-content { opacity: 1; visibility: visible; transform: translateY(0); }
.drawer-content .filters { margin: 0; padding: 0; border: 0; background: transparent; }
.drawer-footer { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 2px 0; color: var(--muted); font-size: 12px; }
.drawer-footer p { margin: 0; }
.leaflet-bottom.leaflet-right { bottom: 10px; right: 8px; }
@media (max-width: 620px) {
  .search-drawer { width: calc(100% - 20px); }
  .drawer-content { padding: 12px; }
  .drawer-content .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .drawer-content .filter--search { grid-column: 1 / -1; }
  .drawer-content .check-filter { min-height: 34px; }
  .map-overlay-status { bottom: 50px; }
}

.search-drawer { height: 32px; }
.drawer-content { position: absolute; top: 32px; left: 0; }

/* Numeric ranges in the map filter drawer */
.drawer-content .filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.drawer-content .filter--search { grid-column: span 3; }
.range-filter { grid-column: span 2; min-width: 0; padding: 0; margin: 0; border: 0; }
.range-filter legend { padding: 0; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.range-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.range-fields input { min-width: 0; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #c9c5ba; border-radius: 9px; color: var(--ink); background: white; font: 500 14px system-ui,sans-serif; }
.drawer-content .check-filter { grid-column: span 2; }
@media (max-width: 620px) {
  .drawer-content .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-content .filter--search, .range-filter { grid-column: 1 / -1; }
  .drawer-content .check-filter { grid-column: span 1; }
}


.price-comparison { padding: 14px; margin: 12px 0 16px; border: 1px solid #d8ddd9; border-radius: 12px; background: #f5f7f5; color: #34433c; }
.price-comparison--bargain { border-color: #a6cdb3; background: #edf6ef; color: #244832; }
.price-comparison p { font-size: 13px; line-height: 1.5; }
.map-preview__comparison { color: #395b4b; font-size: 12px; line-height: 1.35; }

/* Keep the count visible without opening the search panel. */
.map-summary { position: absolute; z-index: 900; top: 12px; right: 12px; max-width: min(240px, calc(100% - 24px)); padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,253,248,.96); box-shadow: 0 4px 18px rgba(20,35,30,.12); pointer-events: none; }
.map-summary p { margin: 0; }
#map-count { color: var(--ink); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.map-summary__progress { margin-top: 4px !important; color: var(--muted); font-size: 12px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.map-summary__progress[hidden] { display: none; }
@media (max-width: 620px) {
  .search-drawer { top: 82px; }
  .map-summary { top: 10px; right: 10px; }
}
