:root {
  --wine-dark: #3b0a12;
  --wine: #6d1a2b;
  --wine-light: #9c2b40;
  --cream: #faf6f0;
  --paper: #ffffff;
  --ink: #2a2226;
  --muted: #8a7f84;
  --border: #e9e0d8;
  --sidebar-w: 380px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

#app {
  display: flex;
  height: 100vh;
}

/* ---------- Sidebar ---------- */

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-header {
  padding: 22px 22px 14px;
  background: linear-gradient(160deg, var(--wine-dark), var(--wine));
  color: #f6e8da;
}

.sidebar-header h1 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 34px;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-header h1 span {
  font-weight: 500;
  font-style: italic;
  color: #e3b98c;
}

.tagline {
  margin: 8px 0 0;
  font-size: 12.5px;
  opacity: 0.85;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 16px 10px;
}

.controls #search {
  grid-column: 1 / -1;
}

.controls input,
.controls select {
  font: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  min-width: 0;
}

.controls input:focus,
.controls select:focus {
  border-color: var(--wine-light);
  box-shadow: 0 0 0 3px rgba(156, 43, 64, 0.12);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 2px 18px 8px;
  font-size: 11px;
  color: var(--muted);
}

.legend-item i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
}

.estate-count {
  padding: 4px 18px 6px;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#estate-list {
  list-style: none;
  margin: 0;
  padding: 0 10px 10px;
  overflow-y: auto;
  flex: 1;
}

#estate-list li {
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  transition: background 120ms;
}

#estate-list li:hover { background: #f1e7dc; }
#estate-list li.active { background: #ecdccc; }

.estate-name {
  font-size: 13.5px;
  font-weight: 600;
}

.estate-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.estate-price {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--wine);
}

.sidebar-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}

.sidebar-footer p { margin: 0; }

/* ---------- Map ---------- */

#map-wrap {
  position: relative;
  flex: 1;
}

#map {
  width: 100%;
  height: 100%;
}

.map-error[hidden] { display: none; }

.map-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #f3ece4, #f3ece4 14px, #efe6dc 14px, #efe6dc 28px);
}

.map-error-card {
  max-width: 460px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 30px;
  box-shadow: 0 10px 35px rgba(59, 10, 18, 0.12);
}

.map-error-card h2 {
  margin: 0 0 10px;
  font-family: "Cormorant Garamond", serif;
  color: var(--wine);
}

.map-error-card p { font-size: 14px; line-height: 1.5; }
.map-error-card code {
  background: var(--cream);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}
.map-error-card a { color: var(--wine-light); }

/* ---------- Info window ---------- */

.iw {
  font-family: "Inter", system-ui, sans-serif;
  max-width: 290px;
  padding: 2px 4px;
}

.iw h3 {
  margin: 0 0 2px;
  font-family: "Cormorant Garamond", serif;
  font-size: 21px;
  color: var(--wine-dark);
}

.iw .iw-class {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.iw .iw-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--wine);
  margin: 6px 0 2px;
}

.iw .iw-price-note {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.iw .iw-blurb {
  font-size: 12.5px;
  line-height: 1.45;
  margin: 8px 0;
}

.iw .iw-sources {
  font-size: 10.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%;
    min-width: 0;
    height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
