/* 字型：源石黑體 TW（SIL OFL 1.1，https://github.com/ButTaiwan/genseki-font）。這裡指向本機的完整檔，上線時 build-public 會裁成只含用到的字；英文小字用 Inter。
   版面參考作品集型樣板：淺灰底、四個角落固定的小字導覽、很大的標題、錯落擺放的圖片，只有一個強調色 */
@font-face { font-family: "GenSeki Gothic"; font-weight: 400; font-display: swap; src: url("fonts/GenSekiGothic2TW-R.base-dc24a9c0db.woff2") format("woff2"); }
@font-face { font-family: "GenSeki Gothic"; font-weight: 400; font-display: swap; src: url("fonts/GenSekiGothic2TW-R.extra-014c0d0c97.woff2") format("woff2"); unicode-range: U+a9,U+f6,U+26a,U+274,U+280,U+29c,U+29f,U+301,U+302,U+304,U+306,U+307,U+30a,U+30f,U+310,U+316,U+318,U+31c,U+31e,U+31f,U+324,U+325,U+32f,U+330,U+332,U+33d,U+340,U+343,U+344,U+345,U+346,U+349,U+34c,U+350,U+353,U+355,U+357,U+35a,U+3ae,U+489,U+1d00,U+1d04,U+1d05,U+1d07,U+1d0b,U+1d0f,U+1d18,U+1d1b,U+1d20,U+2003,U+2060,U+22ef,U+2592,U+2715,U+4f0e,U+53cc,U+54b2,U+54cf,U+54de,U+5591,U+5660,U+56d3,U+5707,U+5768,U+5910,U+5a6d,U+5a9c,U+5afa,U+5b17,U+5b95,U+5c14,U+5e30,U+5fe1,U+5fe4,U+6041,U+605a,U+612b,U+61de,U+61df,U+6382,U+6390,U+6425,U+6440,U+657b,U+6633,U+6792,U+67ca,U+684e,U+688f,U+68b6,U+690f,U+6c69,U+6c93,U+6dd6,U+6dfc,U+6f36,U+6f62,U+7027,U+723f,U+731d,U+7374,U+737e,U+7460,U+7490,U+753a,U+766f,U+7699,U+76aa,U+7704,U+7780,U+77fb,U+78e3,U+7921,U+7942,U+7aa3,U+7ab8,U+7cbc,U+7cc5,U+7da3,U+7e7e,U+7f45,U+81ca,U+8216,U+8351,U+83c7,U+866f,U+868b,U+8712,U+875f,U+87c4,U+88a4,U+88ce,U+88cf,U+89b7,U+89e5,U+8a61,U+8a84,U+8b05,U+8b14,U+8de9,U+8e09,U+8e30,U+8e4c,U+9021,U+9162,U+95c3,U+95c7,U+9746,U+9749,U+9a03,U+9d1e,U+9da9,U+9f95,U+a731,U+ff65; }
@font-face { font-family: "GenSeki Gothic"; font-weight: 500; font-display: swap; src: url("fonts/GenSekiGothic2TW-M.base-dc24a9c0db.woff2") format("woff2"); }
@font-face { font-family: "GenSeki Gothic"; font-weight: 500; font-display: swap; src: url("fonts/GenSekiGothic2TW-M.extra-014c0d0c97.woff2") format("woff2"); unicode-range: U+a9,U+f6,U+26a,U+274,U+280,U+29c,U+29f,U+301,U+302,U+304,U+306,U+307,U+30a,U+30f,U+310,U+316,U+318,U+31c,U+31e,U+31f,U+324,U+325,U+32f,U+330,U+332,U+33d,U+340,U+343,U+344,U+345,U+346,U+349,U+34c,U+350,U+353,U+355,U+357,U+35a,U+3ae,U+489,U+1d00,U+1d04,U+1d05,U+1d07,U+1d0b,U+1d0f,U+1d18,U+1d1b,U+1d20,U+2003,U+2060,U+22ef,U+2592,U+2715,U+4f0e,U+53cc,U+54b2,U+54cf,U+54de,U+5591,U+5660,U+56d3,U+5707,U+5768,U+5910,U+5a6d,U+5a9c,U+5afa,U+5b17,U+5b95,U+5c14,U+5e30,U+5fe1,U+5fe4,U+6041,U+605a,U+612b,U+61de,U+61df,U+6382,U+6390,U+6425,U+6440,U+657b,U+6633,U+6792,U+67ca,U+684e,U+688f,U+68b6,U+690f,U+6c69,U+6c93,U+6dd6,U+6dfc,U+6f36,U+6f62,U+7027,U+723f,U+731d,U+7374,U+737e,U+7460,U+7490,U+753a,U+766f,U+7699,U+76aa,U+7704,U+7780,U+77fb,U+78e3,U+7921,U+7942,U+7aa3,U+7ab8,U+7cbc,U+7cc5,U+7da3,U+7e7e,U+7f45,U+81ca,U+8216,U+8351,U+83c7,U+866f,U+868b,U+8712,U+875f,U+87c4,U+88a4,U+88ce,U+88cf,U+89b7,U+89e5,U+8a61,U+8a84,U+8b05,U+8b14,U+8de9,U+8e09,U+8e30,U+8e4c,U+9021,U+9162,U+95c3,U+95c7,U+9746,U+9749,U+9a03,U+9d1e,U+9da9,U+9f95,U+a731,U+ff65; }
:root {
  --paper: #F1F1F0;
  --surface: #E4E4E2;
  --ink: #111111;
  --mist: #6B6B6B;
  --accent: #D2352A;
  --line: rgba(0, 0, 0, .14);
  --sans: "GenSeki Gothic", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --latin: "Inter", "Helvetica Neue", sans-serif;
  --edge: clamp(16px, 2.2vw, 28px);           /* 角落小字離視窗邊緣的距離 */
  --side: clamp(20px, 11vw, 190px);           /* 內容左右的留白，桌機上讓出角落小字的位置 */
  --max: 1180px;
  --read: 820px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { background: var(--paper); color-scheme: light; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden;
  background: var(--paper); color: var(--ink);
  font: 400 15px/1.85 var(--sans); letter-spacing: .02em; -webkit-font-smoothing: antialiased;
}
b, strong, th { font-weight: 500; }   /* 粗體用中黑：最粗只載到 500，少下載一個字重 */
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: .3em; transition: color .15s, text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 30; background: var(--ink); color: var(--paper); padding: 6px 14px; }
.skip:focus { left: 8px; }

