/* 首頁固定文字的宋體子集（約 13 KB；iPhone 沒有 Songti TC，不載入就會退成黑體）。
   動態文字（作品標題）不用它：一行裡一字宋一字黑更難看。字與清單見 scripts/subset-brand-font.py。 */
@font-face { font-family: "Brand Serif"; src: url("/assets/fonts/brand-serif-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --paper: #F7F5F0;
  --paper-2: #EDE9E1;
  --ink: #1C1A17;
  --ink-2: #3A362F;
  --muted: #5B554C;
  --rule: #DDD8CE;
  --seal: #9E2B1D;
  --seal-text: #8A2418; /* 朱紅的文字版：在紙色上對比 ≥ 7:1（朱紅只給朱印與落款章一類的印記，釋文正在讀的標示線也用朱紅；其他互動與提醒改用 --accent） */
  /* 跳色（石青，取自書畫顏料）：只給「可以按的東西」與「現在的位置」——播放鈕、進度、聲音鈕、目前的踏石、標籤、小標、連結滑過、提醒文字。
     --accent 對白砂 #E2E0DA 5.28:1、對 --accent-soft 5.40:1、對紙色 #F7F5F0 6.39:1，白字放在它上面 6.96:1（都 ≥ 4.5:1）。作品、標題、釋文維持墨色。 */
  --accent: #2C5F78;
  --accent-soft: #DCE4E6;
  --serif: "Songti TC", "Noto Serif CJK TC", "Noto Serif TC", "PMingLiU", serif;
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --serif-fixed: "Brand Serif", var(--serif); /* 只給寫死的文字用 */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: var(--ink); }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 520px) { .wrap { padding: 0 20px; } }

.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 24px 0; border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 10; padding: 12px 18px; background: var(--ink); color: var(--paper); text-decoration: none; }
.skip-link:focus { top: 12px; }
.skip-link:hover { color: var(--paper); }
.brand-mark { width: 26px; height: 26px; background: var(--seal); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 15px; }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 4px; }
.site-nav { display: flex; gap: 24px; font-size: 15px; }
.site-nav a { text-decoration: none; padding: 10px 0; }

.serif { font-family: var(--serif); }
.muted { color: var(--muted); }

