/* 學鳩齋 樣式表
   版面構想：日本傳統色。白天如灰白和紙配消炭墨，夜裡如呂色漆配灰白字；朱印只作齋主之印。字型一律宋體。
   白天：灰白 #f1efe8・生壁 #e6e2d6・消炭 #3f3a39・鈍色 #6e6866・利休鼠 #6c7163・臙脂 #a8343a
         紺鼠（學術）#3e5873・千歳緑（參學）#3d6b4f・朽葉（生活）#86683c
   夜間：呂色 #2a2826・灰白 #e2ddd0・銀鼠 #aaa49b・利休白茶 #a3a894・珊瑚 #e48f7d
         浅縹（學術）#8fa8c8・青磁（參學）#86b79a・芥子（生活）#d2b06a

   目次：1 色彩與字型　2 基本　3 頁首　4 頁尾　5 首頁　6 分類列表　7 文章頁　8 獺祭魚頁
         9 分類背景　10 日夜切換與換頁動畫
   之後新增或調整樣式，請找到對應段落直接修改，不要再往檔尾疊加覆寫。 */


/* ===== 1 色彩與字型 ===== */
:root {
  --paper: #f1efe8;
  --paper-2: #e6e2d6;
  --card: #f7f6f1;
  --ink: #3f3a39;
  --ink-soft: #6e6866;
  --rule: #d3cec3;
  --dove: #6c7163;
  --seal: #a8343a;
  --c-academic: #3e5873;
  --c-talks: #3d6b4f;
  --c-life: #86683c;
  --c-taji: #a8343a;
  --font-display: "Noto Serif TC", "Songti TC", "PMingLiU", "MingLiU", serif;
  --font-body: "Noto Serif TC", "Songti TC", "PMingLiU", "MingLiU", serif;
  --ease: cubic-bezier(.22,.61,.36,1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #2a2826;
  --paper-2: #33302d;
  --card: #2f2c2a;
  --ink: #e2ddd0;
  --ink-soft: #aaa49b;
  --rule: #4a4540;
  --dove: #a3a894;
  --seal: #e48f7d;
  --c-academic: #8fa8c8;
  --c-talks: #86b79a;
  --c-life: #d2b06a;
  --c-taji: #e48f7d;
  color-scheme: dark;
}

/* 齋名：青柳隷書しも（只含「學鳩齋」三字） */
@font-face {
  font-family: "Aoyagi Reisho Name";
  src: url("fonts/aoyagireisho-name.woff2") format("woff2");
  font-display: swap;
}


/* ===== 2 基本 ===== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.9;
  letter-spacing: 0.02em;
}
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 4px; }
a:hover { color: var(--seal); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { text-wrap: balance; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.stage { perspective: 1600px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  font-family: var(--font-body); font-size: 14px; padding: 5px 14px; border-radius: 2px;
  border: 1px solid var(--ink-soft); background: transparent; color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--seal); color: var(--seal); }

/* 區段（分類頁、獺祭魚頁） */
.section { padding: 56px 0; border-bottom: 1px solid var(--rule); }
.section:last-child { border-bottom: 0; }
.page-head { padding: 64px 0 32px; border-bottom: 1px solid var(--rule); }
.page-head + .section { padding-top: 24px; }
.page-head h1, .article h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(28px, 3.6vw, 38px); line-height: 1.5; letter-spacing: .04em; word-break: keep-all; overflow-wrap: anywhere; }
/* 標題只在標點處斷行，不把詞拆開；整句沒有標點又太長時才逐字斷 */
.page-head h1 { margin: 0; }
.page-head p { margin: 0; color: var(--ink-soft); max-width: 36em; }
.sample-note { font-size: 13px; color: var(--dove); margin: 20px 0 0; }


/* ===== 3 頁首 ===== */
header.top { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 10; }
header.top .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 23px; text-decoration: none; letter-spacing: 0.08em; }
.brand-name { display: flex; flex-direction: column; font-family: "Aoyagi Reisho Name", var(--font-display); font-size: 30px; letter-spacing: 0.12em; line-height: 1; }
.top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 4px; }
nav a {
  display: block; text-decoration: none; color: var(--ink-soft); font-size: 15px;
  padding: 4px 10px; border-radius: 2px; position: relative;
}
nav a:hover, nav a[aria-current="page"] { color: var(--ink); }
/* 選單底線：從中間展開 */
nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--seal); transform: scaleX(0); transition: transform .3s var(--ease); }
nav a:hover::after, nav a[aria-current="page"]::after { transform: scaleX(1); }
.ext { font-size: 0.8em; color: var(--dove); margin-left: 2px; }

