/* Noise demo widget — full-bleed Mapbox map with right sidebar.
   Same visual language as the property-scores dev inspector but locked
   to 5 pre-cached locations (no API calls). */

.noise-demo {
  margin-top: 3rem;
  position: relative;
  width: 100%;
  height: 600px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
@media (max-width: 768px) {
  .noise-demo { height: 720px; }
}

.noise-demo__map { position: absolute; top: 0; left: 0; right: 320px; bottom: 0; }
@media (max-width: 768px) {
  .noise-demo__map { right: 0; bottom: 50%; }
}

/* Right sidebar */
.noise-demo__sidebar {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 320px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 16px;
  font-size: 0.82rem;
}
@media (max-width: 768px) {
  .noise-demo__sidebar {
    top: auto; bottom: 0; left: 0; width: auto; max-height: 50%;
    border-left: none; border-top: 1px solid var(--border-subtle);
  }
}

/* Location chips inside sidebar */
.noise-demo__chip {
  padding: 5px 9px; border-radius: 6px;
  background: white; border: 1px solid #e2e8f0;
  font-size: 0.7rem; color: #475569; cursor: pointer;
  font-weight: 500; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.15s;
  text-align: left; line-height: 1.2;
}
.noise-demo__chip:hover { border-color: #94a3b8; }
.noise-demo__chip.is-active { background: #0f172a; color: white; border-color: #0f172a; }
.noise-demo__chip-db {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.65rem; opacity: 0.7;
}
.noise-demo__chip.is-active .noise-demo__chip-db { opacity: 0.9; }

/* Sidebar sections */
.noise-demo__section { margin-bottom: 14px; }
.noise-demo__section-title {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #94a3b8; margin-bottom: 6px;
}
.noise-demo__card {
  background: white; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px;
}

/* Layer switches — row with label left, switch right */
.noise-demo__switches { padding: 4px 8px; }
.noise-demo__switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; cursor: pointer; user-select: none;
  font-size: 0.78rem; color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}
.noise-demo__switch-row:last-child { border-bottom: none; }

/* Score headline */
.noise-demo__db-row {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px;
}
.noise-demo__db {
  font-size: 2.2rem; font-weight: 700; line-height: 1;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: -0.02em;
}
.noise-demo__db-unit { font-size: 0.78rem; color: #64748b; font-weight: 600; }
.noise-demo__db-label { font-size: 0.78rem; color: #475569; font-weight: 600; margin-bottom: 6px; }

.noise-demo__gauge {
  position: relative; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #22c55e 0%, #84cc16 22%, #f59e0b 44%, #ef4444 66%, #b91c1c 100%);
  margin-bottom: 4px;
}
.noise-demo__gauge-pin {
  position: absolute; top: -3px;
  width: 3px; height: 12px; background: #0f172a; border-radius: 2px;
  transform: translateX(-50%); transition: left 0.4s cubic-bezier(.4,0,.2,1);
}
.noise-demo__gauge-scale {
  display: flex; justify-content: space-between;
  font-size: 0.6rem; color: #94a3b8;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin-bottom: 10px;
}

.noise-demo__blurb { font-size: 0.72rem; color: #64748b; line-height: 1.5; margin-top: 6px; }

/* Stats grid */
.noise-demo__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.noise-demo__stat-key { color: #94a3b8; font-size: 0.7rem; }
.noise-demo__stat-val {
  text-align: right; color: #1e293b; font-weight: 600;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.75rem;
}
.noise-demo__stat-hint { color: #94a3b8; font-weight: 400; font-size: 0.62rem; margin-left: 4px; }

/* Slope arrow */
.noise-demo__aspect {
  display: inline-block; transform-origin: center;
  transition: transform 0.4s ease;
  width: 14px; height: 14px; vertical-align: middle; margin-left: 4px;
}

/* Floating legend bottom-left */
.noise-demo__legend {
  position: absolute; bottom: 12px; left: 12px;
  z-index: 5; padding: 8px 10px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.08); border-radius: 8px;
  font-size: 0.7rem; color: #475569; min-width: 160px;
}
.noise-demo__legend-bar {
  height: 6px; border-radius: 999px; margin: 4px 0 2px;
  background: linear-gradient(90deg, #22c55e 0%, #84cc16 22%, #f59e0b 44%, #ef4444 66%, #b91c1c 100%);
}
.noise-demo__legend-scale {
  display: flex; justify-content: space-between;
  font-size: 0.55rem; color: #94a3b8;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Hide Mapbox UI clutter */
.noise-demo .mapboxgl-ctrl-bottom-left,
.noise-demo .mapboxgl-ctrl-bottom-right,
.noise-demo .mapboxgl-ctrl-attrib { display: none !important; }

/* Facade SVG (anchored on map via marker) */
.noise-demo-rose { pointer-events: none; }
.noise-demo-rose .petal { transition: opacity 0.2s; cursor: pointer; pointer-events: auto; }
.noise-demo-rose .petal:hover { opacity: 0.85; }
.noise-demo-rose text {
  font: 600 10px Inter, system-ui, sans-serif;
  fill: #1e293b; pointer-events: none;
}
.noise-demo-rose .label-bg { fill: rgba(255,255,255,0.92); stroke: rgba(0,0,0,0.06); }

/* iOS switch (for Wave animation toggle) */
.noise-demo-switch {
  position: relative; display: inline-block; width: 28px; height: 14px;
  flex-shrink: 0;
}
.noise-demo-switch input { opacity: 0; width: 0; height: 0; }
.noise-demo-switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 999px; transition: background 0.2s;
}
.noise-demo-switch-slider:before {
  content: ''; position: absolute; height: 10px; width: 10px;
  left: 2px; top: 2px; background: white; border-radius: 50%;
  transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.noise-demo-switch input:checked + .noise-demo-switch-slider { background: #2563eb; }
.noise-demo-switch input:checked + .noise-demo-switch-slider:before { transform: translateX(14px); }