main { flex: 1; outline: none; padding: clamp(96px, 13vh, 150px) var(--side) clamp(72px, 10vw, 140px); }
.page, .hero { max-width: var(--max); margin: 0 auto; }

/* 四個角落：左上名字和選單、右上信箱、左下社群連結、右下聯絡 */
.top, .corner { position: fixed; z-index: 5; font-size: 13px; line-height: 1.55; letter-spacing: .04em; }
.top { top: var(--edge); left: var(--edge); }
.brand { display: block; font-weight: 500; text-decoration: none; }
#tabs { display: flex; flex-direction: column; align-items: flex-start; margin-top: 2px; }
#tabs a, .corner a, a.corner { text-decoration: none; }
#tabs a:hover, .corner a:hover, a.corner:hover { color: var(--accent); }
#tabs a[aria-current] { color: var(--accent); }
#tabs a.sub { padding-left: 1em; }
#tabs a[hidden] { display: none; }
.grp { display: flex; align-items: center; gap: 2px; }
.fold { width: 1.6em; height: 1.6em; padding: 0; border: 0; background: none; color: var(--mist); font: inherit; cursor: pointer; display: grid; place-items: center; }
.fold::before { content: ""; width: .38em; height: .38em; border-right: 1.2px solid currentColor; border-bottom: 1.2px solid currentColor; transform: translateY(-.1em) rotate(45deg); transition: transform .25s var(--ease); }
.fold[aria-expanded="false"]::before { transform: rotate(-45deg); }
.fold:hover { color: var(--accent); }
.menu-btn { display: none; }
.mail { top: var(--edge); right: var(--edge); }
.social { bottom: var(--edge); left: var(--edge); display: flex; flex-direction: column; }
.corner.contact { bottom: var(--edge); right: var(--edge); }
.corner[hidden] { display: none; }