/* 太陽／月亮切換鈕 */
.theme-toggle {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  cursor: pointer; display: grid; place-items: center; padding: 0; flex: none;
}
.theme-toggle:hover { border-color: var(--seal); color: var(--seal); }
.theme-toggle svg { position: absolute; width: 20px; height: 20px; transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .4s; }
.theme-toggle .sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root[data-theme="dark"] .theme-toggle .sun { opacity: 0; transform: rotate(90deg) scale(.5); }
:root[data-theme="dark"] .theme-toggle .moon { opacity: 1; transform: rotate(0) scale(1); }

/* 閱讀進度：頁首下方一條書籤線 */
#progress { position: fixed; left: 0; top: 0; height: 2px; width: 0; background: var(--seal); z-index: 20; }

@media (max-width: 720px) {
  header.top .wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 6px; padding-top: 10px; padding-bottom: 8px; }
  header.top .top-right { display: contents; }
  header.top .theme-toggle { grid-column: 2; grid-row: 1; }
  header.top nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; }
  header.top nav::-webkit-scrollbar { display: none; }
  header.top nav ul { flex-wrap: nowrap; white-space: nowrap; }
}


/* ===== 4 頁尾 ===== */
footer { border-top: 1px solid var(--rule); }
footer .wrap { padding-top: 26px; padding-bottom: 36px; color: var(--ink-soft); font-size: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.foot-icons { display: inline-flex; gap: 10px; }
.foot-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-soft); border: 1px solid var(--rule); transition: color .2s, border-color .2s; }
.foot-icon:hover { color: var(--seal); border-color: var(--seal); }


/* ===== 5 首頁 ===== */
/* 上半：照片裱在一整條紙色底帶上（紙裱），照片完整顯示不裁切 */
.mount { --plate-h: min(calc(100svh - 180px), 860px); background: var(--paper-2); padding: 40px 24px 28px; }
.mount-inner { max-width: 1320px; margin: 0 auto; }
/* 照片下方的《莊子》引文 */
.spread {
  max-width: 1320px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0;
  border-bottom: 1px solid var(--rule);
}
.leaf { padding-bottom: 28px; }
.leaf-plate { padding-right: 0; min-width: 0; }
.plate { position: relative; height: var(--plate-h); }
.plate-item { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1.1s var(--ease); display: flex; place-items: center; justify-content: center; }
.plate-item.is-on { opacity: 1; }
.plate-item img { max-width: 100%; max-height: var(--plate-h); width: auto; height: auto; object-fit: contain; display: block; box-shadow: 0 30px 60px -32px rgba(30, 25, 20, .55), 0 0 0 1px rgba(63, 58, 57, .06); }
/* 呼吸：停留時極緩放大約 3%；剛換下的那張（was-on）繼續到淡出結束，避免跳動 */
@media (prefers-reduced-motion: no-preference) {
  .plate-item.is-on img, .plate-item.was-on img { animation: breathe 9s ease-in-out infinite alternate; }
  @keyframes breathe { from { transform: scale(1); } to { transform: scale(1.03); } }
}
/* 照片說明：貼齊照片左緣（位置由首頁的程式計算） */
.plate-foot { display: flex; justify-content: flex-start; align-items: baseline; gap: 16px; margin-top: 18px; font-size: 13px; color: var(--dove); letter-spacing: .12em; min-height: 0; transition: margin-left .4s var(--ease); }
.plate-cap { color: var(--ink-soft); font-size: 13px; }
.plate-foot:empty, .plate-cap:empty { display: none; }

/* 引文：整段置中，各行靠左 */
.epigraph { margin: 44px auto 8px; padding: 0; text-align: left; width: fit-content; max-width: 100%; }
.epigraph::before { content: ""; display: block; width: 36px; height: 1px; background: var(--seal); margin: 0 auto 18px 0; }
.epigraph blockquote { margin: 0; padding: 0; border: 0; background: none; }
.epigraph p { margin: 0; font-size: 20px; line-height: 2.1; letter-spacing: .12em; color: var(--ink); font-weight: 600; text-indent: 0; }
.epigraph figcaption { margin-top: 10px; font-size: 14px; letter-spacing: .25em; color: var(--ink-soft); }

