/* ============================================
   知識園地：文章內頁與列表
   數值來源：D:\figma-export\frame-25\desktop（知識園地 內頁 1920×2078）
   ============================================ */

/* ── 內頁上方的情境帶（設計稿 article-hero 1920×310） ── */
.article-hero {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(140px, 16vw, 310px);
  overflow: hidden;
}
.article-hero__bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 「文章專區」疊在情境照上。照片是深藍，但不同裁切位置亮度不一，
   文字加一層淡的文字陰影當保險，不另外壓一層遮罩把照片弄糊。 */
.article-hero__label {
  position: relative;
  margin: 0;
  /* 情境帶在桌機有 230～310 高，22px 的字擺在中間顯得太小。
     手機維持 18（帶高只剩 140，再大就塞不下），桌機長到 36。 */
  font-size: clamp(1.125rem, 0.55rem + 2.2vw, 2.25rem);
  font-weight: var(--fw-medium);
  letter-spacing: .08em;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

.article {
  width: 100%;
  max-width: calc(1440px + var(--container-pad) * 2);
  margin-inline: auto;
  padding: clamp(var(--space-6), 3vw, 43px) var(--container-pad) clamp(var(--space-12), 7vw, 120px);
}

.article__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: clamp(var(--space-5), 3vw, 40px);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
/* 麵包屑是行內連結（16.8px 高）；內距撐開點擊區、外距抵銷不動行高。 */
.article__crumbs a {
  display: inline-block;
  padding-block: 12px;
  margin-block: -12px;
  color: inherit;
  text-decoration: none;
}
.article__crumbs a:hover { color: var(--color-brand); }
.article__crumb-sep { color: var(--color-border); }

/* 三欄：330 / 700 / 330，欄距 40（設計稿實測）。
   三欄加欄距剛好 1440 ＝ 設計稿的版心，但 1440 的視窗扣掉左右內距只剩 1344，
   固定寬度的軌道會往兩側各溢出 48px。用 minmax(0, …) 讓軌道在放不下時一起縮。 */
.article__grid {
  display: grid;
  grid-template-columns:
    minmax(0, var(--article-rail))
    minmax(0, var(--article-content))
    minmax(0, var(--article-rail));
  justify-content: center;
  gap: var(--article-gap);
  align-items: start;
}

/* ── 左右兩欄 sticky ──
   align-self: start 是關鍵 —— grid 項目預設 stretch，高度被撐滿就永遠不會 sticky。
   祖先鏈上也不能有 overflow: hidden。 */
.article__rail {
  position: sticky;
  top: calc(var(--header-h) + var(--space-6));
  align-self: start;
  max-height: calc(100vh - var(--header-h) - var(--space-12));
  overflow-y: auto;
}
/* 設計稿 Frame 868／867 的色條是 330×14 的 #e6433e（原本誤寫成黃色）。
   改成參考版型的細線 —— 側欄收進卡片之後，14px 的粗條會壓過內容。 */
.article__rail-title {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 3px solid var(--color-brand);
  font-size: var(--fs-lg);         /* 20px */
  font-weight: var(--fw-bold);
  line-height: 1.2;
}

/* 參考版型：右側「其他文章」整區是一張有框的卡片。 */
.article__card {
  padding: var(--space-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}

/* 目錄
   設計稿 Frame 869：列表 280 寬（比 330 的欄寬內縮 26）、項目間距 31、
   分隔線為 1px #000。 */
.toc__list,
.more-list {
  padding-inline: 0;
}
.toc__list {
  display: flex;
  flex-direction: column;
  margin: 0;
  list-style: none;
  counter-reset: toc;
}
.toc__item + .toc__item { border-top: 1px solid var(--color-border); }
.toc__item--h3 .toc__link { padding-left: var(--space-6); }

/* 層級編號 1 / 1.1 / 1.2 / 2。用 CSS counter 產生，PHP 那邊不必多存一個欄位；
   counter-reset 的作用域包含「該元素與其後的兄弟」，所以 h2 重設 h3 的計數器有效。 */
.toc__list { counter-reset: toc-h2; }
.toc__item--h2 { counter-increment: toc-h2; counter-reset: toc-h3; }
.toc__item--h3 { counter-increment: toc-h3; }
.toc__link::before {
  margin-right: .35em;
  font-variant-numeric: tabular-nums;
  color: var(--color-brand);
}
.toc__item--h2 > .toc__link::before { content: counter(toc-h2); font-weight: var(--fw-medium); }
.toc__item--h3 > .toc__link::before { content: counter(toc-h2) "." counter(toc-h3); }
/* 參考版型：目錄項目固定單行，過長用省略號，側欄高度才不會被長標題撐開。 */
.toc__link {
  display: block;
  padding: var(--space-3);
  border-left: 3px solid transparent;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--color-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background var(--ease-base), color var(--ease-base);
}
.toc__link:hover { background: var(--color-brand-soft); color: var(--color-brand); }
/* 目前所在的段落：淡紅底塊＋左側紅線＋紅字（捲動時由 main.js 換 class）。 */
.toc__link.is-current {
  background: var(--color-brand-soft);
  border-left-color: var(--color-brand);
  font-weight: var(--fw-semibold);
  color: var(--color-brand);
}

/* 其他文章（設計稿 Frame 870，與目錄同一套度量） */
.more-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  list-style: none;
}
.more-list__item + .more-list__item { border-top: 1px solid var(--color-border); }
/* 參考版型：標題完整換行不截斷，滑過時整塊變淡紅底（設計稿 Frame 871 的 #ffe1e0）。 */
.more-list__link {
  display: block;
  margin-inline: calc(var(--space-3) * -1);
  padding: var(--space-4) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--ease-base), color var(--ease-base);
}
.more-list__link:hover,
.more-list__link:focus-visible {
  background: var(--color-brand-soft);
  font-weight: var(--fw-semibold);
  color: var(--color-brand);
}
/* 設計稿 Frame 872 是 129×54 的方角實心鈕；參考版型改成撐滿卡片的圓角鈕。 */
.more-list__all {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  margin-top: var(--space-6);
  padding: 15px 24px;
  background: var(--color-brand);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
  transition: background var(--ease-base);
}
.more-list__all:hover,
.more-list__all:focus-visible { background: var(--color-brand-hover); color: #fff; }

/* ── 內文 ── */
.article__title {
  margin: 0 0 var(--space-6);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: 1.2;
}
/* 標題下方的分類與日期 */
.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: calc(var(--space-6) * -1 + var(--space-2)) 0 var(--space-6);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.article__cat {
  display: inline-flex;
  align-items: center;
  /* 設計稿沒有這個元件；40 是可點擊的下限。 */
  min-height: 40px;
  padding: 3px var(--space-4);
  background: var(--color-brand-soft);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  color: var(--color-brand);
  text-decoration: none;
  transition: background var(--ease-base), color var(--ease-base);
}
.article__cat:hover,
.article__cat:focus-visible { background: var(--color-brand); color: #fff; }

.article__figure { margin: 0 0 var(--space-8); }
.article__figure img {
  width: 100%;
  height: auto;
  /* 設計稿 Rectangle 150（700×477）cornerRadius = 0 */
}
/* 設計稿內文是 16px／19px（1.1875），但那段是 18 行的「內文內文…」假字；
   實際中文長文在 1.19 會黏成一塊，因此長篇正文統一 1.8（與 FAQ 答案一致）。
   其餘有設計稿依據的區塊一律 1.2。 */
.article__body { font-size: var(--fs-base); line-height: var(--lh-loose); }
.article__body > * + * { margin-top: var(--space-5); }
.article__body h2 {
  margin-top: var(--space-10);
  padding-left: var(--space-4);
  border-left: 6px solid var(--color-brand);
  font-size: var(--fs-xl);
  line-height: 1.2;
  /* 錨點跳轉時不要被 sticky header 蓋住 */
  scroll-margin-top: calc(var(--header-h) + var(--space-6));
}
.article__body h3 {
  margin-top: var(--space-8);
  font-size: var(--fs-lg);
  line-height: 1.2;
  color: var(--color-brand);
  scroll-margin-top: calc(var(--header-h) + var(--space-6));
}
.article__body img { max-width: 100%; height: auto; border-radius: var(--radius-md); }
.article__body ul,
.article__body ol { padding-left: var(--space-6); }
.article__body li + li { margin-top: var(--space-2); }

/* ── 上下篇 ── */
.article__nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: clamp(var(--space-10), 5vw, 72px);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
}
.article__nav-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--ease-base), background var(--ease-base);
}
.article__nav-link:hover,
.article__nav-link:focus-visible { background: var(--color-brand-soft); border-color: var(--color-brand); }
.article__nav-link--next { text-align: right; }
.article__nav-label { font-size: var(--fs-sm); color: var(--color-brand); }
.article__nav-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  color: var(--color-text);
}