/* 大標題 */
.display { margin: 0; font: 500 clamp(52px, 8.4vw, 132px)/1.12 var(--sans); letter-spacing: .02em; overflow-wrap: anywhere; }
.page-head { position: relative; z-index: 1; max-width: 10em; font-size: clamp(52px, 8.4vw, 132px); margin-bottom: .5em; }
.page-head .display { font-size: inherit; }
.page-head .desc { max-width: 34em; margin-top: 28px; font-size: 15px; line-height: 1.9; color: var(--mist); }
.page-head .desc p { margin: 0 0 .9em; }
.empty { margin: 0; padding: 24px 0 64px; color: var(--mist); }
.draft {
  display: inline-block; vertical-align: middle; margin-left: 14px; padding: 3px 10px; border-radius: 99px;
  font: 400 12px/1.3 var(--sans); letter-spacing: .1em; color: #fff; background: var(--accent);
}
.meta { font-size: 12.5px; color: var(--mist); letter-spacing: .06em; font-variant-numeric: tabular-nums; }

/* 子分頁：上層分頁標題下面的連結列，以及子分頁頂端回上層的連結 */
.subnav { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: -8px 0 clamp(48px, 6vw, 88px); font-size: 15px; letter-spacing: .04em; }
.subnav a { text-decoration: none; padding-bottom: 4px; border-bottom: 1px solid var(--line); transition: color .15s, border-color .15s; }
.subnav a::after { content: " →"; }
.subnav a:hover { color: var(--accent); border-color: currentColor; }
.back.up { display: inline-block; margin-bottom: 14px; }

/* 目錄分頁：子分頁排成大字清單 */
.toc-cover { max-width: 960px; margin: 0 0 clamp(40px, 5vw, 72px); }
.toc-cover img { display: block; width: 100%; height: auto; }
.toc { list-style: none; margin: 0; padding: 0; max-width: 960px; }
.toc li { border-top: 1px solid var(--line); }
.toc li:last-child { border-bottom: 1px solid var(--line); }
.toc a { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); align-items: baseline; gap: 4px 12px; padding: clamp(18px, 2.4vw, 30px) 0; text-decoration: none; }
.toc .no { font: 400 13px/1 var(--latin); letter-spacing: .1em; color: var(--mist); }
.toc .name { font: 500 clamp(26px, 3.6vw, 48px)/1.3 var(--sans); letter-spacing: .02em; transition: color .15s; }
.toc .sub { grid-column: 2; font: 400 clamp(14px, 1.4vw, 18px)/1.4 var(--latin), var(--sans); color: var(--mist); }
.toc .name::after { content: " →"; font-weight: 400; font-size: .6em; color: var(--mist); transition: margin .3s var(--ease), color .15s; }
.toc a:hover .name, .toc a:hover .name::after { color: var(--accent); }