/* 下半：左書齋介紹＋畫，右齋主名片 */
.lower { max-width: 1100px; margin: 0 auto; padding: 72px 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; align-items: start; }
/* 小標籤：書齋、書齋主人、著作、摘要、註釋、目錄、引用本文，同一種樣式 */
.lower-label, .abstract b, .notes-block h2, .toc-side b, .cite-box b { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .4em; color: var(--seal); }
.lower-label { margin: 0 0 22px; }
.lower-main { padding-right: 56px; }
.lower-intro p { margin: 0 0 1.15em; font-size: 17px; line-height: 2; color: var(--ink); text-indent: 0; }
.lower-intro p:first-child { font-size: 20px; line-height: 1.9; font-weight: 600; letter-spacing: .04em; }
.lower-art { margin: 34px 0 0; }
.lower-art img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.lower-art figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-soft); letter-spacing: .06em; }
[data-theme="dark"] .lower-art img { filter: brightness(.88); }

.card { border-left: 1px solid var(--rule); padding-left: 56px; }
.card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.card-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--rule); flex: none; }
.card-name { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .12em; }
.card-bio p { margin: 0 0 .9em; font-size: 15px; line-height: 1.95; color: var(--ink-soft); }

.card-books { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule); }
.card-books .lower-label { margin-bottom: 14px; }
.card-books ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.card-books li { display: flex; gap: 12px; align-items: flex-start; }
.card-books svg { width: 19px; height: 19px; flex: none; margin-top: 3px; color: var(--ink-soft); }
.card-books p { margin: 0; }
.book-title { font-size: 14px; line-height: 1.7; color: var(--ink); }
.book-title a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.book-title a:hover { color: var(--seal); border-color: var(--seal); }
.book-meta { font-size: 13px; line-height: 1.7; color: var(--ink-soft); margin-top: 2px !important; }

.card-links { list-style: none; margin: 18px 0 0; padding: 18px 0 0; border-top: 1px solid var(--rule); display: grid; gap: 12px; }
.card-links a, .card-links .is-text { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink); text-decoration: none; }
.card-links svg { width: 19px; height: 19px; color: var(--ink-soft); flex: none; transition: color .2s; }
.card-links a span { border-bottom: 1px solid transparent; transition: border-color .2s, color .2s; }
.card-links a:hover span { color: var(--seal); border-color: var(--seal); }
.card-links a:hover svg { color: var(--seal); }
.card-links .is-text { color: var(--ink-soft); }
#owner, #contact { scroll-margin-top: 90px; }

@media (max-width: 900px) {
  .mount { --plate-h: min(92vw, 70svh); padding: 20px 10px 16px; }
  .spread { padding: 0 10px; }
  .epigraph p { font-size: 17px; }
  .lower { grid-template-columns: minmax(0, 1fr); padding: 48px 20px 64px; gap: 44px; }
  .lower-main { padding-right: 0; }
  .lower-intro p { line-height: 2.05; }
  .lower-intro p:first-child { font-size: 18px; }
  .card { border-left: 0; border-top: 1px solid var(--rule); padding: 32px 0 0; }
}


/* ===== 6 分類列表 ===== */
.list { list-style: none; margin: 0; padding: 0; }
.list li { position: relative; display: grid; grid-template-columns: 8em 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px dashed var(--rule); }
.list li:first-child { padding-top: 0; }
.list time { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; color: var(--dove); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 3px; }
.list h3 { margin: 0 0 4px; font-size: 20px; font-weight: 600; line-height: 1.6; }
.list h3 a { text-decoration: none; }
/* 預覽：三個分類一致，最多三行 */
.list .preview {
  margin: 4px 0 0; max-width: 40em; font-size: 15px; line-height: 1.9; color: var(--ink-soft);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
/* 滑過時落下一條書籤 */
.list li::before {
  content: ""; position: absolute; right: 18px; top: -1px; width: 12px; height: 34px;
  background: var(--c); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 6px), 0 100%);
  transform: scaleY(0); transform-origin: top; transition: transform .3s var(--ease);
}
.list li:hover::before { transform: scaleY(1); }
.list li:first-child::before { top: -22px; }
/* 載入時依序浮現 */
@media (prefers-reduced-motion: no-preference) {
  .list li { animation: rise-in .5s var(--ease) both; }
  .list li:nth-child(2) { animation-delay: .05s; }
  .list li:nth-child(3) { animation-delay: .1s; }
  .list li:nth-child(4) { animation-delay: .15s; }
  .list li:nth-child(n+5) { animation-delay: .2s; }
  @keyframes rise-in { from { transform: translateY(8px); opacity: .35; } }
}

