/* 步佈台灣 — 首頁「探索走讀地圖」區塊
   搜尋列 UI 對齊現行站的 exposed filter（白卡 + 陰影 + 46px 控件 + #3eaafd 按鈕）。
   注入位置：index.html 的 .gavias-blockbuilder-content 之前（首頁最上方）。 */

.dgw-explore {
  background: #f3efe8; padding: 20px 0 26px;
  position: relative; z-index: 1;   /* < 站頭 #header 的 z-index:99，讓導覽下拉選單蓋得住地圖 */
}
.dgw-explore * { box-sizing: border-box; }

/* 舊站鏡像殘留的死搜尋表單（GET /景點，靜態站無效）— 本 widget 已取代，隱藏
   （本 widget 自己的表單是 .dgx-search，不受影響） */
form.dg-20-contact,
form[id^="views-exposed-form-listing-content"] { display: none !important; }

/* 「精選數位走讀」標題 —— 補上頁面建構器 row 原本會給的上下留白，比照「最新數位走讀」 */
.dgx-feat-head { margin: 46px 0 4px !important; }
.dgx-feat-head .title { margin-bottom: 0 !important; }

/* 卡片圖片統一裁切比例 —— 對齊現行站的 Drupal medium 圖片樣式（750×500 = 3:2） */
.listing-block .listing-image { height: auto !important; overflow: visible; }
.listing-block .listing-image .item-image,
.listing-block .listing-image .field--name-field-listing-image,
.listing-block .listing-image .field__item {
  display: block !important; width: 100% !important; height: auto !important;
}
.listing-block .listing-image .item-image { aspect-ratio: 3 / 2; overflow: hidden; }
.listing-block .listing-image .item-image > a { display: block; width: 100%; height: 100%; }
.listing-block .listing-image img {
  width: 100% !important; height: 100% !important; object-fit: cover !important; display: block;
}
/* 走讀路線卡（台灣北部/中部/南部/東部 區塊的主視覺 banner） */
.field--name-field-dguidedwalks-images .item-image {
  display: block; aspect-ratio: 16 / 10; overflow: hidden;
}
.field--name-field-dguidedwalks-images .item-image > a { display: block; width: 100%; height: 100%; }
.field--name-field-dguidedwalks-images .item-image img {
  width: 100% !important; height: 100% !important; object-fit: cover !important; display: block;
}

