/* =========================================================
   ページ全体
========================================================= */

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    Meiryo,
    sans-serif;

  color: #202124;
  background: #f4f6f8;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* =========================================================
   ヘッダー
========================================================= */

#title-bar {
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  padding: 10px 16px;

  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid #d9dde3;

  box-shadow:
    0 1px 5px
    rgba(0, 0, 0, 0.12);
}

#title-bar h1 {
  margin: 0;

  font-size: 21px;
  line-height: 1.35;
}

#title-bar p {
  margin: 3px 0 0;

  color: #5f6368;
  font-size: 13px;
}


/* =========================================================
   記録切り替えプルダウン
========================================================= */

#record-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

#record-controls select {
  height: 36px;
  font-size: 16px;
  padding: 0 12px;
}

#record-controls select:disabled {
  color: #777777;
  background: #eeeeee;
  cursor: not-allowed;
  opacity: 0.8;
}

/* 気象要素 */
#element-select {
  width: 210px;
}

/* 期間 */
#period-select {
  width: 80px;
}

/* =========================================================
   地図
========================================================= */

main {
  position: relative;

  flex: 1;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;

  background: #cfe8f3;
}


/* =========================================================
   読み込みメッセージ
========================================================= */

#status-message {
  position: absolute;

  z-index: 8;

  top: 12px;
  left: 50%;

  padding: 8px 14px;

  color: #222222;
  font-size: 14px;
  font-weight: 600;

  background: rgba(255, 255, 255, 0.96);

  border: 1px solid #bfc5cc;
  border-radius: 5px;

  box-shadow:
    0 1px 6px
    rgba(0, 0, 0, 0.18);

  transform: translateX(-50%);
}


/* =========================================================
   アメダスマーカー共通
========================================================= */

/*
 * Marker本体の原点を観測地点座標にする。
 */
.station-marker {
  position: relative;

  width: 0;
  height: 0;

  cursor: pointer;
}


/* =========================================================
   ズームアウト時の四角
========================================================= */

.station-square {
  position: absolute;

  left: 0;
  top: 0;

  box-sizing: border-box;

  border:
    1.5px solid
    rgba(30, 30, 30, 0.9);

  border-radius: 1px;

  box-shadow:
    0 0 0 1px
    rgba(255, 255, 255, 0.85),
    0 1px 3px
    rgba(0, 0, 0, 0.55);

  transform: translate(-50%, -50%);
}

.station-square:hover {
  transform:
    translate(-50%, -50%)
    scale(1.3);
}


/* =========================================================
   ズーム時の気温・地点名
========================================================= */

/*
 * 気温・地点名・観測日をまとめたラベル。
 *
 * element自体の原点が観測地点座標なので、
 * translate(-50%, -50%)により
 * ラベル全体の中央が元の四角の中心に一致する。
 */
.station-record-label {
  position: absolute;

  left: 0;
  top: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-width: 140px;

  line-height: 1;
  white-space: nowrap;

  transform: translate(-50%, -50%);

  pointer-events: auto;
}


/*
 * 上段：観測極値
 */
.station-temp {
  position: static;

  margin: 0 0 2px;

  font-size: 15px;
  font-weight: 800;

  line-height: 1;
  white-space: nowrap;

  text-shadow: none;
}


/*
 * 下段：地点名
 */
.station-name {
  position: static;

  margin: 0;

  color: #111111;

  font-size: 12px;
  font-weight: 800;

  line-height: 1;
  white-space: nowrap;

  text-shadow:
    -2px -2px 0 #ffffff,
    -1px -2px 0 #ffffff,
     0   -2px 0 #ffffff,
     1px -2px 0 #ffffff,
     2px -2px 0 #ffffff,

    -2px -1px 0 #ffffff,
     2px -1px 0 #ffffff,

    -2px  0   0 #ffffff,
     2px  0   0 #ffffff,

    -2px  1px 0 #ffffff,
     2px  1px 0 #ffffff,

    -2px  2px 0 #ffffff,
    -1px  2px 0 #ffffff,
     0    2px 0 #ffffff,
     1px  2px 0 #ffffff,
     2px  2px 0 #ffffff,

     0 0 4px #ffffff;
}


/*
 * ズーム12以上で表示する観測日
 */
