/* 介面尺寸標準（所有地區共用；base.html 最後載入，蓋過 vendor 與各功能樣式）。
 * 標準：頁邊 24／20／16px（桌機／平板／手機）、按鈕高 36px（小按鈕 30px）、標籤 22px、
 * 相鄰按鈕與標籤間距至少 6px（換行後上下排也是，用 gap 不用 margin）、有底色或框線的容器內容離每邊至少 8px。
 * 檢查工具：python3 tools/ui_spacing_check.py（說明在檔案開頭）。
 * vendor/portal.css 是島引馬祖的複本，不直接改；要修的寫在這裡。
 * 有些頁的功能樣式寫在 body 裡（比這份晚載入），所以個別頁的規則前面加 html 提高優先順序。 */

/* ---------- 頁邊 ---------- */
.shell { --shell-pad: 24px; }
.sitefoot__in { padding-inline: 24px; }
@media (max-width: 1024px) {
  .shell { --shell-pad: 20px; }
  .sitefoot__in { padding-inline: 20px; }
}
@media (max-width: 640px) {
  .shell { --shell-pad: 16px; }
  .sitefoot__in { padding-inline: 16px; }
}
/* 頁邊加大後，頁首（站名、入口、工具列）在 390px 仍要排在同一列：項目間距 8px 改 6px */
@media (max-width: 430px) {
  .masthead .shell { column-gap: 6px; }
}

/* ---------- 個別頁：被 .shell 的 margin: 0 auto 蓋掉的上下距離（功能樣式比 vendor 先載入） ---------- */
html .shell.tf-tabs { margin-top: 14px; margin-bottom: 12px; }   /* 停車、現場：縣市列與鄉鎮列 */
html .shell.tf-towns { margin-bottom: 12px; }
html .shell.tf-note { margin-top: 10px; }
html .shell.tf-ask { margin-top: 16px; }

/* ---------- 相鄰按鈕至少 6px ---------- */
html .tf-pt__go { gap: 6px; }   /* 停車：導航、電話 */
html .cd-otg__cells { gap: 6px; }   /* 老物件：年代格 */
html .cdk__tags { gap: max(6px, 1.2cqw); }   /* 生物誌卡牌：卡上的標籤 */

/* ---------- 標籤至少 22px ---------- */
html .gd-tag { height: 22px; }   /* 季節行事曆：進行中、約 */

/* ---------- 有底色或框線的容器：內容離邊至少 8px ---------- */
html .pt-time { padding: 8px 10px; }   /* 交通船、班次的時刻方塊 */
html .ax-leg.is-cut > div { padding: 8px; }   /* 無障礙路線：斷線的一段 */
html .gd-cell { padding: 8px; }   /* 季節行事曆：月曆格 */
html .kd-grid__r { padding: 8px; }   /* 親子：各區設施表的列（選中的列有底色） */
html .li-tbl__n, html .li-tbl__n small { gap: 6px; }   /* 生活資訊表格：名稱旁的標籤 */

/* ---------- 不超出畫面：好幾支電話寫在一起時電話鈕換行 ---------- */
html .li-tel, html .li-nav { max-width: 100%; height: auto; min-height: 30px; padding-block: 4px; border-radius: 15px; white-space: normal; overflow-wrap: anywhere; }

/* ---------- 標題的子句：塞得下時整句不斷開，比一行還長時才在句內換行（原本會超出頁邊） ---------- */
@media (max-width: 640px) {
  .dl-title__cl { display: inline-block; max-width: 100%; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }   /* 先在空白處換行，真的放不下才斷字 */
}

/* ---------- 可點的人物標籤當小按鈕：至少 30px ---------- */
html .hr-chip { height: 30px; }   /* 歷史大事：事件裡的人物 */

/* 節慶詳情頁照片框（手機）：圖說移到照片下方時，框的灰底會包住圖說、文字貼邊；手機版拿掉灰底（2026-11-23） */
@media (max-width: 560px) { html .gd-band.has-cap { background: none; } }

/* ---------- 手機頁首「會員與顯示」選單（site/_hdmenu.html；2026-11-23 使用者選定）----------
   ≤640px：「日」鈕與登入／會員鈕收進一顆選單鈕，語言鈕（地球）留在外面，頁首一行；平板、電腦照舊各自的鈕。五站同一套。 */
.hdm { display: none; position: relative; }
.hdm > summary { list-style: none; cursor: pointer; }
.hdm > summary::-webkit-details-marker { display: none; }
.hdm:not([open]) .hdm__list { display: none; }
.masthead:has(.hdm[open]) { position: relative; z-index: calc(var(--z-sticky, 100) + 8); }
.hdm__list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; display: grid; gap: 2px; min-width: 11.5em; padding: 8px; box-sizing: border-box;
  background: var(--surface, #fff); border: 1.5px solid var(--line-strong, #b9c6c3); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.hdm__sec { margin: 0; padding: 6px 8px 2px; font-size: 12px; font-weight: 600; color: var(--ink-muted, #56676c); }
.hdm__sec + .hdm__i, .hdm__sec + .hdm__seg { margin-top: 2px; }
.hdm__i { display: flex; align-items: center; min-height: 40px; padding: 0 12px; box-sizing: border-box; border: 0; border-radius: 8px; background: none;
  color: var(--ink, #10242a); font: inherit; font-size: 15.5px; text-decoration: none; text-align: left; cursor: pointer; }
.hdm__i:hover { background: var(--surface-sunken, #eef1ee); }
.hdm__seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hdm__seg .hdm__i { justify-content: center; border: 1px solid var(--line, #d3dcda); }
.hdm__seg .hdm__i[aria-pressed="true"] { font-weight: 700; background: var(--surface-sunken, #eef1ee); border-color: var(--ink, #10242a); }
@media (max-width: 640px) {
  .hdm { display: inline-flex; }
  .mast-tools .pt-theme, .mast-tools .authbtn { display: none !important; }
  .mast-tools .hdm .hdm__btn { width: 36px; min-width: 36px; padding: 0; justify-content: center; }
}