.dgw-explore-inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.dgw-explore-title { margin: 0 0 12px; font-size: 1.3rem; font-weight: 700; color: #059343; text-align: center; }
.dgw-explore-sub { display: none; }

/* 搜尋列 —— 對齊現行站 #views-exposed-form-listing-content-listing-filter-form (.dg-20-contact) */
.dgx-search {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .1);
  padding: 8px; margin-bottom: 14px;
}
.dgx-search input[type="search"] {
  height: 46px; flex: 1 1 240px; min-width: 0;
  border: 1px solid #e6e6e6; border-radius: 4px; padding: 0 16px;
  font-size: 16px; color: #67676f; background: #fff;
  box-shadow: inset 0 0 2px 2px rgba(0, 0, 0, .02);
}
.dgx-search input[type="search"]::placeholder { color: #9a9aa2; }
.dgx-search .dgx-btn {
  height: 46px; padding: 0 26px; border: 0; border-radius: 4px;
  background: #3eaafd; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.dgx-search .dgx-btn:hover { background: #2b9bf0; }
.dgx-search .dgx-reset {
  height: 46px; padding: 0 16px; border: 1px solid #e6e6e6; border-radius: 4px;
  background: #fff; color: #888; font-size: 14px; cursor: pointer;
}
.dgx-count { font-size: .88rem; color: #8a8a8a; margin-left: auto; padding-right: 6px; white-space: nowrap; }

/* 多選下拉（分類 / 地區） */
.dgx-ms { position: relative; flex: 0 1 190px; }
.dgx-ms-btn {
  width: 100%; height: 46px; border: 1px solid #e6e6e6; border-radius: 5px;
  padding: 0 30px 0 14px; font-size: 16px; color: #67676f; background: #fff; cursor: pointer;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, #999 50%), linear-gradient(135deg, #999 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.dgx-ms-btn.has-sel { border-color: #3eaafd; color: #1f8fe0; font-weight: 600; }
.dgx-ms-panel {
  position: absolute; z-index: 1200; top: calc(100% + 4px); left: 0; min-width: 220px; max-width: 280px;
  max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid #e6e6e6;
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); padding: 6px;
}
.dgx-ms-panel label {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px;
  font-size: .95rem; color: #333; cursor: pointer;
}
.dgx-ms-panel label:hover { background: #f0f7ff; }
.dgx-ms-panel .dgx-ms-all { border-bottom: 1px solid #eee; font-weight: 600; color: #555; margin-bottom: 2px; }
.dgx-ms-panel input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; accent-color: #3eaafd; }
.dgx-ms-ic { width: 22px; height: 22px; object-fit: contain; flex: 0 0 auto; }

/* 地圖 */
.dgx-map {
  width: 100%; height: 460px; border-radius: 10px; overflow: hidden;
  border: 1px solid #cfc9ba; background: #a9d3df;   /* 海水色 —— 尚未上圖磚的邊緣看起來像海，不會是破圖灰 */
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, .12);
}
.dgx-map .leaflet-container { font: inherit; background: #a9d3df; }

/* 分類圖示 marker（白底圓徽章 + 分類色外框） */
.dgx-mk {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 2px solid #0991de;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}
.dgx-mk img { width: 19px; height: 19px; object-fit: contain; display: block; }

/* 叢集徽章 —— 半透明填色 + 同色系光暈（bg / box-shadow 由 clusterIcon 依級別給） */
.dgx-cluster { background: transparent; }
.dgx-cl {
  border-radius: 50%; color: #fff; font-weight: 700; text-align: center; letter-spacing: .2px;
  font-size: 11px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  border: 1.5px solid rgba(255, 255, 255, .85);
  backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
  transition: transform .15s ease, box-shadow .15s ease;
}
.dgx-cluster:hover .dgx-cl { transform: scale(1.08); }

/* 圖例 */
.dgx-legend {
  background: rgba(255, 255, 255, .94); border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .25); font-size: .8rem; color: #333; max-width: 168px;
}
.dgx-lg-toggle {
  display: block; width: 100%; text-align: left; border: 0; background: #059343; color: #fff;
  font-size: .8rem; font-weight: 600; padding: 5px 10px; border-radius: 6px 6px 0 0; cursor: pointer;
}
.dgx-lg-body { padding: 6px 8px; display: grid; gap: 3px; }
.dgx-lg-body[hidden] { display: none; }
.dgx-lg-row { display: flex; align-items: center; gap: 6px; line-height: 1.2; }
.dgx-lg-row img { width: 18px; height: 18px; object-fit: contain; flex: 0 0 auto; }

/* popup —— 用 !important 蓋過佈景主題對 popup 內元素的規則（會把 <p>/文字隱藏） */
.leaflet-popup-content { margin: 12px 14px !important; }
.dgx-pop { width: 220px; }
.dgx-pop .dgx-pop-walk {
  display: block !important; visibility: visible !important;
  font-size: .8rem !important; color: #0991de !important; font-weight: 600;
  margin: 0 0 3px !important; padding: 0 !important; line-height: 1.3 !important; text-align: left;
}
.dgx-pop .dgx-pop-name {
  display: block !important; visibility: visible !important;
  font-size: 1.02rem !important; font-weight: 700; color: #1c1c1c !important;
  margin: 0 0 5px !important; padding: 0 !important; line-height: 1.35 !important; text-align: left;
}
.dgx-pop .dgx-pop-meta {
  display: block !important; visibility: visible !important;
  font-size: .76rem !important; color: #888 !important;
  margin: 0 0 8px !important; padding: 0 !important; text-align: left;
}
.dgx-pop img { width: 100%; height: 112px; object-fit: cover; border-radius: 5px; display: block; margin: 0 0 10px; background: #e2ded4; }
.dgx-pop .dgx-pop-link { display: inline-block !important; background: #3eaafd; color: #fff !important; font-size: .82rem; text-decoration: none; padding: 6px 15px; border-radius: 20px; }
.dgx-pop .dgx-pop-link:hover { background: #2b9bf0; }

.dgx-empty { padding: 40px 16px; text-align: center; color: #999; font-size: .95rem; }

@media (max-width: 767px) {
  .dgx-search { gap: 8px; }
  .dgx-search input[type="search"] { flex: 1 1 100%; }
  .dgx-ms { flex: 1 1 calc(50% - 4px); }
  .dgx-search .dgx-btn { flex: 1 1 100%; }
  .dgx-search .dgx-reset { flex: 0 0 auto; }
  .dgx-count { margin-left: 0; flex: 1 1 100%; text-align: center; }
  .dgx-map { height: 360px; }
  .dgx-legend { max-width: 140px; font-size: .72rem; }
}

/* 以名稱篩選時，地圖上結果點旁的名稱標籤 */
.leaflet-tooltip.dgx-name{background:#fff;border:1px solid #245945;border-radius:4px;color:#245945;font-size:12px;font-weight:600;line-height:1.3;padding:2px 6px;box-shadow:0 1px 3px rgba(0,0,0,.25);white-space:nowrap;pointer-events:none}
.leaflet-tooltip.dgx-name:before{display:none}
