/* ============================================================
 * global.css — 全站共用樣式
 * 載入順序：在 Tailwind CDN 之後、page CSS 之前
 * 用途：基礎行為 / 跨頁通用 utility / 跨頁動畫關鍵字
 * page 專屬樣式請放 public/css/pages/{頁名}.css
 * ============================================================ */

html { scroll-behavior: smooth; }

/* 防止某 element 寫死寬度撐破 mobile viewport 出現橫向 scroll。
   iOS Chrome/Safari 對 overflow-x:clip 支援不完整，用 hidden + max-width 雙保險。 */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ------------------------------------------------------------
 * 跨頁 safety reset：避免 admin body_html 內 inline width 或
 * iframe / table 把 mobile viewport 撐寬導致橫向 scroll。
 * Tailwind preflight 預設只對 img/video 有，這裡補 iframe/table/svg
 * + 全部 !important 防 admin 內 inline style 蓋掉。
 * ------------------------------------------------------------ */
img,
svg,
video,
canvas,
iframe,
embed,
object {
  max-width: 100% !important;
  height: auto;
}

iframe { height: revert; }   /* iframe 通常自己有 height attr，不要被 auto 蓋 */

table {
  max-width: 100% !important;
  display: block;            /* 讓 overflow-x 生效，超寬表格內部捲動而非撐破 page */
  overflow-x: auto;
}
