:root {
  --ink: #1c1915;
  --muted: #5e584f;
  --paper: #f6f3ec;
  --line: #e3ddd2;
  --pin: #24362e;
  --pin-on: #efe6d2;
  --gold: #8d6a32;
  --whatsapp: #1f6b45;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body,
#map {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #d7d3cb;
}

#map {
  height: 100dvh;
}

.maplibregl-ctrl-top-right {
  top: calc(8px + env(safe-area-inset-top));
  right: 8px;
}

.maplibregl-ctrl-top-left {
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
}

.maplibregl-ctrl-attrib {
  font-size: 11px;
}

.filters {
  position: absolute;
  z-index: 3;
  top: calc(56px + env(safe-area-inset-top));
  left: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 68px);
  pointer-events: none;
}

.filters-scroll {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 1px 4px;
  scrollbar-width: none;
  pointer-events: auto;
}

.filters-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid #e4e4e4;
  border-radius: 999px;
  background: #fff;
  color: #3a3a3a;
  font: 550 14px/1 "Avenir Next", "Segoe UI", sans-serif;
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.06);
  cursor: pointer;
}

.chip svg {
  width: 16px;
  height: 16px;
  color: #8a8a8a;
}

.chip-price {
  padding: 0 14px;
}

.chip.is-on {
  padding: 0 13px 0 11px;
  border: 2px solid #1c1c1c;
  color: #1c1c1c;
}

.chip-price.is-on {
  padding: 0 13px;
}

.chip.is-on svg {
  color: #1c1c1c;
}

.filters-more {
  position: absolute;
  top: 2px;
  right: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dadce0;
  border-radius: 50%;
  background: #fff;
  color: #3c4043;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.28), 0 1px 3px 1px rgba(60, 64, 67, 0.12);
  cursor: pointer;
  pointer-events: auto;
}

.filters-back {
  right: auto;
  left: 0;
}

.filters-more[hidden] {
  display: none;
}

.filters-more svg {
  width: 20px;
  height: 20px;
}

.pin {
  display: grid;
  grid-template-columns: 16px auto;
  column-gap: 7px;
  align-items: center;
  padding: 6px 8px 6px 7px;
  border: 2px solid #fff;
  border-radius: 6px;
  background: var(--pin);
  color: #fff;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  text-align: left;
  box-shadow: 0 2px 8px rgba(28, 25, 21, 0.35);
  cursor: pointer;
}

.pin-house {
  background: #6e4b32;
}

.pin-icon {
  grid-row: 1 / span 2;
  width: 16px;
  height: 16px;
}

.pin-size,
.pin-price {
  display: block;
  line-height: 1.2;
  white-space: nowrap;
}

.pin-size {
  font-size: 11px;
  font-weight: 650;
}

.pin-price {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 12px;
  font-weight: 700;
}

.pin.is-selected {
  background: var(--pin-on);
  color: var(--ink);
  transform: scale(1.06);
}

.pin.is-selected .pin-price {
  border-top-color: rgba(28, 25, 21, 0.22);
}

.pin:focus-visible,
.chip:focus-visible,
.filters-more:focus-visible,
.card-close:focus-visible,
.action:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.card {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(82dvh, 720px);
  overflow: auto;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--paper);
  box-shadow: 0 -12px 40px rgba(28, 25, 21, 0.22);
  transform: translateY(105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s ease;
}

.card.is-open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.card-handle {
  width: 42px;
  height: 4px;
  margin: 4px auto 8px;
  border-radius: 999px;
  background: #d3cdc2;
}

.card-toolbar {
  position: sticky;
  top: 10px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  height: 0;
  pointer-events: none;
}

.card-close {
  pointer-events: auto;
  min-height: 36px;
  margin-top: 4px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: 600 13px/1 "Avenir Next", "Segoe UI", sans-serif;
  box-shadow: 0 1px 4px rgba(28, 25, 21, 0.16);
  cursor: pointer;
}

.carousel {
  position: relative;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 14px;
  background: #c8c4bb;
  aspect-ratio: 16 / 10;
  touch-action: pan-y;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.28s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
}

.carousel-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #1c1c1c;
  box-shadow: 0 1px 4px rgba(28, 25, 21, 0.22);
  transform: translateY(-50%);
  cursor: pointer;
}

.carousel-nav svg {
  width: 18px;
  height: 18px;
}

.carousel-prev {
  left: 8px;
}

.carousel-next {
  right: 8px;
}

.carousel-dots {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.carousel-dot.is-on {
  background: #fff;
}

.place {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

h1 {
  margin: 6px 48px 0 0;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.price {
  margin: 10px 0 0;
  color: var(--gold);
  font-size: 1.35rem;
  font-weight: 700;
}

#card-facts {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

#card-facts li {
  position: relative;
  padding: 8px 0 8px 16px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.35;
}

#card-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pin);
}

.actions[hidden] {
  display: none;
}

.actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
  padding-top: 10px;
  background: linear-gradient(to bottom, rgba(246, 243, 236, 0), var(--paper) 10px);
}

.action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
}

.action-call {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px #cfc8bb;
}

.action-whatsapp {
  gap: 8px;
  background: var(--whatsapp);
  color: #fff;
}

.action-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

@media (min-width: 760px) {
  .card {
    left: 16px;
    right: auto;
    bottom: 16px;
    width: 380px;
    max-height: calc(100dvh - 32px);
    border-radius: 18px;
    padding-bottom: 18px;
  }

  .card-handle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .carousel-track {
    transition: none;
  }
}