/* ============================================
   知識園地列表
   ============================================ */
/* 情境帶：素材 art-hero.webp 為 1920×310。
   width 一定要明寫 —— 只給 aspect-ratio ＋ min-height 的話，
   窄視窗會由高度反推出比視窗更寬的寬度（同 .hub-hero 的坑）。 */
.art-hero {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1920 / 310;
  min-height: 200px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
}
.art-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
/* 素材本身已壓暗，這裡只補一層很淡的保險，不再重複壓暗 */
.art-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, .12) 0%, rgba(0, 0, 0, .04) 100%);
}
.art-hero__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: calc(760px + var(--container-pad) * 2);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  text-align: center;
}
.art-hero__title {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  color: #fff;
}
/* 主標維持原級，說明收一階 */
.art-hero__lede { margin: 0; font-size: var(--fs-sm); line-height: 1.4; color: #fff; }

.art-list { padding-block: clamp(var(--space-10), 5vw, 80px) clamp(var(--space-12), 7vw, 120px); }
.art-list__inner {
  width: 100%;
  max-width: calc(1228px + var(--container-pad) * 2);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
/* ── 區塊標頭（參考版型）──
   英文小標 ／ 分類名 ／ 分隔線 ／ 篇數 */
.art-head {
  max-width: 900px;
  margin: 0 auto clamp(var(--space-8), 4vw, 56px);
  text-align: center;
}
.art-head__eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: .08em;
  color: var(--color-accent);
}
.art-head__title {
  margin: 0;
  font-size: var(--fs-2xl);        /* 28px */
  font-weight: var(--fw-bold);
  line-height: 1.2;
}
.art-head__count {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-base);
  line-height: 1.2;
  color: var(--color-text-muted);
}
.art-head__count strong { color: var(--color-brand); }