/* 首頁 */
.hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: center; min-height: calc(100vh - 220px); }
.hero-img { grid-column: 1 / 7; grid-row: 1; margin: 0; }
.hero-img img { display: block; width: 100%; height: auto; max-height: calc(100vh - 160px); object-fit: cover; }
.hero-text { grid-column: 6 / 13; grid-row: 1; position: relative; z-index: 1; padding-left: clamp(0px, 3vw, 48px); }
.hero.text-only .hero-text { grid-column: 1 / 13; padding-left: 0; }
.hero h1 { font-size: clamp(64px, 11vw, 168px); line-height: 1.08; }
.hero h1 span { word-break: keep-all; }   /* 網站名稱只在後台換行的地方斷行，太長放不下時才會自動斷 */
.page-head.no-title { max-width: none; font-size: 16px; margin-bottom: clamp(36px, 5vw, 64px); }
.page-head.no-title .desc { margin-top: 0; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hero-tag { margin: 1.2em 0 0; max-width: 24em; font-size: 15px; color: var(--mist); }
.cta { display: inline-block; margin-top: clamp(40px, 7vh, 88px); margin-left: 25%; font-size: 14px; font-weight: 500; letter-spacing: .08em; text-decoration: none; }
.cta::after { content: " →"; transition: margin .3s var(--ease); }
.cta:hover { color: var(--accent); }
.cta:hover::after { margin-left: 6px; }

/* 畫廊：大圖錯落 */
.stagger { display: grid; gap: clamp(72px, 12vw, 180px); padding-top: clamp(8px, 2vw, 24px); }
.piece { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 0 clamp(20px, 3vw, 48px); margin: 0; }
.piece > a { grid-column: 3 / 9; grid-row: 1; display: block; background: var(--surface); }
.piece.wide > a { grid-column: 1 / 10; }
.piece img { display: block; width: 100%; height: auto; }
.piece figcaption { grid-column: 9 / 13; grid-row: 1; max-width: 22em; padding-bottom: 4px; }
.piece.wide figcaption { grid-column: 10 / 13; }
.piece.flip > a { grid-column: 5 / 11; }
.piece.flip.wide > a { grid-column: 4 / 13; }
.piece.flip figcaption { grid-column: 1 / 5; justify-self: end; text-align: right; }
.piece.flip.wide figcaption { grid-column: 1 / 4; }
.piece h2 { margin: 2px 0 0; font: 500 19px/1.5 var(--sans); letter-spacing: .04em; }
.piece figcaption p { margin: 10px 0 0; font-size: 14px; line-height: 1.85; color: var(--mist); }
@media (hover: hover) { .piece > a img { transition: opacity .3s; } .piece > a:hover img { opacity: .9; } }

/* 畫廊：格狀 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 28px; }
.chips button {
  font: inherit; font-size: 13px; letter-spacing: .08em; color: var(--mist);
  background: none; border: 1px solid var(--line); border-radius: 0; padding: 3px 16px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.chips button:hover { color: var(--ink); border-color: var(--mist); }
.chips button[aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
/* 文章標籤：文字分頁，選中的加底線；排序是列表上緣的小字 */
.chips.tabs { gap: 4px 26px; padding-bottom: 36px; }
.chips.tabs button { font-size: 14px; background: none; border: 0; border-bottom: 1px solid transparent; border-radius: 0; padding: 2px 0; }
.chips.tabs button[aria-pressed="true"] { color: var(--ink); background: none; border-color: var(--ink); }
.listhead { display: flex; padding-bottom: 4px; }
.listhead .sort { font: 400 12px var(--latin); letter-spacing: .08em; color: var(--mist); background: none; border: 0; padding: 6px 0; cursor: pointer; transition: color .15s; }
.listhead .sort:hover { color: var(--ink); }
.listhead .sort::after { content: "  ⇅" / ""; }
.grid { --cols: 3; --min: 220; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1px; column-gap: clamp(12px, 1.6vw, 22px); }
.cell { position: relative; display: block; overflow: hidden; align-self: start; background: var(--surface); }
.cell img { display: block; width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; transition: transform .7s var(--ease); }
.cell span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 10px;
  font-size: 13px; letter-spacing: .06em; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7)); opacity: 0; transition: opacity .25s;
}
.cell:focus-visible span { opacity: 1; }
@media (hover: hover) { .cell:hover img { transform: scale(1.03); } .cell:hover span { opacity: 1; } }

/* 放大檢視 */
#lightbox {
  --surface: #262626; --mist: #A8A8A8; --line: rgba(255, 255, 255, .24);
  position: fixed; inset: 0; z-index: 20; background: rgba(12, 12, 12, .96); color: #F2F2F2;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: clamp(16px, 3vw, 40px); gap: 18px;
  animation: fade .2s ease-out;
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; outline: none;   /* 蓋掉 dialog 預設的置中小視窗 */
}
#lightbox:not([open]) { display: none; }
@keyframes fade { from { opacity: 0; } }
.lb-img { min-height: 0; display: flex; align-items: center; justify-content: center; }
.lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-cap { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; max-width: var(--max); width: 100%; margin: 0 auto; }
.lb-cap h2 { margin: 0; font: 500 18px/1.5 var(--sans); letter-spacing: .04em; }
.lb-cap p { margin: 4px 0 0; font-size: 14px; color: var(--mist); max-width: 46em; line-height: 1.7; }
.lb-ctl { display: flex; gap: 6px; flex: none; }
.lb-ctl a {
  width: 42px; height: 42px; display: grid; place-items: center; text-decoration: none;
  border: 1px solid var(--line); border-radius: 50%; font-size: 15px; transition: border-color .15s, background .15s;
}
.lb-ctl a:hover { border-color: var(--mist); background: var(--surface); }

