/*
 * 蚊媒介感染症ハイリスク地点マップ 専用スタイル
 * （Leaflet 本体のスタイルは leaflet/leaflet.css）
 *
 * マーカーは地点の座標を原点(0,0)として、各パーツを絶対配置で描く。
 * 棒の高さ = 患者数(--patients) × 1人あたりの高さ(--bar-unit)。
 * --bar-unit は「大きく／小さく」ボタンで mosquitomap.js が書き換える。
 */

#map {
  --bar-unit: 7px;
  --bar-width: 32px;
}

/* マーカーの入れ物（大きさ0。中身ははみ出して表示） */
#map .mosq-marker {
  background: none;
  border: none;
}
#map .mosq-marker > span {
  position: absolute;
  display: block;
  background-repeat: no-repeat;
}
#map .mosq-area,
#map .mosq-shadow {
  background-size: 100% 100%;
}

/* ウイルス保有蚊を確認した地点: 黄色の円（地点を中心に 128×64） */
#map .mosq-area {
  left: -64px;
  top: -32px;
  width: 128px;
  height: 64px;
  opacity: 0.9;
  background-image: url("img-dengue/area64.png");
}

/* 棒グラフの影（操作の対象外） */
#map .mosq-shadow {
  left: calc(var(--bar-width) / -2);
  top: calc(var(--bar-width) * -1 + 2px);
  width: calc(var(--bar-width) * 2);
  height: var(--bar-width);
  background-image: url("img-dengue/shadow64.png");
  pointer-events: none;
}

/* 棒グラフ（円柱）: 上面の楕円・側面・下面の楕円の3枚を重ねる。
   下面の楕円の中心が地点の座標になるよう、bottom を楕円の半分だけ下げる */
#map .mosq-bar {
  left: calc(var(--bar-width) / -2);
  bottom: calc(var(--bar-width) / -4);
  width: var(--bar-width);
  height: calc(var(--patients) * var(--bar-unit) + var(--bar-width) / 2);
  background-image:
    url("img-dengue/ellipsean_plane.png"),
    url("img-dengue/bar64.png"),
    url("img-dengue/ellipsean.png");
  background-size:
    100% calc(var(--bar-width) / 2),
    100% calc(100% - var(--bar-width) / 2),
    100% calc(var(--bar-width) / 2);
  background-position: top, center, bottom;
  transition: height 0.15s ease-out;
}

/* ポップアップ */
#map .mosq-popup .leaflet-popup-content {
  margin: 8px 12px;
  font-size: 0.9em;
  line-height: 1.6;
  white-space: nowrap;
}

/* 地図左上の地域ボタン（区部・多摩／伊豆諸島／小笠原諸島） */
#map .mosq-areas {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#map .mosq-areas button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #666;
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
#map .mosq-areas button.has-places {
  border-color: #c05000;
  color: #a03c00;
  font-weight: bold;
}
#map .mosq-areas button[aria-pressed="true"] {
  background: #336600;
  border-color: #336600;
  color: #fff;
}

/* 出典表示 */
#map .leaflet-control-attribution {
  color: #000;
  background-color: rgba(230, 255, 255, 0.7);
  font-size: 12px;
}