.station-date {
  position: static;

  margin-top: 3px;

  color: #333333;

  font-size: 12px;
  font-weight: 600;

  line-height: 1;
  white-space: nowrap;

  text-shadow:
    -1px -1px 0 #ffffff,
     1px -1px 0 #ffffff,
    -1px  1px 0 #ffffff,
     1px  1px 0 #ffffff,
     0 0 4px #ffffff;
}


/* =========================================================
   ポップアップ
========================================================= */

.maplibregl-popup-content {
  padding: 13px 15px;

  border-radius: 6px;
}

.popup-title {
  margin-bottom: 6px;

  font-size: 18px;
  font-weight: 800;
}

.popup-record {
  margin: 5px 0;

  font-size: 17px;
}

.popup-sub {
  color: #4c4f52;

  font-size: 13px;
  line-height: 1.55;
}

.popup-link {
  display: inline-block;

  margin-top: 8px;

  font-size: 13px;
  font-weight: 700;
}


/* =========================================================
   凡例
========================================================= */

#legend {
  position: absolute;

  z-index: 7;

  right: 10px;
  bottom: 28px;

  padding: 9px 11px;

  color: #222222;
  font-size: 12px;

  background:
    rgba(255, 255, 255, 0.96);

  border:
    1px solid
    rgba(110, 115, 120, 0.35);

  border-radius: 5px;

  box-shadow:
    0 1px 7px
    rgba(0, 0, 0, 0.28);
}

.legend-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.legend-colors {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.continuous-legend {
  display: flex;
  position: relative;
  height: 268px;
}

.legend-color-block {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 1px solid #222;
}

.legend-boundaries {
  position: relative;
  width: 40px;
}

.legend-boundaries span {
  position: absolute;
  left: 5px;
  transform: translateY(-50%);

  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}


/* ==========================
   クレジット表示
========================== */

#footer-credit {
    position: absolute;

    left: 10px;
    bottom: 10px;

    z-index: 1000;

    padding: 6px 8px;

    font-size: 11px;
    line-height: 1.4;

    color: #444;

    background: rgba(255,255,255,0.85);

    border-radius: 4px;

    pointer-events: none;
}

#map-information {
  position: absolute;

  z-index: 7;

  left: 10px;
  bottom: 30px;

  padding: 6px 9px;

  color: #333333;
  font-size: 11px;
  line-height: 1.5;

  background:
    rgba(
      255,
      255,
      255,
      0.9
    );

  border:
    1px solid
    rgba(
      110,
      115,
      120,
      0.35
    );

  border-radius: 4px;

  box-shadow:
    0 1px 4px
    rgba(
      0,
      0,
      0,
      0.18
    );
}

.information-title {
  font-size: 12px;
  font-weight: 700;
}

.unofficial-notice {
  margin-top: 2px;
  font-weight: 700;
}

/* =========================================================
   凡例・情報パネルの最小化
========================================================= */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 8px;
}

.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 22px;
  height: 22px;

  padding: 0;

  color: #333333;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;

  cursor: pointer;

  background: rgba(255, 255, 255, 0.9);

  border: 1px solid #aeb4bc;
  border-radius: 3px;
}

.panel-toggle:hover {
  background: #eeeeee;
}

.panel-content {
  display: block;
}

.panel-content.collapsed {
  display: none;
}

/* =========================================================
   スマートフォン
========================================================= */

@media (max-width: 720px) {

  #title-bar {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
  }

  #title-bar h1 {
    flex-shrink: 0;
    margin: 0;
    font-size: 14px;
    white-space: nowrap;
  }

  #record-controls {
    min-width: 0;
    gap: 5px;
    margin-left: auto;
  }

  #record-controls select {
    height: 32px;
    padding: 0 5px;
    font-size: 13px;
  }

  #element-select {
    width: 150px;
  }

  #period-select {
    width: 65px;
  }

  #legend {
    right: 6px;
    bottom: 24px;
    padding: 5px 6px;
    font-size: 9px;
  }

  .legend-title {
    font-size: 11px;
  }

  .legend-boundaries {
    width: 30px;
  }

  .legend-boundaries span {
    left: 4px;
    font-size: 10px;
  }

  #map-information {
    left: 6px;
    bottom: 24px;
    padding: 3px 5px;
    font-size: 10px;
    line-height: 1.25;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .information-title {
    font-size: 10px;
  }

  .panel-toggle {
    width: 16px;
    height: 16px;
    font-size: 10px;
  }

  .panel-header {
    gap: 5px;
  }
}