/* 文章列表 */
.posts { list-style: none; margin: 0; padding: 0; max-width: 880px; }
.posts li { border-top: 1px solid var(--line); }
.posts li:last-child { border-bottom: 1px solid var(--line); }
.posts a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; padding: 30px 0; text-decoration: none; }
.posts h2 { margin: 0; font: 500 clamp(20px, 2.2vw, 26px)/1.45 var(--sans); letter-spacing: .03em; transition: color .15s; }
.posts .meta { margin-bottom: 6px; }
.posts p { margin: 8px 0 0; max-width: 40em; font-size: 14.5px; color: var(--mist); line-height: 1.75; }
.posts .thumb { width: 176px; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface); display: block; }
.pages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.pages button { min-width: 36px; height: 36px; padding: 0 8px; font: inherit; font-size: 13px; color: var(--mist); background: none; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.pages button:hover { color: var(--ink); border-color: var(--mist); }
.pages button[aria-current] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 12px; color: var(--mist); border: 1px solid var(--line); border-radius: 0; padding: 0 11px; }
@media (hover: hover) { .posts a:hover h2 { color: var(--accent); } }

/* 文章 */
.article { max-width: var(--read); }
.back { font-size: 13px; color: var(--mist); letter-spacing: .06em; text-decoration: none; }
.back:hover { color: var(--accent); }
.article h1 { margin: 1.1em 0 .5em; font: 500 clamp(30px, 4.6vw, 52px)/1.35 var(--sans); letter-spacing: .02em; }
.article .cover { display: block; width: 100%; height: auto; margin: 32px 0 0; background: var(--surface); }
.prose { margin-top: 40px; font-size: clamp(15.5px, 1.3vw, 17px); line-height: 2; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.5em; }
.prose.indent > p { text-indent: 2em; }
.prose h2 { margin: 2.2em 0 .7em; font: 500 1.4em/1.5 var(--sans); letter-spacing: .03em; }
.prose h3 { margin: 2em 0 .6em; font: 500 1em/1.6 var(--sans); letter-spacing: .08em; color: var(--accent); }
.prose blockquote { margin: 1.8em 0; padding: 0 0 0 22px; border-left: 2px solid var(--accent); color: var(--mist); }
.prose ul, .prose ol { margin: 0 0 1.5em; padding-left: 1.5em; }
.prose li::marker { color: var(--mist); }
.prose img { display: block; height: auto; margin: 2.2em auto; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 3em 30%; }
.prose a { text-decoration-color: var(--accent); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.5em; font-size: .95em; }
.prose th, .prose td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 500; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: clamp(48px, 7vw, 80px); padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: block; text-decoration: none; min-width: 0; }
.pager .next { text-align: right; }
.pager small { display: block; font-size: 13px; color: var(--mist); letter-spacing: .06em; }
.pager span { display: block; margin-top: 6px; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; transition: color .15s; }
.pager a:hover span { color: var(--accent); }

/* 自我介紹：照片墊在大標題下面，文字在右邊 */
.about .page-head { margin-bottom: -.32em; }
.about-body { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 clamp(24px, 4vw, 64px); align-items: start; }
.about-body figure { grid-column: 1 / 6; margin: 0; }
.about-body figure img { display: block; width: 100%; height: auto; }
.about-text { grid-column: 7 / 13; padding-top: clamp(40px, 8vw, 120px); max-width: 32em; }
.about-body.solo .about-text { grid-column: 1 / 10; padding-top: .8em; }
.about-text p { margin: 0 0 1.2em; font-size: 14.5px; line-height: 2; }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn { display: inline-block; min-width: 168px; padding: 11px 32px; background: var(--ink); color: var(--paper); text-align: center; font-size: 13px; letter-spacing: .12em; text-decoration: none; transition: background .2s; }
.btn:hover { background: var(--accent); }
.contact-sec { margin-top: clamp(96px, 14vw, 200px); scroll-margin-top: 80px; }
.contact-sec dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 28px clamp(24px, 4vw, 64px); margin: clamp(32px, 4vw, 56px) 0 0; max-width: 900px; }
.contact-sec dt { font-size: 12.5px; font-weight: 500; letter-spacing: .08em; margin-bottom: 10px; }
.contact-sec dd { margin: 0; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }

