:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.488 0.243 264.376);
  --primary-foreground: oklch(0.97 0.014 254.604);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --radius: 0.45rem;
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-heading: 'Geist', var(--font-sans);
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;
}

.dark {
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.424 0.199 265.638);
  --primary-foreground: oklch(0.97 0.014 254.604);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
}

html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.price-pin {
  background: var(--primary);
  color: var(--primary-foreground);
  font: 600 11px/1 var(--font-sans);
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35), 0 0 0 2px #fff inset;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.price-pin:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 20px rgba(30, 64, 175, 0.45), 0 0 0 2px #fff inset;
}

.ol-attribution {
  background: rgba(255, 255, 255, 0.7) !important;
  border-radius: 8px !important;
  font-size: 10px !important;
}

.themed-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklch, var(--primary) 55%, transparent) transparent;
  scrollbar-gutter: stable;
}
.themed-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.themed-scrollbar::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}
.themed-scrollbar::-webkit-scrollbar-thumb {
  background: color-mix(in oklch, var(--primary) 35%, transparent);
  border-radius: 9999px;
  transition: background 200ms ease;
}
.themed-scrollbar::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklch, var(--primary) 70%, transparent);
}
.themed-scrollbar::-webkit-scrollbar-thumb:active {
  background: var(--primary);
}

.range-thumb { pointer-events: none; }
.range-thumb::-webkit-slider-thumb {
  pointer-events: auto;
  appearance: none;
  background: var(--primary);
  cursor: grab;
  border: 2px solid #fff;
  border-radius: 9999px;
  width: 18px;
  height: 18px;
  transition: transform 0.15s;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.18);
}
.range-thumb::-webkit-slider-thumb:hover { transform: scale(1.1); }
.range-thumb::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
.range-thumb::-moz-range-thumb {
  pointer-events: auto;
  background: var(--primary);
  cursor: grab;
  border: 2px solid #fff;
  border-radius: 9999px;
  width: 18px;
  height: 18px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.18);
}
.range-thumb::-webkit-slider-runnable-track { background: transparent; }
.range-thumb::-moz-range-track { background: transparent; }

@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lightbox-zoom {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.lightbox-fade { animation: lightbox-fade 180ms ease-out; }
.lightbox-zoom { animation: lightbox-zoom 260ms cubic-bezier(0.22, 1, 0.36, 1); }

.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track { -ms-overflow-style: none; scrollbar-width: none; touch-action: pan-x; }

.collapsible {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 500ms ease-out, opacity 500ms ease-out, margin 500ms ease-out;
}
.collapsible.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 1.25rem;
}
.collapsible > div { overflow: hidden; }

[hidden] { display: none !important; }

/* ── Measure tooltips ─────────────────────────────────────────── */
.tooltip {
  position: relative;
  font: 600 11px var(--font-sans);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}

/* Live label that follows the sketch */
.tooltip-measure {
  background: var(--destructive);
  color: #fff;
  padding: 4px 10px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}

/* Permanent label left on the map after draw ends */
.tooltip-static {
  background: #fff;
  color: var(--destructive);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1.5px solid var(--destructive);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}

/* Small downward pointer */
.tooltip-measure::after,
.tooltip-static::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  translate: -50% 0;
  border: 5px solid transparent;
  border-top-color: var(--destructive);
}


/* ==========================================================================
   Map tour (?maptour) — right-rail story panel
   ========================================================================== */
body.maptour-active #top-search,
body.maptour-active #toolbox {
  display: none !important;
}

#maptour-overlay {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  z-index: 60;
  pointer-events: auto;
}

.maptour-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.22), 0 0 0 1px rgb(0 0 0 / 0.05);
  overflow: hidden;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.maptour-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.95);
  color: #525252;
  border: 1px solid rgb(0 0 0 / 0.08);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.maptour-close:hover {
  background: #fff;
  color: #111;
}
.maptour-close i {
  width: 16px;
  height: 16px;
}

.maptour-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #f5f5f5, #e5e5e5);
  overflow: hidden;
}
.maptour-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.maptour-photo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #a3a3a3;
  font-size: 12px;
  font-weight: 500;
}
.maptour-photo-empty i {
  width: 28px;
  height: 28px;
  opacity: 0.7;
}
.maptour-kind-pill {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  backdrop-filter: blur(4px);
}