/* ── 分類篩選 ──
   全部＋各分類的藥丸鈕。目前分類用實心紅，其餘是紅框白底。
   篩選列併進標頭裡：上方是「看的是哪一區、幾篇」，分隔線之後才是切換用的控制項。 */
.art-filter {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
/* 藥丸鈕維持「一列」：放不下就橫向捲，不折行堆成第二列。 */
/* 捲動視窗：兩側的箭頭鈕疊在藥丸列上，邊緣再用漸層淡出當「還有更多」的提示 */
.art-filter__viewport {
  position: relative;
}
.art-filter__arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-brand);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  cursor: pointer;
  transition: background var(--ease-base);
}
/* display:grid 的權重高過瀏覽器預設的 [hidden]{display:none}，
   不補這一條的話 JS 設了 hidden 箭頭還是看得見。 */
.art-filter__arrow[hidden] { display: none; }
.art-filter__arrow:hover,
.art-filter__arrow:focus-visible { background: var(--color-brand-soft); }
.art-filter__arrow--prev { left: 0; }
.art-filter__arrow--next { right: 0; }
.art-filter__arrow span {
  display: block;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--color-brand);
  border-right: 2px solid var(--color-brand);
}
.art-filter__arrow--prev span { rotate: -135deg; margin-left: 3px; }
.art-filter__arrow--next span { rotate: 45deg; margin-right: 3px; }
/* 箭頭底下的漸層，讓藥丸像是捲進去而不是被硬切斷 */
.art-filter__viewport::before,
.art-filter__viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ease-base);
}
.art-filter__viewport::before {
  left: 0;
  background: linear-gradient(90deg, var(--color-bg) 30%, transparent);
}
.art-filter__viewport::after {
  right: 0;
  background: linear-gradient(270deg, var(--color-bg) 30%, transparent);
}
.art-filter__viewport.can-prev::before,
.art-filter__viewport.can-next::after { opacity: 1; }

.art-filter__list {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  /* safe：放得下就置中，放不下退回靠左 —— 純 center 在溢出時會把開頭那顆
     推到捲動範圍之外，怎麼捲都看不到「全部」。 */
  justify-content: safe center;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;

  overflow-x: auto;
  overscroll-behavior-x: contain;
  /* 捲軸會貼在藥丸下緣很醜；邊緣切一半的藥丸本身就是可捲的提示 */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* 留給 focus 外框，不然鍵盤聚焦時外框會被捲動容器切掉 */
  padding-block: 4px;
  margin-block: -4px;
}
.art-filter__list::-webkit-scrollbar { display: none; }
.art-filter__list > li { flex: 0 0 auto; }
.art-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 40 是可點擊的下限；這一列不是設計稿元件，直接用 40 當基準。 */
  min-height: 40px;
  padding: 5px var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-brand);
  border-radius: var(--radius-full);
  font-size: var(--fs-base);
  line-height: 1.2;
  color: var(--color-brand);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ease-base), color var(--ease-base);
}
/* 全站的 a:hover 會改字色（權重 0,1,1 高於 .art-chip），
   所以 hover／目前狀態都要把字色一起寫死，否則紅字會落在紅底上。 */
