:root {
  color-scheme: light;
  --sand: #f4efe6;
  --ink: #1b1b1b;
  --clay: #c7a27a;
  --ocean: #345c6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff6e8 0%, #f4efe6 60%, #eadbc6 100%);
}

header {
  padding: 24px clamp(16px, 4vw, 48px) 8px;
  position: relative;
}

header h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  text-align: center;
}

.site-help {
  display: flex;
  justify-content: center;
  position: relative;
}

#site-help-button {
  border: 1px solid rgba(27, 27, 27, 0.25);
  background: white;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

#site-help-button:hover {
  border-color: rgba(52, 92, 107, 0.45);
}

#site-help-button:focus-visible {
  outline: 2px solid rgba(52, 92, 107, 0.6);
  outline-offset: 2px;
}

.site-help-text {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px));
  background: white;
  border: 1px solid rgba(27, 27, 27, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 10px 24px rgba(27, 27, 27, 0.14);
  font-size: 13px;
  line-height: 1.4;
  z-index: 20;
  display: none;
}

.site-help:hover .site-help-text,
.site-help.is-open .site-help-text {
  display: block;
}

header p {
  margin: 0;
  max-width: 540px;
  text-align: center;
  margin-inline: auto;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px) 32px;
}

#map-panel {
  width: min(720px, 100%);
  display: grid;
  gap: 10px;
}

#map {
  width: 100%;
  height: 480px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(52, 92, 107, 0.2);
  box-shadow: 0 12px 24px rgba(27, 27, 27, 0.08);
}

#coffee-button-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
}

#coffee-button-slot > * {
  position: static !important;
  bottom: auto !important;
  right: auto !important;
  left: auto !important;
}

aside {
  width: min(720px, 100%);
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 24px rgba(27, 27, 27, 0.08);
  border: 1px solid rgba(27, 27, 27, 0.08);
}

#top-switches {
  display: flex;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

#data-source-switch {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(27, 27, 27, 0.16);
  border-radius: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex: 1 1 300px;
}

#data-source-switch legend {
  padding: 0 6px;
  font-weight: 600;
}

#data-source-switch label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#sale-or-rent-switch {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(27, 27, 27, 0.16);
  border-radius: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex: 1 1 300px;
}

#sale-or-rent-switch legend {
  padding: 0 6px;
  font-weight: 600;
}

#sale-or-rent-switch label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#property-filters {
  margin: 0 0 12px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(27, 27, 27, 0.16);
  border-radius: 10px;
  display: grid;
  gap: 8px;
}

#property-filters legend {
  padding: 0 6px;
  font-weight: 600;
}

#property-filters label {
  font-size: 14px;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filter-field {
  display: grid;
  gap: 6px;
}

#property-filters input[type="text"],
#property-filters select {
  width: 100%;
  border: 1px solid rgba(27, 27, 27, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: white;
}

#property-filters label.is-disabled {
  opacity: 0.5;
}

#property-filters select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(27, 27, 27, 0.06);
}

#property-filters input[type="range"] {
  width: 100%;
}

.filter-divider {
  height: 1px;
  margin: 6px 0;
  background: linear-gradient(to right, rgba(27, 27, 27, 0.08), rgba(27, 27, 27, 0.24), rgba(27, 27, 27, 0.08));
}

#price-range-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

#price-range-values span:first-child,
#price-range-values span:last-child {
  font-weight: 600;
}

@media (max-width: 640px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
}

#status {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--sand);
  border-radius: 8px;
}

#reset-view {
  display: block;
  margin: 0 auto 12px;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  background: var(--ocean);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

#reset-view:hover {
  filter: brightness(1.05);
}

#reset-view:focus-visible {
  outline: 2px solid rgba(52, 92, 107, 0.6);
  outline-offset: 2px;
}

#reset-view.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

#property-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.property-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(199, 162, 122, 0.15);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.property-item.is-selected {
  background: rgba(52, 92, 107, 0.18);
  box-shadow: 0 8px 20px rgba(27, 27, 27, 0.12);
  transform: translateY(-1px);
}

.property-item.is-dimmed {
  opacity: 0.35;
  filter: grayscale(0.8);
}

@media (max-width: 900px) {
  main {
    align-items: stretch;
  }
}