.btn { min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--btn-line, #8A8479); background: transparent; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.solid { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.swatch { width: 12px; height: 12px; border: 1px solid rgba(0, 0, 0, 0.15); display: inline-block; }

.site-footer { margin-top: 72px; padding: 28px 0 44px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

/* ---------- 列表頁 ---------- */
/* 首頁是一座枯山水：白砂與耙紋由 garden.js 畫在最底層，標 data-calm 的元素是石，耙紋繞著它們流動。 */
body.garden-page { --btn-line: #6B665C; --paper: #E2E0DA; --paper-2: #D6D3CB; --muted: #48443C; --seal-text: #7A1F14; --veil: 226, 224, 218; --rule: rgba(58, 54, 47, 0.28); position: relative; overflow-x: clip; min-height: 100svh; }
body.garden-page ::selection { background: rgba(158, 43, 29, 0.2); }
body.garden-page .brand-mark { background: #9E2B1D; color: #F3EEE3; } /* 朱印在任何背景都是同一個紅 */
body.garden-page .site-header { border-bottom: 0; }
.rest-box { position: absolute; pointer-events: none; }
.work-page .controlbar .play { background: none; color: var(--ink); border: 1px solid var(--ink-2); transition: background-color 240ms ease-out, color 240ms ease-out; }
.work-page .controlbar .play:hover { background: var(--ink); color: var(--paper); }
.work-page .controlbar span.pill { background: none; border: 0; color: var(--ink-2); padding: 8px 4px; }
.work-page .controlbar button.pill { background: none; color: var(--ink); border: 1px solid var(--rule); }
.work-page .progress { height: 2px; background: var(--rule); }
.work-page .related { border-top: 0; }
.garden { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 900ms cubic-bezier(0.16, 1, 0.3, 1); }
.garden[data-ready="true"] { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .garden { transition: none; } }
body.garden-page .wrap { position: relative; z-index: 1; max-width: 1320px; padding: 0 clamp(20px, 4vw, 56px); }

.home-head { display: flex; align-items: center; padding: 28px 0 0; }
.home-head .site-nav { font-family: var(--serif-fixed); font-size: 18px; gap: 40px; letter-spacing: 0.12em; }

/* 第一屏：作品、釋文（沒有釋文時是三句話）、站名三塊，位置由 list.js 依作品比例設的 data-layout 決定（規則見 src/works/homeLayout.ts）。
   wide：作品在左，站名在右上，釋文橫排在右下，底邊與作品底邊對齊。
   tall：窄作品旁邊的空白多，釋文改直排，落在作品與站名之間；作品左側、作品與釋文、釋文與站名三段留白平分。
   兩種版面站名的上緣都對齊作品的上緣。--r 是作品比例。釋文只放前三行，字級與每行長度由 list.js 算（--wfit、--ww、--wh），放不下的部分慢慢捲。 */
.home-hero { --gutter: clamp(20px, 4vw, 56px); --share: 0.68; --h: clamp(360px, calc(100svh - 202px), 760px); --maxw: calc((min(1320px, 100vw) - 2 * var(--gutter)) * var(--share)); --sw: min(calc(var(--h) * var(--r, 1.35)), var(--maxw)); display: grid; grid-template-rows: auto auto; row-gap: 12px; align-content: center; min-height: calc(100svh - 72px); padding: 24px 0 40px; }
.home-hero[data-layout="wide"] { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto; column-gap: clamp(24px, 4vw, 56px); } /* 右欄兩格：站名在上、三句話在下，作品跨過這兩格，視窗再矮也不會互相壓到 */
.home-hero[data-layout="tall"] { grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr) auto minmax(24px, 1fr) auto; }
.home-sheet { display: contents; }
.home-sheet[hidden] { display: none; }
.home-work { display: block; position: relative; width: var(--sw); max-width: 100%; aspect-ratio: var(--r, 1.35); justify-self: start; grid-row: 1; }
.home-work img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; }
.home-work img[data-sheet-ready="true"] { box-shadow: 0 0 0 1px rgba(40, 34, 26, 0.08), -5px 9px 14px -4px rgba(40, 34, 26, 0.26), -22px 38px 60px -20px rgba(40, 34, 26, 0.34); }
/* 砂圈中央的石頭與細圓；佔位層透明，作品到了才有落影。 */
.sheet-loading { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sheet-stone, .sheet-ripple { position: absolute; inset: 0; margin: auto; width: var(--stone-size); height: var(--stone-size); }
.sheet-stone { opacity: 0; transform: scale(0.9); }
.sheet-stone .stone { display: block; width: 100%; height: 100%; transition: none; }
.sheet-ripples { position: absolute; inset: 0; }
.sheet-ripple { border: 1px solid var(--ink-2); border-radius: 50%; opacity: 0; }
.sheet-still .sheet-stone { opacity: 1; transform: none; }
.sheet-still .sheet-ripple:first-child { opacity: 0.5; transform: scale(1.5); }
.sheet-still .sheet-ripple:nth-child(2) { opacity: 0.36; transform: scale(2.1); }
.sheet-error { z-index: 0; }
.home-hero[data-layout="wide"] .home-work { grid-column: 1; grid-row: 1 / 3; }
.home-hero[data-layout="tall"] .home-work { grid-column: 2; }

.home-cap { grid-row: 2; font-family: var(--serif); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; }
.cap-link { flex: 1 1 0; min-width: 11em; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 18px; min-height: 48px; padding: 8px 0; color: var(--ink); text-decoration: none; } /* 整行題記都是連結，點標題也進作品頁 */
.cap-link:hover { color: var(--accent); }
.home-hero[data-layout="wide"] .home-cap { grid-column: 1; grid-row: 3; width: var(--sw); max-width: 100%; }
.home-hero[data-layout="tall"] .home-cap { grid-column: 2 / -1; justify-self: start; width: min(100%, max(var(--sw), 600px)); } /* 固定寬，踏石的位置不會隨標題長短跳動 */
/* 踏石：上一件／下一件按鈕沿用播放鈕的圓形細線，中間最多五顆石，目前這件最大、外圍兩圈耙紋 */
.home-work { touch-action: pan-y; }
.home-step { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.home-step[hidden] { display: none; }
.step-btn { width: 48px; height: 48px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--ink-2); border-radius: 50%; background: none; color: var(--ink); cursor: pointer; transition: background-color 240ms ease-out, color 240ms ease-out, opacity 240ms ease-out; }
.step-btn:hover { background: var(--ink); color: var(--paper); }
.step-btn[aria-disabled="true"] { opacity: 0.32; cursor: default; }
.step-btn[aria-disabled="true"]:hover { background: none; color: var(--ink); }
.step-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; height: 48px; }
.step { position: relative; display: flex; align-items: center; justify-content: center; width: 20px; height: 48px; }
.step .stone { width: 15px; height: 15px; opacity: 0.35; }
.step[data-d="1"] { width: 30px; }
.step[data-d="1"] .stone { width: 20px; height: 20px; opacity: 0.6; }
.step[data-d="0"] { width: 56px; }
.step[data-d="0"] .stone { width: 28px; height: 28px; opacity: 1; }
.step[data-d="0"]::before, .step[data-d="0"]::after { content: ""; position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px solid var(--accent); transform: translate(-50%, -50%); }
.step[data-d="0"]::before { width: 40px; height: 40px; }
.step[data-d="0"]::after { width: 54px; height: 54px; border-color: rgba(44, 95, 120, 0.4); } /* --accent 的淡一階 */
@media (prefers-reduced-motion: reduce) { .step-btn { transition: none; } }
.cap-label { font-family: var(--serif-fixed); font-size: 15px; letter-spacing: 0.1em; color: var(--muted); white-space: nowrap; }
.cap-title { font-size: 22px; letter-spacing: 0.12em; }

.home-mark { grid-row: 1; align-self: start; justify-self: end; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.home-hero[data-layout="wide"] .home-mark { grid-column: 2; }
.home-hero[data-layout="tall"] .home-mark { grid-column: 6; }
.home-name { margin: 0; writing-mode: vertical-rl; font-family: var(--serif-fixed); font-size: clamp(44px, 7.1svh, 64px); font-weight: 400; letter-spacing: 0.16em; line-height: 1; }
.home-mark .brand-mark { width: 40px; height: 40px; font-family: var(--serif-fixed); font-size: 24px; text-decoration: none; }
.home-mark .brand-mark:hover { color: var(--paper); }

/* 釋文沿用早期三句話的版型：宋體、墨色、字距寬、行距大，一句一行，底部對齊作品底邊 */
.home-words { grid-row: 1; align-self: end; font-family: var(--serif); color: var(--ink-2); }
.home-hero[data-layout="tall"] .home-words { align-self: start; } /* 直排釋文在作品高度的中線：位置由 list.js 算（margin-top） */
.home-hero[data-layout="wide"] .home-words { grid-column: 2; grid-row: 2; justify-self: start; }
.home-hero[data-layout="tall"] .home-words { grid-column: 4; }
/* 釋文：只放前三行，行距放寬（直排 2.4 倍字高、橫排 2.2 倍）。放不下的部分用 overflow 藏起來，
   由 list.js 慢慢捲；overflow 用 auto 是為了手指、滾輪與方向鍵可以自己撥，捲軸不顯示。 */
.words-scroll { --wfit: 18px; --fa: 0px; --fb: 0px; --wfade: 36px; font-size: var(--wfit); overflow: auto; scrollbar-width: none; transition: opacity 500ms ease-out; }
.words-scroll::-webkit-scrollbar { display: none; }
.words-scroll p { margin: 0; white-space: nowrap; }
/* 墨色濃淡：第一行最濃（--ink）、第二行（--ink-2）、第三行以後轉淡（--muted，對比仍約 6:1），像一筆墨寫到後面漸淡 */
.words-scroll p:nth-child(1) { color: var(--ink); }
.words-scroll p:nth-child(n + 3) { color: var(--muted); } /* 斷行由 list.js 的 fitWords 決定，一行一個 <p>，瀏覽器不再另外折行 */
.home-hero[data-layout="tall"] .words-scroll p + p { margin-block-start: var(--wg, 40px); } /* 直排時下一行在左邊，block-start 就是它的右側 */
.home-hero[data-layout="wide"] .words-scroll { width: var(--ww, 280px); height: var(--wh, 120px); line-height: 1.85; letter-spacing: 0.06em; }
.home-hero[data-layout="tall"] .words-scroll { writing-mode: vertical-rl; width: var(--ww, 170px); height: var(--wh, 320px); line-height: 1; letter-spacing: 0.2em; }
/* 行進方向兩端用遮罩淡出，不加框；起點那端在還沒捲動時不淡 */
.home-words[data-scrolls] .words-scroll { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fa), #000 calc(100% - var(--fb)), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fa), #000 calc(100% - var(--fb)), transparent 100%); }
.home-hero[data-layout="tall"] .home-words[data-scrolls] .words-scroll { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--fa), #000 calc(100% - var(--fb)), transparent 100%); mask-image: linear-gradient(to left, transparent 0, #000 var(--fa), #000 calc(100% - var(--fb)), transparent 100%); }
/* 讀到哪裡：2px 細線，砂線底軌、朱紅已讀，延用播放進度的語彙；直排由右往左長，橫排由左往右。
   線尾是暫停鈕（手指放開、滑鼠移開都會續捲，所以要有一個會一直維持的開關）；按鈕本身 44px，用負邊界不多佔高度 */
.words-ctl { display: none; align-items: center; gap: 4px; margin-top: 4px; width: var(--ww, 170px); }
.home-words[data-scrolls] .words-ctl { display: flex; }
.home-hero[data-layout="tall"] .words-ctl { flex-direction: row-reverse; }
.words-bar { flex: 1 1 auto; height: 2px; background: var(--rule); }
.words-bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(var(--p, 0)); transform-origin: left center; }
.home-hero[data-layout="tall"] .words-bar i { transform-origin: right center; }
.words-pause { flex: none; width: 44px; height: 44px; margin: -10px -8px; padding: 0; border: 0; background: none; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.words-pause:hover { color: var(--accent); }
.words-pause[aria-pressed="true"], .words-pause:active { color: var(--accent); }
.words-pause svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.words-pause .ic-play { display: none; fill: currentColor; stroke-width: 1; }
.words-pause[aria-pressed="true"] .ic-pause { display: none; }
.words-pause[aria-pressed="true"] .ic-play { display: inline; }
@media (prefers-reduced-motion: reduce) { .words-pause { display: none; } } /* 偏好減少動態時本來就不自己捲 */
.words-scroll:focus-visible, .words-pause:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.garden-wall { height: clamp(220px, 30vw, 430px); width: 100vw; margin-left: calc(50% - 50vw); background: url("/assets/garden-wall.webp") center bottom / cover no-repeat; filter: grayscale(0.88) sepia(0.08) contrast(0.96) brightness(1.03); -webkit-mask-image: linear-gradient(transparent, #000 44%); mask-image: linear-gradient(transparent, #000 44%); } /* 水墨：近乎單色，上緣樹梢淡入；牆腳是一條實線，落影由 garden.js 畫在牆下（data-wall） */
.home-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 48px; margin-top: 8px; }
.home-list-head h2 { margin: 0; font-family: var(--serif-fixed); font-size: clamp(30px, 2.4vw, 34px); font-weight: 400; letter-spacing: 0.2em; }
body.garden-page .chips { gap: 8px 28px; }
.chip { border: 0; background: none; color: var(--ink-2); font-family: var(--serif); font-size: 17px; letter-spacing: 0.1em; min-height: 44px; padding: 0 2px; cursor: pointer; }
.chip:hover { color: var(--accent); }
body.garden-page .chip[aria-pressed="true"] { background: none; color: var(--accent); box-shadow: inset 0 -1.5px 0 var(--accent); }

#series-list:focus { outline: none; }
.works { list-style: none; margin: 44px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px clamp(48px, 7vw, 112px); }
.works .card { flex-direction: row; align-items: center; gap: 26px; min-height: 104px; padding: 12px 0; color: var(--ink); }
.stone { width: 64px; height: 64px; flex: 0 0 auto; color: #4A4640; overflow: visible; transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1); }
.stone .rock { fill: currentColor; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.stone .facet { fill: none; stroke: var(--stone-facet, #8E8A81); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }.card:hover .stone, .card:focus-visible .stone { transform: translateY(-3px); }
@media (prefers-reduced-motion: reduce) { .stone { transition: none; } .card:hover .stone, .card:focus-visible .stone { transform: none; } }
.words { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.works .card .title { font-family: var(--serif); font-size: clamp(21px, 1.85vw, 26px); font-weight: 600; letter-spacing: 0.08em; line-height: 1.4; }
.works .card:hover .title { color: var(--accent); }
.works .card .sub { font-size: 15px; letter-spacing: 0.06em; line-height: 1.5; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; width: fit-content; margin-top: 40px; font-family: var(--serif-fixed); font-size: 17px; letter-spacing: 0.08em; }
.pager[hidden] { display: none; }
.page-nums { display: flex; gap: 6px; }
.page-step, .page-num { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; color: var(--ink-2); text-decoration: none; }
.page-step[aria-disabled="true"] { color: var(--muted); opacity: 0.55; }
.page-num[aria-current="page"] { color: var(--accent); font-weight: 700; box-shadow: inset 0 -1.5px 0 var(--accent); }
a.page-step:hover, a.page-num:hover { color: var(--accent); }
.empty-note { margin: 72px 0 0; font-family: var(--serif); font-size: 19px; letter-spacing: 0.08em; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }

.home-about { display: flex; flex-wrap: wrap; gap: 20px 56px; margin-top: 128px; max-width: 760px; }
.home-about h2 { margin: 0; font-family: var(--serif-fixed); font-size: 26px; font-weight: 400; letter-spacing: 0.2em; }
.home-about > div { flex: 1 1 360px; min-width: 0; }
.home-about p { margin: 0; }
.home-about .serif { font-size: 18px; line-height: 2; color: var(--ink-2); }
.home-about .muted { margin-top: 12px; font-size: 15px; }
body.garden-page .site-footer { margin-top: 96px; color: var(--muted); }

@media (max-width: 1100px) {
  .home-hero { --share: 0.6; }
}
@media (max-width: 860px) {
  /* 手機：站名一律在右邊，第一屏就看得到（手機瀏覽器的上下列會吃掉不少高度，站名不能被推到折線下面）。
     寬作品在左，題記與釋文接在它下面；窄作品維持作品、釋文、站名三欄並排 */
  .home-hero { --h: clamp(280px, calc(100svh - 224px), 680px); min-height: 0; align-content: start; row-gap: 12px; padding: 8px 0 32px; }
  .home-hero[data-layout="wide"] { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; column-gap: 20px; }
  .home-hero[data-layout="wide"] .home-work { grid-column: 1; grid-row: 1; width: 100%; }
  .home-hero[data-layout="wide"] .home-work img[data-sheet-ready="true"] { box-shadow: 0 0 0 1px rgba(40, 34, 26, 0.08), -4px 8px 12px -4px rgba(40, 34, 26, 0.26), -10px 22px 32px -12px rgba(40, 34, 26, 0.34); }
  .home-hero[data-layout="wide"] .home-cap { grid-column: 1; grid-row: 2; width: auto; }
  .home-hero[data-layout="wide"] .home-words { grid-column: 1; grid-row: 3; align-self: start; margin-top: 12px; }
  .home-hero[data-layout="wide"] .home-mark { grid-column: 2; grid-row: 1 / 4; }
  .home-hero[data-layout="tall"] { --sw: min(calc(var(--h) * var(--r, 0.4)), calc((100vw - 2 * var(--gutter)) * 0.42)); grid-template-columns: auto minmax(16px, 1fr) auto minmax(16px, 1fr) auto; }
  .home-hero[data-layout="tall"] .home-work { grid-column: 1; }
  .home-hero[data-layout="tall"] .home-work img[data-sheet-ready="true"] { box-shadow: 0 0 0 1px rgba(40, 34, 26, 0.08), -4px 8px 12px -4px rgba(40, 34, 26, 0.26), -10px 22px 32px -12px rgba(40, 34, 26, 0.34); }
  .home-hero[data-layout="tall"] .home-cap { grid-column: 1 / -1; width: auto; justify-self: stretch; }
  .home-step { flex: 1 1 100%; justify-content: space-between; gap: 8px; }
  .step-btn { width: 44px; height: 44px; }
  .home-hero[data-layout="tall"] .home-words { grid-column: 3; }
  .home-hero[data-layout="tall"] .home-mark { grid-column: 5; }
  .home-name { font-size: clamp(44px, 12.4vw, 64px); }
  .home-mark .brand-mark { width: 44px; height: 44px; font-size: 26px; }
  .cap-title { font-size: 20px; }
}
@media (max-width: 520px) {
  /* 手機：站名與朱印貼著右緣，原本的 20px 邊太擠（iPhone 17 Pro 寬 402px，Safari 上更明顯）。首頁左右各放寬到 28px，
     橫放時再避開瀏覽器的安全區（瀏覽器圓角與動態島） */
  body.garden-page .wrap { padding: 0 max(28px, env(safe-area-inset-right)) 0 max(28px, env(safe-area-inset-left)); }
  .home-hero { --gutter: 28px; }
  /* 站名在手機上縮小：橫幅作品很矮（約 206px），原本 50px 的站名比作品還高三分之一，變成畫面裡最重的東西；約 40px 時是作品高度的 1.1 倍左右，仍是右緣的落款 */
  .home-name { font-size: clamp(34px, 10vw, 44px); letter-spacing: 0.12em; }
}
@media (max-width: 760px) {
  .works { grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 28px; }
  .works .card { gap: 20px; min-height: 92px; }
  .stone { width: 48px; height: 48px; }
  .pager { gap: 4px 14px; }
}

.series-head { padding-top: 88px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.series-head h2 { margin: 0; font-family: var(--serif); font-size: 30px; letter-spacing: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.series { display: flex; flex-wrap: wrap; gap: 24px 48px; padding: 36px 0; border-top: 1px solid var(--rule); margin-top: 28px; }
.series + .series { margin-top: 0; }
.series aside { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.series aside h3 { margin: 0; font-family: var(--serif); font-size: 24px; letter-spacing: 2px; display: flex; align-items: center; gap: 12px; }
.series aside h3 .swatch { width: 26px; height: 26px; }
.grid { flex: 4 1 560px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 32px 24px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; } } /* 手機：兩欄，一個系列不用滑太久 */
.card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.card .thumb { aspect-ratio: 3 / 4; overflow: hidden; background: var(--paper-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.card .title { font-family: var(--serif); font-size: 16px; line-height: 1.5; }
.card .sub { font-size: 13px; color: var(--muted); }

/* ---------- 作品頁 ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0 28px -14px; padding: 6px 14px; width: fit-content; max-width: 100%; font-size: 16px; color: var(--muted); background: rgba(var(--veil), 0.86); } /* 照片背景上的底，文字才讀得清楚 */
.crumbs a { color: var(--muted); text-decoration: none; position: relative; }
.crumbs a::after, .related header a::after { content: ""; position: absolute; inset: -10px -8px; } /* 看不見的點擊區：手機上不到 44px 高的連結也點得到，版面不變 */
.related header a { position: relative; }
.stage-col { flex: 0 0 auto; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.stage { position: relative; width: 100%; max-width: 560px; aspect-ratio: 9 / 16; overflow: hidden; background: transparent; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.thumb.scene { position: relative; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; }
.thumb.scene img { width: auto !important; height: auto !important; max-width: 72%; max-height: 88%; object-fit: contain; box-shadow: 0 1px 2px rgba(20, 12, 5, 0.35), 0 10px 20px rgba(20, 12, 5, 0.3); }
.card:hover .thumb.scene img { transform: translateY(-3px); }
.controlbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.progress { height: 3px; background: rgba(140, 134, 124, 0.45); }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); }
/* 控制列在畫布外、背景可能很深或很淺：用紙色底加細框，兩種背景都看得清楚 */
.controlbar .play, .controlbar .pill { background: var(--paper); color: var(--ink); border: 1px solid rgba(0, 0, 0, 0.22); }
.play { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(28, 26, 23, 0.8); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pill { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 14px; background: rgba(28, 26, 23, 0.8); color: var(--paper); font-size: 17px; letter-spacing: 1px; border: 0; font-family: inherit; }
button.pill { min-height: 44px; cursor: pointer; }
.stage-note { font-size: 16px; color: var(--muted); }

.facts { margin: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px 16px; font-size: 18px; padding-top: 22px; border-top: 1px solid var(--rule); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.draft { font-size: 16px; color: var(--accent); }

.intro, .notes { padding-top: 80px; display: flex; flex-wrap: wrap; gap: 24px 48px; }
.intro h2, .notes h2 { margin: 0; flex: 1 1 200px; font-family: var(--serif); font-size: 24px; letter-spacing: 2px; }
.intro .body, .notes .body { flex: 4 1 520px; min-width: 0; max-width: 720px; display: flex; flex-direction: column; gap: 18px; }
.intro .body p { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 2; color: var(--ink-2); }
.xidu { padding-top: 96px; display: flex; flex-direction: column; gap: 80px; }
.xidu > header h2 { margin: 0; font-family: var(--serif); font-size: 30px; letter-spacing: 4px; }
.xidu > header p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.detail { display: flex; flex-wrap: wrap; gap: 32px 56px; align-items: center; }
.detail.reverse { flex-direction: row-reverse; }
.detail figure { margin: 0; flex: 3 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.detail.narrow figure { flex: 1 1 260px; max-width: 360px; }
.detail figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--paper-2); }
.detail figcaption { display: flex; gap: 12px; align-items: baseline; font-size: 14px; color: var(--muted); }
.detail figcaption b { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--accent); }
.detail .body { flex: 2 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.detail .body h3 { margin: 0; font-family: var(--serif); font-size: 26px; line-height: 1.5; }
.detail .body p { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 2; color: var(--ink-2); }
.pull { margin: 0; display: flex; gap: 18px; }
.pull::before { content: ""; flex: 0 0 auto; width: 3px; background: var(--accent); }
.pull p { margin: 0; font-family: var(--serif); font-size: clamp(24px, 3vw, 34px) !important; line-height: 1.6 !important; font-weight: 600; color: var(--ink) !important; }

.related { margin-top: 96px; padding-top: 40px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 24px; }
.related header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.related h2 { margin: 0; font-family: var(--serif); font-size: 24px; letter-spacing: 2px; }
.related .works { margin-top: 8px; }

/* ---------- 作品頁（docs/designs/work-page-redesign.md §14）：和首頁同一個版面 ----------
   第一屏沿用首頁的 .home-hero（作品、釋文、直排標題三塊，版面由 homeLayout 決定 wide／tall），差別只有三處：
   作品是會播放運鏡的畫布（取景窗比作品大一圈，窗外透明）、標題是作品標題而不是站名、釋文桌機放在固定區域（放不下就慢慢捲、播放時跟著運鏡；窄版完整顯示，見 §14.8）。
   往下是水墨化的頁首照片（借景）：做法與首頁的土牆相同，一道全寬的牆，上緣淡進砂裡，牆腳落影由 garden.js 畫。 */
.pill[hidden] { display: none; }
.work-bar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 22px 0 0; }
.work-bar .brand { gap: 14px; min-height: 52px; flex: none; white-space: nowrap; }
.work-bar .site-nav { flex: none; white-space: nowrap; }
.work-bar .brand-mark { width: 44px; height: 44px; font-family: var(--serif-fixed); font-size: 27px; border-radius: 2px; }
.work-bar .brand-name { font-family: var(--serif-fixed); font-size: 27px; font-weight: 400; letter-spacing: 0.22em; }
.work-bar .site-nav { font-family: var(--serif-fixed); font-size: 18px; gap: 40px; letter-spacing: 0.12em; }
.work-bar a:hover { color: var(--accent); }
.work-bar .brand:hover { color: var(--ink); }

.work-hero { --h: clamp(340px, calc(100svh - 252px), 760px); min-height: 0; align-content: start; padding: 28px 0 24px; }
.work-hero { padding-left: max(0px, calc(var(--ring-reach, 0px) - var(--gutter) + 8px)); } /* 左邊的砂圈要放得下：視窗窄（如編輯器預覽的 1280）時整組往右讓出，作品才在沙堆中間 */
.work-hero .home-words, .work-hero .home-mark { position: relative; z-index: 2; } /* 畫布取景窗比作品大一圈：文字永遠在畫布上面 */
.work-stage { position: relative; aspect-ratio: var(--r, 1.35); height: auto; touch-action: pan-y; }
.work-stage .rest-box { inset: 0; } /* 砂圈繞著作品本身；作品與陰影、砂縫由播放器畫在 canvas */
.work-stage canvas { position: absolute; display: block; pointer-events: none; }
.work-hero .home-work { grid-row: 1; }
.work-hero[data-layout="wide"] .home-work { grid-row: 1 / 3; }
.work-cap { position: relative; z-index: 2; gap: 8px 18px; }
.work-cap .progress { flex: 1 1 100%; order: -1; height: 2px; background: var(--rule); margin-bottom: 8px; }
.work-cap .controlbar { flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
.work-cap .controlbar .play { background: var(--accent); color: #fff; border: 1px solid var(--accent); width: 48px; height: 48px; flex: none; transition: background-color 240ms ease-out, color 240ms ease-out; }
.work-cap .controlbar .play:hover { background: var(--accent-soft); color: var(--accent); }
.work-cap .controlbar span.pill { background: none; border: 0; color: var(--ink-2); padding: 8px 4px; font-family: var(--serif); letter-spacing: 0.1em; }
.work-cap .controlbar button.pill { background: none; color: var(--ink); border: 1px solid var(--ink-2); }
.work-cap .stage-note { flex: 1 1 100%; margin: 0; }
/* 聲音鈕（有配樂才有）：開＝跳色外框與文字、淡底；關＝喇叭加斜線、外框與文字退成墨色、底色透明。狀態靠圖示與文字，不只靠顏色 */
.work-cap .controlbar .sound { flex: none; min-width: 0; max-width: 100%; min-height: 48px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px 0 12px; border-radius: 24px; border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-family: var(--serif); font-size: 17px; letter-spacing: 0.08em; cursor: pointer; transition: background-color 240ms ease-out, color 240ms ease-out, border-color 240ms ease-out; }
.work-cap .controlbar .sound[aria-pressed="false"] { border-color: var(--ink-2); background: transparent; color: var(--ink-2); }
.work-cap .controlbar .sound:hover { background: var(--accent); color: #fff; }
.work-cap .controlbar .sound svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.work-cap .controlbar .sound .sound-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-cap .controlbar .sound[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .work-cap .controlbar .sound, .work-cap .controlbar .play { transition: none; } }
@media (max-width: 520px) {
  /* 手機：只留圖示（44×44 圓形），文字藏起來，aria-label 還在 */
  .work-cap .controlbar .sound { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .work-cap .controlbar .sound .sound-text { display: none; }
}
.home-step .step-btn[aria-disabled="true"] { pointer-events: none; }
a.step-btn:hover { background: var(--ink); color: var(--paper); }

/* 標題與出處：直排，標題在右、出處在它左邊略低；標題字卡是 Mac 輸出的透明圖（只有標題），沒有字卡時用文字 */
.work-mark { flex-direction: row-reverse; align-items: flex-start; gap: 14px; }
.work-hero[data-layout="wide"] .work-mark { justify-self: end; }
.work-title { margin: 0; font-weight: 400; }
.work-title img { display: block; width: auto; max-width: none; }
.work-title-text { display: block; writing-mode: vertical-rl; font-family: var(--serif); font-size: clamp(34px, 5vw, 60px); font-weight: 500; letter-spacing: 0.16em; line-height: 1.15; max-height: calc(var(--h) * 0.72); }
.work-source { margin: 0; padding-top: 96px; writing-mode: vertical-rl; font-family: var(--serif); font-size: 18px; letter-spacing: 0.24em; line-height: 1; color: var(--ink-2); }

/* 釋文：完整顯示。每行一句，斷行規則與首頁同一份（home-layout.js 的 wordsLines），由 work.js 量版面後畫 */
.work-words { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.work-words h2 { margin: 0; font-family: var(--serif-fixed); font-size: 15px; font-weight: 400; letter-spacing: 0.5em; color: var(--accent); }
.work-words .words-lines { --wfit: 20px; font-family: var(--serif); font-size: var(--wfit); color: var(--ink); }
.work-words .words-lines p { margin: 0; white-space: nowrap; }
.work-words .words-lines:not([data-mode]) { width: 0; height: 0; overflow: hidden; } /* 還沒排版的整段釋文不佔位：不然長釋文的右欄（auto）撐滿，作品那一欄被擠成 0 寬，量不到版面就永遠排不出來 */
.work-words .words-lines[data-mode="wide"] { width: max-content; max-width: 100%; line-height: 1.9; letter-spacing: 0.06em; }
.work-words .words-lines[data-mode="tall"] { writing-mode: vertical-rl; height: max-content; line-height: 1; letter-spacing: 0.2em; }
.work-words .words-lines[data-mode="tall"] p + p { margin-block-start: var(--wg, 40px); }
/* 釋文放不下時（直排）：固定大小、由右往左慢慢捲（words-drift.js，和首頁 tall 版面同一套）。
   words-body 是釋文行加捲動控制列（進度細線與暫停鈕）；尚未讀到的左端用遮罩淡出，起點那端還沒捲動時不淡（--fa／--fb 由 words-drift.js 設）。
   放得下時沒有 data-scrolls：沒有遮罩、沒有控制列，外觀與不捲的版面相同。 */
.words-body { display: flex; flex-direction: column; flex: none; }
.work-words .words-lines { --fa: 0px; --fb: 0px; --wfade: 48px; transition: opacity 500ms ease-out; }
.work-words[data-scrolls] .words-lines { overflow: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--fa), #000 calc(100% - var(--fb)), transparent 100%); mask-image: linear-gradient(to left, transparent 0, #000 var(--fa), #000 calc(100% - var(--fb)), transparent 100%); }
.work-words[data-scrolls] .words-lines::-webkit-scrollbar { display: none; }
.work-words[data-scrolls] .words-lines[data-mode="tall"] { width: var(--ww); }
.work-words .words-lines[data-mode="tall"] { height: var(--wh, max-content); }
.work-words .words-lines:focus-visible, .work-words .words-pause:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.work-words[data-follow] .words-pause { visibility: hidden; } /* 播放中跟著運鏡捲，暫停鈕用不到；用 visibility 讓控制列高度不變 */
/* 釋文跟著運鏡（閱讀運鏡，work.js 的 syncWords）：正在讀的字濃墨加朱紅底線（不只靠顏色），讀過的中墨，還沒讀的淡墨；對比都在 7:1 以上 */
.work-words .words-lines .g { transition: color 240ms ease-out; }
.work-words .words-lines[data-sync] .g { color: var(--muted); }
.work-words .words-lines[data-sync] .g.done { color: var(--ink-2); }
.work-words .words-lines[data-sync] .g.on { color: var(--ink); text-decoration: underline; text-decoration-color: var(--seal); text-decoration-thickness: 2px; text-underline-offset: 0.28em; }
@media (prefers-reduced-motion: reduce) { .work-words .words-lines .g { transition: none; } }
.work-words .draft { margin: 0; }
.work-hero[data-layout="wide"] .work-words { grid-column: 2; grid-row: 2; justify-self: start; align-self: end; }
.work-hero[data-layout="tall"] .work-words { flex-direction: row-reverse; align-items: flex-start; gap: 14px; grid-column: 4; align-self: start; }
.work-hero[data-layout="tall"] .work-words h2 { writing-mode: vertical-rl; }
.work-hero[data-layout="tall"] .work-words .draft { writing-mode: vertical-rl; }

/* 橫幅作品、桌機（> 860px、非分享預覽圖）：右欄是一塊和作品等高的區域，釋文直排、和標題並排、一律靠上對齊。
   由右到左：標題（字卡或文字）→ 出處 → 「釋文」小標 → 釋文欄；草稿提示橫排在右欄最底、靠右。控制列在作品正下方 12px，右欄永遠不比作品高。
   格線四欄（作品｜釋文｜小標｜標題）。帶 aria-labelledby 的 <section class="work-words"> 保持是真正的盒子（不用 display: contents，免得輔具把它從無障礙樹拿掉）：
   它跨第 2 到 4 欄、第 1 到 2 列，用 subgrid 沿用外層的欄與列，裡面的釋文欄、小標、草稿提示因此各自落在對應的格子裡；第 4 欄那格是標題（.work-mark）的位置，section 底下的標題在它上面（後來居上）。
   釋文欄的可視高度、欄數與捲動由 work.js 的 layoutHero 算（放不下時固定寬度由右往左慢捲，見 words-drift.js）。 */
@media (min-width: 861px) {
  /* 第一屏往左右對稱超出版心，最寬 min(1360px, 可視寬度 − 80px)（放得寬時左右各至少留 40px）；版心已貼近視窗邊時 max() 取 100%，自然退回原本的寬度與留白。可視寬度 --vw 是 <html> 的 clientWidth（不含垂直捲軸，由 work.html 的 inline script 設並隨縮放更新；100vw 含捲軸，傳統捲軸會讓留白差約半條捲軸寬）。
     頁首（.work-bar）與 hero 以下的區塊都不動：只有 hero 自己用負的 margin 往外長。作品的寬高（--sw）仍以原本的版心寬為基準，不隨 hero 變寬；
     作品靠 hero 左側、標題靠右緣，多出來的寬度都給中間的釋文。左邊要留得下砂圈（--ring-reach）：hero 離視窗左緣的距離是 (--vw − 寬度) / 2，不夠放砂圈的部分用 padding-left 補。 */
  /* 頁首跟著放寬（work.js 的 setBar 在 <html> 設 data-bar="wide"，work.html 的 inline script 在第一次繪製前先照上一頁的記錄設好）：
     寬度與 hero 同一個算式，站名左緣對齊 hero 左緣、導覽右緣對齊標題右緣。位置全由 CSS 算，視窗縮放時直接跟著；只有載入後得知版面的那一次，work.js 用 transform 滑動站名與導覽（不動畫寬度，不重排）。 */
  html[data-bar="wide"] body:not(.og) .work-bar { width: max(100%, min(1360px, calc(var(--vw, 100vw) - 80px))); margin-inline: calc((100% - max(100%, min(1360px, calc(var(--vw, 100vw) - 80px)))) / 2); }
  body:not(.og) .work-hero[data-layout="wide"] { --hw: max(100%, min(1360px, calc(var(--vw, 100vw) - 80px))); width: var(--hw); margin-inline: calc((100% - var(--hw)) / 2); padding-left: max(0px, calc(var(--ring-reach, 0px) + 8px - (var(--vw, 100vw) - var(--hw)) / 2)); }
  body:not(.og) .work-hero[data-layout="wide"] { grid-template-columns: minmax(0, var(--sw)) minmax(0, 1fr) auto auto; grid-template-rows: 1fr auto auto; column-gap: 0; row-gap: 0; }
  body:not(.og) .work-hero[data-layout="wide"] .home-cap { margin-top: 12px; }
  body:not(.og) .work-hero[data-layout="wide"] .work-mark { grid-column: 4; grid-row: 1; align-self: start; justify-self: start; }
  body:not(.og) .work-hero[data-layout="wide"] .work-words { grid-column: 2 / 5; grid-row: 1 / 3; display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; gap: 0; justify-self: stretch; align-self: stretch; pointer-events: none; }
  body:not(.og) .work-hero[data-layout="wide"] .work-words > * { pointer-events: auto; }
  body:not(.og) .work-hero[data-layout="wide"] .work-words h2 { grid-column: 2; grid-row: 1; align-self: start; writing-mode: vertical-rl; line-height: 1; margin: 0 14px 0 0; padding-left: 20px; }
  body:not(.og) .work-hero[data-layout="wide"] .words-body { grid-column: 1; grid-row: 1; align-self: start; justify-self: end; min-width: 0; max-width: 100%; margin-left: clamp(24px, 4vw, 56px); }
  body:not(.og) .work-hero[data-layout="wide"] .work-words .draft { grid-column: 1 / -1; grid-row: 2; align-self: end; justify-self: end; text-align: right; }
  body:not(.og) .work-hero[data-layout="wide"] .words-ctl { flex-direction: row-reverse; }
  body:not(.og) .work-hero[data-layout="wide"] .words-bar i { transform-origin: right center; }
}

/* 借景：頁首照片轉成水墨，做成一道全寬的牆。桌機約 22vw 高（1280 時 280px），上緣約四成淡進砂裡，所以看得到的牆不到一半 */
.work-wall { --wall: none; height: clamp(150px, 22vw, 300px); width: 100vw; margin: clamp(64px, 9vw, 130px) 0 0 calc(50% - 50vw); background: var(--wall) 50% 62% / cover no-repeat; filter: grayscale(1) sepia(0.12) contrast(0.9) brightness(1.12);
  -webkit-mask-image: linear-gradient(transparent 0%, rgba(0,0,0,.35) 18%, rgba(0,0,0,.8) 34%, #000 46%); mask-image: linear-gradient(transparent 0%, rgba(0,0,0,.35) 18%, rgba(0,0,0,.8) 34%, #000 46%); }

/* 牆後：學習心得與作品介紹在左，作品資訊在右；沒有心得與介紹時只有資訊一欄 */
.work-foot { display: grid; grid-template-columns: minmax(0, 680px) minmax(0, 280px); justify-content: center; column-gap: clamp(48px, 8vw, 104px); align-items: start; padding-top: 72px; }
.work-foot.solo { grid-template-columns: minmax(0, 480px); }
.work-article { display: flex; flex-direction: column; gap: 56px; min-width: 0; }
.work-foot .intro, .work-foot .notes { padding-top: 0; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 22px; }
.work-foot .intro h2, .work-foot .notes h2 { flex: none; margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 500; letter-spacing: 0.18em; }
.work-foot .intro .body, .work-foot .notes .body { flex: none; max-width: none; }
.work-foot .intro .body p { font-size: 19px; line-height: 2.05; color: var(--ink); }
.work-foot .prose p, .work-foot .prose li, .work-foot .prose td, .work-foot .prose th { font-size: 19px; line-height: 2.05; color: var(--ink); }
.work-side { display: flex; flex-direction: column; gap: 24px; min-width: 0; padding-top: 6px; }
.work-side .facts { padding-top: 0; border-top: 0; grid-template-columns: auto minmax(0, 1fr); font-size: 17px; }
.work-side .facts:empty { display: none; }
.work-side .facts dt { color: var(--muted); }
.work-side .work-tags { justify-content: flex-start; }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; min-height: 48px; font-family: var(--serif); font-size: 17px; letter-spacing: 0.16em; color: var(--ink); text-decoration: none; box-shadow: inset 0 -1px 0 rgba(58, 54, 47, 0.35); }
.back-link:hover { color: var(--accent); box-shadow: inset 0 -1.5px 0 var(--accent); }
.work-page .related { margin-top: 96px; border-top: 0; padding-top: 0; }
.work-page .related h2 { font-family: var(--serif-fixed); font-size: clamp(26px, 2.2vw, 30px); font-weight: 400; letter-spacing: 0.2em; }
@media (max-width: 860px) {
  .work-bar { padding-top: 12px; }
  .work-hero { --h: clamp(280px, calc(100svh - 224px), 680px); padding-top: 24px; padding-left: 0; }
  .work-hero[data-layout="wide"] .home-work { grid-row: 1; }
  .work-hero[data-layout="wide"] .work-words { grid-column: 1 / -1; grid-row: 3; align-self: start; margin-top: 12px; }
  .work-hero[data-layout="wide"] .work-mark { grid-column: 2; grid-row: 1 / 3; }
  /* 窄螢幕：直幅作品旁邊放不下直排的完整釋文，改成橫排接在作品與播放列下面 */
  .work-hero[data-layout="tall"] .work-words { grid-column: 1 / -1; grid-row: 3; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 8px; }
  .work-hero[data-layout="tall"] .work-words h2, .work-hero[data-layout="tall"] .work-words .draft { writing-mode: horizontal-tb; }
  /* 直幅作品在手機上：作品本身置中（兩側的 1fr 等寬），直排標題在它右邊的空白裡，不夠寬時往右緣延伸 */
  .work-hero[data-layout="tall"] { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 16px; }
  .work-hero[data-layout="tall"] .home-work { grid-column: 2; }
  .work-hero[data-layout="tall"] .work-mark { grid-column: 3; justify-self: start; }
  .work-foot { grid-template-columns: minmax(0, 1fr); row-gap: 48px; padding-top: 56px; }
  .work-source { padding-top: 56px; font-size: 15px; }
}
@media (max-width: 520px) {
  .work-bar .brand { gap: 10px; min-height: 48px; }
  .work-bar .brand-mark { width: 36px; height: 36px; font-size: 22px; }
  .work-bar .brand-name { font-size: 20px; letter-spacing: 0.12em; }
  .work-bar .site-nav { gap: 0; font-size: 15px; letter-spacing: 0.06em; }
  .work-bar .site-nav a { padding: 12px 6px; }
  .work-source { font-size: 14px; }
  .work-foot .intro h2, .work-foot .notes h2 { font-size: 26px; }
  .work-foot .intro .body p, .work-foot .prose p, .work-foot .prose li { font-size: 18px; }
}

/* 社群分享預覽圖（?og=1）：用 1280×672 的視窗排版（Mac 代理再縮成 1200×630，版面和編輯器預覽的桌機 1280 一樣）只留第一屏的站名、作品、標題、釋文與牆的一角；播放列、導覽、牆後的內容都不要 */
html[data-og] { overflow: hidden; }
body.og { height: 672px; min-height: 0; overflow: hidden; }
body.og .site-nav, body.og .work-cap, body.og .work-foot, body.og .related, body.og .site-footer, body.og .skip-link { display: none; }
body.og .work-hero { --h: 410px; padding-top: 24px; padding-bottom: 0; }
body.og .work-hero { padding-left: 0; }
body.og .work-hero[data-layout="wide"] { grid-template-columns: auto auto; justify-content: center; column-gap: 72px; } /* 橫幅作品：作品與右欄整組置中，作品不貼左邊、和標題之間也不留一大塊空白 */
body.og .work-wall { position: fixed; left: 0; bottom: 0; margin: 0; height: 100px; -webkit-mask-image: linear-gradient(transparent 0%, rgba(0,0,0,.5) 40%, #000 82%); mask-image: linear-gradient(transparent 0%, rgba(0,0,0,.5) 40%, #000 82%); } /* 牆只露最底下一角，不蓋到作品與右欄的文字 */
body.og .draft { display: none; }
@media (max-width: 360px) {
  .work-bar .brand { gap: 8px; }
  .work-bar .brand-mark { width: 32px; height: 32px; font-size: 20px; }
  .work-bar .brand-name { font-size: 17px; letter-spacing: 0.08em; }
  .work-bar .site-nav { font-size: 14px; letter-spacing: 0.04em; }
  .work-bar .site-nav a { padding: 12px 4px; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 公開頁狀態：載入中、錯誤、404／410 */
.loading { padding: 96px 0; text-align: center; color: var(--muted); }
.notice { padding: 96px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; max-width: 560px; }
.notice h1 { margin: 0; font-family: var(--serif); font-size: 32px; letter-spacing: 2px; }
.stage-note { display: flex; align-items: center; gap: 10px; }
.stage-note[hidden] { display: none; }

/* 標籤：作品標題下的一排連結，點了回首頁並篩選 */
.work-info { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; min-width: 0; }
.work-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; }
.work-page .work-tags { justify-content: flex-start; }
.work-tags a { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--serif); font-size: 18px; letter-spacing: 0.08em; color: var(--ink-2); text-decoration: none; box-shadow: inset 0 -1px 0 var(--rule); }
.work-tags a span { margin-right: 2px; color: var(--accent); }
.work-tags a:hover { color: var(--accent); box-shadow: inset 0 -1.5px 0 var(--accent); }
.tag-chips { margin-top: 4px; gap: 4px 24px; }
.tag-chips[hidden] { display: none; }
body.garden-page .tag-chips .chip { font-size: 16px; }

/* 學習心得（作者的 Markdown，伺服器轉成 HTML 後放進來）：內文與釋文同一套襯線字，標題從 h3 開始 */
.prose { overflow-wrap: anywhere; }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose li, .prose td, .prose th { font-family: var(--serif); font-size: 18px; line-height: 2; color: var(--ink-2); }
.prose h3, .prose h4, .prose h5, .prose h6 { font-family: var(--serif); font-weight: 600; color: var(--ink); line-height: 1.6; margin-top: 2em; letter-spacing: 0.06em; }
.prose h3 { font-size: 24px; }
.prose h4 { font-size: 21px; }
.prose h5, .prose h6 { font-size: 18px; }
.prose h3:first-child, .prose h4:first-child { margin-top: 0; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose a { color: var(--accent); text-underline-offset: 4px; }
.prose a:hover { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.6em; }
.prose li + li { margin-top: 0.3em; }
.prose li > p { margin: 0; }
.prose ul:has(> li > input[type="checkbox"]) { list-style: none; padding-left: 0.2em; }
.prose input[type="checkbox"] { margin-right: 0.6em; accent-color: var(--ink); }
.prose blockquote { margin-left: 0; padding: 0.1em 0 0.1em 1.2em; border-left: 3px solid var(--ink-2); }
.prose blockquote p { color: var(--ink-2); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose code { padding: 0.1em 0.35em; background: var(--paper-2); font-size: 0.9em; }
.prose pre { overflow-x: auto; padding: 14px 16px; background: var(--paper-2); }
.prose pre code { padding: 0; background: none; }
.prose del { color: var(--muted); }
.md-table { overflow-x: auto; }
.prose table { border-collapse: collapse; min-width: 60%; }
.prose th, .prose td { padding: 8px 14px; border: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose th { background: var(--paper-2); font-weight: 600; color: var(--ink); }
@media (max-width: 520px) { .prose p, .prose li, .prose td, .prose th { font-size: 17px; } .work-page .work-tags { justify-content: flex-start; } }
.prose input[type="checkbox"]:disabled { opacity: 1; }

/* 手機播放畫面（docs/designs/library-location-web-music-opening-wall.md E；邏輯在 theater.js）
   窄螢幕上按「播放運鏡」才出現的一層，橫拿時要求系統全螢幕或讓 Safari 收列。底色與作品頁的砂同色。
   作品畫布與聲音鈕是搬進來的同一個元素。直拿：頂列、全寬舞台、進度條、釋文、底列；橫拿：作品佔滿、釋文只留正在讀的一行。 */
html.th-open, html.th-open body { overflow: hidden; }
/* Safari 只會因根捲動收列；底下仍是 inert，固定的舞台蓋住捲動內容。 */
html[data-th-immersive="collapse"], html[data-th-immersive="collapse"] body { overflow: visible; }
html[data-th-immersive="collapse"] body { min-height: calc(100lvh + 160px); }
html[data-th-immersive="collapse"] .theater { touch-action: pan-y; overscroll-behavior: auto; }
.th-viewport-ruler { position: fixed; top: 0; height: 100lvh; width: 0; visibility: hidden; pointer-events: none; }
.theater { --th-unread: #5F5B53; /* 還沒讀的淡墨：在砂色 #E2E0DA 上 5.1:1，不能再淡 */
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; z-index: 1000; display: flex; flex-direction: column; overflow: hidden;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  background-color: var(--paper); background-image: repeating-linear-gradient(0deg, rgba(58, 54, 47, 0.05) 0 1px, transparent 1px 18px);
  color: var(--ink); font-family: var(--serif); overscroll-behavior: none; touch-action: none; }
.theater[hidden] { display: none; }
.theater:fullscreen { width: 100%; height: 100%; }
.theater:-webkit-full-screen { width: 100%; height: 100%; }
.theater::backdrop { background: var(--paper); }
.theater::-webkit-backdrop { background: var(--paper); }
.theater p { margin: 0; }
.theater .th-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; background: rgba(226, 224, 218, 0.9); color: var(--ink); border: 1px solid var(--ink-2); font-family: var(--serif); font-size: 17px; letter-spacing: 0.1em; cursor: pointer; flex: none; }
.theater .th-btn[hidden] { display: none; }
.theater .th-btn:disabled { color: var(--th-unread); border-color: var(--rule); cursor: default; }
.theater .th-btn:not(:disabled):hover { background: var(--ink); color: var(--paper); }
.theater .th-btn svg { flex: none; }
.theater .th-play { width: 56px; height: 56px; flex: none; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 240ms ease-out, color 240ms ease-out; }
.theater .th-play:hover { background: var(--accent-soft); color: var(--accent); }

/* 頂列：收起、作品標題、聲音鈕 */
.theater .th-top { flex: none; min-height: calc(62px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; display: flex; align-items: center; gap: 10px; position: relative; z-index: 3; }
.theater .th-title { flex: 1 1 auto; min-width: 0; text-align: center; font-size: 17px; letter-spacing: 0.12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theater .th-hint, .theater .th-fs { display: none; }
.theater .th-top-end { flex: none; min-width: 84px; display: flex; justify-content: flex-end; } /* 和左邊的收起鈕一樣寬，標題才在正中間 */
.theater .sound { flex: none; width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent); cursor: pointer; transition: background-color 240ms ease-out, color 240ms ease-out, border-color 240ms ease-out; }
.theater .sound[aria-pressed="false"] { border-color: var(--ink-2); background: transparent; color: var(--ink-2); }
.theater .sound:hover { background: var(--accent); color: #fff; }
.theater .sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theater .sound .sound-text { display: none; } /* 只留圖示；aria-label 還在 */

/* 舞台：左右貼齊螢幕邊（全寬）。作品的高度 = 全寬放得下最寬取景窗的高度（取景窗寬 = 螢幕寬），不超過寬的 1.25 倍，也不擠掉釋文區（最少 150px）。
   畫布的比例綁定發布時的作品比例（取景窗是 webFrame 依比例算的），所以舞台維持作品的比例、其餘補砂色，不拉伸 */
.theater .th-stage { flex: 0 1 calc(min(100vw / var(--th-r), 125vw) + 28px); min-height: 0; position: relative; container-type: size; display: flex; justify-content: center; align-items: center; padding: 10px 0 18px; z-index: 1; }
.theater[data-notext] .th-stage { flex: 1 1 auto; }
.theater .th-work { position: relative; flex: none; aspect-ratio: var(--th-r); height: min(100cqh, calc(100cqw / var(--th-r)), 125cqw); }
.theater .th-work canvas { position: absolute; display: block; pointer-events: none; }
.theater .th-note { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 2px 12px; background: rgba(226, 224, 218, 0.92); font-size: 16px; color: var(--ink-2); white-space: nowrap; z-index: 2; }
.theater .th-note[hidden] { display: none; }
.theater .th-progress { flex: none; height: 3px; background: var(--rule); position: relative; z-index: 2; }
.theater .th-progress span { display: block; height: 100%; width: 0; background: var(--accent); }

/* 釋文：置中，上下緣淡出；正在讀的一行固定停在中間偏上。三種墨色：正在讀濃墨（粗體＋石青底線）、讀過中墨、還沒讀淡墨（不藏起來） */
.theater .th-words { flex: 1 1 150px; min-height: 150px; container-type: size; position: relative; }
.theater .th-lines { height: 100%; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; touch-action: pan-y; position: relative; padding: 34cqh 16px 56cqh; text-align: center;
  font-size: 24px; letter-spacing: 0.06em; line-height: 1.7; color: var(--ink);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 86%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 86%, transparent 100%); }
.theater .th-lines::-webkit-scrollbar { display: none; }
.theater .th-lines p { white-space: nowrap; }
.theater .th-lines .g { transition: color 240ms ease-out; }
.theater .th-lines[data-sync] .g { color: var(--th-unread); }
.theater .th-lines[data-sync] .g.done { color: var(--ink-2); }
.theater .th-lines[data-sync] .g.on { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--seal); text-decoration-thickness: 3px; text-underline-offset: 0.26em; }
.theater .th-lines[data-sync] p.now { font-weight: 700; }

/* 底列（拇指區）：播放／暫停、時間、放回。減少動態時多「上一行」「下一行」，沒有自動捲動動畫 */
.theater .th-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 16px max(22px, env(safe-area-inset-bottom)); position: relative; z-index: 3; }
.theater .th-time { flex: 1 1 auto; min-width: 0; font-size: 18px; letter-spacing: 0.1em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.theater[data-reduced] .th-bar { justify-content: space-between; }
.theater[data-reduced] .th-time { flex: 1 1 100%; order: -1; text-align: center; }
.theater .th-stop { margin-left: auto; }
.theater[data-reduced] .th-stop { margin-left: 0; }
@media (prefers-reduced-motion: reduce) { .theater .th-lines .g, .theater .th-play, .theater .sound { transition: none; } }

/* 橫拿（高度 < 500px）：舞台佔滿整個可視範圍；收起在左上、播放在左下、聲音在右上，都帶半透明砂色底；釋文只留正在讀的一行疊在底部中央；進度條貼在最底 */
@media (orientation: landscape) and (max-height: 499px) {
  .theater { padding-left: 0; padding-right: 0; }
  .theater .th-top { position: absolute; top: 0; left: 0; right: 0; min-height: 0; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); justify-content: space-between; pointer-events: none; z-index: 4; }
  .theater .th-top > * { pointer-events: auto; }
  .theater .th-title { display: none; }
  /* 提示獨立置中，出現與消失都不會推動原本左右兩端的按鈕。 */
  .theater .th-hint, .theater .th-fs { position: absolute; left: 50%; transform: translateX(-50%); min-height: 48px; font-family: var(--serif); font-size: 16px; color: var(--ink); background: rgba(226, 224, 218, 0.9); }
  .theater .th-hint { align-items: center; padding: 8px 14px; pointer-events: none; }
  html[data-th-immersive="collapse"][data-th-chrome="shown"] .theater .th-hint,
  html[data-th-immersive="fs"][data-th-chrome="shown"] .theater .th-fs { display: inline-flex; }
  .theater .th-top-end { min-width: 0; }
  .theater .th-close { min-height: 48px; }
  .theater .sound { width: 48px; height: 48px; background: rgba(226, 224, 218, 0.9); }
  .theater .sound[aria-pressed="false"] { background: rgba(226, 224, 218, 0.9); }
  .theater .sound:hover { background: var(--accent); }
  .theater .th-stage { position: absolute; inset: 0; flex: none; padding: 0; }
  .theater .th-note { bottom: 56px; }
  .theater .th-progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; }
  .theater .th-words { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); width: min(calc(100% - 260px), 640px); min-height: 0; flex: none; container-type: normal; z-index: 3; pointer-events: none; }
  .theater .th-lines { height: auto; overflow: hidden; padding: 4px 14px; font-size: 22px; line-height: 1.5; background: rgba(226, 224, 218, 0.9); -webkit-mask-image: none; mask-image: none; border-radius: 6px; }
  .theater .th-lines p:not(.now) { display: none; }
  .theater .th-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); gap: 8px; flex-wrap: nowrap; pointer-events: none; z-index: 4; }
  .theater .th-bar > * { pointer-events: auto; }
  .theater .th-time { display: none; }
  .theater .th-play { width: 48px; height: 48px; background: rgba(226, 224, 218, 0.9); color: var(--accent); border: 1.5px solid var(--accent); }
  .theater .th-play:hover { background: var(--accent); color: #fff; }
  .theater .th-stop { margin-left: auto; min-height: 48px; }
  .theater[data-reduced] .th-bar { justify-content: flex-start; }
  .theater[data-reduced] .th-stop { margin-left: auto; }
  .theater[data-reduced] .th-time { display: none; }
  .theater[data-reduced] .th-prev { order: 2; }
  .theater[data-reduced] .th-play { order: 1; }
  .theater[data-reduced] .th-next { order: 3; }
  .theater[data-reduced] .th-stop { order: 4; }
  .theater[data-reduced] .th-words { width: min(calc(100% - 520px), 640px); }
}