/* 索書號 */
.callno {
  font-family: var(--font-body); font-size: 12px; letter-spacing: 0.08em; color: var(--c);
  border: 1px solid var(--rule); background: transparent; padding: 0 6px; border-radius: 2px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.meta-line { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--dove); }
.kw { font-size: 12px; background: var(--paper-2); color: var(--ink-soft); padding: 0 8px; border-radius: 2px; }
.cat-tag { font-size: 13px; color: var(--c); text-decoration: none; }

@media (max-width: 720px) {
  .list li { grid-template-columns: 1fr; gap: 2px; }
}


/* ===== 7 文章頁 ===== */
.post-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; justify-content: center; }
.article { max-width: 42em; min-width: 0; margin: 0 auto; padding: 64px 0 24px; }
.article .crumbs { font-size: 14px; color: var(--dove); margin-bottom: 12px; }
.article .crumbs a { color: var(--c); text-decoration: none; }
.article h1 { margin: 0 0 8px; }
.subtitle { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; font-style: italic; line-height: 1.6; letter-spacing: 0; }
.article .byline { font-size: 14px; color: var(--ink-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); margin-bottom: 32px; }

/* 摘要 */
.abstract { background: var(--paper-2); padding: 24px; border-left: 3px solid var(--c); border-radius: 0 3px 3px 0; margin: 0 0 32px; font-size: 15px; line-height: 1.95; }
.abstract b { display: block; margin-bottom: 8px; }

/* 內文 */
.prose { font-size: 18px; line-height: 2.05; }
.prose p { margin: 0 0 1.35em; text-indent: 0; }
.prose h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 2.4em 0 .9em; padding-top: .4em; scroll-margin-top: 90px; letter-spacing: .04em; }
.prose h3 { font-size: 20px; font-weight: 600; margin: 1.8em 0 .7em; scroll-margin-top: 90px; }
.prose blockquote { font-family: var(--font-body); font-size: 17px; line-height: 2; background: var(--paper-2); border-left: 3px solid var(--rule); padding: 16px 22px; margin: 1.6em 0; color: var(--ink); border-radius: 0 3px 3px 0; }
.prose blockquote p { text-indent: 0; margin: 0 0 .8em; }
.prose blockquote p:last-child { margin: 0; }
.prose ol, .prose ul { padding-left: 1.6em; margin: 0 0 1.4em; }
.prose li { margin-bottom: .5em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0 1.4em; }
.prose em { font-style: normal; color: var(--ink-soft); font-size: 15px; }
/* 單張圖：高度不超過約一個畫面的七成 */
.prose img { max-width: 100%; max-height: min(70vh, 560px); width: auto; height: auto; display: block; margin: 1.6em auto; border-radius: 2px; }
/* 連續兩張以上的圖：兩欄相簿，點圖看原圖（由文章頁的程式自動排成） */
.prose .gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 1.8em 0; }
.prose .gallery a { display: block; overflow: hidden; border-radius: 2px; background: var(--paper-2); }
.prose .gallery img { width: 100%; height: auto; max-height: none; aspect-ratio: 4 / 3; object-fit: cover; margin: 0; border-radius: 0; transition: transform .4s var(--ease); }
.prose .gallery a:hover img { transform: scale(1.02); }
/* 文章內照片與圖說 */
.prose .post-fig { margin: 2em 0; }
.prose .post-fig img { margin: 0 auto; max-height: min(70vh, 560px); width: auto; max-width: 100%; box-shadow: 0 18px 30px -24px rgba(30,25,20,.45); }
.prose .post-fig figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-soft); letter-spacing: .08em; text-align: center; }
.prose, .notes-block, .fn-pop, .abstract, .cite-box { overflow-wrap: anywhere; word-break: normal; }