.maptour-body {
  padding: 16px 18px 12px;
  flex: 1;
  overflow-y: auto;
}
.maptour-progress {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #737373;
  margin-bottom: 6px;
}
.maptour-title {
  font-family: 'Geist', 'DM Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  color: #0a0a0a;
  margin: 0 0 8px;
}
.maptour-blurb {
  font-size: 13.5px;
  line-height: 1.55;
  color: #404040;
  margin: 0;
}

.maptour-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid rgb(0 0 0 / 0.06);
  background: rgb(250 250 250 / 0.7);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.maptour-audio {
  width: 100%;
  height: 34px;
  border-radius: 9999px;
}
.maptour-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.maptour-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: #fff;
  border: 1px solid rgb(0 0 0 / 0.08);
  color: #404040;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.maptour-btn:hover {
  background: #f5f5f5;
  color: #111;
}
.maptour-btn:active {
  transform: scale(0.96);
}
.maptour-btn i {
  width: 16px;
  height: 16px;
}
.maptour-btn-primary {
  width: 46px;
  height: 46px;
  background: #0a0a0a;
  color: #fff;
  border-color: #0a0a0a;
}
.maptour-btn-primary:hover {
  background: #262626;
  color: #fff;
}
.maptour-btn-primary i {
  width: 18px;
  height: 18px;
}

@media (max-width: 640px) {
  #maptour-overlay {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 70vh;
  }
}

/* ==========================================================================
   Map tour — intro card, carousel, scene label
   ========================================================================== */

.maptour-loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 9999px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.18);
  font-size: 13px;
  color: #404040;
}
.maptour-loading i {
  width: 16px;
  height: 16px;
  animation: maptour-spin 1s linear infinite;
}
@keyframes maptour-spin { to { transform: rotate(360deg); } }

.maptour-intro {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  animation: maptour-fade 0.25s ease;
}
@keyframes maptour-fade { from { opacity: 0; } to { opacity: 1; } }

.maptour-intro-card {
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.32);
  text-align: center;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.maptour-intro-eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #737373;
  margin-bottom: 4px;
}
.maptour-intro-title {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #0a0a0a;
  margin: 0 0 10px;
}
.maptour-intro-sub {
  font-size: 13.5px;
  line-height: 1.55;
  color: #525252;
  margin: 0 0 20px;
}
.maptour-intro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
.maptour-intro-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: #fafafa;
  border-radius: 14px;
  border: 1px solid rgb(0 0 0 / 0.06);
}
.maptour-intro-stats strong {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #0a0a0a;
  line-height: 1;
  margin-bottom: 4px;
}
.maptour-intro-stats span {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #737373;
}

.maptour-intro-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 9999px;
  background: #0a0a0a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.maptour-intro-btn:hover { background: #262626; }
.maptour-intro-btn:active { transform: scale(0.98); }
.maptour-intro-btn i { width: 16px; height: 16px; }
.maptour-intro-skip {
  margin-top: 8px;
  background: transparent;
  border: 0;
  color: #737373;
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 10px;
}
.maptour-intro-skip:hover { color: #0a0a0a; }

/* Scene label inside the right rail */
.maptour-scene-label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(244, 63, 94, 0.1);
  color: rgb(190, 18, 60);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.maptour-scene-label:empty { display: none; }

/* Carousel media + controls */
.maptour-media-slot {
  position: absolute;
  inset: 0;
}
.maptour-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.maptour-carousel-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.maptour-carousel-nav i { width: 16px; height: 16px; }
.maptour-carousel-prev { left: 8px; }
.maptour-carousel-next { right: 8px; }
.maptour-photo-wrap:hover .maptour-carousel-nav {
  opacity: 1;
}
.maptour-carousel-nav:hover {
  background: rgba(0, 0, 0, 0.7);
}

.maptour-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  gap: 6px;
}
.maptour-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.55);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.maptour-dot.is-active {
  background: #fff;
  transform: scale(1.3);
}
