/* Styles for the <buildings-map> element (static/map/buildings-map.js).
   Loaded once from base.html so the host's height clamp is in force from
   first paint. Everything is on the site's tokens from base.html: colour,
   the type steps and --tap-min. The bmap- prefix scopes the rules; the
   element has no shadow root.

   The host rule is on the tag so the height clamp holds before the element
   upgrades. The rules over MapLibre's chrome are on .bmap-wrap, which the
   element adds to itself on connection: as a class-plus-class selector they
   outrank MapLibre's own (.maplibregl-ctrl-group:not(:empty) and the like),
   which a tag-plus-class selector would not. */
buildings-map {
  display: block;
  position: relative;
  /* Viewport height less the site header and 200px of breathing room,
     held between 600px and 1600px. --header-h is measured and kept in
     sync by base.html. */
  height: var(--bmap-height, clamp(600px, calc(100svh - var(--header-h, 64px) - 200px), 1600px));
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px var(--shadow);
  isolation: isolate;
  background: var(--card);
}
.bmap-map {
  width: 100%;
  height: 100%;
}
.bmap-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--fg-muted);
  text-align: center;
  padding: 0 24px;
  z-index: 500;
}
.bmap-message[hidden] {
  display: none;
}

/* MapLibre chrome on the site's tokens: square, paper, ink. */
.bmap-wrap .maplibregl-ctrl-group {
  border-radius: 0;
  background: var(--paper);
  box-shadow: 0 6px 18px var(--shadow);
}
.bmap-wrap .maplibregl-ctrl-group button {
  border-radius: 0;
}
.bmap-wrap .maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--line);
}
.bmap-wrap .maplibregl-ctrl-attrib {
  background: var(--paper);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  border-radius: 0;
}
.bmap-wrap .maplibregl-ctrl-attrib a {
  color: var(--fg-muted);
}
.bmap-wrap .maplibregl-ctrl-attrib-button {
  border-radius: 0;
}
.bmap-wrap .maplibregl-ctrl-attrib.maplibregl-compact {
  border-radius: 0;
}

/* Pins and clusters: squares in the site's monochrome. The button is the
   hit area; the visible square is drawn inside it so tap size and mark
   size can differ. */
.bmap-pin,
.bmap-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-family: 'Work Sans', sans-serif;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--paper);
}
.bmap-pin::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 2px 6px var(--shadow-deep);
}
.bmap-pin:hover::before {
  background: var(--ink);
}
.bmap-cluster {
  width: 30px;
  height: 30px;
}
.bmap-cluster span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  box-sizing: border-box;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--paper);
  box-shadow: 0 2px 6px var(--shadow-deep);
}

/* Popup chrome stripped so the card rules below own the look. */
.bmap-wrap .maplibregl-popup {
  max-width: none !important;
}
.bmap-wrap .maplibregl-popup-content {
  padding: 0;
  border-radius: 0;
  box-shadow: 0 14px 30px var(--shadow);
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.bmap-wrap .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.bmap-wrap .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.bmap-wrap .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--paper);
}
.bmap-wrap .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.bmap-wrap .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.bmap-wrap .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--paper);
}
.bmap-wrap .maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--paper);
}
.bmap-wrap .maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--paper);
}
.bmap-wrap .maplibregl-popup-close-button {
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: var(--tint-hover);
  color: var(--fg-muted);
  font-size: var(--text-base);
  line-height: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.bmap-wrap .maplibregl-popup-close-button:hover {
  background: var(--tint-press);
  color: var(--ink);
}

/* Building card inside popup, mirrors .building-card from buildings.html */
.bmap-card {
  padding: 10px 14px;
  background: var(--paper);
  width: 230px;
}
.bmap-card-name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: var(--text-heading);
  line-height: var(--leading-heading);
  letter-spacing: 0.3px;
  color: var(--fg);
  margin-bottom: 8px;
  margin-right: 18px;
}
.bmap-card-hood {
  margin-bottom: 6px;
}
.bmap-card-notes {
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.bmap-card-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.bmap-card-cta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: 'Work Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.bmap-card-cta:hover {
  background: var(--tint-hover);
}

/* Everything tappable on the map is at least --tap-min on a phone. */
@media (max-width: 640px) {
  .bmap-wrap .maplibregl-ctrl-group button {
    width: var(--tap-min);
    height: var(--tap-min);
  }
  .bmap-pin,
  .bmap-cluster {
    width: var(--tap-min);
    height: var(--tap-min);
  }
  .bmap-wrap .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show),
  .bmap-wrap .maplibregl-ctrl-attrib-button {
    min-width: var(--tap-min);
    min-height: var(--tap-min);
  }
  .bmap-wrap .maplibregl-popup-close-button {
    width: var(--tap-min);
    height: var(--tap-min);
    top: 0;
    right: 0;
  }
  .bmap-card-name {
    margin-right: 36px;
  }
  .bmap-card-cta {
    height: var(--tap-min);
  }
}