/* 註腳號碼 */
.fn { position: relative; top: -.6em; vertical-align: baseline; font-size: 12px; line-height: 1; color: var(--c); background: none; border: 0; padding: 1px 2px; margin: 0 1px; cursor: pointer; font-family: var(--font-body); font-weight: 600; border-radius: 2px; }
.fn:hover { color: var(--seal); text-decoration: underline; }

/* 註腳小卡片 */
.fn-pop { position: absolute; z-index: 30; background: var(--card); color: var(--ink); border: 1px solid var(--rule); border-radius: 4px; padding: 14px 16px 10px; font-size: 14px; line-height: 1.8; box-shadow: 0 10px 30px -12px rgba(0,0,0,.35); }
.fn-pop[hidden] { display: none; }
.fn-pop-n { display: inline-block; min-width: 1.6em; color: var(--c-academic); font-weight: 600; }
.fn-pop-more { display: block; margin-top: 6px; font-size: 12px; color: var(--dove); text-decoration: none; }
@media (prefers-reduced-motion: no-preference) {
  .fn-pop:not([hidden]) { animation: pop-in .18s var(--ease) both; }
  @keyframes pop-in { from { opacity: 0; transform: translateY(4px); } }
}

/* 註釋與參考書目 */
.notes-block { margin-top: 40px; border-top: 1px solid var(--rule); padding-top: 20px; font-size: 14px; line-height: 1.85; color: var(--ink-soft); }
.notes-block h2 { margin: 0 0 12px; scroll-margin-top: 90px; }
.notes-block h3 { font-size: 14px; color: var(--dove); font-weight: 600; margin: 18px 0 8px; letter-spacing: .1em; }
.notes-block ol { margin: 0 0 20px; padding-left: 1.6em; }
.notes-block li { margin-bottom: 6px; scroll-margin-top: 100px; }
.notes-block li:target { background: var(--paper-2); }
.notes-block ul { list-style: none; margin: 0 0 8px; padding: 0; }
.notes-block ul li { padding-left: 2em; text-indent: -2em; }
.fn-back { text-decoration: none; color: var(--dove); font-size: 12px; margin-left: 4px; }

/* 引用本文：借閱卡 */
.cite-box {
  position: relative; margin-top: 28px; border: 1px solid var(--rule); border-top: 3px double var(--seal); border-radius: 3px;
  padding: 16px 20px 30px;
  background-color: var(--card);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, color-mix(in srgb, var(--c-academic) 18%, transparent) 27px 28px);
  background-position: 0 10px;
}
.cite-box::after {
  content: ""; position: absolute; left: 50%; bottom: 8px; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: var(--paper); border: 1px solid var(--rule);
}
.cite-box b { display: block; margin-bottom: 6px; }
.cite-box p { margin: 0 0 12px; font-size: 14px; line-height: 1.8; }

/* 上一篇／下一篇 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--rule); }
.pager a { text-decoration: none; display: block; font-size: 15px; }
.pager small { display: block; color: var(--dove); font-size: 12px; }
.pager .next { text-align: right; }

/* 目錄：寬螢幕在右側，窄螢幕在文前可收合 */
.toc-side { display: none; }
.toc-side b { display: block; margin-bottom: 10px; }
.toc-side ol, .toc-inline ol { list-style: none; margin: 0; padding: 0; }
.toc-side li { margin: 0 0 8px; }
.toc-side a { text-decoration: none; color: var(--ink-soft); display: block; padding-left: 10px; border-left: 2px solid transparent; transition: color .2s, border-color .2s; }
.toc-side a:hover, .toc-side a.on { color: var(--ink); border-left-color: var(--c); }
.toc-side .toc-tail a { color: var(--dove); }
.toc-inline { border: 1px solid var(--rule); border-radius: 3px; padding: 10px 16px; margin: 0 0 28px; background: var(--card); font-size: 15px; }
.toc-inline summary { cursor: pointer; color: var(--ink-soft); }
.toc-inline ol { margin-top: 8px; }
.toc-inline li { margin: 4px 0; }
.toc-inline a { text-decoration: none; }

