/* ===================================================================
   css/pages/mobile-table-scroll-20261203.css
   手機版醫療對照表：容器內水平捲動 + 固定第一欄 + 觸控提示
   建立日期：2026-12-03

   為什麼需要這個檔：
   1. 全站 58 頁引用的是 css/styles-20261015.css（0 頁引用 styles.css）。
      styles.css 裡雖然有 .table-scroll-wrapper 的降級規則，但線上實際沒有任何
      頁面載入該檔 → 那套規則在線上完全不生效。
   2. 因此手機表格必須靠「頁面專屬 CSS ＋ 包在有 overflow-x 的容器內」來處理，
      這是本站既有做法（見 lung-nodule-over-1cm-faq-table-20261106.css、
      incentive-spirometry-20261112.css 的 .compare-wrap）。
   3. 本檔把該模式抽成共用規則，供各文章頁引用，避免每頁重複寫。

   設計原則（依劉醫師手機版要求）：
   - 不要求病人雙指縮放：表格整體可左右滑動。
   - 固定第一欄（項目名稱），滑動時仍知道自己在看哪一列。
   - 提供可見的「可左右滑動」提示，避免病人以為表格被截斷。
   - 內文最小 16px（醫療內容不為塞資訊而縮小字體）。
   =================================================================== */

/* ---------- 既有 .term-table-wrap：只補字級（該容器已可捲動） ---------- */
.term-table-wrap table {
  min-width: 460px;
}

.term-table-wrap th,
.term-table-wrap td {
  font-size: 1rem;      /* 16px 起步 */
  line-height: 1.7;
}

.term-table-wrap thead th {
  font-size: 1.0625rem; /* 17px */
}

@media (max-width: 768px) {
  .term-table-wrap table { min-width: 460px; }
  .term-table-wrap th,
  .term-table-wrap td { font-size: 1rem; }
  .term-table-wrap thead th { font-size: 1.0625rem; }
}

/* ---------- 既有 .compare-wrap：字級同樣需抬到 16px ---------- */
.compare-wrap table {
  font-size: 1rem;
}

.compare-wrap th,
.compare-wrap td {
  font-size: 1rem;
  line-height: 1.7;
}

@media (max-width: 768px) {
  .compare-wrap table { font-size: 1rem; }
  .compare-wrap th,
  .compare-wrap td { font-size: 1rem; }
}

/* ---------- 捲動容器 ---------- */
.mt-scroll {
  display: block;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid #e8c98b;
  border-radius: 8px;
  background: #fff;
}

.mt-scroll:focus-visible {
  outline: 3px solid #8a4a1f;
  outline-offset: 2px;
}

/* ---------- 表格本體 ---------- */
.mt-scroll table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 1rem;      /* 16px 起步 */
  line-height: 1.7;
}

.mt-scroll th,
.mt-scroll td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #e8c98b;
  vertical-align: top;
  line-height: 1.7;
  font-size: 1rem;
  word-break: break-word;
}

/* 表頭 */
.mt-scroll th {
  background: #8a4a1f;
  color: #fff;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

/* 第一欄（項目名稱）固定 */
.mt-scroll th:first-child,
.mt-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fdfaf4;
  font-weight: 600;
  color: #5a3a12;
  white-space: normal;
  min-width: 92px;       /* 至少容納 5～6 個中文字 */
  box-shadow: 2px 0 4px rgba(138, 74, 31, 0.10);
}

.mt-scroll th:first-child {
  z-index: 3;
  background: #8a4a1f;
  color: #fff;
}

/* 斑馬紋需疊在 sticky 第一欄之上 */
.mt-scroll tr:nth-child(even) td { background: #fdfaf4; }
.mt-scroll tr:nth-child(even) td:first-child { background: #f4ece0; }

/* ---------- 可左右滑動提示 ---------- */
.mt-hint {
  display: none;
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: #5a6a8a;
  line-height: 1.6;
}

.mt-hint::before {
  content: '⇄ ';
  font-weight: 700;
}

/* ---------- 手機版 ---------- */
@media (max-width: 768px) {
  .mt-scroll {
    margin: 1.25rem 0;
    /* 右側加漸層，暗示還有內容可滑 */
    background-image: linear-gradient(to left, rgba(138, 74, 31, 0.10), transparent 40px);
    background-repeat: no-repeat;
    background-attachment: local, scroll;
  }

  .mt-scroll table {
    min-width: 520px;
    font-size: 1rem;
  }

  .mt-scroll th,
  .mt-scroll td {
    padding: 0.7rem 0.75rem;
    font-size: 1rem;
  }

  /* 觸控目標與可讀性：抬-highlight 列 */
  .mt-scroll tbody tr:nth-child(even) td { background: #fbf7f0; }

  .mt-hint { display: block; }
}

@media (max-width: 400px) {
  .mt-scroll table { min-width: 480px; }
}

/* ---------- 減少動態偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .mt-scroll { scroll-behavior: auto; }
}