.art-chip:hover,
.art-chip:focus-visible {
  background: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
  color: #fff;                       /* 白字 / #db202c → 4.94:1 */
}
.art-chip.is-active {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}
.art-chip.is-active:hover,
.art-chip.is-active:focus-visible {
  background: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
  color: #fff;
}

/* 設計稿是三欄；窄一點變兩欄，手機一欄。 */
.art-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.art-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .10);
  transition: box-shadow var(--ease-base), transform var(--ease-base);
}
.art-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
/* 沒有特色圖片時留一塊灰色佔位（設計稿就是這樣呈現），卡片高度才一致。 */
.art-card__media {
  display: block;
  aspect-ratio: 16 / 10;
  background: #d9d9d9;
  overflow: hidden;
}
.art-card__media img { transition: transform var(--ease-base); }
.art-card:hover .art-card__media img { transform: scale(1.04); }
.art-card__media img { width: 100%; height: 100%; object-fit: cover; }
.art-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-3);
  padding: var(--space-5);
}
/* 標題與日期同一行：標題靠左、日期靠右，標題長的時候日期不會被擠掉。 */
.art-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.art-card__title {
  margin: 0;
  font-size: var(--fs-lg);          /* 15 → 18：卡片標題是列表頁的主角，原本偏小 */
  font-weight: var(--fw-bold);
  line-height: 1.4;
}
/* 內距撐開點擊區、外距抵銷所以版面不變（18×1.4 ＋ 22 ＝ 47，過 44 的門檻）。 */
.art-card__title a {
  display: inline-block;
  padding-block: 11px;
  margin-block: -11px;
  color: var(--color-text);
  text-decoration: none;
}
.art-card__title a:hover { color: var(--color-brand); }
.art-card__date {
  flex-shrink: 0;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.art-card__excerpt {
  margin: 0;
  font-size: var(--fs-base);        /* 13 → 15：13px 的中文摘要在列表裡很吃力 */
  line-height: 1.7;
  color: var(--color-text);
}
/* 查看更多：紅色漸層藥丸，貼齊卡片底部 */
.art-card__more {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: auto;
  padding: var(--space-2) var(--space-6);
  background: linear-gradient(90deg, #e6433e 0%, #f4736e 100%);
  border-radius: var(--radius-full);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: #fff;
  text-decoration: none;
  transition: filter var(--ease-base);
}
.art-card__more:hover,
.art-card__more:focus-visible { filter: brightness(.92); color: #fff; }

.art-list__empty { margin: 0; text-align: center; color: var(--color-text-muted); }

.art-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: clamp(var(--space-8), 4vw, 60px);
}
.art-pager .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--color-text);
  text-decoration: none;
}
.art-pager .page-numbers.current,
.art-pager .page-numbers:hover {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}

/* ── RWD ──
   窄畫面把兩側欄收到內文前後，並取消 sticky（欄寬不足時 sticky 沒有意義）。 */
@media (max-width: 768px) {
  /* 6.19:1 在手機只剩 60px 高，放不下標題，改成自動高度 */
  .art-hero {
    aspect-ratio: auto;
    min-height: 0;
    padding-block: var(--space-12);
  }
}

@media (max-width: 1280px) {
  .article__grid { grid-template-columns: 260px minmax(0, 1fr) 260px; gap: var(--space-8); }
}
/* ── 手機版目錄抽屜 ──
   桌機不存在（把手與抽屜都 display:none），rail 留在三欄版面裡。 */
.toc-fab,
.toc-drawer { display: none; }

