:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #5a665f;
  --support: #3f4b45;
  --line: rgba(24, 32, 29, 0.14);
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #fff;
  --surface-muted: #f4f7f4;
  --field-surface: #fff;
  --surface-hover: rgba(37, 111, 87, 0.08);
  --popup-surface: #fff;
  --popup-border: rgba(24, 32, 29, 0.05);
  --popup-control-surface: rgba(255, 255, 255, 0.88);
  --popup-control-hover: #fff;
  --media-surface: #dfe5df;
  --media-gradient: linear-gradient(135deg, rgba(37, 111, 87, 0.14), rgba(217, 111, 50, 0.08));
  --accent: #256f57;
  --accent-hover: #1f5e4a;
  --accent-contrast: #fff;
  --accent-2: #d96f32;
  --focus: rgba(37, 111, 87, 0.42);
  --danger: #7f1d1d;
  --danger-line: rgba(185, 28, 28, 0.28);
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.18);
  --popup-shadow:
    0 1px 2px rgba(17, 24, 39, 0.08),
    0 18px 40px rgba(17, 24, 39, 0.18),
    0 38px 70px rgba(17, 24, 39, 0.14);
  --page-bg: #eef1ed;
  --button-shadow: 0 8px 16px rgba(37, 111, 87, 0.2);
  --control-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="clear"] {
  color-scheme: light;
  --ink: #1c2d27;
  --muted: #607169;
  --support: #384a43;
  --line: rgba(34, 65, 53, 0.2);
  --surface: rgba(239, 246, 236, 0.9);
  --surface-solid: #f4f8f1;
  --surface-muted: #e5eee2;
  --field-surface: rgba(255, 255, 255, 0.74);
  --surface-hover: rgba(37, 111, 87, 0.1);
  --popup-surface: #f4f8f1;
  --popup-border: rgba(34, 65, 53, 0.16);
  --popup-control-surface: rgba(244, 248, 241, 0.9);
  --popup-control-hover: #fff;
  --media-surface: #dce6dc;
  --media-gradient: linear-gradient(135deg, rgba(37, 111, 87, 0.16), rgba(217, 111, 50, 0.1));
  --accent: #256f57;
  --accent-hover: #1f5e4a;
  --accent-contrast: #fff;
  --focus: rgba(37, 111, 87, 0.42);
  --danger: #7f1d1d;
  --danger-line: rgba(185, 28, 28, 0.28);
  --shadow: 0 16px 38px rgba(26, 55, 43, 0.2);
  --popup-shadow:
    0 1px 2px rgba(26, 55, 43, 0.1),
    0 18px 42px rgba(26, 55, 43, 0.2),
    0 34px 68px rgba(26, 55, 43, 0.14);
  --page-bg: #eef4ec;
  --button-shadow: 0 8px 16px rgba(37, 111, 87, 0.2);
  --control-shadow: 0 8px 18px rgba(26, 55, 43, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body,
.shell,
.map {
  width: 100%;
  height: 100%;
  min-height: 420px;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--page-bg);
}

button,
input,
select {
  font: inherit;
}

.shell {
  position: relative;
}

.map {
  position: absolute;
  inset: 0;
}

.toolbar {
  position: absolute;
  z-index: 4;
  top: 14px;
  left: 14px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: min(760px, calc(100% - 190px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  color: var(--accent-contrast);
  background: var(--accent);
  font-size: 12px;
  letter-spacing: 0;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(320px, 34vw);
  min-width: 220px;
}

.location-field {
  min-width: 0;
  flex: 1 1 auto;
}

.search input,
.location-field input,
select,
button {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--field-surface);
}

.search input,
.location-field input {
  min-width: 0;
  padding: 0 10px;
}

.location-submit {
  width: auto;
  min-width: 44px;
  flex: 0 0 auto;
  border-color: var(--accent);
  color: var(--accent-contrast);
  background: var(--accent);
}

.location-submit:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

select {
  padding: 0 28px 0 10px;
}

.style-switcher {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.style-switcher button {
  height: 30px;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.style-switcher button[aria-checked="true"] {
  color: var(--ink);
  background: var(--surface-solid);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.style-switcher button:hover:not([aria-checked="true"]) {
  color: var(--ink);
}

button {
  min-width: 70px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 650;
}

button:hover,
select:hover,
.search input:hover,
.location-field input:hover {
  border-color: var(--accent);
}

.location-results {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.location-option,
.location-results-empty {
  width: 100%;
  height: auto;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: var(--surface-solid);
  text-align: left;
}

.location-option {
  display: grid;
  gap: 2px;
}

.location-option:hover,
.location-option[aria-selected="true"] {
  background: var(--surface-hover);
}

.location-option-name,
.location-option-context {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-option-name {
  font-size: 13px;
  font-weight: 750;
}

.location-option-context,
.location-results-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.search-area {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  width: auto;
  min-width: 148px;
  max-width: calc(100% - 28px);
  border-color: transparent;
  color: var(--accent-contrast);
  background: var(--accent);
  box-shadow: var(--shadow);
}

.search-area:hover {
  border-color: transparent;
  background: var(--accent-hover);
}

.search-area[hidden] {
  display: none;
}

.status,
.empty,
.error {
  position: absolute;
  z-index: 2;
  left: 14px;
  bottom: 14px;
  max-width: min(520px, calc(100% - 28px));
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.35;
}

.empty,
.error {
  color: var(--ink);
}

.error {
  border-color: var(--danger-line);
  color: var(--danger);
}

.rw-popup {
  --rw-popup-pad: 12px;
  width: min(294px, calc(100vw - 52px));
  max-width: none;
  padding: var(--rw-popup-pad);
  color: var(--ink);
  background: var(--popup-surface);
}

.rw-popup-media {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 2;
  margin: 0 0 12px;
  border-radius: 6px;
  background:
    var(--media-gradient),
    var(--media-surface);
}

.rw-popup-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.rw-popup:hover .rw-popup-media img {
  transform: scale(1.035);
}

.rw-popup-body {
  display: grid;
  gap: 0;
}

.rw-popup-title {
  display: -webkit-box;
  margin: 0 0 6px;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 760;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rw-popup-meta,
.rw-popup-details,
.rw-popup-address {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rw-popup-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rw-popup-details {
  color: var(--support);
  font-size: 12.5px;
  font-weight: 650;
}

.rw-popup-address {
  margin-top: 4px;
}

.rw-popup-price {
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 780;
}

.rw-popup-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 34px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--accent-contrast);
  background: var(--accent);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.rw-popup-link:hover {
  background: var(--accent-hover);
  box-shadow: var(--button-shadow);
  transform: translateY(-1px);
}

.rw-popup-carousel {
  width: min(310px, calc(100vw - 52px));
}

.rw-popup-carousel-stage {
  position: relative;
  display: grid;
}

.rw-popup-slide {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px) scale(0.99);
  transition:
    opacity 220ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 260ms;
}

.rw-popup-slide.is-active {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  transition-delay: 0s;
}

.rw-popup-carousel-overlay {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 3 / 2;
  pointer-events: none;
}

.rw-popup-control {
  display: inline-grid;
  width: 34px;
  min-width: 0;
  height: 34px;
  margin: 0 8px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--popup-control-surface);
  box-shadow: var(--control-shadow);
  font-size: 24px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.rw-popup-control:hover {
  border-color: var(--line);
  background: var(--popup-control-hover);
  transform: scale(1.04);
}

.rw-popup-control:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.rw-popup-dots {
  position: absolute;
  right: 0;
  bottom: 10px;
  left: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.rw-popup-dot {
  width: 7px;
  min-width: 0;
  height: 7px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.22);
  cursor: pointer;
  transition:
    width 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.rw-popup-dot[aria-current="true"] {
  width: 18px;
  border-color: #fff;
  background: #fff;
}

.rw-popup-dot:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.mapboxgl-popup-content {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--popup-border);
  border-radius: 8px;
  background: var(--popup-surface);
  box-shadow: var(--popup-shadow);
  animation: rw-popup-enter 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.rw-popup-from-marker .mapboxgl-popup-tip {
  display: none;
}

.rw-popup-from-marker .mapboxgl-popup-content {
  transform-origin: 50% 100%;
  animation: rw-marker-card-enter 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: clip-path, transform, opacity;
}

.mapboxgl-popup-close-button {
  z-index: 3;
  top: 6px;
  right: 6px;
  width: 26px;
  min-width: 0;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: var(--popup-control-surface);
  font-size: 18px;
  line-height: 24px;
}

.mapboxgl-popup-close-button:hover {
  background: var(--popup-control-hover);
}

@keyframes rw-popup-enter {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rw-marker-card-enter {
  0% {
    opacity: 0.98;
    clip-path: inset(calc(100% - 34px) calc(50% - 42px) 0 calc(50% - 42px) round 999px);
    transform: translateY(7px) scale(0.98);
  }

  45% {
    clip-path: inset(calc(100% - 92px) 44px 0 44px round 18px);
  }

  100% {
    opacity: 1;
    clip-path: inset(0 round 8px);
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rw-popup-media img,
  .rw-popup-slide,
  .rw-popup-control,
  .rw-popup-dot,
  .rw-popup-link {
    transition: none;
  }

  .rw-popup:hover .rw-popup-media img,
  .rw-popup-control:hover,
  .rw-popup-link:hover {
    transform: none;
  }

  .mapboxgl-popup-content {
    animation: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  html,
  body,
  .shell,
  .map {
    min-height: 520px;
  }

  .toolbar {
    right: 14px;
    width: auto;
    max-width: none;
    flex-wrap: wrap;
  }

  .location-search {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }

  .brand {
    max-width: calc(100vw - 46px);
  }

  .search-area {
    top: 84px;
    right: 14px;
  }
}