/* 頁尾 */
.foot { padding: 0 var(--side) 28px; text-align: center; font-size: 12px; color: var(--mist); letter-spacing: .06em; }

/* 角色區 */
.cast { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 26px 20px; margin: -8px 0 clamp(48px, 6vw, 80px); }
.cast button { width: 120px; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; }
.tile { position: relative; display: block; overflow: hidden; aspect-ratio: 1; background: var(--surface); }
.tile img { position: absolute; max-width: none; }
.cname { display: block; margin: 10px -12px 0 0; font-size: 13px; line-height: 1.5; letter-spacing: .04em; color: var(--mist); word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; transition: color .15s; }
@media (hover: hover) {
  .cast button:hover .cname { color: var(--accent); }
}
#cast {
  border: 0; padding: 0; background: var(--paper); color: var(--ink); overflow: hidden;
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  height: min(860px, calc(100vh - 32px));   /* 固定大小，切換差分時視窗不會跟著圖片變大變小 */
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5);
}
#cast[open] { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); animation: fade .2s ease-out; }
#cast.solo { width: min(560px, calc(100vw - 32px)); }
#cast.solo[open] { grid-template-columns: 1fr; }
#cast::backdrop { background: color-mix(in srgb, var(--ink) 55%, transparent); }
#cast figure { margin: 0; min-height: 0; background: var(--surface); display: flex; align-items: center; justify-content: center; }
#cast figure img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cast-text { padding: clamp(28px, 4vw, 48px); padding-right: clamp(32px, 4vw, 56px); overflow-y: auto; max-height: calc(100vh - 32px); }
.cast-text h2 { margin: 0 0 .9em; font: 500 clamp(24px, 3vw, 34px)/1.3 var(--sans); letter-spacing: .03em; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.cast-text h2:has(+ .aka) { margin-bottom: .15em; }
.cast-text .aka { margin: 0 0 1.4em; color: var(--mist); font-size: 14px; letter-spacing: .1em; }
.cast-text p { margin: 0 0 1em; font-size: 15px; line-height: 1.95; }
/* Markdown（分頁說明、角色設定） */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md .ln { display: block; text-indent: 2em; }   /* 角色介紹：每一行開頭空兩格 */
.md h3, .md h4, .md h5 { margin: 1.6em 0 .5em; font-weight: 500; line-height: 1.5; letter-spacing: .04em; color: var(--ink); }
.md h3 { font-size: 1.25em; }
.md h4 { font-size: 1.08em; color: var(--accent); }
.md h5 { font-size: 1em; color: var(--accent); }
.md ul, .md ol { margin: 0 0 1em; padding-left: 1.4em; }
.md li::marker { color: var(--mist); }
.md blockquote { margin: 0 0 1em; padding-left: 18px; border-left: 2px solid var(--accent); color: var(--mist); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 1.6em 0; }
.md a { text-decoration-color: var(--accent); }
.md a:hover { color: var(--accent); }
.md table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95em; }
.md th, .md td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { font-weight: 500; }
.md td:first-child { color: var(--mist); white-space: nowrap; }
#cast .close {
  position: absolute; top: 12px; right: 12px; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 90%, transparent); color: var(--ink); font-size: 14px; cursor: pointer;
}
#cast .close:hover { border-color: var(--mist); }

/* 回到最上方 */
#toTop {
  position: fixed; right: var(--edge); bottom: calc(var(--edge) + 32px); z-index: 6; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); font: inherit; font-size: 17px; line-height: 1; cursor: pointer;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s, border-color .15s;
}
#toTop.on { opacity: 1; visibility: visible; }
#toTop:hover { border-color: var(--mist); }