@media (max-width: 1024px) {
  /* 左緣的「目錄」把手：直書、固定在視窗中間偏上 */
  .toc-fab {
    display: block;
    position: fixed;
    left: 0;
    top: 60vh;
    z-index: var(--z-sticky);
    min-height: 92px;
    padding: var(--space-4) 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left: 0;
    border-radius: 0 10px 10px 0;
    box-shadow: 2px 2px 12px rgba(0, 0, 0, .16);
    cursor: pointer;
    transition: background var(--ease-base);
  }
  .toc-fab__text {
    display: block;
    /* 直書：中文轉 90 度會倒，用 vertical-rl 才是正的 */
    writing-mode: vertical-rl;
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    letter-spacing: .1em;
    color: var(--color-heading);
  }
  .toc-fab:hover,
  .toc-fab:focus-visible { background: var(--color-brand-soft); }
  /* 捲到頁尾時滑出畫面（JS 加上 is-hidden），不要壓在頁尾導覽的字上 */
  .toc-fab {
    transition: background var(--ease-base), translate 240ms ease, opacity 240ms ease;
  }
  .toc-fab.is-hidden {
    translate: -100% 0;
    opacity: 0;
    pointer-events: none;
  }

  .toc-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 1050);
    pointer-events: none;
  }
  /* 後面的頁面模糊掉：純壓黑會讓底下的文字還是看得出形狀，
     模糊之後抽屜與內容的分界清楚很多。降一點黑度，讓模糊自己去做分離。 */
  .toc-drawer__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 240ms ease;
  }
  .toc-drawer__panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(360px, 86vw);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-6) var(--space-5);
    background: var(--color-bg);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .2);
    overflow-y: auto;
    overscroll-behavior: contain;
    translate: -100% 0;
    transition: translate 280ms cubic-bezier(.22, .61, .36, 1);
  }
  .toc-drawer.is-open { pointer-events: auto; }
  .toc-drawer.is-open .toc-drawer__scrim { opacity: 1; }
  .toc-drawer.is-open .toc-drawer__panel { translate: 0 0; }

  /* 抽屜頂端的紅底頁首：負外距把面板內距抵銷掉，紅底才做得到滿版。
     sticky 讓 logo 與 X 在目錄捲動時留在原地（目錄＋其他文章加起來會超過一屏）。 */
  .toc-drawer__head {
    position: sticky;
    top: calc(var(--space-6) * -1);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin: calc(var(--space-6) * -1) calc(var(--space-5) * -1) 0;
    padding: 13px var(--container-pad);
    background: var(--color-brand);
  }
  .toc-drawer__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
    /* 圖 34 高，點擊區補到 44（外距抵銷，不影響列高）—— 同頁首的作法 */
    padding-block: 5px;
    margin-block: -5px;
  }
  .toc-drawer__logo img {
    display: block;
    width: 168px;
    height: 34px;
  }
  .toc-drawer__close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
  }
  /* 右上角的 X：兩條線交叉，比箭頭更明確是「關閉」而不是「收合」 */
  .toc-drawer__close span {
    position: relative;
    display: block;
    width: 22px;
    height: 22px;
    margin-inline: auto;
  }
  .toc-drawer__close span::before,
  .toc-drawer__close span::after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 2px;
    margin-top: -1px;
    background: #fff;            /* 疊在紅底頁首上 */
    border-radius: 1px;
  }
  .toc-drawer__close span::before { rotate: 45deg; }
  .toc-drawer__close span::after { rotate: -45deg; }
  .toc-drawer__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }
  /* 搬進抽屜之後不需要原本的置頂與寬度限制。
     align-self 要明確寫 stretch —— rail 原本是 grid 項目，
     從 .article__grid 的 align-items: start 帶著 start 過來，
     搬進 flex column 之後就會縮成內容寬（實測目錄只剩 186）。 */
  .toc-drawer .article__rail {
    position: static;
    align-self: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  /* 抽屜打開時鎖住背景捲動 */
  body.has-toc-drawer { overflow: hidden; }

  .article__grid { grid-template-columns: 1fr; }
  .article__rail {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .article__rail--toc { order: 1; }
  .article__main { order: 2; }
  .article__rail--more { order: 3; }
}

@media (max-width: 1024px) {
  .art-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
}
/* ── 觸控版型（對齊 1200 的漢堡斷點）── */
@media (max-width: 1200px) {
  .art-chip { min-height: 44px; }
}
/* ── 窄螢幕的版面調整（純版型，不跟觸控斷點綁在一起）── */
@media (max-width: 768px) {
  /* 標題與日期在手機併排只剩約 77px，改成日期在上、標題在下 */
  .art-card__head { flex-direction: column-reverse; align-items: flex-start; gap: var(--space-1); }
}
@media (max-width: 768px) {
  /* 捲動列拉到螢幕兩側：邊緣露出半顆藥丸才看得出「還有更多、可以捲」，
     內距補回來，第一顆與最後一顆仍然不會貼邊。 */
  .art-filter__list {
    margin-inline: calc(var(--container-pad) * -1);
    padding-inline: var(--container-pad);
  }
}
@media (max-width: 600px) {
  .art-grid { grid-template-columns: minmax(0, 1fr); }
  .art-filter__list { gap: var(--space-2); }
  .art-chip { padding: 5px var(--space-4); }
}
