/* Score map demo widget — full-bleed Mapbox map with right sidebar.
   Generic sibling of noise-widget.css: same layout skeleton, per-score
   content rendered by score-map-widget.js from pre-baked JSON fixtures
   (no runtime score API calls). */

.score-map {
  margin-top: 3rem;
  position: relative;
  width: 100%;
  height: 600px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.06));
  background: var(--bg-card, #fff);
}
@media (max-width: 768px) {
  /* Mobile: no fixed height / inner scroll — map is a fixed-height block,
     the panel flows below it at natural height, the page is the only
     scroller (Bo, 2026-07-04). */
  .score-map { height: auto; }
}

.score-map__map { position: absolute; top: 0; left: 0; right: 320px; bottom: 0; }
@media (max-width: 768px) {
  .score-map__map { position: relative; top: auto; left: auto; right: auto; bottom: auto; height: 420px; }
}

/* Right sidebar */
.score-map__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 rgba(15, 23, 42, 0.06);
  overflow-y: auto;
  padding: 16px;
  font-size: 0.82rem;
}
@media (max-width: 768px) {
  .score-map__sidebar {
    position: static; width: auto; max-height: none; overflow-y: visible;
    border-left: none; border-top: 1px solid rgba(15, 23, 42, 0.06);
  }
}

/* Location chips */
.score-map__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: flex; align-items: center; justify-content: space-between; gap: 5px;
  transition: all 0.15s;
  text-align: left; line-height: 1.2;
  width: 100%;
}
.score-map__chip:hover { border-color: #94a3b8; }
.score-map__chip.is-active { background: #0f172a; color: white; border-color: #0f172a; }
.score-map__chip-val {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.65rem; opacity: 0.7; white-space: nowrap;
}
.score-map__chip.is-active .score-map__chip-val { opacity: 0.9; }

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

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

.score-map__gauge {
  position: relative; height: 6px; border-radius: 999px;
  margin-bottom: 4px;
  /* background set per score by JS (direction differs: 0 can be worst or best) */
}
.score-map__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);
}
.score-map__gauge-scale {
  display: flex; justify-content: space-between;
  font-size: 0.6rem; color: #94a3b8;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin-bottom: 10px;
}

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

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

/* Factor bars (walkability categories, view factors) */
.score-map__bars { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.score-map__bar-row { display: grid; grid-template-columns: 86px 1fr 44px; align-items: center; gap: 8px; }
.score-map__bar-name { font-size: 0.68rem; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-map__bar-track { display: block; height: 6px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.score-map__bar-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.5s cubic-bezier(.4,0,.2,1); }
.score-map__bar-val {
  text-align: right; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.65rem; color: #64748b;
}

/* Site list (contamination EPA records) */
.score-map__sites { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.score-map__site { border-left: 3px solid #8b5cf6; padding-left: 8px; }
.score-map__site-name { font-size: 0.7rem; font-weight: 600; color: #1e293b; line-height: 1.3; }
.score-map__site-issue { font-size: 0.65rem; color: #64748b; line-height: 1.35; }
.score-map__site-dist {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem; color: #94a3b8;
}

/* Floating legend bottom-left */
.score-map__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; max-width: 230px;
}
.score-map__legend-title { font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.score-map__legend-bar { height: 6px; border-radius: 999px; margin: 4px 0 2px; }
.score-map__legend-scale {
  display: flex; justify-content: space-between;
  font-size: 0.55rem; color: #94a3b8;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.score-map__legend-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.66rem; margin-top: 4px;
}
.score-map__legend-swatch {
  width: 14px; height: 10px; display: inline-block; border-radius: 2px; flex-shrink: 0;
}

/* Map marker labels (amenities, EPA sites) */
.score-map__pin-label {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  padding: 1px 6px;
  font: 600 10px 'JetBrains Mono', ui-monospace, monospace;
  color: #1e293b;
  white-space: nowrap;
  pointer-events: none;
}

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

/* Hero cover drift — translate the whole map container (canvas + markers as
   one composited layer). Amplitude ±28px stays inside the 40px bleed the
   widget gives the container in hero mode. */
@keyframes score-map-hero-drift {
  from { transform: translateX(-28px); }
  to   { transform: translateX(28px); }
}
.score-map--hero [data-map] { will-change: transform; }
.score-map--hero.is-drifting [data-map] {
  animation: score-map-hero-drift 45s ease-in-out infinite alternate;
}
@media (prefers-reduced-motion: reduce) {
  .score-map--hero.is-drifting [data-map] { animation: none; }
}

@media (max-width: 768px) {
  .score-map__legend { bottom: auto; top: 12px; }
}