/* 手機和窄視窗：角落小字改成上方的選單列和頁尾 */
@media (max-width: 860px) {
  :root { --side: 20px; }
  body { display: flex; }
  .top {
    position: sticky; top: 0; left: 0; order: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    padding: 14px var(--side); background: color-mix(in srgb, var(--paper) 90%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-size: 15px;
  }
  .menu-btn { display: block; font: inherit; font-size: 13px; letter-spacing: .1em; background: none; border: 0; padding: 6px 0 6px 12px; color: var(--ink); cursor: pointer; }
  #tabs { display: none; width: 100%; padding: 18px 0 10px; }
  .menu-open #tabs { display: flex; }
  #tabs a { padding: 6px 0; font-size: clamp(24px, 7vw, 32px); font-weight: 500; line-height: 1.35; }
  #tabs a.sub { padding: 2px 0 2px 1.2em; font-size: clamp(17px, 5vw, 21px); font-weight: 400; }
  main { order: 1; padding-top: 32px; padding-bottom: 72px; }
  .corner { position: static; order: 2; padding: 0 var(--side); font-size: 14px; }
  .mail { order: 3; padding-bottom: 6px; }
  .social { flex-direction: row; flex-wrap: wrap; gap: 4px 20px; padding-bottom: 6px; }
  .corner.contact { order: 4; padding-bottom: 6px; }
  .foot { order: 5; padding-top: 28px; text-align: left; }
  .display, .page-head { font-size: clamp(44px, 13vw, 72px); }
  .hero { display: block; min-height: 0; }
  .hero-img { width: 82%; }
  .hero-text { margin-top: -.5em; padding-left: 0; }
  .hero h1 { font-size: clamp(56px, 17vw, 96px); text-align: right; }
  .hero.text-only h1 { text-align: left; }
  .hero-tag { margin-left: auto; text-align: right; }
  .hero.text-only .hero-tag { margin-left: 0; text-align: left; }
  .cta { display: table; margin: 32px 0 0 auto; }
  .stagger { gap: 56px; }
  .piece, .piece.flip { display: block; }
  .piece > a, .piece.flip > a { margin-left: 0; margin-right: 8%; }
  .piece.flip > a { margin-left: 8%; margin-right: 0; }
  .piece.wide > a { margin: 0; }
  .piece figcaption, .piece.flip figcaption { max-width: none; margin-top: 14px; text-align: left; }
  .grid { --cols: 2; --min: 0; }
  .posts a { gap: 16px; padding: 24px 0; align-items: start; }
  .posts .thumb { width: 92px; aspect-ratio: 1; margin-top: 6px; }
  .about-body { display: block; }
  .about-body figure { width: 78%; }
  .about-text { padding-top: 32px; }
  .lb-cap { flex-direction: column; align-items: flex-start; gap: 12px; }
  #toTop { bottom: 16px; right: 16px; }
  .cast { gap: 20px 14px; margin-top: 0; }
  .cast button { width: 92px; }
  #cast[open] { grid-template-columns: 1fr; overflow-y: auto; }
  #cast:not(.solo) figure { height: 58vh; }
  .cast-text { max-height: none; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* 文章最後：回到這篇文章所屬的總覽頁 */
.back-list { display: table; margin: clamp(40px, 6vw, 64px) auto 0; padding: 10px 28px; border: 1px solid var(--line); font-size: 14px; letter-spacing: .1em; text-decoration: none; color: inherit; transition: border-color .15s; }
.back-list:hover { border-color: var(--ink); }

/* 暴雷：||文字|| 蓋成色塊，點一下才顯示；>! 開頭的整段收在「點一下展開」裡 */
.spoiler { padding: 0 .2em; border-radius: 3px; background: var(--ink); color: transparent; cursor: pointer; user-select: none; transition: background .2s, color .2s; }
.spoiler:not(.shown) * { visibility: hidden; }
.spoiler.shown { background: color-mix(in srgb, var(--ink) 8%, transparent); color: inherit; cursor: auto; user-select: auto; }
.spoil { margin: 0 0 1em; padding: 6px 14px; border: 1px dashed var(--line); }
.spoil > summary { cursor: pointer; color: var(--mist); font-size: .92em; }
.spoil[open] > summary { margin-bottom: .6em; }

/* 讀音：<ruby>文字<rt>讀音</rt></ruby>，讀音小字平均分散在文字上方 */
ruby { ruby-align: space-around; }
rt { font-size: .5em; letter-spacing: .1em; color: var(--mist); }

/* 表格：每一欄平分寬度，欄數相同的表格上下對齊，不會因為內容長短錯開；太長的字會在格子裡換行 */
.prose table, .md table { table-layout: fixed; }
.prose th, .prose td, .md th, .md td { overflow-wrap: anywhere; }
.md td:first-child { white-space: normal; }