@media (min-width: 1120px) {
  .post-grid { grid-template-columns: minmax(0, 42em) 220px; }
  .post-grid .article { margin: 0; }
  .post-grid:has(.toc-side[hidden]) { grid-template-columns: minmax(0, 42em); }
  .toc-side:not([hidden]) { display: block; position: sticky; top: 96px; align-self: start; margin-top: 150px; font-size: 13px; line-height: 1.7; }
  .toc-inline { display: none; }
}
@media (max-width: 720px) {
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
}


/* ===== 8 獺祭魚頁 ===== */
.about-grid { display: grid; grid-template-columns: 220px 1fr; gap: 48px; }
.about-grid h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin: 0; }
.about-grid .body { max-width: 38em; }
.about-grid .body p { margin: 0 0 14px; }
.quote { margin: 0 0 20px; padding: 18px 22px; background: var(--paper-2); border-left: 3px solid var(--dove); font-family: var(--font-display); font-size: 18px; }
.quote cite { display: block; margin-top: 6px; font-style: normal; color: var(--ink-soft); font-size: 14px; font-family: var(--font-body); }
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; gap: 14px; }
}


/* ===== 9 分類背景（原圖），文字放在半透明紙面上 ===== */
body.has-bg::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--bgimg) center 35% / cover no-repeat; }
body.has-bg header.top { background: color-mix(in srgb, var(--paper) 78%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
body.has-bg main#app { max-width: 1148px; margin: 40px auto 56px; padding-bottom: 40px; background: color-mix(in srgb, var(--paper) var(--bga, 74%), transparent); -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px); box-shadow: 0 18px 50px -24px rgba(0,0,0,.45); }
body.has-bg footer { background: color-mix(in srgb, var(--paper) 78%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@media (max-width: 1200px) { body.has-bg main#app { margin: 28px 20px 40px; } }
@media (max-width: 700px) { body.has-bg main#app { margin: 16px 10px 28px; } }
/* 手機：文字離螢幕邊緣一律 20px（紙面 10 + 內距 10） */
@media (max-width: 720px) {
  .wrap { padding: 0 20px; }
  body.has-bg main#app .wrap { padding: 0 10px; }
  .page-head { padding: 48px 0 24px; }
  .article { padding-top: 48px; }
}

/* 整幅顯示：畫完整置中於背景，四周用畫邊顏色補滿；文字紙面照常滿版（後台 bg_whole） */
body.bg-whole::before { top: 67px; background: var(--bgimg) center / contain no-repeat, var(--bgfill, var(--paper-2)); }
/* 透明灰紙面、不模糊（後台 bg_gray）。文字框透明度由後台 bg_transparency 設定，版型換算成不透明度 --bga */
body.bg-gray main#app, body.bg-gray header.top, body.bg-gray footer { -webkit-backdrop-filter: none; backdrop-filter: none; }
body.bg-gray main#app { background: rgb(232 232 230 / var(--bga, 62%)); }
body.bg-gray header.top, body.bg-gray footer { background: rgba(232, 232, 230, .72); }
[data-theme="dark"] body.bg-gray main#app { background: rgb(28 28 30 / calc(var(--bga, 62%) - 4%)); }
[data-theme="dark"] body.bg-gray header.top, [data-theme="dark"] body.bg-gray footer { background: rgba(28, 28, 30, .7); }


/* ===== 10 日夜切換與換頁動畫：只動 transform 與 opacity ===== */
/* 切換時整頁緩緩換色（不支援圓形展開的瀏覽器） */
html.theme-fade body, html.theme-fade header.top, html.theme-fade footer { transition: background-color .5s ease, color .5s ease, border-color .5s ease; }

/* 換頁：整頁淡出淡入、內容輕輕上浮 */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .38s var(--ease) both; }
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* 日夜切換：圓形從按鈕展開 */
html.theme-reveal::view-transition-old(root) { animation: none; }
html.theme-reveal::view-transition-new(root) { animation: reveal .6s var(--ease) both; }
@keyframes reveal { from { clip-path: circle(0 at var(--rx, 100%) var(--ry, 0)); } to { clip-path: circle(var(--rr, 150vmax) at var(--rx, 100%) var(--ry, 0)); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
  .theme-toggle svg, nav a::after, .list li::before { transition: none; }
}
